:root { --ui: 1; } /* plate scale, set from the window size by worldmap.js */

/* Landing plate: a question, a world drawn in population dots, and the rules
 * of the round set out like a specification sheet. */

.startScreen {
  position: fixed;
  inset: 0;
  z-index: 800;
  overflow-y: auto;
  overflow-x: hidden;
  overflow-x: clip; /* the dot-world bleeds past the gutter on purpose; it must never scroll sideways */
  background: var(--paper);
  opacity: 1;
  transition: opacity var(--dur) var(--ease-std);
}

.startScreen.fadeOut { opacity: 0; }
.startScreen.hidden { display: none; }

/* A faint survey grid behind everything, like ruled map paper */
.startScreen::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--rule) 1px, transparent 1px),
    linear-gradient(90deg, var(--rule) 1px, transparent 1px);
  background-size: calc(96px * var(--ui)) calc(96px * var(--ui));
  background-position: -1px -1px;
  opacity: 0.45;
}

.startPlate {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  grid-template-areas:
    "top top"
    "hero world"
    "card card"
    "foot foot";
  column-gap: var(--s6);
  row-gap: var(--s5);
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  max-width: calc(1480px * var(--ui));
  min-height: 100%;
  margin: 0 auto;
  padding: var(--s4) clamp(20px, 4vw, calc(64px * var(--ui))) var(--s4);
}

.startTop {
  grid-area: top;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
}

.startLogo {
  --gp-width: calc(190px * var(--ui));
  opacity: 0;
  transition: opacity 0.5s ease;
}

.startLogo.gp-visible { opacity: 1; }

/* ---- the daily streak: a globe with a degree of arc per day ---- */

/* in the plate's top row, just before the controls (and beside the logo on a phone) */
.streakGlobe { position: relative; display: inline-flex; margin-left: auto; }
@media (min-width: 641px) { .streakGlobe:not(.hidden) + .startTopControls { margin-left: 0; } }

.streakGlobeBtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px 3px 4px;
  border-radius: var(--radius);
  transition: background var(--dur-fast) var(--ease-std);
}
.streakGlobeBtn:hover { background: rgba(23, 33, 58, 0.06); }

.streakGlobeIcon { display: block; overflow: visible; }
.sgSea { fill: var(--sheet); stroke: var(--ink); stroke-width: 1.4; }
.sgLine { fill: none; stroke: var(--ink); stroke-opacity: 0.45; stroke-width: 1; }
.sgTrack { fill: none; stroke: var(--rule); stroke-width: 2; }
.sgArc {
  fill: none;
  stroke: var(--terra-deep);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 0 360;
  transition: stroke-dasharray 0.6s var(--ease), stroke-opacity var(--dur) var(--ease-std);
}
/* today's degree is still to be earned: the arc waits, paler */
.streakGlobe.isPending .sgArc { stroke-opacity: 0.55; }

.streakGlobeNum {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: lining-nums tabular-nums;
}

/* the explanation, on hover or keyboard focus: a small sheet under the globe */
.streakTip {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 260px;
  padding: 12px 14px;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--ink-2);
  text-align: left;
  background: var(--sheet);
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: 4px 4px 0 rgba(23, 33, 58, 0.16);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transform-origin: top right;
  transition: opacity var(--dur-fast) var(--ease-std), transform var(--dur-fast) var(--ease-std), visibility 0s linear var(--dur-fast);
  pointer-events: none;
}
.streakGlobe:hover .streakTip,
.streakGlobeBtn:focus-visible + .streakTip {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition-delay: 0s;
}
.streakTipTitle { font-family: var(--font-display); font-size: 16px; font-weight: 700; color: var(--ink); }
.streakTipState { font-weight: 650; color: var(--terra-ink); }
.streakTipState.isDone { color: var(--moss-ink); }
.streakTipBest { color: var(--ink-3); }

/* touch: no hover, a tap opens the daily challenge instead */
@media (hover: none) { .streakTip { display: none; } }

.startTopControls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: calc(10px * var(--ui));
}

/* ---- the question ---- */

/* above the map's feathered paper patch, which reaches up into it on narrow screens */
.startHero { grid-area: hero; align-self: center; position: relative; z-index: 1; }

.startHeadline {
  max-width: 13ch;
  margin: 0;
  font-family: var(--font-display);
  font-size: calc(80px * var(--ui));
  font-weight: 700;
  line-height: 0.98;
  letter-spacing: -0.035em;
  color: var(--ink);
  text-wrap: balance;
}

.textLink {
  display: inline-block;
  margin-top: var(--s3);
  padding: 2px 0;
  font-size: calc(14.5px * var(--ui));
  font-weight: 650;
  color: var(--ink);
  border-bottom: 1.5px solid var(--terra-deep);
  transition: color var(--dur-fast) var(--ease-std);
}

.textLink:hover { color: var(--terra-ink); }

.fieldHint {
  font-size: calc(12.5px * var(--ui));
  line-height: 1.3;
  color: var(--ink-3);
}

.startTagline {
  max-width: 46ch;
  margin: var(--s5) 0 0;
  font-size: calc(17px * var(--ui));
  line-height: 1.5;
  color: var(--ink-2);
}

/* ---- the world, in dots ---- */


.worldFig {
  grid-area: world;
  position: relative;
  align-self: center;
  margin: 0 calc(clamp(20px, 4vw, calc(64px * var(--ui))) * -0.5) 0 0;
  min-width: 0;
  isolation: isolate;
}

/* The map has its own graticule, so the page's survey grid must not show
   through it: a patch of plain paper sits under the map and runs past its edges,
   its rim feathered with a wide blur so it melts into the paper. */
.worldFig::before {
  content: "";
  position: absolute;
  inset: -14px -10px;
  z-index: -1;
  background: var(--paper);
  border-radius: 10px;
  box-shadow: 0 0 34px 26px var(--paper);
  pointer-events: none;
}

.worldDots { display: block; width: 100%; height: auto; aspect-ratio: 360 / 148; }


/* ---- the settings, laid out like a map's title block ---- */

.startCard {
  grid-area: card;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s5) var(--s6);
  padding-top: var(--s4);
  border-top: 1px solid var(--ink);
}

.startFields {
  flex: 1 1 calc(760px * var(--ui));
  display: grid;
  /* the counter and the two instruments size their own columns; the region row takes the rest */
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  column-gap: var(--s5);
}

/* Every field is a heading row and a body row. The rows are shared across the
   strip (subgrid), so a heading that wraps onto two lines in one language
   moves every control down together, and the controls start on one line. */
.fieldBlock {
  display: grid;
  grid-row: span 2;
  grid-template-rows: subgrid;
  row-gap: calc(10px * var(--ui));
  align-content: start;
  min-width: 0;
  padding-left: var(--s4);
  border-left: 1px solid var(--rule-strong);
}

.fieldHead {
  display: flex;
  flex-direction: column;
  gap: calc(3px * var(--ui));
  min-width: 0;
}

.fieldBody {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: calc(8px * var(--ui));
  min-width: 0;
}

.fieldRounds .fieldLabel { max-width: calc(170px * var(--ui)); }

.fieldBlock:first-child { padding-left: 0; border-left: 0; }

.fieldLabel {
  font-family: var(--font-display);
  font-style: italic;
  font-size: calc(16.5px * var(--ui));
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink-2);
}

/* region: the kind of place in the heading's tabs (like the radius's scale),
   and the place itself on one framed card - its silhouette and name - built
   like the raised plate of the selectors (lit top edge, contact shadow) and
   pressing in the same way. A tap opens the list. */
/* the tiles and the card share one cell; the one not in use is hidden but
   keeps its room, so the column's height never changes with the tab */
.regionPicker { display: grid; width: 100%; }
.regionLayer { grid-area: 1 / 1; min-width: 0; transition: opacity var(--dur-fast) var(--ease-std); }
.regionLayer.isOff { visibility: hidden; opacity: 0; }
.regionTiles { display: flex; flex-wrap: wrap; align-content: flex-start; gap: calc(4px * var(--ui)) 2px; }

/* "Continents": a row of them, drawn - one tap each */
.regionTile {
  display: inline-flex;
  align-items: center;
  gap: calc(6px * var(--ui));
  padding: calc(5px * var(--ui)) calc(9px * var(--ui)) calc(5px * var(--ui)) calc(6px * var(--ui));
  font-size: calc(13.5px * var(--ui));
  font-weight: 600;
  color: var(--ink-3);
  border-bottom: 2px solid transparent;
  transition: color var(--dur-fast) var(--ease-std), border-color var(--dur-fast) var(--ease-std),
    background var(--dur-fast) var(--ease-std);
}

.regionTile:hover { color: var(--ink); background: rgba(23, 33, 58, 0.05); }
.regionTile.active { color: var(--ink); border-color: var(--terra-deep); }

.regionTile .regionIcon { display: flex; width: calc(30px * var(--ui)); height: calc(22px * var(--ui)); }
.regionTile .regionIcon svg {
  display: block;
  width: 100%;
  height: 100%;
  color: var(--ink-4);
  transition: color var(--dur-fast) var(--ease-std);
}
.regionTile:hover .regionIcon svg { color: var(--ink-2); }
.regionTile.active .regionIcon svg { color: var(--terra-deep); }

/* "Countries": too many for tiles - one card for the chosen one, opening the list */
.regionCard {
  display: flex;
  align-items: center;
  gap: calc(12px * var(--ui));
  width: 100%;
  max-width: calc(280px * var(--ui));
  padding: calc(10px * var(--ui)) calc(12px * var(--ui)) calc(10px * var(--ui)) calc(10px * var(--ui));
  text-align: left;
  color: var(--ink);
  background: linear-gradient(180deg, #FAF9F4 0%, var(--sheet) 60%, #ECE9DF 100%);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 1px 2px rgba(23, 33, 58, 0.16);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: border-color var(--dur-fast) var(--ease-std), box-shadow 90ms var(--ease-std), transform 90ms var(--ease-std);
}
.regionCard:hover { border-color: var(--ink); }
.regionCard:active { transform: translateY(1px); box-shadow: inset 0 1px 2px rgba(23, 33, 58, 0.14); transition-duration: 25ms; }
.regionCard:focus-visible { outline: 2px solid var(--terra-deep); outline-offset: 2px; }
.regionCardIcon { flex: 0 0 auto; display: flex; width: calc(60px * var(--ui)); height: calc(46px * var(--ui)); }
.regionCardIcon svg { display: block; width: 100%; height: 100%; color: var(--terra-deep); }
.regionCardText { flex: 1 1 auto; display: flex; flex-direction: column; gap: calc(3px * var(--ui)); min-width: 0; }
.regionCardName {
  font-family: var(--font-display);
  font-size: calc(19px * var(--ui));
  font-weight: 700;
  line-height: 1.1;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.regionCardSub .testTag { margin-right: 2px; padding: 0 5px; font-size: calc(10px * var(--ui)); line-height: 1.4; vertical-align: 0.05em; }
.regionCardSub { font-size: calc(11.5px * var(--ui)); line-height: 1.3; color: var(--ink-3); }
.regionCardCaret { flex: 0 0 auto; width: calc(10px * var(--ui)); height: calc(6px * var(--ui)); color: var(--ink-3); }
}


/* "Test": the set of countries is a trial for now */
.testTag {
  display: inline-block;
  padding: 1px 6px 2px;
  font-family: var(--font-ui);
  font-size: calc(10.5px * var(--ui));
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: 0.4px;
  color: var(--terra-ink);
  background: var(--terra-soft);
  border: 1px dashed rgba(156, 74, 34, 0.45);
  border-radius: 2px;
  cursor: help;
  vertical-align: middle;
}

/* rounds, radius and timer: see instruments.css */

.startActions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--s3);
  flex: 0 0 auto;
  min-width: calc(240px * var(--ui));
}

.startBtnBig { padding: calc(15px * var(--ui)) calc(36px * var(--ui)); font-size: calc(17px * var(--ui)); }

.startDuelBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: calc(8px * var(--ui));
  padding: calc(8px * var(--ui)) 2px;
  font-size: calc(14.5px * var(--ui));
  font-weight: 650;
  color: var(--ink);
  border: 0;
  border-bottom: 1.5px solid var(--ink);
  border-radius: 0;
  background: transparent;
}

.startDuelBtn:hover { background: transparent; color: var(--terra-ink); border-color: var(--terra-ink); }
.startDuelBtn svg { flex-shrink: 0; }

/* the daily challenge: its status rides on the button - a streak still to
   keep today in the mark colour, a finished day quietly ticked */
.dailyChip {
  padding: 0 calc(6px * var(--ui));
  font-size: calc(12px * var(--ui));
  font-weight: 700;
  line-height: 1.6;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  border-radius: 2px;
}
.dailyChip.isAtRisk { color: var(--ink); background: var(--terra); }
.dailyChip.isDone { color: var(--moss-ink); background: var(--sunk); }

.duelResumeCount {
  min-width: calc(20px * var(--ui));
  padding: 0 calc(6px * var(--ui));
  font-size: calc(12px * var(--ui));
  font-weight: 700;
  text-align: center;
  color: var(--ink);
  background: var(--terra);
  border-radius: 2px;
}

.startFooter {
  grid-area: foot;
  padding-top: var(--s3);
  font-size: calc(12.5px * var(--ui));
  line-height: 1.6;
  color: var(--ink-3);
  border-top: 1px solid var(--rule);
}

.startFooter a {
  margin-left: calc(4px * var(--ui));
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--rule-strong);
  transition: color var(--dur-fast) var(--ease-std), border-color var(--dur-fast) var(--ease-std);
}

.startFooter a:hover { color: var(--terra-ink); border-color: var(--terra-ink); }
.startFooter .footerSep { margin: 0 calc(8px * var(--ui)); color: var(--ink-4); }

/* One orchestrated entrance, the first time the page loads */
.startScreen.intro .startHeadline,
.startScreen.intro .startTagline,
.startScreen.intro .startCard {
  animation: plateIn 0.8s var(--ease) both;
}
.startScreen.intro .startTagline { animation-delay: 0.12s; }
.startScreen.intro .startCard { animation-delay: 0.24s; }

@keyframes plateIn {
  from { opacity: 0; transform: translateY(calc(18px * var(--ui))); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---- narrower laptops: strip becomes two rows ---- */
@media (max-width: 1240px) {
  /* rounds and radius take what their instruments need; the timer column takes the rest */
  .startFields { grid-template-columns: auto auto minmax(0, 1fr); row-gap: var(--s5); }
  .fieldRegion { grid-column: 1 / -1; }
  .fieldRegion + .fieldBlock { padding-left: 0; border-left: 0; }
}

/* ---- tablet / phone: one column, the dot-world becomes a banner ---- */
@media (max-width: 999px) {
  .startPlate {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "top" "hero" "world" "card" "foot";
    row-gap: var(--s5);
  }
  .startHeadline { max-width: 14ch; font-size: clamp(40px, 11vw, 72px); }
  .worldFig { margin: 0 -8px; }
  .startActions { flex-direction: row; flex-wrap: wrap; align-items: center; min-width: 0; width: 100%; }
}

@media (max-width: 640px) {
  /* the controls drop under the logo rather than run off the right edge */
  .startTop { flex-wrap: wrap; row-gap: var(--s3); }
  .startLogo { --gp-width: 128px; }
  .startTopControls { gap: 6px; margin-left: auto; }
  .startTopControls .ghostBtn { padding: 5px 9px; font-size: 12.5px; }
  .startTopControls .userChipEmail { max-width: 96px; }

  /* rounds and timer share a row; the radius instrument needs the full width */
  .startFields { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); row-gap: var(--s5); }
  .fieldBlock,
  .fieldRegion + .fieldBlock { padding-left: 0; border-left: 0; }
  .fieldRounds { order: 1; padding-right: var(--s3); }
  .fieldTimer { order: 2; padding-left: var(--s3); border-left: 1px solid var(--rule-strong); }
  .fieldRadius { order: 3; grid-column: 1 / -1; padding-top: var(--s4); border-top: 1px solid var(--rule); }
  .radiusInstrument { width: 100%; }

  .startActions { flex-direction: column; align-items: stretch; }
  .startBtnBig { width: 100%; }
  .regionCard { max-width: none; }   /* a phone: the region card takes the whole row */
  .regionTile { padding-right: 7px; font-size: 13px; }
}

/* touch: region tiles and quick picks get fingertip-sized hit areas */
@media (pointer: coarse) {
  .regionTile { min-height: 40px; }
  .startDuelBtn { min-height: 44px; }
  .textLink { padding: 8px 0 4px; }
}

/* Legal links (credits, privacy, terms) at the end of the footer */
.startFooter .footerLegal { display: inline-flex; flex-wrap: wrap; gap: 0 calc(10px * var(--ui)); }
.startFooter .footerLegal a { margin-left: 0; }
