/* Shared UI for the game pages: layout, mode tabs, tooltips, results, stats, seeds. */

main { max-width: 680px; margin: 0 auto; padding: 22px 16px 56px; }

.modes { display: flex; gap: 4px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; }
.modes a {
  padding: 6px 14px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}
.modes a.active { background: var(--text); color: var(--bg); }
@media (max-width: 480px) { .modes a { padding: 6px 10px; font-size: 13px; } }

.title-row { text-align: center; }

/* --- fit-to-window play screens --- */
body.fit main { padding-top: clamp(8px, 2.4vh, 22px); padding-bottom: clamp(6px, 1.6vh, 18px); }
body.fit #stage { flex: 1 1 auto; min-height: 0; container-type: size; display: flex; flex-direction: column; }
body.fit #stage > * { flex-shrink: 0; } /* pages opt single elements back in to shrinking */
body.fit h1 { font-size: clamp(30px, 6.4vh, 52px); margin-top: 0; }
body.fit .sub { font-size: 13px; }
body.fit .dots { margin: clamp(6px, 1.6vh, 18px) 0 clamp(8px, 2.2vh, 22px); }
body.fit .prompt { font-size: clamp(21px, 4vh, 30px); margin-bottom: clamp(6px, 1.8vh, 18px); }
body.fit .round-no { margin-bottom: 2px; }
/* short phones: the dots already say which round it is */
@media (max-height: 700px) {
  body.fit h1 { font-size: clamp(28px, 5.4vh, 40px); }
  body.fit .round-no { display: none; }
}
h1 { font-family: var(--display); font-weight: 900; font-size: 52px; letter-spacing: 0.03em; text-transform: uppercase; margin: 6px 0 2px; line-height: 1; }
.sub { margin: 0; color: var(--muted); font-size: 14px; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

@keyframes pop { 50% { transform: scale(1.35); } }
.loading { text-align: center; color: var(--muted); padding: 60px 0; }

/* --- progress dots --- */
.dots { list-style: none; display: flex; justify-content: center; gap: 9px; padding: 0; margin: 18px 0 22px; }
.dots li {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--line);
  transition: background 0.25s, border-color 0.25s;
}
.dots li.current { border-color: var(--text); }
.dots li.win { background: var(--win); border-color: var(--win); animation: pop 0.35s ease-out; }
.dots li.loss { background: var(--loss); border-color: var(--loss); animation: pop 0.35s ease-out; }

/* --- tooltips --- */
.tip-host { position: relative; display: inline-flex; }
.tip-host::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translate(-50%, 4px);
  padding: 5px 9px;
  border-radius: 6px;
  background: #070c13;
  color: var(--text);
  font: 600 12px/1.2 var(--body);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s, transform 0.12s;
  z-index: 10;
}
.tip-host:hover::after, .tip-host.show::after { opacity: 1; transform: translate(-50%, 0); }

/* --- results --- */
.results { text-align: center; }
.results.enter { animation: rise 0.4s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.score { font-family: var(--display); font-weight: 900; line-height: 1; }
.score .big { font-size: 112px; }
.score .of { font-size: 40px; color: var(--muted); margin-left: 6px; }
.blurb { font-family: var(--display); font-size: 26px; font-weight: 600; margin: 8px 0 22px; }
.result-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.next-daily { color: var(--muted); font-size: 14px; margin: 18px 0 0; }
.next-daily span { color: var(--text); font-variant-numeric: tabular-nums; font-weight: 600; }

.results h3 {
  font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 14px;
}
.stats, .board, .panel { margin-top: 30px; padding: 20px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat-row b { display: block; font-family: var(--display); font-size: 36px; }
.stat-row span { font-size: 12px; color: var(--muted); }
.dist { display: grid; grid-template-columns: repeat(var(--cols, 11), 1fr); gap: 5px; height: 110px; margin-top: 20px; }
.dist-col { display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; }
.dist-bar { position: relative; min-height: 3px; background: var(--panel-2); border-radius: 4px 4px 0 0; }
.dist-bar i { position: absolute; top: -17px; left: 0; right: 0; font-style: normal; font-size: 11px; color: var(--muted); }
.dist-col.me .dist-bar { background: var(--accent); }
.legend { margin: 14px 0 0; font-size: 12px; color: var(--muted); display: flex; justify-content: center; align-items: center; gap: 6px; }
.lg { display: inline-block; width: 14px; height: 14px; border-radius: 4px; background: var(--panel-2); margin-left: 8px; }
.dist-label { font-size: 11px; color: var(--muted); margin-top: 4px; }
@media (max-width: 520px) {
  .stat-row b { font-size: 28px; }
}

.toast {
  position: fixed; left: 50%; top: 18px;
  transform: translate(-50%, -12px);
  padding: 10px 16px; border-radius: 8px;
  background: var(--text); color: var(--bg); font-weight: 600; font-size: 14px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 20;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

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

/* --- seeds --- */
.seed-chip {
  display: inline-flex; align-items: center; gap: 5px;
  margin-left: 2px; padding: 2px 9px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel-2);
  font-size: 13px; color: var(--muted);
  cursor: pointer;
  vertical-align: middle;
}
.seed-chip b { color: var(--text); font-family: ui-monospace, monospace; font-weight: 600; letter-spacing: 0.04em; }
.seed-chip:hover { border-color: var(--steel); }

.seed-screen { max-width: 420px; margin: 8px auto 0; text-align: center; }
.seed-copy { color: var(--muted); line-height: 1.5; margin: 0 0 22px; }

.seed-box { margin-top: 30px; padding: 18px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.seed-form { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.seed-form label {
  font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted);
}
.seed-row { display: flex; gap: 8px; width: 100%; max-width: 360px; }
.seed-row input {
  flex: 1; min-width: 0; min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--bg); color: var(--text);
  font: 600 16px ui-monospace, monospace; letter-spacing: 0.06em;
}
.seed-row input:focus { outline: none; border-color: var(--accent); }

/* --- LAN-only reveal switch (top right of the masthead) --- */
.masthead .modes { margin-left: auto; }
.dev-toggle {
  position: absolute; top: calc(100% + 8px); right: 12px;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 10px 4px 5px;
  border: 1px dashed var(--accent); border-radius: 999px;
  background: rgba(14, 22, 32, 0.85);
  color: var(--accent); font-size: 13px; font-weight: 600;
  cursor: pointer; user-select: none;
}
.dev-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.dev-track {
  position: relative; width: 30px; height: 18px; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--line); transition: background 0.15s;
}
.dev-track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--muted); transition: transform 0.15s, background 0.15s;
}
.dev-toggle input:checked + .dev-track { background: color-mix(in srgb, var(--accent) 35%, var(--panel-2)); }
.dev-toggle input:checked + .dev-track::after { transform: translateX(12px); background: var(--accent); }
.dev-toggle input:focus-visible + .dev-track { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 520px) {
  /* just the switch on phones, so it clears the page title */
  .dev-toggle { right: 8px; padding: 4px 5px; }
  .dev-toggle > span:last-child { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
}

/* --- hero picker dialog (Deadoku, Who Said It) --- */
#picker {
  width: min(420px, calc(100vw - 32px));
  max-height: min(560px, 80vh);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.8);
}
#picker[open] { display: flex; flex-direction: column; }
#picker::backdrop { background: rgba(5, 9, 14, 0.7); backdrop-filter: blur(3px); }
.picker-head { display: flex; align-items: center; gap: 10px; padding: 14px 14px 10px 18px; margin: 0; }
#picker-title { flex: 1; margin: 0; font-family: var(--display); font-size: 20px; text-transform: uppercase; letter-spacing: 0.02em; }
#picker-title span { color: var(--muted); margin: 0 4px; }
.picker-close { border: 0; background: none; color: var(--muted); font-size: 18px; cursor: pointer; padding: 6px; }
#picker-search {
  margin: 0 14px 10px;
  min-height: 44px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--text); font: 500 16px var(--body);
}
#picker-search:focus { outline: none; border-color: var(--accent); }
#picker-list { list-style: none; margin: 0; padding: 0 8px 10px; overflow-y: auto; }
#picker-list li {
  display: flex; align-items: center; gap: 12px;
  padding: 6px 10px; border-radius: 10px;
  font-weight: 600; cursor: pointer;
}
#picker-list li img { width: 36px; height: 36px; }
#picker-list li em { margin-left: auto; font-style: normal; font-size: 12px; color: var(--muted); font-weight: 500; }
#picker-list li:hover, #picker-list li.active { background: var(--panel-2); }
#picker-list li.active { box-shadow: inset 3px 0 0 var(--accent); }
#picker-list li.used { opacity: 0.4; cursor: not-allowed; }
#picker-list li.empty { color: var(--muted); cursor: default; justify-content: center; padding: 18px; }
