:root {
    color-scheme: light;
    --paper: #ffffff;
    --ink: #30312f;
    --muted: #6a6b66;
    --line: #dedfd9;
    --line-strong: #92958c;
    --note: #fff8cf;
    --gold: #80641f;
    --red: #b7463e;
    --green: #3d7659;
    --hand: "Segoe Print", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", cursive;
    --utility: "Consolas", "Courier New", monospace;
    --rough: 3px 7px 4px 8px / 7px 3px 8px 4px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; }
body { display: flow-root; margin: 0; min-height: 100vh; color: var(--ink); background: var(--paper); font-family: "Segoe UI", ui-sans-serif, system-ui, sans-serif; font-size: 14px; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
h1, h2, p { margin: 0; }
a { color: inherit; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid var(--green); outline-offset: 5px; }
/* Shared lettering and sketched controls for the game and store. */
.eyebrow, .section-heading, .target-label, .stat-label { font-family: var(--utility); font-size: 0.67rem; font-weight: 400; letter-spacing: 0.1em; text-transform: uppercase; }
.eyebrow { color: var(--muted); }
.button { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 9px 18px; border: 1.5px solid var(--ink); border-radius: var(--rough); color: var(--paper); background: var(--ink); box-shadow: 3px 3px 0 #d8dacd; cursor: pointer; font-weight: 650; text-decoration: none; transition: transform 0.15s ease, box-shadow 0.15s ease; }
.button:hover:not(:disabled) { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 #c9cdbe; }
.button:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: none; }
.button:disabled { color: #797b74; background: #f5f6f2; border-color: #c9cbc3; box-shadow: none; cursor: not-allowed; }
.button.secondary { color: var(--ink); background: var(--paper); box-shadow: none; border-color: var(--line-strong); }
.button.secondary:disabled { color: #797b74; border-color: #c9cbc3; }
.green { color: var(--green); }
.gold { color: var(--gold); }
.app-shell { width: min(1540px, calc(100% - 64px)); height: calc(100dvh - 64px); min-height: 600px; margin: 32px auto; display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 32px; }
.mission-panel { display: flex; flex-direction: column; min-height: 0; gap: 16px; padding: 8px 5px 8px 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.brand-lockup { padding: 0 4px 16px; border-bottom: 1px solid var(--line); }
.brand-lockup h1 { position: relative; width: fit-content; margin: 4px 0 16px; font-family: var(--hand); font-size: 2.8rem; font-weight: 700; line-height: 1.4; letter-spacing: -0.07em; transform: rotate(-3deg); }
.brand-lockup h1::after { content: ""; position: absolute; left: -2px; right: -8px; bottom: 0; height: 7px; border-top: 2px solid var(--ink); border-radius: 50%; transform: rotate(-2deg); }
.brand-lockup p, .drawing-hint { color: var(--muted); font-size: 0.83rem; line-height: 1.65; }
.mission-card { position: relative; margin: 5px 3px 0; padding: 20px 18px 18px; background: var(--note); border: 1px solid #e8deb0; border-radius: 1px 3px 5px 2px; box-shadow: 2px 3px 0 #eeeee7; transform: rotate(-1deg); }
.mission-card::before { content: ""; position: absolute; width: 65px; height: 19px; left: calc(50% - 32px); top: -10px; background: #e9ece1c9; border: 1px solid #d9ddd080; transform: rotate(4deg); }
.section-heading, .confidence-heading, .recognizer-status { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tier-chip { color: var(--gold); padding: 3px 6px; border: 1px solid #c9ba7e; border-radius: var(--rough); letter-spacing: 0; white-space: nowrap; }
.target-label { margin-top: 14px; color: var(--muted); }
#targetPrompt { margin-top: 4px; font-family: var(--hand); font-size: 1.65rem; font-weight: 700; line-height: 1.5; }
.mission-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 15px; color: var(--muted); font-size: 0.7rem; }
.mission-meta span:first-child { grid-column: 1 / -1; padding-bottom: 9px; border-bottom: 1px dashed #cfc595; }
.mission-meta strong { color: var(--ink); font-family: var(--utility); font-weight: 400; }
.mission-meta span:first-child strong { font-size: 1rem; }
.recognition-card { padding: 0 5px; border-left: 2px solid transparent; transition: border-color 0.2s; }
.recognition-card.close { border-color: var(--green); }
.recognizer-status { justify-content: flex-start; color: var(--muted); font-size: 0.78rem; min-height: 24px; }
.thinking-dot { width: 7px; height: 7px; flex-shrink: 0; border-radius: 46% 54% 45% 55%; background: var(--line-strong); }
.thinking-dot.active { background: var(--green); animation: think 0.65s ease-in-out infinite alternate; }
@keyframes think { to { opacity: 0.35; } }
.guess-list { display: grid; margin: 12px 0 15px; padding: 0; list-style: none; }
.guess-list li { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #e9eae5; color: var(--muted); font-size: 0.8rem; text-transform: capitalize; }
.guess-list li:first-child { color: var(--ink); }
.guess-list strong { font-family: var(--utility); font-weight: 400; }
.confidence-heading { color: var(--muted); font-size: 0.7rem; }
.confidence-heading strong { color: var(--green); font-family: var(--utility); }
.confidence-track { height: 8px; margin-top: 9px; overflow: hidden; border: 1px solid var(--line-strong); border-radius: var(--rough); background: #f5f6f2; }
.confidence-track span { display: block; width: 0; height: 100%; background: repeating-linear-gradient(115deg, var(--green), var(--green) 2px, #7f9e81 2px, #7f9e81 4px); transition: width 0.3s ease; }
.drawing-tools { display: grid; gap: 10px; }
.clear-button { width: 100%; }
.drawing-hint { padding: 12px 3px 0; border-top: 1px dashed var(--line); }
.training-tools { font-size: 0.72rem; color: var(--muted); }
.training-tools summary { width: fit-content; cursor: pointer; padding: 5px 0; }
.training-tools .button { margin-top: 10px; font-size: 0.75rem; }
.training-tools p { margin-top: 10px; line-height: 1.6; }
.game-panel { min-width: 0; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); }
.top-hud { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 20px; padding: 8px 0 22px; }
.status-copy .eyebrow { margin-bottom: 8px; }
#instructions, .game-over { max-width: 380px; font-size: 0.83rem; line-height: 1.6; }
.game-over { color: var(--red); }
.hud-stats, .controls { display: flex; align-items: center; gap: 20px; }
.stat-card { min-width: 68px; }
.stat-label { display: block; color: var(--muted); font-size: 0.63rem; }
.stat-value { display: block; margin-top: 5px; font-family: var(--utility); font-size: 1.3rem; font-weight: 400; }
.arena-wrap { position: relative; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; padding: 0 22px 0 36px; border: 1.5px solid var(--line-strong); border-radius: 4px 2px 6px 3px; background: var(--paper); box-shadow: 4px 5px 0 #f1f2ed, 5px 6px 0 #dedfd8; }
.arena-wrap::before { content: ""; position: absolute; top: 0; bottom: 0; left: 22px; width: 1px; background: #dedfd9; }
.arena-wrap::after { content: ""; position: absolute; left: 7px; top: 24px; bottom: 18px; width: 7px; background: radial-gradient(ellipse at center, #eceee7 0 3px, #b8bbae 3px 3.5px, transparent 3.5px); background-size: 7px 38px; background-repeat: no-repeat round; }
.sheet-heading, .sheet-footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; color: var(--muted); }
.sheet-heading { min-height: 52px; border-bottom: 1px solid var(--line); font-family: var(--utility); font-size: 0.65rem; letter-spacing: 0.06em; }
.sheet-heading span:last-child { font-family: var(--hand); font-size: 0.8rem; letter-spacing: 0; }
.sheet-footer { min-height: 46px; border-top: 1px solid var(--line); font-size: 0.68rem; }
.arena-legend { display: flex; flex-wrap: wrap; gap: 18px; }
.arena-legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend-mark { display: inline-block; width: 7px; height: 7px; border-radius: 45% 55% 48% 52%; background: var(--ink); }
.legend-mark.danger { background: var(--red); }
.legend-mark.pickup { background: var(--green); }
.sheet-footer > span { font-family: var(--hand); }
#gameContainer { position: relative; width: 100%; height: 100%; min-height: 0; overflow: hidden; touch-action: none; user-select: none; background: #fff; }
.game-page.is-playing #gameContainer { cursor: none; }
#drawingCanvas { position: absolute; inset: 0; z-index: 20; width: 100%; height: 100%; pointer-events: none; }
.blank-page { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 14px; text-align: center; pointer-events: none; padding: 20px; }
.blank-page svg { width: min(300px, 80%); height: 110px; color: #82877a; }
.blank-page h2 { font-family: var(--hand); font-size: clamp(1.45rem, 2.6vw, 2.3rem); font-weight: 400; line-height: 1.5; transform: rotate(-2deg); }
.blank-page h2 span { background: linear-gradient(transparent 68%, #f5e8a8 68% 91%, transparent 91%); }
.blank-page p { max-width: 270px; color: var(--muted); font-size: 0.8rem; line-height: 1.8; }
.blank-page .hand-note { margin-top: 12px; font-family: var(--hand); font-size: 0.78rem; transform: rotate(3deg); }
.has-started .blank-page { display: none; }
#playerCursor { position: absolute; z-index: 100; width: 16px; height: 16px; pointer-events: none; transform: translate(-50%, -50%); border: 2px solid var(--ink); border-radius: 45% 55% 48% 52%; background: #fff; }
#playerCursor::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--ink); }
.game-page:not(.has-started) #playerCursor { visibility: hidden; }
.bullet, .orb { position: absolute; pointer-events: none; border-radius: 45% 55% 48% 52%; }
.bullet { z-index: 50; width: 9px; height: 9px; background: var(--red); border: 1px solid #913830; }
.orb { z-index: 30; width: 14px; height: 14px; opacity: 0; background: #dcebdc; border: 2px solid var(--green); transition: opacity 0.5s ease; }
.orb::after { content: "+"; position: absolute; inset: -2px; color: var(--green); font: 12px/14px var(--utility); text-align: center; }
.orb.visible { opacity: 1; }
.mission-flash { position: absolute; top: 50%; left: 50%; z-index: 120; max-width: 90%; width: max-content; padding: 12px 20px; pointer-events: none; opacity: 0; transform: translate(-50%, -50%) scale(0.85) rotate(-3deg); color: var(--green); background: #ffffffed; border: 2px solid var(--green); border-radius: var(--rough); font-family: var(--hand); font-size: clamp(1.2rem, 3vw, 2.5rem); text-align: center; }
.mission-flash.show { animation: flash 1.15s ease; }
@keyframes flash { 20%, 70% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(-3deg); } 100% { opacity: 0; transform: translate(-50%, -60%) scale(1.05) rotate(-3deg); } }
@media (max-width: 1150px) {
    .app-shell { width: calc(100% - 40px); margin: 20px auto; height: calc(100dvh - 40px); gap: 24px; grid-template-columns: 250px minmax(0, 1fr); }
    .top-hud { grid-template-columns: 1fr; gap: 12px; }
    #instructions, .game-over { max-width: none; }
    .hud-stats { justify-content: space-between; }
    .sheet-footer > span { display: none; }
}
@media (max-width: 760px) {
    .app-shell { width: calc(100% - 32px); height: auto; min-height: 0; margin: 16px auto; grid-template-columns: 1fr; gap: 24px; }
    .mission-panel { display: grid; grid-template-columns: 1fr 1fr; overflow: visible; padding: 0; align-items: start; }
    .brand-lockup { grid-column: 1 / -1; padding-bottom: 16px; }
    .brand-lockup h1 { font-size: 2.4rem; margin-bottom: 12px; }
    .mission-card { margin-top: 8px; }
    .recognition-card { padding-top: 10px; }
    .drawing-tools { grid-column: 1 / -1; }
    .game-panel { min-height: 520px; }
    #gameContainer { min-height: 350px; }
    .sheet-heading { min-height: 48px; }
}
@media (max-width: 440px) {
    .mission-panel { gap: 18px 12px; }
    .mission-card { padding: 18px 12px 14px; }
    .section-heading { font-size: 0.59rem; letter-spacing: 0.02em; gap: 5px; }
    #targetPrompt { font-size: 1.3rem; }
    .mission-meta { grid-template-columns: 1fr; }
    .mission-meta span:first-child { grid-column: auto; }
    .arena-wrap { padding-right: 14px; padding-left: 30px; }
    .sheet-heading span:last-child { font-size: 0.66rem; }
    .arena-legend { gap: 12px; font-size: 0.62rem; }
    .hud-stats { gap: 12px; flex-wrap: wrap; }
    .controls { margin-left: auto; }
    .top-hud .button { padding: 9px 12px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; } }
