/* Elements with the hidden attribute stay hidden, even when a kit class sets display. */
[hidden] { display: none !important; }

:root {
  /* Older names, now pointing at the design-system tokens in sd-kit.css. */
  --ink: var(--sd-ink);
  --ink2: var(--sd-ink-raised);
  --paper: var(--sd-paper);
  --muted: var(--sd-ink-soft);
  --lime: var(--sd-lime);
  --lime-dark: var(--sd-lime-dark);
  --blue: var(--sd-blue);
  --blue-dark: var(--sd-blue-text);
  --red: var(--sd-red);
  --green: var(--sd-green);
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --fs: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
html.large-text { --fs: 19px; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #14181b; color: var(--ink); font-family: var(--font); font-size: var(--fs); -webkit-text-size-adjust: 100%; }
body { overscroll-behavior: none; touch-action: none; user-select: none; -webkit-user-select: none; }
#app { position: fixed; inset: 0; }
#game { position: absolute; inset: 0; display: block; outline: none; touch-action: none; }
#game:focus-visible { outline: 3px solid var(--lime); outline-offset: -3px; }

button { font: inherit; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.row-buttons { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.row-buttons.col { flex-direction: column; align-items: stretch; }
.muted { color: var(--muted); }
.small { font-size: .86em; }
.ok { color: var(--green); font-weight: 800; }
.no { color: var(--red); font-weight: 800; }

/* ---------- HUD ----------
   The HUD is styled by sd-kit-02-hud.css, the toast and dialogue box by sd-kit-03-dialogue-toasts.css (Fable).
   Only the shared .progress bar (tech card) lives here. */
.progress { height: 12px; background: #3a444b; border-radius: 999px; overflow: hidden; }
.progress .bar { height: 100%; width: 0; background: var(--lime); transition: width .1s linear; }

/* Speaker colors for the dialogue box (name label needs white text at 4.5:1 on --sd-speaker). */
.sd-dialogue[data-who="rosa"]    { --sd-speaker: #2f6e45; --sd-speaker-tint: #e2f1e7; }
.sd-dialogue[data-who="marla"]   { --sd-speaker: #b3362b; --sd-speaker-tint: #fbe5e2; }
.sd-dialogue[data-who="okafor"]  { --sd-speaker: #a8500a; --sd-speaker-tint: #fdeadb; }
.sd-dialogue[data-who="delgado"] { --sd-speaker: #a3446a; --sd-speaker-tint: #f9e4ee; }
.sd-dialogue[data-who="park"]    { --sd-speaker: #3b6e8f; --sd-speaker-tint: #e1eef6; }
.sd-dialogue[data-who="brandt"]  { --sd-speaker: #7a5c2e; --sd-speaker-tint: #f3ead9; }
.sd-dialogue[data-who="ortiz"]   { --sd-speaker: #4f5960; --sd-speaker-tint: #e8ecee; }
.sd-dialogue[data-who="player"]  { --sd-speaker: #3b7a1f; --sd-speaker-tint: var(--sd-lime-tint); }

/* ---------- Panels ---------- */
#panel-root { position: absolute; inset: 0; pointer-events: none; z-index: 30; }
.msg { min-height: 1.2em; font-weight: 600; }
.msg.good { color: var(--green); }
.msg.bad { color: var(--red); }
blockquote { margin: 8px 0; padding: 8px 14px; background: #fbf7ec; border-left: 5px solid #d4b26a; border-radius: 6px; }

.tab-body { padding-top: 4px; }

/* Controller */

/* Head panel */
.nozzle-box { display: flex; gap: 12px; align-items: center; }
.nozzle-brand { height: 40px; max-width: 120px; object-fit: contain; background: #20272c; border-radius: 6px; padding: 3px; }

/* Results / report */
table { border-collapse: collapse; }

/* Journal */
.journal-back { display: block; margin: 18px auto 0; max-width: 200px; opacity: .9; background: var(--ink); border-radius: 8px; padding: 6px; }
.hint-line { display: flex; gap: 10px; align-items: flex-start; margin-top: 10px; }
.hint-line canvas { width: 44px; height: 44px; border-radius: 8px; flex: 0 0 auto; }
.hint-line p { margin: 0; }

/* Map */


/* Ending */

#loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; background: #14181b; z-index: 50; }
#loading[hidden] { display: none; }
.noscript { color: #fff; text-align: center; padding: 40px; }

html.reduce-motion *, html.reduce-motion *::before, html.reduce-motion *::after { transition: none !important; animation: none !important; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- Campaign: money, energy, shops ---------- */
.ticket { width: 150px; height: 80px; border-radius: 10px; border: 3px dashed #b28a1a; background: repeating-linear-gradient(45deg, #ffe680, #ffe680 8px, #ffd34d 8px, #ffd34d 16px); display: flex; align-items: center; justify-content: center; text-align: center; font-weight: 900; color: #5a4300; flex: 0 0 auto; }
.ticket.win { background: #d6f5c8; border-color: var(--green); color: var(--green); }
.ticket.lose { background: #eceff1; border-color: #9aa3aa; color: #5c646b; }


/* ---------- Design-system glue (game-specific additions to sd-kit.css) ---------- */
.panel-backdrop { position: absolute; inset: 0; pointer-events: auto; padding-bottom: calc(var(--sd-sp-2) + var(--safe-b)); }
.sd-panel { user-select: text; }
.sd-panel__body { touch-action: pan-y; }
.sd-panel__body p { line-height: var(--sd-lh); }
.sd-panel__body h3 { margin: var(--sd-sp-4) 0 var(--sd-sp-2); font-size: var(--sd-fs-md); }
.sd-panel__body .sd-callout { margin: var(--sd-sp-3) 0; }
.sd-callout__text > :first-child { margin-top: 0; }
.sd-callout__text > :last-child { margin-bottom: 0; }
.sd-callout__body > .sd-callout__text { margin-top: 0; }
.sd-tabs { margin: var(--sd-sp-2) 0 var(--sd-sp-3); }
.tab-body { padding-top: var(--sd-sp-1); }
.sd-table-wrap { margin: var(--sd-sp-2) 0; }
.sd-table td .small { display: block; }
/* Long answer buttons read better in sentence case. */
.row-buttons.col > .sd-btn { width: 100%; }

/* ---------- Install jobs ---------- */
.flag-chip { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--sd-ink); border-radius: 2px; vertical-align: -2px; }


/* ---------- Troubleshooting and programming jobs ---------- */

/* The install-a-flag panel stacks its pieces */
.sd-install-wrap { display: grid; gap: var(--sd-sp-3); min-width: 0; }

/* The Master Shovel on the tech card */

/* SprinklerDude Radio */
.sd-range { width: 100%; accent-color: var(--sd-lime, #b8f24a); min-height: 44px; }
.sd-radio__now { display: grid; gap: 2px; margin: 0; }
.sd-radio__title { font-size: var(--sd-fs-xl, 1.4rem); line-height: 1.2; }

/* Dialogue: Skip next to Next */
.sd-dialogue__actions { display: flex; align-self: flex-end; gap: var(--sd-sp-2); margin-bottom: 3px; flex: none; }
.sd-dialogue__actions .sd-dialogue__next { align-self: auto; margin: 0; }

/* Phones: no key cap on the Interact prompt, and readable tool names */
.touch .sd-hud-prompt__key { display: none; }
.touch .sd-tool__name { font-size: 12px; }

/* Pause menu on a short screen: five buttons wrap to two rows instead of crowding one */
@container sd-viewport (max-height: 520px) {
  .sd-menu__group { flex-wrap: wrap; }
  .sd-menu__group > .sd-btn { flex: 1 1 30%; }
}

/* Feedback form */
.sd-textarea { min-height: 120px; resize: vertical; line-height: 1.4; font-family: inherit; padding-top: var(--sd-sp-2); }
