* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: #000;
  background: #fff;
  font: 15px/1.45 system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  height: 56px;
  padding: 14px 24px 0;
  border-bottom: 1px solid #000;
}
.mark { color: #000; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; text-decoration: none; }
#status { font-variant-numeric: tabular-nums; font-weight: 600; }
#status span { color: #767676; font-weight: 400; }

/* game */
#game {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  height: calc(100dvh - 56px);
}
.work { display: flex; flex-direction: column; min-height: 0; padding: 24px; }
.frame {
  flex: 1;
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
}
.frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity .2s;
}
.frame img.on { opacity: 1; }

.label {
  padding-top: 16px;
  max-width: 640px;
  font-size: 14px;
  line-height: 1.4;
}
.label .who { font-weight: 700; }
.label .title { font-style: italic; }
.label .muted { color: #767676; }
.label a { color: #000; }

.panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 24px;
  border-left: 1px solid #000;
  min-height: 0;
  overflow: auto;
}
.row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.k { font-weight: 700; }
.hint { color: #767676; font-size: 14px; }

.year { display: flex; align-items: baseline; gap: 6px; }
#yearInput {
  width: 3.4em;
  padding: 0;
  border: 0;
  border-bottom: 1px solid transparent;
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.03em;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
#yearInput:focus { outline: none; border-bottom-color: #000; }
.era {
  padding: 0;
  border: 0;
  background: none;
  font-size: 15px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

input[type=range] {
  width: 100%;
  margin: 10px 0 0;
  accent-color: #000;
  height: 24px;
  -webkit-appearance: none;
  appearance: none;
  background: none;
}
input[type=range]::-webkit-slider-runnable-track { height: 2px; background: #000; }
input[type=range]::-moz-range-track { height: 2px; background: #000; }
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px; margin-top: -8px;
  border-radius: 50%; background: #000; border: 0;
}
input[type=range]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #000; border: 0; }

.ticks { position: relative; height: 18px; font-size: 11px; color: #767676; }
.ticks span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.ticks span:first-child { transform: none; }

.nudge { display: flex; gap: 6px; margin-top: 8px; }
.nudge button {
  flex: 1;
  padding: 6px 0;
  border: 1px solid #000;
  background: #fff;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.nudge button:hover { background: #000; color: #fff; }

.where { display: flex; flex-direction: column; gap: 8px; flex: 1; min-height: 240px; }
#map { flex: 1; min-height: 220px; border: 1px solid #000; background: #fff; cursor: crosshair; }
.leaflet-container { font: inherit; }
.leaflet-control-attribution { font-size: 10px; }
.leaflet-control-attribution a { color: #767676; }
.leaflet-bar, .leaflet-bar a { border-radius: 0 !important; }
.leaflet-touch .leaflet-bar { border: 1px solid #000; }

.go {
  width: 100%;
  padding: 14px;
  border: 1px solid #000;
  background: #000;
  color: #fff;
  font-weight: 700;
}
.go:disabled { background: #fff; color: #767676; border-color: #ccc; cursor: default; }

.result { border-top: 1px solid #000; padding-top: 12px; font-variant-numeric: tabular-nums; }
.result .line { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
.result .line span:last-child { font-weight: 700; }
.result .muted { color: #767676; }
.result .total { border-top: 1px solid #ddd; margin-top: 6px; padding-top: 8px; font-size: 18px; }

.pin { width: 14px; height: 14px; border-radius: 50%; background: #000; border: 2px solid #fff; box-shadow: 0 0 0 1px #000; }
.pin.answer { background: #e4002b; box-shadow: 0 0 0 1px #e4002b; }

/* intro + end */
.intro, .end { max-width: 720px; margin: 0 auto; padding: 72px 24px; }
.intro h1, .end h1 { margin: 0 0 16px; font-size: 52px; line-height: 1.02; letter-spacing: -0.035em; font-weight: 700; }
.intro p { font-size: 18px; margin: 0 0 32px; max-width: 560px; }
.intro .go { width: auto; padding: 14px 40px; }
.intro .src { margin-top: 48px; font-size: 13px; color: #767676; }

.end .sub { color: #767676; margin: 0 0 40px; font-size: 18px; }
.rounds { border-top: 1px solid #000; }
.rounds li {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid #ddd;
}
.rounds ol { list-style: none; margin: 0; padding: 0; }
.rounds img { width: 72px; height: 72px; object-fit: cover; display: block; }
.rounds .t { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rounds .t a { color: inherit; text-decoration: none; }
.rounds .t a:hover { text-decoration: underline; }
.rounds .m { color: #767676; font-size: 13px; }
.rounds .s { font-weight: 700; font-variant-numeric: tabular-nums; }
.end .go { width: auto; padding: 14px 40px; margin-top: 32px; }

.zoom {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #fff;
  cursor: zoom-out;
}
.zoom img { max-width: 100%; max-height: 100%; object-fit: contain; }

@media (max-width: 820px) {
  header { padding: 14px 16px 0; }
  #game { display: block; height: auto; }
  .work { padding: 16px; }
  .frame { height: 44vh; width: 100%; display: block; }
  .panel { border-left: 0; border-top: 1px solid #000; padding: 16px; }
  .where { min-height: 0; }
  #map { height: 280px; flex: none; }
  .intro, .end { padding: 40px 16px; }
  .intro h1, .end h1 { font-size: 38px; }
}
