:root {
  color-scheme: light;
  --ink: #18263b;
  --quiet: #4b5e73;
  --blue: #174884;
  --navy: #0e2c56;
  --paper: #f8f6f0;
  --line: #d1dce9;
  --red: #a03130;
  --display: Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.5 system-ui, sans-serif;
}

p, h1, h2 { margin: 0; }

.shell {
  width: min(100% - 32px, 690px);
  margin-inline: auto;
}

.masthead, .brand, .edition, .clue-header, .progress, .result-actions {
  display: flex;
  align-items: center;
}

.masthead { min-height: 60px; }
.brand {
  min-height: 44px;
  gap: 10px;
  color: var(--navy);
  font-weight: 750;
  text-decoration: none;
}
.brand:hover span { text-decoration: underline; text-underline-offset: .2em; }
.brand img { display: block; }

.intro {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: clamp(19px, 4.5vw, 36px);
  border-radius: 14px 14px 0 0;
  background: var(--navy);
  color: #fff;
}

h1 {
  font: 700 clamp(2.75rem, 8vw, 4.9rem)/.98 var(--display);
  letter-spacing: -.065em;
}

.intro p { margin-top: 10px; max-width: 32ch; color: #dce7f4; }

.compass {
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: clamp(54px, 16vw, 103px);
  aspect-ratio: 1;
  margin-inline: clamp(0px, 2vw, 14px);
  border-radius: 50%;
  border: 1px solid #aabdd4;
  background:
    linear-gradient(90deg, transparent 49%, #54759b 49% 51%, transparent 51%),
    linear-gradient(transparent 49%, #54759b 49% 51%, transparent 51%),
    radial-gradient(circle, transparent 58%, #54759b 59% 61%, transparent 62%),
    var(--navy);
}

.compass::before {
  position: absolute;
  inset: -10px;
  z-index: -1;
  border-radius: 50%;
  box-shadow: 0 0 0 1px #50729757, 0 0 0 11px #50729722, 0 0 0 12px #50729747,
              0 0 0 24px #50729715, 0 0 0 25px #50729738;
  content: "";
}

.compass span {
  width: 25%;
  height: 64%;
  transform: rotate(35deg);
  background: linear-gradient(#ff8171 50%, #e2eefb 50%);
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}

.game, .fallback {
  padding: clamp(16px, 4.3vw, 32px);
  background: #fff;
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 14px 14px;
}

.edition {
  flex-wrap: wrap;
  gap: 2px 9px;
  margin-bottom: 14px;
  font-size: .8rem;
  color: var(--quiet);
}
.edition span { color: var(--blue); font-weight: 750; }

.clue-header { justify-content: space-between; gap: 12px; }
.clue-header h2 { font-size: .93rem; color: var(--navy); }
.progress { gap: 5px; list-style: none; margin: 0; padding: 0; }
.progress li {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--quiet);
  font-size: .72rem;
  font-weight: 750;
}
.progress .revealed { background: #e7eef7; color: var(--navy); }
.progress .current { border-color: var(--blue); background: var(--blue); color: #fff; }

.clues { list-style: none; padding: 0; margin: 10px 0 16px; }
.clues li + li { margin-top: 6px; }
.clue-text {
  display: flex;
  align-items: baseline;
  gap: 9px;
  padding: 8px 11px;
  color: var(--quiet);
  background: #f4f6f9;
  border-radius: 6px;
  font-size: .92rem;
}
.clue-number { flex: none; color: var(--blue); font-size: .76rem; font-weight: 750; }
.clue-text:last-child {
  align-items: start;
  padding: clamp(12px, 3.4vw, 18px);
  color: var(--ink);
  background: #edf4fc;
  font: 400 clamp(1.33rem, 4.85vw, 1.8rem)/1.25 var(--display);
}

.feedback { margin: -4px 0 12px; color: var(--quiet); font-size: .9rem; font-weight: 600; }
label { display: block; margin-bottom: 5px; font-size: .9rem; font-weight: 750; }
.guess-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }

input, button {
  min-height: 48px;
  border: 1px solid #75869b;
  border-radius: 7px;
  font: inherit;
}

input { width: 100%; padding: 8px 10px; background: #fff; color: var(--ink); }
input[aria-invalid="true"] { border-color: var(--red); }
button, summary { cursor: pointer; font-weight: 750; }

.primary { background: var(--blue); border-color: var(--blue); color: #fff; padding: 8px 14px; }
.primary:hover { background: var(--navy); }
.secondary {
  min-height: 44px;
  margin-top: 4px;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: var(--blue);
  text-decoration: underline;
  text-underline-offset: .2em;
}
.error { margin-top: 6px; color: var(--red); font-size: .9rem; }
.error:empty { margin: 0; }

:focus-visible { outline: 3px solid #155ca0; outline-offset: 3px; }
.result {
  padding: clamp(13px, 3.4vw, 23px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}
.result-note { color: var(--blue); font-size: .91rem; font-weight: 750; }
.result h2 { margin: 3px 0 7px; font: 700 clamp(1.65rem, 5.5vw, 2.35rem)/1.1 var(--display); }
.new-round { margin-top: 10px; color: var(--quiet); font-size: .87rem; }
.result-actions { align-items: start; flex-wrap: wrap; gap: 3px 16px; margin-top: 12px; }
details { max-width: 100%; }
summary { min-height: 44px; padding: 10px 0; color: var(--blue); }
details ul { margin: 2px 0 0; padding-inline-start: 20px; overflow-wrap: anywhere; }
details a, footer > a { color: var(--blue); text-underline-offset: .2em; }
details li + li { margin-top: 7px; }

footer { padding: 11px 0 24px; color: var(--quiet); font-size: .86rem; }
footer > p, footer > a { display: inline-block; padding-block: 10px; }
footer > a { min-height: 44px; margin-inline-start: 10px; font-weight: 750; }
footer details { border-top: 1px solid var(--line); margin-top: 4px; }
footer details li a { display: inline-flex; align-items: center; min-height: 44px; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 359px) {
  .guess-row { grid-template-columns: minmax(0, 1fr); }
  .shell { width: calc(100% - 24px); }
}
