/* Windows draws flag emoji as two letters ("ES"). This font fills in only the
   flag code points, so everything else keeps using the normal fonts. */
@font-face {
  font-family: 'Twemoji Country Flags';
  unicode-range: U+1F1E6-1F1FF, U+1F3F4, U+E0062-E0063, U+E0065, U+E0067, U+E006C, U+E006E, U+E0073-E0074, U+E0077, U+E007F;
  src: url('https://cdn.jsdelivr.net/npm/country-flag-emoji-polyfill@0.1/dist/TwemojiCountryFlags.woff2') format('woff2');
  font-display: swap;
}

/* ====================================================================
   Ana — "papel y mandarina"
   Paper background, navy ink. Two accents with one job each:
     blue   = where you are and what you have picked
     orange = the one thing to press on each screen (and the dot of Ana.)
   Everything else (calendar dots, flags, pills) stays soft.
   ==================================================================== */

:root {
  --paper: #fbf7f0;
  --card: #ffffff;
  --sand: #efe8dc;
  --line: #e4dccd;
  --line-strong: #d3c8b5;

  --ink: #1f2a44;
  --ink-2: #4a5670;
  --ink-3: #7a8499;

  --blue: #2e57b8;
  --blue-soft: #e7eefb;
  --blue-ink: #2b4c9b;

  --orange: #e8833a;
  --orange-press: #c2652f;
  --orange-soft: #fce9dc;
  --orange-ink: #9a4a1e;

  --mint: #7fb8a4;
  --mint-soft: #e4f3ec;
  --mint-ink: #24694e;

  --rose: #d96c82;
  --rose-soft: #fce4e4;
  --rose-ink: #b0475a;

  --gold-soft: #fff1cc;
  --gold-ink: #6e5208;

  --shell: 900px;
  --r: 18px;
  --r-sm: 12px;
  --gap: clamp(1.75rem, 5vw, 3rem);

  --f-display: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --f-body: 'Twemoji Country Flags', 'Nunito', system-ui, -apple-system, sans-serif;

  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--f-display);
  font-variation-settings: 'SOFT' 100, 'WONK' 1, 'opsz' 60;
  font-weight: 600;
  line-height: 1.08;
  margin: 0;
  color: var(--ink);
}

a { color: var(--blue); text-decoration-thickness: 2px; text-underline-offset: 3px; }

:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; border-radius: 6px; }

.shell { max-width: var(--shell); margin: 0 auto; padding: 0 clamp(1rem, 4vw, 2rem); }

.eyebrow { font-size: 0.92rem; font-weight: 800; color: var(--orange-press); margin: 0; }

.muted { color: var(--ink-3); }
.hidden { display: none !important; }

/* ---------------------------------------------------------- top bar */

.topbar { display: flex; align-items: center; justify-content: flex-end; gap: 1rem; padding: 1.1rem 0; }

.langs { display: flex; gap: 4px; }
.langs button {
  background: none;
  border: 1px solid transparent;
  color: var(--ink-2);
  font-family: var(--f-body);
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 0.3rem 0.7rem;
  cursor: pointer;
  border-radius: 999px;
}
.langs button:hover { border-color: var(--line-strong); }
.langs button[aria-pressed='true'] { background: var(--ink); color: var(--paper); }

/* ------------------------------------------------------------- hero */

.hero { padding: clamp(1.5rem, 6vw, 3rem) 0 clamp(1.25rem, 3vw, 2rem); }

.hero h1 {
  font-size: clamp(4.5rem, 22vw, 11.5rem);
  font-variation-settings: 'SOFT' 100, 'WONK' 1, 'opsz' 144;
  letter-spacing: -0.02em;
  line-height: 0.85;
  margin: 0.5rem 0 0;
}
.hero h1 .dot { color: var(--orange); }

.hero .tagline {
  font-family: var(--f-display);
  font-variation-settings: 'SOFT' 100, 'WONK' 1;
  font-size: clamp(1.15rem, 3.4vw, 1.6rem);
  color: var(--ink-2);
  max-width: 30ch;
  margin: 1.2rem 0 0;
}

.counters { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.8rem; }

.counter {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  border-radius: 999px;
  padding: 0.5rem 1.15rem 0.55rem;
  background: var(--blue-soft);
  color: var(--blue-ink);
}
.counter:nth-child(2) { background: var(--orange-soft); color: var(--orange-ink); }
.counter:nth-child(3) { background: var(--mint-soft); color: var(--mint-ink); }
.counter b { font-family: var(--f-display); font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.counter span { font-size: 0.85rem; font-weight: 700; }

/* ---------------------------------------------- the curve, in the hero */

.trend { margin-top: 1.6rem; max-width: 640px; }
.trend-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.2rem 1rem; margin-bottom: 0.35rem; }
.trend-k { font-size: 0.85rem; font-weight: 800; color: var(--ink-3); }
.trend-peak { font-size: 0.85rem; font-weight: 700; color: var(--ink-2); }
.trend-plot { position: relative; padding-bottom: 1.3rem; }
.trend-plot svg { display: block; width: 100%; height: 72px; overflow: visible; }
.trend-area { fill: var(--blue-soft); }
.trend-line { fill: none; stroke: var(--blue); stroke-opacity: 0.55; stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.trend-due { stroke: var(--rose); stroke-width: 1.5; stroke-dasharray: 3 4; vector-effect: non-scaling-stroke; }
.trend-labels { position: absolute; left: 0; right: 0; bottom: 0; height: 1.2rem; border-top: 1px solid var(--line); }
.trend-month, .trend-due-label {
  position: absolute;
  top: 0.15rem;
  transform: translateX(-50%);
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--ink-3);
  white-space: nowrap;
  text-transform: capitalize;
}
.trend-month { transform: none; border-left: 1px solid var(--line-strong); padding-left: 0.3rem; }
.trend-due-label { color: var(--rose-ink); }

/* ------------------------------------------- votes per country, hero */

.countries { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 0.9rem; margin-top: 1rem; }
.countries-k { font-size: 0.85rem; font-weight: 800; color: var(--ink-3); }
.country-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.country-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.25rem 0.75rem 0.25rem 0.55rem;
  animation: pop 0.4s cubic-bezier(0.34, 1.6, 0.5, 1) backwards;
}
.country-chip .flag { font-size: 1.2rem; line-height: 1; }
.country-chip b { font-family: var(--f-display); font-size: 1rem; font-weight: 700; color: var(--ink); }

/* ------------------------------------------------------------- tabs */

.tabs {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0.7rem 0;
  margin-bottom: 0.4rem;
}
.tabs::before {
  content: '';
  position: absolute;
  inset: 0 -50vw;
  background: rgba(251, 247, 240, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  opacity: 0;
  transition: opacity 0.22s ease;
  pointer-events: none;
  z-index: -1;
}
.tabs.is-stuck::before { opacity: 1; }
#tabs-sentinel { height: 1px; margin-bottom: -1px; }

.tab {
  flex: 1 1 8rem;
  background: var(--sand);
  border: 0;
  border-radius: 999px;
  color: var(--ink-2);
  font-family: var(--f-body);
  font-size: 0.98rem;
  font-weight: 800;
  padding: 0.7rem 1rem;
  cursor: pointer;
  transition: background 0.15s ease;
}
.tab:hover { background: #e6ddcd; }
.tab[aria-selected='true'] { background: var(--blue); color: #fff; }

.panel { animation: fade 0.24s ease; }
.panel > .section:first-child { padding-top: 1.5rem; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }

/* ---------------------------------------------------------- section */

.section { padding: var(--gap) 0; }
.section > h2 { font-size: clamp(1.8rem, 5vw, 2.5rem); margin-bottom: 0.35rem; }
.section > .lede { color: var(--ink-2); max-width: 54ch; margin: 0 0 1.8rem; font-weight: 600; }

/* ------------------------------------------------------------ steps */

.steps { list-style: none; counter-reset: s; margin: 1.6rem 0 0; padding: 0; display: grid; gap: 0.7rem; }
.step {
  counter-increment: s;
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 1rem;
  row-gap: 0.15rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 1rem 1.3rem;
}
.step::before {
  content: counter(s);
  grid-row: 1 / 3;
  align-self: center;
  font-family: var(--f-display);
  font-size: 2.1rem;
  font-weight: 700;
  color: var(--blue);
  line-height: 1;
  min-width: 1.4ch;
}
.step b { font-family: var(--f-display); font-size: 1.2rem; font-weight: 600; }
.step span { font-size: 0.95rem; font-weight: 600; color: var(--ink-2); }

/* ---------------------------------------- signature: the day ladder */

.cal-wrap {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.5rem 0;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
  -webkit-overflow-scrolling: touch;
}
.cal-inner { display: inline-flex; flex-direction: column; gap: 6px; min-width: max-content; }
.cal-months { display: flex; gap: 3px; padding: 0 1px; }
.cal-month {
  flex: 0 0 auto;
  border-left: 2px solid var(--line-strong);
  min-height: 1.6rem;
}
.cal-month-label {
  position: sticky;
  left: 0;
  display: inline-block;
  padding: 0.1rem 0.6rem 0.1rem 0.45rem;
  background: var(--paper);
  font-family: var(--f-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
  text-transform: capitalize;
  white-space: nowrap;
}
.cal-track { display: flex; align-items: flex-end; gap: 3px; padding: 0 1px; }

.cal-day {
  flex: 0 0 auto;
  width: 34px;
  background: none;
  border: 0;
  border-radius: var(--r-sm);
  padding: 0.4rem 0 0.45rem;
  color: inherit;
  font: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 2px;
  transition: background 0.16s ease, transform 0.16s ease;
}
.cal-day:hover { background: var(--sand); transform: translateY(-2px); }
.cal-day.is-first { box-shadow: inset 2px 0 0 var(--line-strong); }
.cal-day.is-due { background: var(--rose-soft); }
.cal-day.is-due .cal-num { color: var(--rose-ink); font-weight: 900; }

.cal-stack {
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 4px;
  min-height: 104px;
  width: 100%;
}
.cal-dot { width: 10px; height: 10px; border-radius: 50%; animation: pop 0.42s cubic-bezier(0.34, 1.6, 0.5, 1) backwards; }
.cal-dot.c0 { background: var(--mint); }
.cal-dot.c1 { background: #f0a77a; }
.cal-dot.c2 { background: #8fa9dd; }
.cal-dot.c3 { background: #e59aa8; }
.cal-more { font-size: 0.62rem; font-weight: 800; color: var(--ink-2); }
@keyframes pop { from { transform: scale(0.2) translateY(8px); opacity: 0; } }

.cal-num { font-family: var(--f-display); font-size: 0.92rem; font-weight: 700; font-variant-numeric: tabular-nums; padding-top: 0.3rem; }
.cal-dow { font-size: 0.58rem; font-weight: 800; text-transform: uppercase; color: var(--ink-3); }

.cal-day[aria-pressed='true'] { background: var(--blue); color: #fff; }
.cal-day[aria-pressed='true'] .cal-num, .cal-day[aria-pressed='true'] .cal-dow { color: #fff; }
.cal-day[aria-pressed='true'] .cal-dot { background: rgba(255, 255, 255, 0.85); }

.cal-day.is-actual { background: var(--orange); color: #fff; }
.cal-day.is-actual .cal-num, .cal-day.is-actual .cal-dow { color: #fff; }
.cal-day.is-actual .cal-dot { background: rgba(255, 255, 255, 0.85); }

.cal-legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1.4rem; margin-top: 1rem; font-size: 0.82rem; font-weight: 700; color: var(--ink-3); }
.cal-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 0.5rem; }
.key-guess { background: var(--mint); }
.key-yours { background: var(--blue); }
.key-due { background: var(--rose); }

/* ------------------------------------------------ chosen day / email */

.chosen {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem 0.9rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 0.85rem 1.2rem;
  margin-bottom: 1.8rem;
}
.chosen-k { font-size: 0.85rem; font-weight: 800; color: var(--ink-3); }
.chosen-v {
  font-family: var(--f-display);
  font-variation-settings: 'SOFT' 100, 'WONK' 1;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--blue);
  text-transform: capitalize;
  margin-right: auto;
}
.chosen.is-empty .chosen-v { color: var(--ink-3); font-style: italic; }
.chosen-btn {
  background: none;
  border: 0;
  color: var(--blue);
  font-family: var(--f-body);
  font-size: 0.88rem;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  padding: 0.2rem 0;
}
.chosen-btn:hover { color: var(--blue-ink); }
.chosen.is-mail { margin-bottom: 0.9rem; padding-top: 0.7rem; padding-bottom: 0.7rem; }
.chosen.is-mail .chosen-v { font-family: var(--f-body); font-size: 1rem; color: var(--ink); text-transform: none; }

/* ------------------------------------------------------- email gate */

.card.gate h2 { font-size: clamp(1.5rem, 4vw, 2rem); margin-bottom: 0.3rem; }
.card.gate .lede { color: var(--ink-2); font-weight: 600; margin: 0; max-width: 48ch; }
.card.gate .linkbox { margin: 1.2rem 0 0; }
.card.gate .linkbox input { flex: 1 1 240px; font-size: 1.05rem; }
.gate-privacy { font-size: 0.86rem; font-weight: 600; color: var(--ink-3); margin: 1rem 0 0; max-width: 50ch; }
details.lookup { margin-top: 1.4rem; padding-top: 1rem; border-top: 1px solid var(--line); }
details.lookup > summary {
  cursor: pointer;
  list-style: none;
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--blue);
  text-decoration: underline;
  text-underline-offset: 3px;
}
details.lookup > summary::-webkit-details-marker { display: none; }
details.lookup .linkbox { margin: 0.8rem 0 0; }
.gate-grid { margin-top: 1.4rem; }
.err-line { color: var(--rose-ink); font-size: 0.88rem; font-weight: 700; margin: 0.7rem 0 0; }

/* ------------------------------------------------------------- form */

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.5rem 1.6rem; }
.field { display: flex; flex-direction: column; gap: 0.42rem; }
.field.wide { grid-column: 1 / -1; }
.field > label { font-size: 1rem; font-weight: 800; color: var(--ink); }
.field .help { font-size: 0.82rem; color: var(--ink-3); font-weight: 600; }

input[type='text'], input[type='email'], input[type='number'], input[type='time'], textarea, select {
  width: 100%;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 1rem;
  font-weight: 600;
  padding: 0.7rem 0.85rem;
  transition: border-color 0.15s ease;
}
input::placeholder, textarea::placeholder { color: var(--ink-3); opacity: 0.8; }
input:hover, textarea:hover, select:hover { border-color: var(--line-strong); }
input:focus, textarea:focus, select:focus { border-color: var(--blue); outline: none; }
input[type='time'] { width: auto; min-width: 9rem; font-variant-numeric: tabular-nums; }
textarea { resize: vertical; min-height: 120px; line-height: 1.55; }


.slider-row { display: flex; align-items: baseline; gap: 0.9rem; }
.slider-val {
  font-family: var(--f-display);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--blue);
  font-variant-numeric: tabular-nums;
  min-width: 5ch;
}
.slider-val small { font-size: 0.8rem; color: var(--ink-3); margin-left: 0.15rem; }

input[type='range'] { -webkit-appearance: none; appearance: none; width: 100%; height: 26px; background: transparent; cursor: pointer; }
input[type='range']::-webkit-slider-runnable-track { height: 8px; background: var(--sand); border-radius: 999px; }
input[type='range']::-moz-range-track { height: 8px; background: var(--sand); border-radius: 999px; }
input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px; height: 24px; margin-top: -8px;
  border-radius: 50%; background: var(--blue); border: 3px solid #fff;
  box-shadow: 0 1px 3px rgba(31, 42, 68, 0.3);
}
input[type='range']::-moz-range-thumb {
  width: 24px; height: 24px; border: 3px solid #fff; border-radius: 50%; background: var(--blue);
  box-shadow: 0 1px 3px rgba(31, 42, 68, 0.3);
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button {
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  color: var(--ink-2);
  font-family: var(--f-body);
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.4rem 1.05rem;
  cursor: pointer;
  transition: border-color 0.14s ease, background 0.14s ease;
}
.chips button:hover { border-color: var(--line-strong); }
.chips button[aria-pressed='true'] { background: var(--blue); border-color: var(--blue); color: #fff; }

details.extras {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  margin-top: 1.5rem;
  padding: 1.1rem 1.2rem;
}
details.extras > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  font-family: var(--f-display);
  font-variation-settings: 'SOFT' 100, 'WONK' 1;
  font-size: 1.35rem;
  font-weight: 600;
}
details.extras > summary::-webkit-details-marker { display: none; }
details.extras > summary::before { content: '+'; color: var(--blue); font-family: var(--f-body); font-weight: 900; font-size: 1.3rem; }
details.extras[open] > summary::before { content: '\2013'; }
details.extras > summary em { font-family: var(--f-body); font-style: normal; font-size: 0.82rem; font-weight: 700; color: var(--ink-3); }
details.extras .grid { margin-top: 1.4rem; }

.final-note { margin: 2rem 0 0; font-size: 0.92rem; font-weight: 800; color: var(--orange-ink); }

/* ---------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--orange);
  color: #fff;
  border: 0;
  border-radius: 999px;
  font-family: var(--f-body);
  font-size: 1.05rem;
  font-weight: 900;
  padding: 0.85rem 1.9rem;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 4px 0 var(--orange-press);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--orange-press); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--orange-press); }
.btn[disabled] { opacity: 0.55; cursor: default; transform: none; }

.btn.ghost { background: var(--card); color: var(--ink); border: 1.5px solid var(--line-strong); box-shadow: none; font-weight: 800; }
.btn.ghost:hover { border-color: var(--ink-3); box-shadow: none; }
.btn.ghost:active { transform: translateY(1px); }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; margin-top: 2.2rem; }

/* ------------------------------------------------------------ cards */

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: clamp(1.3rem, 4vw, 2.1rem); }

.card.accent { background: var(--blue-soft); border-color: #cddcf6; }
.card.accent h2 { color: var(--blue-ink); }
.card.accent .lede { color: var(--ink-2); }
.card.accent .eyebrow { color: var(--blue-ink); }

.card.gift h2 { font-size: clamp(1.7rem, 4.5vw, 2.3rem); }
.card.gift .gift-lede {
  font-family: var(--f-display);
  font-variation-settings: 'SOFT' 100, 'WONK' 1;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0.5rem 0 0.8rem;
}
.card.gift .gift-body { color: var(--ink-2); font-weight: 600; max-width: 56ch; margin: 0; }

.card.thanks { background: var(--mint-soft); border-color: #c9e6d9; }
.card.thanks h2 { color: var(--mint-ink); font-size: clamp(1.7rem, 5vw, 2.4rem); }
.card.thanks .thanks-body { color: var(--ink); font-weight: 700; font-size: 1.05rem; margin: 0.6rem 0 0.9rem; max-width: 54ch; }
.thanks-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.8rem 1.4rem; margin-top: 0.4rem; }
.card.thanks .chosen-btn { color: var(--mint-ink); }

.mine { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.9rem; margin-top: 1.2rem; }
.mine-k { font-size: 0.85rem; font-weight: 800; color: var(--ink-3); }

.linkbox { display: flex; gap: 0.6rem; margin: 1.2rem 0 0.7rem; flex-wrap: wrap; }
.linkbox input { flex: 1 1 260px; }

.summary-list { margin: 1.5rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 1rem; }
.summary-list .k { font-size: 0.78rem; font-weight: 800; color: var(--ink-3); }
.summary-list .v { font-family: var(--f-display); font-size: 1.35rem; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; margin-top: 0.1rem; }

/* ------------------------------------------------------------ rules */

.rules { display: grid; gap: 0.5rem; margin-top: 1.2rem; }
.rule {
  display: grid;
  grid-template-columns: minmax(96px, 22%) 1fr;
  gap: 1rem;
  padding: 0.7rem 1rem;
  border-radius: var(--r-sm);
  background: var(--card);
  border: 1px solid var(--line);
  align-items: baseline;
}
.rule b { font-size: 1rem; font-weight: 900; color: var(--blue-ink); }
.rule span { font-size: 0.92rem; color: var(--ink-2); font-weight: 600; }

/* ---------------------------------------------------------- ranking */

.rank { list-style: none; margin: 1.5rem 0 0; padding: 0; display: grid; gap: 0.5rem; }
.rank li {
  display: grid;
  grid-template-columns: 2.4rem 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 0.85rem 1rem;
  border-radius: var(--r-sm);
  background: var(--card);
  border: 1px solid var(--line);
}
.rank li:first-child { background: var(--gold-soft); border-color: #f2dc9c; }
.rank .pos { font-family: var(--f-display); font-size: 1.3rem; font-weight: 700; color: var(--ink-3); }
.rank li:first-child .pos { color: var(--gold-ink); }
.rank .who { font-family: var(--f-display); font-size: 1.2rem; font-weight: 600; }
.rank .who small { display: block; font-family: var(--f-body); font-size: 0.78rem; font-weight: 600; color: var(--ink-3); }
.rank .pts { font-family: var(--f-display); font-size: 1.35rem; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.rank li.is-you { outline: 2.5px solid var(--blue); outline-offset: -1px; }

.flag { font-family: 'Twemoji Country Flags', 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif; font-style: normal; }
.rank .pos.flag { font-size: 1.6rem; line-height: 1; }
.who-name .flag { margin-right: 0.15rem; }

#view-closed > .section:first-child { padding-top: 1.5rem; }
.board-h { margin: 2.5rem 0 0; font-size: 1.5rem; }
.rank.board li:first-child { background: var(--card); border-color: var(--line); }
.rank.board .pts { font-size: 1.05rem; text-transform: capitalize; color: var(--blue-ink); }

/* ----------------------------------------------------------- notice */

.notice { background: var(--sand); border-radius: var(--r-sm); padding: 0.8rem 1rem; margin: 1.2rem 0; font-size: 0.92rem; font-weight: 600; color: var(--ink-2); }
.notice.bad { background: var(--rose-soft); color: var(--rose-ink); }
.notice.good { background: var(--mint-soft); color: var(--mint-ink); }

.banner { background: var(--orange-soft); color: var(--orange-ink); font-size: 0.82rem; font-weight: 800; text-align: center; padding: 0.55rem 1rem; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%) translateY(150%);
  background: var(--ink);
  color: #fff;
  font-weight: 800;
  font-size: 0.95rem;
  padding: 0.75rem 1.4rem;
  border-radius: 999px;
  box-shadow: 0 6px 20px rgba(31, 42, 68, 0.25);
  transition: transform 0.3s cubic-bezier(0.34, 1.5, 0.5, 1);
  z-index: 50;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ------------------------------------------------------------ admin */

.admin { margin-top: 2rem; background: var(--card); border: 1.5px solid var(--rose); border-radius: var(--r); padding: 1.5rem; }
.admin h2 { color: var(--rose-ink); }
.admin table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.admin th, .admin td { text-align: left; padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.admin th { color: var(--ink-3); font-size: 0.7rem; text-transform: uppercase; }
.admin .scroll { overflow-x: auto; margin-top: 1rem; }
.admin-editor { margin-top: 1.2rem; border-color: var(--blue); }
.admin-editor h3 { font-size: 1.1rem; margin-bottom: 1rem; }

/* ----------------------------------------------------------- footer */

.foot { margin-top: 2.5rem; padding: 2rem 0 3rem; font-size: 0.82rem; font-weight: 700; color: var(--ink-3); display: flex; justify-content: flex-end; }
.foot a { color: var(--line-strong); text-decoration: none; }
.foot a:hover { color: var(--ink-3); }

/* ------------------------------------------------------------ small */

@media (max-width: 520px) {
  body { font-size: 16px; }
  .rank li { grid-template-columns: 1.9rem 1fr auto; gap: 0.7rem; padding: 0.75rem 0.8rem; }
  .counter { padding: 0.42rem 0.95rem 0.48rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
