* { box-sizing: border-box; }
html { height: 100%; }
body {
  position: relative;
  min-height: 100%;
  margin: 0;
  color: #000;
  background: #fff;
  font: 15px/1.45 system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
/* gallery light: two warm lamps just past the top corners, a few RGB levels at most */
body::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0 0 auto;
  height: 100vh;
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 80% at -4% -8%, rgb(255 184 110 / .045), rgb(255 184 110 / .025) 35%, rgb(255 184 110 / .01) 65%, transparent),
    radial-gradient(ellipse 70% 80% at 104% -8%, rgb(255 184 110 / .045), rgb(255 184 110 / .025) 35%, rgb(255 184 110 / .01) 65%, transparent);
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

/* the E logo sits one E-width in from the left and one E-height down from the top */
:root { --e: 25px; --inset: var(--e); }
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: calc(var(--inset) + var(--e));
  padding: var(--inset) var(--inset) 0;
}
.mark, .mark svg { display: block; width: var(--e); height: var(--e); }
.steps { display: flex; }
.steps i { width: calc(var(--e) * .4); height: calc(var(--e) * .4); background: #f0f0f0; }
.steps i.on { background: #000; }

/* game */
#game {
  display: grid;
  --room: clamp(24px, 3.4vw, 56px);
  --air: clamp(20px, 3.6vh, 36px);
  grid-template-columns: minmax(0, 1fr) clamp(360px, 30vw, 440px);
  height: calc(100dvh - var(--inset) - var(--e));
}
.work { display: flex; flex-direction: column; min-height: 0; padding: calc(var(--air) + 12px) var(--room); }
.frame {
  position: relative;
  flex: 1;
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
}
.loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #767676; font-size: 13px; }
.frame img {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity .2s;
}
.frame img.on { opacity: 1; }

.label { font-size: 14px; line-height: 1.4; }
.label .who { font-weight: 700; }
.label .title { margin: 2px 0 6px; font-size: 20px; line-height: 1.25; }
.label .title i { font-weight: 500; }
.label .muted { color: #767676; }
.label a { color: #000; }

.panel {
  display: flex;
  flex-direction: column;
  gap: var(--air);
  padding: calc(var(--air) + 12px) var(--room) var(--air) 8px;
  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;
  background: none;
  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: 8px 0 8px 4px;
  margin: -8px 0;
  border: 0;
  background: none;
  font-size: 15px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* year scale: the range input sits on top of a tick layer aligned to the thumb travel */
.when { --thumb: 26px; }
.scale { position: relative; margin-top: 6px; }
.ticks, .tick-labels { position: relative; margin: 0 calc(var(--thumb) / 2); }
.ticks { position: absolute; left: calc(var(--thumb) / 2); right: calc(var(--thumb) / 2); top: 50%; margin: 0; pointer-events: none; }
.tick { position: absolute; top: 2px; width: 1px; height: 5px; background: #000; }
.tick.t2 { height: 7px; }
.tick.t1 { height: 10px; }
.tick.zero { top: -10px; height: 21px; width: 2px; margin-left: -0.5px; }
.tick-labels { height: 16px; margin-top: 2px; font-size: 11px; color: #767676; }
.tick-labels span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.tick-labels span:first-child { transform: translateX(calc(var(--thumb) / -2)); }

input[type=range] {
  position: relative;
  display: block;
  width: 100%;
  height: 44px;
  margin: 0;
  background: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}
input[type=range]:focus { outline: 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;
  box-sizing: border-box;
  width: var(--thumb);
  height: var(--thumb);
  margin-top: calc(1px - var(--thumb) / 2);
  border: 4px solid #fff;
  border-radius: 50%;
  background: #000;
  box-shadow: 0 0 0 1px #000;
  cursor: grab;
}
input[type=range]::-moz-range-thumb { box-sizing: border-box; width: var(--thumb); height: var(--thumb); border: 4px solid #fff; border-radius: 50%; background: #000; box-shadow: 0 0 0 1px #000; cursor: grab; }
input[type=range]:active::-webkit-slider-thumb { cursor: grabbing; transform: scale(1.12); }
input[type=range]:active::-moz-range-thumb { cursor: grabbing; }
input[type=range]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 1px #000, 0 0 0 5px #ddd; }

/* result ruler: linear, zoomed to guess and answer */
.ruler { position: relative; height: 70px; margin: 2px 0 14px; }
.rtrack { position: absolute; left: 0; right: 0; top: 34px; height: 1px; background: #000; }
.rt { position: absolute; top: 34px; width: 1px; height: 4px; background: #000; }
.rt.major { height: 8px; }
.rt.zero { top: 24px; height: 18px; width: 2px; }
.rtl { position: absolute; top: 46px; transform: translateX(-50%); font-size: 11px; color: #767676; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rgap { position: absolute; top: 33px; height: 3px; background: repeating-linear-gradient(90deg, #000 0 4px, transparent 4px 8px); }
.rans { position: absolute; top: 28px; height: 13px; margin-left: -7.5px; padding: 0 5.5px; box-sizing: content-box; border: 2px solid #fff; border-radius: 9px; background: #e4002b; box-shadow: 0 0 0 1px #e4002b; }
.ryou { position: absolute; top: 27.5px; width: 14px; height: 14px; margin-left: -9px; border: 2px solid #fff; border-radius: 50%; background: #000; box-shadow: 0 0 0 1px #000; box-sizing: content-box; }
.rl { position: absolute; top: 2px; font-size: 13px; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rl.to-left { transform: translateX(-100%); }
.rl.ans { color: #e4002b; }

.where { display: flex; flex-direction: column; gap: 8px; flex: 1; min-height: 240px; }
#map { flex: 1; min-height: 220px; border: 1px solid #000; background: none; 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 { font-variant-numeric: tabular-nums; }
.result .line { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 0 0 10px; }
.result .pts { font-weight: 700; }
.result .muted { color: #767676; font-size: 14px; }
.result .total { border-top: 1px solid #000; padding-top: 10px; font-size: 22px; font-weight: 700; }

.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 { max-width: 1040px; }
.intro h1, .end h1 { margin: 0 0 16px; font-size: 52px; line-height: 1.02; letter-spacing: -0.035em; font-weight: 700; }
.hero { max-width: 640px; margin: 0 auto; text-align: center; }
.hero > p:first-of-type { margin: 0 auto 32px; font-size: 18px; max-width: 540px; }
.cta { display: flex; justify-content: center; gap: 12px; }
.intro .go { width: auto; padding: 14px 40px; }
.intro .plain { padding: 14px 32px; }
.today, .best { margin: 14px 0 0; font-size: 14px; color: #767676; }
.best { margin-top: 2px; }
.intro .src { margin: 48px 0 0; font-size: 13px; color: #767676; text-align: center; }

/* example round on the intro */
.example {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  margin: 72px 0 0;
  padding-top: 28px;
  border-top: 1px solid #000;
}
.ex-step { min-width: 0; }
.ex-box { height: 240px; border: 1px solid #000; overflow: hidden; opacity: .24; transition: opacity .35s ease, border-color .35s ease; }
.ex-step.complete .ex-box { opacity: .6; }
.ex-step.active .ex-box { opacity: 1; }
.ex-box img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ex-art img { transform: scale(1); transition: transform 1.8s cubic-bezier(.2,.7,.2,1); }
.ex-step.active .ex-art img { transform: scale(1.045); }
.ex-tbox { position: relative; padding: 20px; display: flex; align-items: center; }
#exControls { width: 100%; transition: opacity .25s, transform .35s; }
#exYear { font-size: 36px; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
#exSlider { opacity: 1; --thumb: 26px; }
.ex-guess { margin-top: 24px; padding: 9px; text-align: center; background: #000; color: #fff; font-weight: 700; transition: transform .15s, background .15s; }
.ex-guess.press { transform: scale(.96); background: #555; }
.example figcaption { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-weight: 700; }
.example .n { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 22px; height: 22px; border-radius: 50%; background: #ccc; color: #fff; font-size: 12px; transition: background .5s; }
.ex-step.active .n, .ex-step.complete .n { background: #000; }
.ex-help { margin: 6px 0 0 32px; font-size: 13px; color: #767676; }
.ex-res { margin: 12px 0 0 32px; font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.ex-answer { margin: 14px 0 0 32px; color: #767676; font-size: 14px; visibility: hidden; opacity: 0; transform: translateY(6px); transition: opacity .7s, transform .7s, visibility .7s; }
.ex-answer b { color: #000; }
.revealed .ex-answer { visibility: visible; opacity: 1; transform: none; }
.ex-map { position: relative; }
#exMap { height: 100%; }
.ex-map-hint { position: absolute; z-index: 500; left: 10px; right: 10px; top: 10px; padding: 7px 8px; background: #fff; text-align: center; font-size: 12px; pointer-events: none; }
.ex-drop .pin::after { content: ""; position: absolute; inset: -12px; border: 1px solid #000; border-radius: 50%; pointer-events: none; animation: ex-drop .55s ease-out both; }
@keyframes ex-drop { from { opacity: .65; transform: scale(.35); } to { opacity: 0; transform: scale(1.15); } }
.leaflet-tooltip.ex-tooltip { background: #fff; border: 0; box-shadow: none; border-radius: 0; padding: 3px 5px; font: 600 12px system-ui, sans-serif; }
.leaflet-tooltip.ex-tooltip.answer { color: #e4002b; }
.ex-time { position: absolute; left: 20px; right: 20px; opacity: 0; visibility: hidden; transform: translateY(10px); transition: opacity .3s .05s, transform .4s .05s, visibility .3s; }
.ex-time > .k { display: block; margin-bottom: 24px; }
.ex-time p { margin: 16px 0 0; color: #767676; font-size: 13px; }
.revealed #exControls { opacity: 0; transform: translateY(-10px); pointer-events: none; }
.revealed .ex-time { opacity: 1; visibility: visible; transform: none; }
.ex-hide { opacity: 0; transition: opacity .25s; }
.ex-hide.on { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  .example *, .example *::after { transition: none !important; animation: none !important; }
}

/* percentile vs other players */
.kicker { margin: 0 0 8px; color: #767676; font-weight: 600; }
.rank { margin: -16px 0 40px; }
.pct { font-size: 20px; font-weight: 700; margin-bottom: 12px; }
.histwrap { position: relative; padding-top: 20px; }
.hist { display: block; width: 100%; height: 80px; }
.hist-you { position: absolute; top: 0; transform: translateX(-50%); font-size: 12px; font-weight: 700; }
.hist-axis { display: flex; justify-content: space-between; margin-top: 4px; font-size: 11px; color: #767676; font-variant-numeric: tabular-nums; }

.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; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.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 .actions { display: flex; gap: 12px; margin-top: 32px; }
.end .go { width: auto; padding: 14px 40px; }
/* Rubric footer endorsement (rubriclabs.com/brand): one symbol (1cap) in from the bottom-left corner */
.credit { position: absolute; left: 1cap; bottom: calc(1cap + env(safe-area-inset-bottom)); font-size: 12px; }
#end[hidden] + .credit { display: none; }
.credit a { display: flex; align-items: baseline; gap: .25em; color: #000; text-decoration: none; }
.credit span { margin-left: -.077em; text-box: trim-both cap alphabetic; }
.credit svg { display: block; width: auto; height: calc(1cap * 302.8 / 298); }
.plain { padding: 14px 28px; border: 1px solid #000; background: none; font-weight: 700; }

.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 (pointer: coarse) {
  .when { --thumb: 34px; }
  input[type=range] { height: 52px; }
}

@media (max-width: 820px) {
  :root { --e: 20px; --inset: 16px; }
  #game { display: block; height: auto; }
  .work { padding: 16px; }
  .frame { flex: none; height: 44vh; height: 44svh; width: 100%; display: block; }
  .label { scroll-margin-top: 16px; }
  .panel { padding: 8px 16px 16px; overflow: visible; }
  .go { position: sticky; z-index: 1000; bottom: calc(12px + env(safe-area-inset-bottom)); }
  .frame.ready { height: auto; }
  .frame.ready img { height: auto; max-height: 56svh; }
  .where { min-height: 0; }
  #map { height: 280px; flex: none; }
  .intro, .end { padding: 40px 16px calc(40px + env(safe-area-inset-bottom)); }
  .intro .go, .end .go { position: static; width: 100%; }
  .end .actions .go, .end .actions .plain { flex: 1; padding: 14px 0; }
  .intro h1, .end h1 { font-size: 38px; }
  .cta { flex-direction: column; }
  .intro .plain { width: 100%; }
  .example { grid-template-columns: 1fr; margin-top: 48px; gap: 28px; }
  .ex-tbox { height: 240px; }
  .ex-answer { margin-bottom: 0; }
}
