/* Gissa skidorten – see CLAUDE.md "Design". Retro ski poster: ice, deep blue, poster orange, condensed numbers. */
:root {
  --bg: #EAF1F7;
  --surface: #FFFFFF;
  --ink: #0E2A47;
  --muted: #5A6B7D;
  --accent: #F26B1D;
  --ok: #2E9E5B;
  --bad: #C23B22;
  --skip: #8FA0B2;
  --empty: #D3DEE9;
  --line: #C9D6E2;
  --photo-bg: #0E2A47;
  --radius: 10px;
  --display: "Big Shoulders Display", "Arial Narrow", Impact, sans-serif;
  --sans: "Karla", "Helvetica Neue", Arial, sans-serif;
  --shadow: 0 8px 24px rgba(14, 42, 71, 0.14);
}
* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--ink); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
button, input { font: inherit; }
[hidden] { display: none !important; }

/* Header: one compact row */
.top {
  width: min(100%, 560px);
  margin: 0 auto;
  padding: 8px 14px 6px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand {
  font-family: var(--display);
  font-weight: 900;
  font-size: 1.35rem;
  line-height: 1;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
  white-space: nowrap;
}
.brand span { color: var(--accent); }
.puzzle-meta { color: var(--muted); font-size: 0.8rem; display: inline-flex; gap: 6px; white-space: nowrap; }
.puzzle-meta span:first-child { color: var(--ink); font-weight: 700; }
.top-nav { margin-left: auto; display: flex; gap: 12px; align-items: center; font-size: 0.85rem; white-space: nowrap; }
.top-nav a { color: var(--ink); text-decoration: none; border-bottom: 2px solid var(--line); }
.top-nav a:hover { border-color: var(--ink); }
.link-btn {
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 50%; width: 24px; height: 24px; padding: 0;
  color: var(--ink); cursor: pointer; font-weight: 700; font-size: 0.85rem; line-height: 1;
}
.link-btn:hover { border-color: var(--ink); }

.game, .archive { width: min(100%, 560px); margin: 0 auto; padding: 0 14px 32px; }

/* Photo */
.photo {
  position: relative;
  margin: 0;
  background: var(--photo-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.photo img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: max(170px, calc(var(--vvh, 100vh) - 300px));
  object-fit: contain;
  background: var(--photo-bg);
  transition: opacity .25s ease;
}
.photo img.is-loading { opacity: 0; }
.photo img { cursor: zoom-in; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.photo.is-zooming img { cursor: zoom-out; }
.loupe {
  position: absolute;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .45), inset 0 0 0 1px rgba(0, 0, 0, .15);
  background-repeat: no-repeat;
  background-color: var(--photo-bg);
  pointer-events: none;
  transform: translate(-50%, -50%);
  z-index: 3;
}
.review {
  position: absolute;
  right: 8px;
  bottom: 8px;
  max-width: calc(100% - 16px);
  padding: 7px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .92);
  color: var(--ink);
  border-left: 5px solid var(--empty);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .25);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  line-height: 1.25;
  z-index: 2;
}
.review.is-ok { border-left-color: var(--ok); }
.review.is-bad { border-left-color: var(--bad); }
.review-name { margin: 0; }
.review-name .guess { color: var(--bad); }
.review-back {
  border: 1.5px solid var(--ink); background: #fff; color: var(--ink); border-radius: 8px;
  padding: 4px 9px; font-size: 0.8rem; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.photo img.is-map { background: #F7FAFD; object-fit: cover; }
.frame-chip {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 4px 10px 3px;
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.04em;
}
/* Frame bar: one marker per photo, doubling as the result squares */
.frames {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: flex;
  justify-content: center;
  gap: 8px;
}
.frames button {
  width: 44px;
  height: 26px;
  border: 0;
  border-radius: 7px;
  background: var(--empty);
  padding: 0;
  cursor: default;
  color: #fff;
  font-weight: 800;
  font-size: 0.95rem;
  display: grid;
  place-items: center;
}
.frames button.is-open { background: var(--ink); cursor: pointer; }
.frames button.is-bad { background: var(--bad); }
.frames button.is-bad::after { content: "✗"; }
.frames button.is-skip { background: var(--skip); }
.frames button.is-skip::after { content: "→"; }
.frames button.is-ok { background: var(--ok); }
.frames button.is-ok::after { content: "✓"; }
.frames button.is-current { outline: 3px solid var(--accent); outline-offset: 2px; }
.frames button.is-current:not(.is-bad):not(.is-ok):not(.is-skip) { background: var(--accent); }

/* Clues as ticket rows */
.clues { margin-top: 14px; display: grid; gap: 8px; }
.clue {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 10px 14px 8px;
  display: grid;
  grid-template-columns: 1fr;
  animation: rise .3s ease-out;
  border-left: 5px solid var(--ink);
}
.clue.is-new { border-left-color: var(--accent); }
.clue small { color: var(--muted); font-size: 0.82rem; }
.clue strong {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.75rem;
  line-height: 1.05;
  letter-spacing: 0.01em;
}
.clue strong em { font-style: normal; font-size: 0.6em; font-weight: 600; color: var(--muted); letter-spacing: 0.03em; }
.clue .sub { font-family: var(--sans); color: var(--muted); font-size: 0.85rem; margin-top: 2px; }
.clue-empty { color: var(--muted); font-size: 0.95rem; margin: 0; padding: 6px 2px 0; }

/* Guess */
.guess { margin-top: 10px; }
.combo { display: flex; gap: 6px; }
.field { position: relative; flex: 1; min-width: 0; display: flex; }
.field.is-open #guess-input { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
#guess-input {
  flex: 1;
  width: 100%;
  min-width: 0;
  padding: 9px 12px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-size: 1.05rem;
}
#guess-input:focus { border-color: var(--accent); outline: none; }
#guess-input::placeholder { color: #8A9AAB; }
.suggestions {
  list-style: none;
  margin: 0;
  padding: 4px 0;
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  background: var(--surface);
  border-radius: 0 0 10px 10px;
  box-shadow: 0 8px 18px rgba(14, 42, 71, 0.18);
  border: 2px solid var(--accent);
  border-top: 0;
  max-height: 46vh;
  overflow-y: auto;
  z-index: 5;
}
.suggestions li { padding: 5px 12px; cursor: pointer; font-size: 1rem; line-height: 1.3; }
.suggestions li[aria-selected="true"], .suggestions li:hover { background: #FDEBDD; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 16px;
  border-radius: var(--radius);
  border: 2px solid var(--ink);
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .08s ease, background .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: #D95A12; border-color: #D95A12; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

.pass-hint { margin: 8px 0 0; color: var(--muted); font-size: 0.85rem; }

.wrong { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.wrong li { padding: 4px 10px; border-radius: 999px; background: #E4DCD6; color: #6B4A3C; text-decoration: line-through; font-size: 0.9rem; }
.wrong li.is-skip { text-decoration: none; background: #DCE4EC; color: var(--muted); }

/* Result */
.result {
  margin-top: 18px;
  padding: 18px 18px 16px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border-top: 6px solid var(--accent);
  animation: rise .35s ease-out;
}
.result.is-fail { border-top-color: var(--bad); }
.result-kicker { margin: 0; color: var(--muted); font-size: 0.95rem; }
.result-title {
  margin: 2px 0 0;
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(2.4rem, 11vw, 3.4rem);
  line-height: 0.95;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}
.result-sub { margin: 10px 0 0; }
.result-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.result-actions .btn { flex: 1 1 auto; }
.countdown { margin: 14px 0 0; color: var(--muted); font-size: 0.95rem; }
.stats {
  margin: 14px 0 0;
  padding: 14px 0 0;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.stats div { text-align: center; }
.stats dt { font-size: 0.8rem; color: var(--muted); }
.stats dd { margin: 0; font-family: var(--display); font-weight: 800; font-size: 2rem; line-height: 1; }
.facts { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; }
.facts div small { display: block; color: var(--muted); font-size: 0.78rem; }
.facts div span { font-family: var(--display); font-weight: 800; font-size: 1.4rem; line-height: 1.1; }
.facts .wide { grid-column: 1 / -1; font-size: 0.95rem; }
.credits { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 8px; color: var(--muted); font-size: 0.8rem; }
.credits a { color: var(--muted); }
.credits p { margin: 4px 0; }

.loading { text-align: center; color: var(--muted); margin: 40px 0; }

/* Archive */
.archive h1 { font-family: var(--display); font-weight: 900; font-size: 2.6rem; text-transform: uppercase; margin: 10px 0 2px; line-height: 1; }
.archive-intro { color: var(--muted); margin: 0 0 16px; }
.archive-list { list-style: none; margin: 0; padding: 0; }
.archive-list li a {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  margin-bottom: 8px;
  background: var(--surface);
  border-radius: var(--radius);
  color: var(--ink);
  text-decoration: none;
  border: 2px solid transparent;
}
.archive-list li a:hover { border-color: var(--ink); }
.archive-list li.is-today a { border-color: var(--accent); }
.archive-list .no { font-family: var(--display); font-weight: 800; font-size: 1.3rem; }
.archive-list .date { color: var(--muted); font-size: .9rem; margin-left: 8px; }
.archive-list .status { color: var(--muted); font-size: .9rem; }
.archive-list .solved { font-weight: 700; }
.mini { display: inline-flex; gap: 4px; }
.mini i { width: 14px; height: 14px; border-radius: 4px; background: var(--empty); display: block; }
.mini i.is-ok { background: var(--ok); }
.mini i.is-bad { background: var(--bad); }
.mini i.is-skip { background: var(--skip); }

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 20px);
  background: var(--ink);
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 20;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* Help */
.help { border: 0; border-radius: var(--radius); padding: 22px 22px 18px; width: min(92vw, 440px); box-shadow: var(--shadow); color: var(--ink); }
.help::backdrop { background: rgba(14, 42, 71, .5); }
.help h2 { margin: 0 0 10px; font-family: var(--display); font-weight: 900; font-size: 2rem; text-transform: uppercase; line-height: 1; }
.help ol { margin: 0 0 16px; padding-left: 22px; }
.help li { margin-bottom: 6px; }

@keyframes pop { 0% { transform: scale(.6); } 100% { transform: scale(1); } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (min-width: 600px) {
  body { font-size: 18px; }
  .top { padding-top: 14px; }
  .brand { font-size: 1.6rem; }
}
