/* DunceAI – Tally Cars */

* { 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; }

/* ── 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; }

/* ── 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: 10px;
}
.score-item strong { color: var(--blue); font-size: 1.1rem; }

/* ── Info text ── */
.info-text {
    font-size: 1rem;
    color: #444;
    margin-bottom: 10px;
    min-height: 1.4em;
    line-height: 1.4;
}

/* ── Road canvas ── */
#roadCanvas {
    display: block;
    border-radius: 8px;
    box-shadow: 0 3px 12px rgba(0,0,0,0.3);
    margin-bottom: 14px;
}

/* ── Tally panel ── */
.tally-panel {
    background: #FAFAF5;
    border: 2px solid #DDD;
    border-radius: 14px;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
}

.tally-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.car-btn {
    flex-shrink: 0;
    background: none;
    border: 2px solid #CCC;
    border-radius: 10px;
    padding: 4px 6px;
    cursor: pointer;
    transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
    line-height: 0;
}
.car-btn:not(:disabled):hover {
    border-color: var(--blue);
    background: #EEF4FF;
    transform: scale(1.07);
}
.car-btn:not(:disabled):active,
.car-btn.btn-flash {
    transform: scale(0.92);
    background: #DDE8FF;
    border-color: var(--blue);
}
.car-btn:disabled { opacity: 0.40; cursor: not-allowed; }

.tally-canvas {
    flex: 1;
    min-width: 100px;
    max-width: 160px;
    background: white;
    border: 1px solid #DDD;
    border-radius: 6px;
}

.tally-count {
    flex-shrink: 0;
    min-width: 32px;
    text-align: right;
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--blue);
}

/* ── Start count button ── */
.btn-full {
    display: block;
    width: 100%;
    margin-bottom: 14px;
}

/* ── Entry panel ── */
.entry-panel {
    background: #FFFFF0;
    border: 2px solid #333;
    border-radius: 12px;
    padding: 14px 18px;
    margin-bottom: 14px;
}
.entry-label {
    font-size: 1.1rem;
    font-weight: bold;
    color: #2C3E50;
    margin-bottom: 12px;
}
.spinner-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.spinner-btn {
    width: 44px;
    height: 44px;
    font-size: 1.8rem;
    font-weight: bold;
    border: 3px solid var(--blue);
    border-radius: 50%;
    background: white;
    color: var(--blue);
    cursor: pointer;
    transition: all 0.15s;
    line-height: 1;
}
.spinner-btn:hover { background: var(--blue); color: white; }
.entry-value {
    font-size: 2.2rem;
    font-weight: bold;
    color: #2C3E50;
    min-width: 52px;
    text-align: center;
}
.btn-check {
    background: linear-gradient(135deg, var(--blue), #2C4A6E);
    color: white;
    box-shadow: 0 4px 0 #1E3A5F;
    padding: 10px 22px;
    font-size: 1rem;
    margin-left: auto;
}
.btn-check:hover { transform: translateY(-2px); box-shadow: 0 6px 0 #1E3A5F; }

/* ── 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;
}

/* ── 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; }

/* ── Results table ── */
.results-panel { margin-bottom: 4px; }
.results-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
    font-size: 1rem;
}
.results-table th {
    background: var(--blue);
    color: white;
    padding: 8px 12px;
    font-size: 0.9rem;
    text-align: center;
}
.results-table th:first-child { text-align: left; border-radius: 8px 0 0 0; }
.results-table th:last-child  { border-radius: 0 8px 0 0; }
.results-table td {
    padding: 9px 12px;
    border-bottom: 1px solid #EEE;
    text-align: center;
}
.results-table td:first-child { text-align: left; }
.results-table tr:last-child td { border-bottom: none; }
.results-table tr.match    td { background: #F2FFF2; }
.results-table tr.mismatch td { background: #FFF4F2; }

.colour-cell { display: flex; align-items: center; gap: 8px; font-weight: bold; }
.colour-dot  { display: inline-block; width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; }
.blue-dot    { background: #3A7FC1; }
.red-dot     { background: #C03020; }
.yellow-dot  { background: #D4AC00; }

.result-num         { font-size: 1.2rem; font-weight: bold; color: #555; }
.result-num.correct { color: var(--green); }
.result-num.wrong   { color: var(--red); }
