@font-face {
  font-family: "Instrument Serif";
  src: url("fonts/instrument-serif.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #fdfcf7;
  --ink: #201f1b;
  --muted: #5e5b52;
  --rule: #ccc7b7;
  --matte: #f0eee6;
  --serif: "Instrument Serif", Georgia, serif;
  --mono: ui-monospace, "SFMono-Regular", Consolas, monospace;
  color: var(--ink);
  background: var(--paper);
  font: 15px/1.5 system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; }
h1, h2, p, figure { margin: 0; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .45; cursor: default; }
button:focus-visible, input:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}
a { color: inherit; text-underline-offset: .18em; }
a:hover { text-decoration-thickness: 2px; }
.symbols { position: absolute; width: 0; height: 0; overflow: hidden; }
button svg, .reveal-place svg {
  width: 17px;
  height: 17px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.shell { width: min(1120px, calc(100% - 56px)); margin-inline: auto; }
.masthead { margin-top: 30px; border-top: 2px solid var(--ink); border-bottom: 3px double var(--ink); }
.masthead-line, .masthead-actions, .session { display: flex; align-items: center; gap: 16px; }
.masthead-line { justify-content: space-between; flex-wrap: wrap; min-height: 45px; }
.masthead-actions { flex-wrap: wrap; gap: 7px 16px; }
.brand { font: 400 26px/1 var(--serif); }
.session { color: var(--muted); font: 12px/1.4 var(--mono); }
.session strong { color: var(--ink); font-weight: 650; }
.session span { white-space: nowrap; }
.masthead h1 { margin: 1px 0 10px; font: 400 clamp(44px, 7vw, 88px)/.94 var(--serif); letter-spacing: -.024em; }

.quiet-button, .expand-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}
.quiet-button:hover, .expand-button:hover:enabled { color: var(--ink); }
.expand-button { width: 44px; }

.game-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(250px, 1fr); gap: 20px; margin-top: 17px; }
.photo-column, .game-panel { min-width: 0; }
.photo-stage {
  position: relative;
  display: grid;
  place-items: center;
  height: clamp(315px, 53svh, 555px);
  background: var(--matte);
  border: 1px solid var(--rule);
  overflow: hidden;
}
.photo-stage img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: contain; }
.photo-frame:not(.loaded) img { visibility: hidden; }
.photo-stage .expand-button {
  position: absolute;
  top: 7px;
  right: 7px;
  z-index: 1;
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink);
}
.photo-stage .expand-button:hover:enabled { background: var(--matte); }
.photo-status { position: relative; color: var(--muted); padding: 12px; text-align: center; }
.photo-status button { text-decoration: underline; }
figcaption { padding: 7px 0; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }

.game-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 12px 0 12px 20px;
  border-inline-start: 1px solid var(--rule);
}
.panel-heading h2, .summary h2, .info-dialog h2 {
  font: 400 clamp(27px, 4vw, 41px)/1 var(--serif);
  letter-spacing: -.01em;
}
.panel-heading > p:last-child { margin-top: 6px; color: var(--muted); font-size: 13px; }
.dial { width: min(100%, 202px); aspect-ratio: 1; position: relative; margin: 9px auto 13px; }
.clock-face { display: block; width: 100%; height: 100%; cursor: crosshair; touch-action: none; user-select: none; }
.dial-fill { fill: var(--paper); }
.dial-outline { fill: none; stroke: #969080; stroke-width: 1.3; }
.dial-tick { stroke: #ada695; stroke-width: 1.1; }
.dial-tick.major { stroke: #777263; stroke-width: 1.6; }
.dial-labels { fill: var(--muted); font: 14px var(--mono); text-anchor: middle; }
#dial-marker circle { fill: var(--ink); }
.dial-ray { stroke: var(--ink); stroke-width: 2; stroke-linecap: round; }
.dial-display { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); pointer-events: none; }
.time-equivalent { display: block; margin-top: 3px; color: var(--muted); font: 13px/1.35 var(--mono); white-space: nowrap; }
.dial-display .time-equivalent { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); }
.time-fields { display: flex; align-items: center; color: var(--ink); font: 650 34px/1 var(--mono); letter-spacing: -.05em; }
.time-fields input {
  width: 2.15ch;
  min-height: 44px;
  padding: 0;
  border: 0;
  border-bottom: 1px dotted #908a7b;
  border-radius: 0;
  color: inherit;
  background: transparent;
  pointer-events: auto;
  text-align: center;
  font: inherit;
  letter-spacing: inherit;
}

.primary-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 45px;
  padding: 9px 13px;
  border: 1px solid var(--ink);
  border-radius: 0;
  color: var(--paper);
  background: var(--ink);
  font-size: 14px;
  font-weight: 700;
}
.primary-button:hover:enabled { background: #494539; }

.micro { color: var(--muted); font: 11px/1.4 var(--mono); }
.reveal-panel .panel-heading h2 { margin-top: 4px; font: 600 clamp(37px, 6vw, 61px)/1 var(--mono); letter-spacing: -.07em; }
.reveal-place { display: flex; align-items: center; gap: 6px; }
.reveal-place svg { width: 15px; height: 15px; }
.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
  padding-block: 8px;
  border-block: 1px solid var(--rule);
}
.result-grid strong { display: block; margin-top: 2px; font: 650 17px/1.3 var(--mono); }
.round-points { margin-block: 12px; color: var(--muted); font-size: 13px; }
.round-points strong { color: var(--ink); font: 650 27px/1 var(--mono); }
.evidence { margin-bottom: 14px; color: var(--muted); font-size: 12px; }
.evidence strong { display: block; margin-bottom: 2px; color: var(--ink); }

.summary { max-width: 600px; padding-block: 22px 18px; margin-inline: auto; }
.final-score { margin: 8px 0 15px; color: var(--muted); }
.final-score strong { color: var(--ink); font: 650 31px/1.2 var(--mono); }
.recap { margin: 0 0 14px; padding: 0; list-style: none; }
.recap li { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding-block: 8px; border-bottom: 1px solid var(--rule); }
.recap li:first-child { border-top: 1px solid var(--rule); }
.recap img { width: 56px; height: 39px; object-fit: cover; }
.recap strong { font-size: 13px; }
.recap-detail { display: block; color: var(--muted); font-size: 12px; }
.recap-points { font: 650 13px var(--mono); }
.site-footer { display: flex; justify-content: flex-end; border-top: 1px solid var(--rule); margin-top: 17px; }
.site-footer button { min-height: 44px; border: 0; padding: 0; color: var(--muted); background: transparent; font-size: 12px; }
.site-footer button:hover { color: var(--ink); text-decoration: underline; }

dialog { color: var(--ink); border: 1px solid #938d7e; border-radius: 0; }
dialog::backdrop { background: #201f1bc9; }
.info-dialog { width: min(540px, calc(100% - 24px)); max-height: calc(100% - 24px); padding: 18px 20px; background: var(--paper); }
.dialog-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; border-bottom: 1px solid var(--rule); }
.info-dialog li, .info-dialog p { font-size: 14px; color: var(--muted); }
.info-dialog strong { color: var(--ink); }
.guide-steps { padding-left: 21px; margin: 10px 0 0; }
.guide-steps li + li, #sources-content p, #sources-content details { margin-top: 10px; }
#sources-content details { border-top: 1px solid var(--rule); padding-top: 9px; }
#sources-content summary { font-size: 13px; cursor: pointer; }
#source-list { padding-left: 20px; overflow-wrap: anywhere; }
#source-list li + li { margin-top: 6px; }
.photo-dialog { max-width: calc(100% - 24px); max-height: calc(100% - 24px); padding: 0; background: var(--matte); }
.photo-dialog img { display: block; max-width: 100%; max-height: calc(100dvh - 26px); object-fit: contain; }
.photo-dialog .expand-button { position: absolute; top: 8px; right: 8px; background: var(--paper); border: 1px solid var(--rule); color: var(--ink); }

@media (max-width: 650px) {
  .shell { width: calc(100% - 28px); }
  .masthead { margin-top: 14px; }
  .masthead-line { gap: 0 10px; }
  .masthead-actions, .session { gap: 0 10px; }
  .brand { font-size: 23px; }
  .session { font-size: 11px; }
  .masthead h1 { font-size: clamp(39px, 10vw, 59px); }
  .game-grid { grid-template-columns: minmax(0, 1fr); gap: 11px; margin-top: 11px; }
  .photo-stage { height: auto; aspect-ratio: 4 / 3; }
  .game-panel { padding: 10px 0 0; border-inline-start: 0; border-top: 1px solid var(--rule); }
  .dial { width: 168px; }
  .time-fields { font-size: 28px; }
}
