/* DunceAI – River Tables */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --orange: #FF6B35;
    --blue:   #3D5A80;
    --cream:  #FFF8E7;
    --green:  #4CAF50;
    --red:    #E74C3C;
    --shadow: 0 4px 15px rgba(0,0,0,0.1);
}

body {
    font-family: 'Segoe UI', Tahoma, sans-serif;
    background: linear-gradient(135deg, var(--cream) 0%, #FFE4C4 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 20px;
}

.game-container {
    background: white;
    border-radius: 24px;
    box-shadow: var(--shadow), 0 0 0 4px var(--orange);
    width: 100%;
    max-width: 560px;
    padding: 20px 24px 28px;
}

/* Header */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}
.logo { font-size: 1.4rem; font-weight: bold; }
.logo-dunce { color: var(--orange); }
.logo-ai    { color: var(--blue); }
.game-header h1 { color: #2C3E50; font-size: 1.3rem; }
.back-link { color: var(--blue); text-decoration: none; font-size: 0.9rem; font-weight: bold; }
.back-link:hover { text-decoration: underline; }

/* ── Select screen ── */
.select-content { text-align: center; padding: 10px 0; }
.select-title   { color: var(--blue); font-size: 1.4rem; margin-bottom: 8px; }
.select-hint    { color: #666; font-size: 0.95rem; margin-bottom: 22px; }

.table-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 10px;
}

.table-btn {
    padding: 18px 10px;
    font-size: 1.6rem;
    font-weight: bold;
    border: 3px solid var(--orange);
    border-radius: 14px;
    background: white;
    color: #2C3E50;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}
.table-btn:hover {
    background: #FFF5EE;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255,107,53,0.25);
}
.table-btn.done {
    background: var(--green);
    border-color: #388E3C;
    color: white;
}
.table-btn.done::after {
    content: '✓';
    position: absolute;
    top: 4px;
    right: 7px;
    font-size: 0.9rem;
}
.table-btn.done:hover {
    background: #43A047;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76,175,80,0.3);
}

/* Badge banner on select screen */
.badge-banner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #FFF8DC 0%, #FFFACD 100%);
    border: 2px solid #FFD700;
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 18px;
}
.badge-earned-msg {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--blue);
}

/* ── Game info bar ── */
.game-info-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, #E8F4FD 0%, #D0E8F8 100%);
    border-radius: 10px;
    padding: 8px 14px;
    font-size: 0.95rem;
    color: #2C3E50;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.info-item { flex: 1; min-width: 80px; }
.info-item strong { color: var(--blue); font-size: 1.1rem; }
.quit-link {
    color: var(--blue);
    font-size: 0.85rem;
    font-weight: bold;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}
.quit-link:hover { text-decoration: underline; }

/* ── Canvas ── */
#riverCanvas {
    display: block;
    margin: 0 auto 14px;
    border-radius: 50%;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2), 0 0 0 3px var(--blue);
    cursor: default;
}

/* ── Question box ── */
.question-box {
    background: #ffff99;
    border: 2px solid #000;
    border-radius: 10px;
    padding: 12px 20px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: bold;
    color: #330000;
    margin-bottom: 14px;
}

/* ── Answer grid ── */
.answer-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 14px;
}
.ans-btn {
    padding: 14px 10px;
    border-radius: 12px;
    border: 3px solid var(--blue);
    background: white;
    font-size: 1.4rem;
    font-weight: bold;
    color: var(--blue);
    cursor: pointer;
    transition: all 0.15s ease;
}
.ans-btn:hover:not(:disabled) {
    background: var(--blue);
    color: white;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(61,90,128,0.35);
}
.ans-btn:disabled { cursor: not-allowed; }
.ans-btn.correct { background: var(--green);  border-color: #388E3C; color: white; transform: scale(1.08); }
.ans-btn.wrong   { background: var(--red);    border-color: #C0392B; color: white; }
.ans-btn.reveal  { background: var(--green);  border-color: #388E3C; color: white; transform: scale(1.05); }

/* ── Feedback ── */
.feedback-row {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 14px;
}
.result-badge { font-size: 2.2rem; min-width: 48px; text-align: center; padding-top: 6px; }
.dunce-panel  { display: flex; align-items: flex-start; gap: 10px; flex: 1; }
.dunce-character { flex-shrink: 0; }
.speech-bubble {
    background: white;
    border: 2px solid var(--orange);
    border-radius: 12px;
    padding: 10px 14px;
    position: relative;
    font-size: 0.95rem;
    color: #2C3E50;
    flex: 1;
    line-height: 1.4;
}
.speech-bubble::before {
    content: '';
    position: absolute;
    left: -8px; top: 14px;
    border: 6px solid transparent;
    border-right-color: var(--orange);
}
.speech-bubble::after {
    content: '';
    position: absolute;
    left: -5px; top: 15px;
    border: 5px solid transparent;
    border-right-color: white;
}

/* ── Action row ── */
.action-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* ── Buttons ── */
.btn {
    display: inline-block;
    padding: 12px 24px;
    font-size: 1.05rem;
    font-weight: bold;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    text-align: center;
}
.btn-start {
    background: linear-gradient(135deg, var(--green), #388E3C);
    color: white;
    box-shadow: 0 4px 0 #2E7D32;
}
.btn-start:hover { transform: translateY(-2px); box-shadow: 0 6px 0 #2E7D32; }
.btn-next {
    background: linear-gradient(135deg, var(--blue), #2C4A6E);
    color: white;
    box-shadow: 0 4px 0 #1E3A5F;
    flex: 1;
    text-align: center;
}
.btn-next:hover { transform: translateY(-2px); box-shadow: 0 6px 0 #1E3A5F; }
.btn-back-home {
    background: linear-gradient(135deg, #888, #555);
    color: white;
    box-shadow: 0 4px 0 #333;
}
.btn-back-home:hover { transform: translateY(-2px); box-shadow: 0 6px 0 #333; }

/* ── Complete screen ── */
#completeScreen { text-align: center; padding: 20px 10px; }
.complete-icon  { font-size: 3.5rem; margin-bottom: 12px; }
.complete-content h2 { color: var(--blue); font-size: 1.6rem; margin-bottom: 10px; }
.complete-msg   { color: #555; font-size: 1rem; margin-bottom: 24px; font-style: italic; line-height: 1.5; }

/* ── Badge screen ── */
#badgeScreen { text-align: center; padding: 20px 10px; }
.badge-content { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.badge-award   { /* SVG container */ }
.badge-title   { color: var(--blue); font-size: 1.7rem; }
.badge-msg     { color: #555; font-style: italic; font-size: 1rem; line-height: 1.5; max-width: 380px; }
.badge-btn-row { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
