/* Undefeated — the design system (tool-docs undefeated/DESIGN.md §2). Paper and ink, one blue for
   your side, one red for theirs. Started from the design prototype (design/prototype/style.css). */

@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url('../fonts/source-serif-4-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url('../fonts/source-serif-4-latin-ext-wght-normal.woff2') format('woff2-variations');
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF,
    U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Source Serif 4';
  font-style: italic;
  font-weight: 200 900;
  font-display: swap;
  src: url('../fonts/source-serif-4-latin-wght-italic.woff2') format('woff2-variations');
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Source Serif 4';
  font-style: italic;
  font-weight: 200 900;
  font-display: swap;
  src: url('../fonts/source-serif-4-latin-ext-wght-italic.woff2') format('woff2-variations');
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF,
    U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/ibm-plex-mono-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/ibm-plex-mono-latin-500-normal.woff2') format('woff2');
}

/* Raindrop — an atlas page. Paper land, pale sea, one strong blue for water that moves. The map is
   the game; everything else is a quiet column around it. */

:root {
  --paper: #f4f0e6;
  --ink: #1d2a33;
  --ink-2: #5b6770;
  --line: #d9d2c3;
  --sea: #cfe2e8;
  --sea-ink: #5f8493;
  --land: #f7f3ea;
  --coast: #9fb3b9;
  --border: #c3b9a6;
  --water: #1c68c9;
  --accent: #d9661f;
  --hit: #3f9b52;
  --near: #d9b23a;
  --far: #e0812f;
  --hard: #c2410c;
  --miss: #c9473d;
  --serif: 'Source Serif 4', Georgia, serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --col: 40rem;
  --gutter: clamp(1rem, 4vw, 1.5rem);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #10181e;
    --ink: #e6ecee;
    --ink-2: #9aa8ae;
    --line: #2b3840;
    --sea: #0f2633;
    --sea-ink: #6f97a6;
    --land: #1e2a31;
    --coast: #3e5865;
    --border: #45535a;
    --water: #4aa3ff;
    --accent: #f08a3e;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.5 var(--serif);
  -webkit-font-smoothing: antialiased;
}
a {
  color: inherit;
  text-underline-offset: 0.2em;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
[hidden] {
  display: none !important;
}

.hub,
.bar,
main,
.foot {
  width: 100%;
  max-width: calc(var(--col) + 2 * var(--gutter));
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}
.hub {
  padding-top: max(0.5rem, env(safe-area-inset-top));
  font: 500 0.75rem/1 var(--mono);
  letter-spacing: 0.04em;
}
.hub a {
  display: inline-block;
  padding: 0.4rem 0;
  color: var(--ink-2);
  text-decoration: none;
}
.hub a:hover {
  color: var(--ink);
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.25rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line);
}
.wordmark {
  font: 700 1.5rem/1 var(--serif);
  letter-spacing: -0.01em;
  text-decoration: none;
}
.wordmark::before {
  content: '';
  display: inline-block;
  width: 0.55em;
  height: 0.75em;
  margin-right: 0.3em;
  background: var(--water);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  clip-path: polygon(50% 0, 100% 55%, 100% 100%, 0 100%, 0 55%);
  vertical-align: -0.05em;
}
.bar-actions {
  display: flex;
  gap: 0.25rem;
}
.icon-btn {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  height: 44px;
  padding: 0 0.5rem;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--ink);
  font: 500 0.8rem/1 var(--mono);
  cursor: pointer;
}
.icon-btn:hover {
  background: color-mix(in srgb, var(--ink) 7%, transparent);
}
.icon-btn svg {
  width: 22px;
  height: 22px;
}

.meta {
  margin: 1rem 0 0.25rem;
  font: 500 0.75rem/1.2 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.question {
  margin: 0;
  font: 400 1.6rem/1.2 var(--serif);
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.question strong {
  font-weight: 700;
}
.ask {
  margin: 0.25rem 0 0.75rem;
  font-style: italic;
  color: var(--ink-2);
}

.map {
  position: relative;
  margin: 0 calc(-1 * var(--gutter));
  /* Sized so the map and the Guess row below it fit on the screen together: on a phone the map
     takes every touch (to pan), so anything under it is hard to scroll to. app.js sets the two
     offsets; 100svh is the screen with the browser's bars showing. */
  height: clamp(15rem, calc(100svh - var(--map-top, 12rem) - var(--below-map, 5rem)), 34rem);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--sea);
}
@media (min-width: 42rem) {
  .map {
    margin: 0;
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
  }
}
.map canvas {
  display: block;
  outline-offset: -3px;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}
.zoom {
  position: absolute;
  right: 0.5rem;
  top: 0.5rem;
  display: grid;
  gap: 0.25rem;
}
.zoom button {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font: 500 1.1rem/1 var(--mono);
  cursor: pointer;
}

.pick {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
}
.pick-label {
  flex: 1;
  margin: 0;
  min-height: 2.6rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  line-height: 1.25;
}
.pick-label small {
  font: 400 0.75rem/1.3 var(--mono);
  color: var(--ink-2);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 1.1rem;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: var(--ink);
  color: var(--paper);
  font: 500 0.85rem/1 var(--mono);
  letter-spacing: 0.02em;
  cursor: pointer;
  text-decoration: none;
}
.btn:disabled {
  opacity: 0.35;
  cursor: default;
}
.btn.quiet {
  background: none;
  color: var(--ink);
  border-color: var(--line);
}
.btn svg {
  width: 1.05rem;
  height: 1.05rem;
  margin-right: 0.45rem;
}
.tries {
  margin: 0.4rem 0 0;
  font: 400 0.75rem/1.3 var(--mono);
  color: var(--ink-2);
}

.guesses {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
}
.guesses li {
  display: grid;
  grid-template-columns: 1.25rem 1fr auto;
  gap: 0.6rem;
  align-items: baseline;
  padding: 0.5rem 0;
  border-top: 1px solid var(--line);
}
.tile {
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 3px;
  align-self: center;
}
.tile.hit {
  background: var(--hit);
}
.tile.near {
  background: var(--near);
}
.tile.far {
  background: var(--far);
}
.tile.miss {
  background: var(--miss);
}
.guesses .far {
  font: 400 0.8rem/1.3 var(--mono);
  color: var(--ink-2);
  white-space: nowrap;
}
.clue {
  margin: 0.5rem 0 0;
  padding: 0.6rem 0.75rem;
  border-left: 3px solid var(--water);
  background: color-mix(in srgb, var(--water) 8%, transparent);
}

.result {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}
.result h2 {
  margin: 0;
  font: 700 1.5rem/1.2 var(--serif);
}
.story {
  margin: 0.5rem 0 0.25rem;
  font-size: 1.15rem;
  text-wrap: pretty;
}
.story strong {
  color: var(--water);
}
.km {
  margin: 0 0 1rem;
  font: 400 0.8rem/1.4 var(--mono);
  color: var(--ink-2);
}
.share-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.5rem;
}
.copied {
  min-height: 1.2rem;
  margin: 0.4rem 0 0;
  font: 400 0.75rem/1.2 var(--mono);
  color: var(--ink-2);
}
.next {
  margin: 0.75rem 0 0;
  font: 400 0.8rem/1.4 var(--mono);
  color: var(--ink-2);
}
.status {
  margin: 0.75rem 0 0;
  min-height: 1.2rem;
  color: var(--ink-2);
}

.foot {
  padding-top: 2rem;
  padding-bottom: max(2rem, env(safe-area-inset-bottom));
  font: 400 0.75rem/1.6 var(--mono);
  color: var(--ink-2);
}
.foot p {
  margin: 0;
}

.sheet {
  width: min(30rem, calc(100vw - 2rem));
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink);
}
.sheet::backdrop {
  background: rgb(0 0 0 / 0.4);
}
.sheet-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.sheet h2 {
  margin: 0;
  font: 700 1.3rem/1.2 var(--serif);
}
.rules {
  padding-left: 1.2rem;
}
.rules li {
  margin: 0.4rem 0;
}
.fine {
  font: 400 0.75rem/1.5 var(--mono);
  color: var(--ink-2);
}
.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin: 1rem 0;
  text-align: center;
}
.stat-row dd {
  margin: 0;
  font: 700 1.6rem/1 var(--serif);
}
.stat-row dt {
  order: 2;
  font: 400 0.7rem/1.3 var(--mono);
  color: var(--ink-2);
}
.stat-row div {
  display: flex;
  flex-direction: column-reverse;
  gap: 0.3rem;
}
.dist {
  list-style: none;
  margin: 0;
  padding: 0;
}
.dist li {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  gap: 0.5rem;
  align-items: center;
  margin: 0.3rem 0;
  font: 400 0.75rem/1 var(--mono);
}
.bar-fill {
  height: 1.1rem;
  min-width: 1.4rem;
  padding: 0.15rem 0.35rem;
  border-radius: 3px;
  background: var(--line);
  text-align: right;
}
.bar-fill.mine {
  background: var(--water);
  color: #fff;
}
.prose {
  max-width: var(--col);
}
.prose h1 {
  font: 700 2rem/1.15 var(--serif);
  margin: 1.25rem 0 0.5rem;
}
.prose h2 {
  font: 700 1.2rem/1.3 var(--serif);
  margin: 1.5rem 0 0.25rem;
}

/* The tip line: a plain link to Buy Me a Coffee (no widget, so no third-party script). */
.coffee {
  margin: 1rem 0 0;
  font-size: 0.8125rem;
  color: var(--ink-2);
}
.coffee a {
  color: inherit;
}

/* Hard mode: a two-way switch above the first pin, and a badge by the name while it's on. */
.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.badge {
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: var(--hard);
  color: #fff;
  font: 600 0.72rem/1.2 var(--mono);
  letter-spacing: 0.02em;
}
.mode {
  margin-bottom: 0.75rem;
}
.switch {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 4%, transparent);
}
.switch button {
  min-width: 6.5rem;
  min-height: 36px;
  padding: 0 0.9rem;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--ink-2);
  font: 500 0.82rem/1 var(--mono);
  cursor: pointer;
}
.switch button[aria-checked='true'] {
  background: var(--ink);
  color: var(--paper);
}
.switch button[data-mode='hard'][aria-checked='true'] {
  background: var(--hard);
  color: #fff;
}
.switch button:disabled {
  cursor: default;
}
.switch button:disabled:not([aria-checked='true']) {
  opacity: 0.45;
}
.mode-note {
  margin: 0.35rem 0 0;
  font: 400 0.75rem/1.4 var(--mono);
  color: var(--ink-2);
}
.help-sub {
  margin: 1rem 0 0.25rem;
  font: 700 1rem/1.3 var(--serif);
}
.help-hard {
  margin: 0 0 1rem;
}
.hard-stats {
  margin: 1rem 0 0;
  font: 400 0.8rem/1.4 var(--mono);
}
