/* Kdo to napsal? — case-file dark theme, Kick-flavored.
   The streamer is photosensitive: nothing flashes, nothing strobes. All
   feedback is a calm fade; transitions stay at or under 200ms and move
   nothing further than a few pixels. */

@font-face {
  font-family: "Zilla Slab";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/zillaslab-500-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191,
    U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Zilla Slab";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/zillaslab-500-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7,
    U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F,
    U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
    U+A720-A7FF;
}
@font-face {
  font-family: "Zilla Slab";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/zillaslab-700-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191,
    U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Zilla Slab";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/zillaslab-700-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7,
    U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F,
    U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
    U+A720-A7FF;
}

:root {
  --bg: #0e1310;
  --surface: #171e1a;
  --surface-2: #1e2620;
  --line: #2a352d;
  --text: #e6efe8;
  --muted: #9db3a4;
  --accent: #53fc18;
  --accent-ink: #08300a;
  --accent-dim: #2f7d1a;
  --lav: #b9a7f5;
  --red: #e2574b;
  --red-soft: #4a221f;
  --green-soft: #1d3a17;
  --radius: 10px;
  --display: "Zilla Slab", "Georgia", serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

/* Screens toggle via the hidden attribute; this must beat the per-screen
   display:grid rules or hidden screens stay in the layout. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100dvh;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 0.55rem 1rem;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
button:hover { background: var(--surface-2); }
:is(button, input, a):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}
.primary:hover { background: #6dfd3e; }
.ghost { background: transparent; }
.big { padding: 0.75rem 2rem; font-size: 1.05rem; }

.screen {
  max-width: 46rem;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
}

/* ---------- wordmark & home ---------- */

.wordmark {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: 0.02em;
  margin: 0;
  font-size: clamp(1.9rem, 6vw, 2.8rem);
  line-height: 1.05;
}
.wordmark .q { color: var(--accent); }

.home-head {
  margin: 1.5rem 0 1.25rem;
  padding-bottom: 1.1rem;
  border-bottom: 1px solid var(--line);
}
.subtitle { color: var(--muted); margin: 0.4rem 0 0; }
.subtitle strong { color: var(--lav); font-weight: 600; }

.difficulty {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
  margin-bottom: 1.25rem;
}
.diff-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}
.diff-row label { font-family: var(--display); font-weight: 700; font-size: 1.05rem; }
.diff-value { color: var(--accent); font-variant-numeric: tabular-nums; }
.diff-note { color: var(--muted); font-size: 0.85rem; margin: 0.5rem 0 0; }

input[type="range"] {
  width: 100%;
  margin: 0.75rem 0 0;
  accent-color: var(--accent);
}

.modes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr));
  gap: 0.8rem;
}
.mode-card {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 1rem 1.1rem;
}
.mode-card:hover { border-color: var(--accent-dim); }
.mode-card h2 {
  font-family: var(--display);
  font-size: 1.3rem;
  margin: 0;
}
.mode-tag {
  font-family: var(--body);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.mode-desc { color: var(--muted); font-size: 0.88rem; margin: 0; }
.mode-daily-done { color: var(--lav); font-size: 0.82rem; margin: 0; }

.home-foot {
  margin-top: 2rem;
  color: var(--muted);
  font-size: 0.8rem;
}
.home-foot a { color: var(--lav); }

/* ---------- loading ---------- */

#screen-loading { display: grid; place-items: center; min-height: 100dvh; }
.loading-box { text-align: center; }
.loading-box p { color: var(--muted); }
.loading-track, .timer-track {
  height: 6px;
  border-radius: 3px;
  background: var(--surface-2);
  overflow: hidden;
}
.loading-track { width: 16rem; margin: 0 auto; }
.loading-fill {
  height: 100%;
  width: 30%;
  border-radius: 3px;
  background: var(--accent);
  transition: width 0.4s ease;
}
.error { color: var(--red); }

/* ---------- game ---------- */

.game-head {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-bottom: 0.75rem;
}
.game-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.2rem;
  flex: 1;
}
.game-progress { color: var(--muted); font-family: var(--body); font-size: 0.9rem; font-weight: 400; margin-left: 0.5rem; }
.game-status {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-variant-numeric: tabular-nums;
}
.strikes { color: var(--muted); letter-spacing: 0.15em; }
.strikes .hit { color: var(--red); }
.score-pill {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.15rem 0.7rem;
  font-size: 0.9rem;
}
.timer-num { color: var(--muted); font-size: 0.9rem; min-width: 2.2ch; text-align: right; }
.timer-num.low { color: var(--red); }

.timer-track { margin-bottom: 1rem; }
.timer-fill {
  height: 100%;
  width: 100%;
  background: var(--accent);
  transition: width 0.25s linear, background-color 0.25s ease;
}
.timer-fill.low { background: var(--red); }

.exhibit {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--lav);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  margin-bottom: 0.7rem;
  font-size: 1.15rem;
  overflow-wrap: anywhere;
}
.exhibit .author {
  font-weight: 700;
  margin-right: 0.4rem;
}
.exhibit .author::after { content: ":"; color: var(--muted); }
.exhibit.sealed { color: var(--muted); border-left-color: var(--line); font-style: italic; font-size: 0.95rem; }
.exhibit.small { font-size: 1rem; }
.exhibit-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.35rem;
}
.emote {
  height: 1.75em;
  vertical-align: middle;
  margin: -0.3em 0.05em 0;
}

#answer-area { display: grid; gap: 0.55rem; margin-top: 1rem; }
#answer-area.cols {
  grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
}
.choice {
  text-align: left;
  font-size: 1.05rem;
  padding: 0.7rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
}
.choice > span:first-child { font-weight: 600; }
.choice:not(:disabled):hover { border-color: var(--accent-dim); }
.choice .key {
  color: var(--muted);
  font-size: 0.78rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 0.35rem;
}
.choice .taunt {
  font-size: 0.78rem;
  color: var(--lav);
  font-style: italic;
  text-align: right;
  flex: 1;
}
.choice.correct {
  border-color: var(--accent-dim);
  background: var(--green-soft);
}
.choice.wrong {
  border-color: var(--red);
  background: var(--red-soft);
}
.choice:disabled { cursor: default; }
.choice.dim { opacity: 0.45; }

.exhibit.pickable { cursor: pointer; transition: border-color 0.15s ease, background-color 0.15s ease; }
.exhibit.pickable:hover { background: var(--surface-2); }
.exhibit.correct { border-left-color: var(--accent); background: var(--green-soft); }
.exhibit.wrong { border-left-color: var(--red); background: var(--red-soft); }

.verdict {
  margin-top: 1rem;
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  animation: settle 0.2s ease;
}
.verdict.good { border-color: var(--accent-dim); }
.verdict.bad { border-color: var(--red); }
.verdict h3 { margin: 0 0 0.25rem; font-family: var(--display); }
.verdict.good h3 { color: var(--accent); }
.verdict.bad h3 { color: var(--red); }
.verdict p { margin: 0; color: var(--muted); font-size: 0.9rem; }
.verdict .who { color: var(--text); font-weight: 600; }

@keyframes settle {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: none; }
}

#btn-next { margin-top: 1rem; }

/* shared-case setup & invitation */
.setup-box { display: flex; flex-direction: column; gap: 0.8rem; }
.setup-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-family: var(--display);
  font-weight: 700;
}
.setup-row input[type="text"] {
  font: inherit;
  font-family: var(--body);
  font-weight: 400;
  font-size: 1.05rem;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.55rem 0.9rem;
  max-width: 20rem;
}
.setup-row.check {
  flex-direction: row;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--body);
  font-weight: 400;
  cursor: pointer;
}
.setup-row.check input { accent-color: var(--accent); width: 1.1rem; height: 1.1rem; }
.setup-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.setup-seed {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.9rem;
  color: var(--accent);
  margin: 0;
  letter-spacing: 0.04em;
}

/* wanted-mode name input */
.wanted-form { display: flex; gap: 0.6rem; margin-top: 1rem; position: relative; }
.wanted-form input {
  flex: 1;
  font: inherit;
  font-size: 1.05rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.65rem 1rem;
}
.wanted-form input:disabled,
.wanted-form button:disabled { opacity: 0.5; cursor: default; }
.ac-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 5;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  max-height: 14rem;
  overflow-y: auto;
}
.ac-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0.5rem 1rem;
}
.ac-item:hover, .ac-item.active { background: var(--surface); }

/* ---------- result ---------- */

#screen-result { display: grid; place-items: center; min-height: 100dvh; }
.result-box { text-align: center; max-width: 28rem; }
.result-box h2 { font-family: var(--display); font-size: 2rem; margin: 0 0 0.25rem; }
.result-box p { color: var(--muted); }
.result-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.3rem;
  margin: 1.25rem 0;
}
.result-cell {
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 5px;
  border: 1px solid var(--line);
}
.result-cell.ok { background: var(--green-soft); border-color: var(--accent-dim); }
.result-cell.ko { background: var(--red-soft); border-color: var(--red); }
.result-actions { display: flex; gap: 0.6rem; justify-content: center; flex-wrap: wrap; }

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