/* DunceAI – Word Plot */

* { 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: 580px;
    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; }

/* ── Intro ── */
#introScreen { text-align: center; padding: 10px 0 4px; }
.intro-content h2 { color: var(--blue); font-size: 1.4rem; margin-bottom: 10px; line-height: 1.4; }
.intro-hint { color: #666; font-size: 0.95rem; margin-bottom: 22px; line-height: 1.5; }

.demo-box {
    background: #F8F8F0;
    border: 2px solid #DDD;
    border-radius: 12px;
    padding: 14px 20px;
    display: inline-block;
    margin-bottom: 26px;
    text-align: left;
}
.demo-label { font-size: 0.85rem; color: #666; margin-bottom: 10px; }
.demo-coords { display: flex; align-items: center; gap: 20px; }
.demo-item { font-size: 2rem; font-weight: bold; color: #2C3E50; }
.demo-x { color: var(--orange); }
.demo-y { color: var(--blue); }
.demo-bracket { color: #999; }
.demo-comma { color: #999; }
.demo-arrows { display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; }
.demo-hint-x { color: var(--orange); font-weight: bold; }
.demo-hint-y { color: var(--blue); font-weight: bold; }

/* ── Score bar ── */
.score-bar {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    background: linear-gradient(135deg, #E8F4FD 0%, #D0E8F8 100%);
    border-radius: 10px;
    padding: 8px 16px;
    font-size: 0.95rem;
    color: #2C3E50;
    margin-bottom: 14px;
}
.score-item strong { color: var(--blue); font-size: 1.1rem; }

/* ── Plot prompt ── */
.plot-prompt {
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, #FFFFF0, #FFFDE7);
    border: 2px solid #333;
    border-radius: 12px;
    padding: 12px 18px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.prompt-label {
    font-size: 1rem;
    color: #444;
    font-weight: bold;
}
.coord-box {
    font-size: 2rem;
    font-weight: bold;
    letter-spacing: 2px;
}
.coord-paren { color: #999; font-size: 1.8rem; }
.coord-comma { color: #999; margin: 0 2px; }
.coord-x { color: var(--orange); min-width: 36px; display: inline-block; text-align: center; }
.coord-y { color: var(--blue);   min-width: 36px; display: inline-block; text-align: center; }

/* ── Grid canvas ── */
#gridCanvas {
    display: block;
    border-radius: 8px;
    box-shadow: 0 3px 12px rgba(0,0,0,0.15);
    margin-bottom: 10px;
    cursor: crosshair;
}

/* ── Progress ── */
.progress-text {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 12px;
    min-height: 1.3em;
}

/* ── Guess section ── */
.guess-section {
    background: #F0F8FF;
    border: 2px solid var(--blue);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.guess-section.locked {
    opacity: 0.4;
    pointer-events: none;
}
.guess-label {
    font-size: 1rem;
    font-weight: bold;
    color: var(--blue);
}
.guess-row {
    display: flex;
    gap: 10px;
    align-items: center;
}
.guess-input {
    flex: 1;
    font-size: 1.4rem;
    font-weight: bold;
    padding: 8px 12px;
    border: 2px solid var(--blue);
    border-radius: 8px;
    text-transform: uppercase;
    color: #2C3E50;
    letter-spacing: 4px;
    text-align: center;
    outline: none;
    max-width: 160px;
}
.guess-input:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(255,107,53,0.2); }

/* ── 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;
}

/* ── Wrong-click flash ── */
.wrong-flash {
    animation: wrongFlash 0.4s ease;
}
@keyframes wrongFlash {
    0%   { box-shadow: 0 3px 12px rgba(0,0,0,0.15); }
    40%  { box-shadow: 0 0 0 4px #E74C3C; }
    100% { box-shadow: 0 3px 12px rgba(0,0,0,0.15); }
}

/* ── 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;
    display: block;
    width: 100%;
    margin-bottom: 14px;
}
.btn-next:hover { transform: translateY(-2px); box-shadow: 0 6px 0 #1E3A5F; }
.btn-check {
    background: linear-gradient(135deg, var(--blue), #2C4A6E);
    color: white;
    box-shadow: 0 4px 0 #1E3A5F;
    padding: 10px 20px;
    font-size: 1rem;
    white-space: nowrap;
}
.btn-check:hover { transform: translateY(-2px); box-shadow: 0 6px 0 #1E3A5F; }
