/* Science Lagoon Game Zone shell: a bright day at the lagoon beach. One
   deliberate daytime look; it stays light even when the device uses dark
   mode. Games keep their own styles in the iframe (src/embed/ holds the few
   overrides used inside the lagoon).
   Layout: an island map first, then beach-hut stations grouped by shore. */

:root {
  --sand: #fff8ea;
  --sand-2: #fcecc9;
  --foam: #ffffff;
  --line: #efd9ae;
  --ink: #133a42;
  --muted: #48676a;
  --lagoon: #12b5b8;
  --lagoon-deep: #057a80;
  --sea: #e8fbf8;
  --on-sea: #133a42;
  --sun: #ffc531;
  --sun-deep: #d18f00;
  --on-sun: #2a1d00;
  --coral: #e24a2f;
  --palm: #1b8a52;
  --sky-top: #a4e6f6;
  --sky-bottom: #f0fcfa;
  --water-1: #8ce6de;
  --water-2: #39c8c3;
  --surf: #ffffffc2;
  --ripple: #ffffff59;
  --beach: #fbe9c2;
  --grass: #a8da70;
  --forest: #3a9a58;
  --rock: #cbb48f;
  --rock-dark: #6e5a44;
  --solar: #2f6fa8;
  --wood: #b07b44;
  --wood-dark: #83582e;
  --on-wood: #fff8e8;
  --trail: #b9925a;
  --trail-walked: #e39a12;
  --selected-bg: #ffc531;
  --selected-fg: #2a1d00;
  --focus: #1d4ed8;
  --shadow: 0 10px 24px #0a5f6a1a;
  --display: 'Lilita One', 'Arial Rounded MT Bold', system-ui, sans-serif;
  --label: 'Fredoka', 'Atkinson Hyperlegible', system-ui, sans-serif;
  --body: 'Atkinson Hyperlegible', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --radius: 18px;
  --gutter: clamp(16px, 4vw, 48px);
  color-scheme: light;
}

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

html {
  background: var(--sand);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--body);
  line-height: 1.5;
  /* Fine sand grain. */
  background:
    radial-gradient(color-mix(in srgb, var(--line) 45%, transparent) 1px, transparent 1.5px) 0 0 / 22px 22px,
    var(--sand);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1,
h2 {
  text-wrap: balance;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: 0;
  background: none;
  touch-action: manipulation;
}

a {
  color: inherit;
}

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

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 10;
  padding: 10px 16px;
  background: var(--sun);
  color: var(--on-sun);
  font-weight: 700;
  border-radius: 8px;
}

.skip-link:focus {
  top: 12px;
}

.icon {
  width: 1em;
  height: 1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 6;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.accent {
  color: var(--coral);
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--label);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--lagoon-deep);
}

.muted {
  color: var(--muted);
  font-size: 14px;
}

/* ---- Top bar and Lagoon Pass chip ----------------------------------------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px var(--gutter);
  background: var(--foam);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 3px 0 color-mix(in srgb, var(--lagoon) 35%, transparent);
  position: relative;
  z-index: 2;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  margin-right: auto;
}

.brand-mark {
  width: 42px;
  height: 42px;
  fill: none;
  stroke-width: 7;
  stroke-linecap: round;
}

.bm-sun {
  fill: var(--sun);
  stroke: none;
}

.bm-wave {
  stroke: var(--lagoon);
}

.brand-text {
  font-family: var(--display);
  font-size: 22px;
  line-height: 1.05;
}

.brand-text small {
  display: block;
  font-family: var(--label);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--lagoon-deep);
}

.topbar nav {
  display: flex;
  gap: 4px;
}

.topbar nav a {
  padding: 9px 14px;
  border-radius: 999px;
  text-decoration: none;
  font-family: var(--label);
  font-weight: 600;
  font-size: 16px;
  color: var(--muted);
}

.topbar nav a:hover {
  color: var(--ink);
  background: color-mix(in srgb, var(--lagoon) 12%, transparent);
}

.topbar nav a[aria-current='page'] {
  color: var(--selected-fg);
  background: var(--selected-bg);
}

.pass-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 5px 14px 5px 5px;
  min-height: 48px;
  border-radius: 999px;
  background: var(--sand);
  border: 2px solid var(--line);
  text-align: left;
}

.pass-chip:hover {
  border-color: var(--lagoon);
}

.pass-chip-avatar,
.pass-avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-family: var(--display);
  color: var(--on-sun);
  background: radial-gradient(circle at 35% 30%, #fff1b8, var(--sun) 60%, var(--sun-deep));
}

.pass-chip-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.pass-chip-name {
  font-weight: 700;
  max-width: 14ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pass-chip-meta {
  font-family: var(--label);
  font-size: 13px;
  color: var(--muted);
}

.pass-chip-stats {
  display: flex;
  gap: 10px;
  font-family: var(--label);
  font-weight: 600;
  font-size: 15px;
}

.pass-chip-stats span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.pass-chip-stats span:first-child .icon {
  color: var(--lagoon-deep);
}

.pass-chip-stats span:last-child .icon {
  color: var(--coral);
}

.notice,
.update-banner {
  margin: 0;
  padding: 12px var(--gutter);
  background: color-mix(in srgb, var(--sun) 30%, var(--foam));
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  font-size: 15px;
}

.update-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  background: color-mix(in srgb, var(--lagoon) 18%, var(--foam));
}

main {
  display: block;
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 var(--gutter) 56px;
}

main:focus {
  outline: none;
}

/* ---- Buttons --------------------------------------------------------------- */

.coin-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 12px 20px;
  border-radius: 999px;
  font-family: var(--label);
  font-weight: 600;
  font-size: 17px;
  color: var(--on-sun);
  background: var(--sun);
  box-shadow: 0 4px 0 var(--sun-deep);
  transition:
    transform 0.12s,
    box-shadow 0.12s;
}

.coin-btn:hover {
  background: color-mix(in srgb, var(--sun) 85%, white);
}

.coin-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--sun-deep);
}

.coin-btn--big {
  max-width: 100%;
  font-size: clamp(17px, 2vw, 19px);
  padding: 14px 24px;
  text-align: left;
}

.coin-btn--wide {
  width: 100%;
  margin: 8px 0 18px;
}

/* A little sun on the main buttons. */
.coin {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff8d6, #ff9f1c 75%);
  box-shadow: 0 0 0 3px color-mix(in srgb, #ff9f1c 35%, transparent);
}

.ghost-btn,
.ghost-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 2px solid var(--lagoon-deep);
  color: var(--lagoon-deep);
  font-family: var(--label);
  font-weight: 600;
  text-decoration: none;
  background: transparent;
}

.ghost-btn:hover,
.ghost-link:hover {
  background: color-mix(in srgb, var(--lagoon) 14%, transparent);
}

.ghost-btn.danger {
  border-color: var(--coral);
  color: var(--coral);
}

.text-btn {
  padding: 8px 0;
  font-weight: 700;
  color: var(--lagoon-deep);
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* ---- Home: postcard hero and scoreboard ----------------------------------- */

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: clamp(20px, 4vw, 56px);
  align-items: center;
  margin-top: 20px;
  padding: clamp(20px, 3.5vw, 40px) clamp(18px, 3.5vw, 40px) clamp(56px, 6vw, 72px);
  border-radius: 28px;
  background: linear-gradient(var(--sky-top), var(--sky-bottom));
  border: 1px solid var(--line);
  overflow: hidden;
  isolation: isolate;
}

/* The sun, low over the water. */
.hero::before {
  content: '';
  position: absolute;
  right: 8%;
  bottom: 18px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--sun) 85%, white), var(--sun) 55%, transparent 71%);
  opacity: 0.55;
  z-index: -1;
}

/* Waves along the bottom of the postcard. */
.hero::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 52px;
  z-index: -1;
  background: linear-gradient(var(--water-1), var(--water-2));
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 52'%3E%3Cpath d='M0 14q15-12 30 0t30 0 30 0 30 0V52H0Z'/%3E%3C/svg%3E")
    0 0 / 120px 52px repeat-x;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 52'%3E%3Cpath d='M0 14q15-12 30 0t30 0 30 0 30 0V52H0Z'/%3E%3C/svg%3E")
    0 0 / 120px 52px repeat-x;
  animation: waves 9s linear infinite;
}

@keyframes waves {
  to {
    -webkit-mask-position: 120px 0;
    mask-position: 120px 0;
  }
}

.hero h1,
.page-head h1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(34px, 5.4vw, 64px);
  line-height: 1.04;
  margin: 10px 0 12px;
  overflow-wrap: break-word;
}

.hero h1 .accent {
  display: block;
  text-shadow: 0 3px 0 color-mix(in srgb, var(--sun) 70%, transparent);
}

.hero h1:focus,
.page-head h1:focus {
  outline: none;
}

.lead {
  max-width: 60ch;
  font-size: clamp(16px, 1.6vw, 19px);
  color: var(--muted);
}

.hero .lead {
  color: var(--ink);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}

.hero .ghost-link {
  background: color-mix(in srgb, var(--foam) 70%, transparent);
}

.live-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--palm);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--palm) 25%, transparent);
}

.scoreboard {
  padding: 20px;
  border-radius: var(--radius);
  background: var(--foam);
  border: 2px solid var(--line);
  box-shadow: var(--shadow);
}

.sb-title {
  font-family: var(--label);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--lagoon-deep);
  overflow-wrap: anywhere;
}

.sb-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 14px 0;
}

.sb-grid > div,
.pass-stats > div {
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--sand);
  border: 1px solid var(--line);
}

.sb-grid dt,
.pass-stats dt {
  font-family: var(--label);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.sb-grid dd,
.pass-stats dd {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin: 2px 0 0;
  font-family: var(--display);
  font-size: 28px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.sb-grid dd small {
  font-family: var(--label);
  font-size: 14px;
  color: var(--muted);
}

.sb-flame {
  align-self: center;
  font-size: 20px;
  color: var(--coral);
  fill: color-mix(in srgb, var(--coral) 25%, transparent);
}

.sb-rank {
  font-size: 15px;
}

.sb-rank b {
  color: var(--coral);
}

.sb-next {
  font-family: var(--label);
  font-size: 14px;
  color: var(--muted);
}

progress {
  appearance: none;
  -webkit-appearance: none;
  display: block;
  width: 100%;
  height: 12px;
  border: 0;
  border-radius: 999px;
  background: var(--sand-2);
  overflow: hidden;
  color: var(--zone, var(--lagoon));
}

progress::-webkit-progress-bar {
  background: var(--sand-2);
}

progress::-webkit-progress-value {
  background: var(--zone, var(--lagoon));
  border-radius: 999px;
}

progress::-moz-progress-bar {
  background: var(--zone, var(--lagoon));
  border-radius: 999px;
}

.xp-bar {
  --zone: var(--coral);
  margin-top: 10px;
}

/* ---- Home: stations around the lagoon ------------------------------------- */

.floor {
  margin-top: 32px;
}

.floor-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 24px;
  margin-bottom: 16px;
}

.floor-head h2,
.section-title {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(26px, 3vw, 36px);
}

.floor-head p {
  font-family: var(--label);
  font-size: 15px;
  color: var(--muted);
}

.floor-head a {
  color: var(--lagoon-deep);
  font-weight: 600;
}

.wings {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px;
}

.wing {
  --wing-ink: color-mix(in srgb, var(--wing) 55%, var(--ink));
  grid-column: span 6;
  padding: 14px;
  border-radius: 26px;
  border: 2px dashed color-mix(in srgb, var(--wing) 45%, var(--line));
  background: color-mix(in srgb, var(--wing) 9%, var(--sand));
}

.wing--life {
  grid-column: span 7;
}

.wing--energy {
  grid-column: span 5;
}

.wing-sign {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 14px;
  margin-bottom: 12px;
}

.wing-sign h2 {
  font-family: var(--display);
  font-weight: 400;
  font-size: 23px;
  color: var(--wing-ink);
}

.wing-sign p {
  color: var(--muted);
  font-size: 15px;
}

.wing-count {
  margin-left: auto;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--foam);
  border: 1px solid var(--line);
  font-family: var(--label);
  font-size: 13px;
  font-weight: 600;
  color: var(--wing-ink);
}

.cabinets {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}

/* A beach hut: striped awning, a window onto sky and sea, the station's sign. */
.cabinet {
  --zone-ink: color-mix(in srgb, var(--zone) 55%, var(--ink));
  display: flex;
  flex-direction: column;
  border-radius: 18px 18px 14px 14px;
  background: var(--foam);
  border: 2px solid color-mix(in srgb, var(--zone) 35%, var(--line));
  box-shadow: var(--shadow);
  transition:
    transform 0.2s,
    box-shadow 0.2s;
}

.cabinet:hover,
.cabinet:focus-within {
  transform: translateY(-3px);
  box-shadow:
    var(--shadow),
    0 0 0 3px color-mix(in srgb, var(--zone) 40%, transparent);
}

.cab-marquee {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px 10px;
  border-radius: 16px 16px 0 0;
  background: repeating-linear-gradient(90deg, var(--zone) 0 18px, var(--foam) 18px 36px);
}

/* Scalloped edge of the awning. */
.cab-marquee::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -9px;
  height: 10px;
  background: radial-gradient(circle at 9px 0, var(--zone) 8.5px, transparent 9px) 0 0 / 36px 10px repeat-x;
}

.cab-no,
.cab-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 9px;
  border-radius: 999px;
  background: var(--foam);
  font-family: var(--label);
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.cab-no {
  color: var(--zone-ink);
}

.cab-status.is-stamped {
  color: var(--selected-fg);
  background: var(--selected-bg);
}

.stamp-mark {
  font-size: 15px;
  stroke-width: 9;
}

.cab-screen {
  position: relative;
  display: grid;
  place-items: center;
  height: 84px;
  margin: 16px 12px 0;
  border-radius: 14px;
  color: var(--zone-ink);
  background: linear-gradient(var(--sky-top), var(--sky-bottom) 62%, var(--water-1) 62%, var(--water-2));
  border: 4px solid color-mix(in srgb, var(--zone) 30%, var(--foam));
  overflow: hidden;
}

.cab-screen .icon {
  width: 50px;
  height: 50px;
  stroke-width: 5;
  transition: transform 0.3s;
}

.cabinet:hover .cab-screen .icon {
  transform: translateY(-3px) rotate(-4deg);
}

.cab-tier,
.cab-last {
  position: absolute;
  bottom: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--foam);
  font-family: var(--label);
  font-size: 12px;
  font-weight: 600;
}

.cab-tier {
  left: 6px;
  color: var(--ink);
}

.cab-last {
  right: 6px;
  color: var(--lagoon-deep);
}

.cab-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 10px 12px 0;
}

.cab-name {
  margin: 0 0 2px;
  font-family: var(--display);
  font-weight: 400;
  font-size: 21px;
  line-height: 1.15;
}

.cab-subject {
  font-family: var(--label);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--zone-ink);
}

.cab-game {
  font-family: var(--body);
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  font-style: italic;
  color: var(--muted);
}

.cab-detail {
  margin: 6px 0 10px;
  font-size: 14px;
  color: var(--muted);
}

.cab-progress {
  margin-top: auto;
}

.cab-progress-text {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
  font-size: 13px;
  color: var(--muted);
}

.label-short {
  display: none;
}

.cab-progress-text b {
  font-family: var(--label);
  color: var(--zone-ink);
}

.lights {
  display: flex;
  gap: 4px;
}

.lights i {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: var(--sand-2);
}

.lights i.on {
  background: var(--zone);
}

.cabinet .coin-btn {
  margin: 10px;
  min-height: 44px;
}

.coin-btn--cabinet {
  justify-content: flex-start;
  gap: 12px;
  padding: 5px 16px;
  font-size: 19px;
}

.coin-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.05;
  text-align: left;
}

.coin-stack small {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* ---- Pages: pass, notebook, grown-ups ------------------------------------- */

.page-head {
  padding: clamp(28px, 4vw, 52px) 0 24px;
}

.pass-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas:
    'avatar id stats'
    'xp xp stats'
    'action action stats';
  align-items: center;
  gap: 14px 22px;
  padding: 22px 24px 22px 32px;
  margin-bottom: 36px;
  border-radius: 20px;
  background: linear-gradient(90deg, var(--lagoon) 0 10px, transparent 10px), var(--foam);
  border: 2px solid var(--line);
  box-shadow: var(--shadow);
}

.pass-avatar {
  grid-area: avatar;
  width: 72px;
  height: 72px;
  font-size: 32px;
}

.pass-id {
  grid-area: id;
}

.pass-label {
  font-family: var(--label);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--lagoon-deep);
}

.pass-name {
  font-family: var(--display);
  font-size: clamp(26px, 3vw, 36px);
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.pass-meta {
  color: var(--muted);
}

.pass-stats {
  grid-area: stats;
  display: grid;
  grid-template-columns: repeat(2, minmax(110px, 1fr));
  gap: 10px;
  margin: 0;
  padding-left: 22px;
  border-left: 2px dashed var(--line);
}

.pass-xp {
  grid-area: xp;
  font-family: var(--label);
  font-size: 14px;
  color: var(--muted);
}

.pass-xp progress {
  margin-bottom: 6px;
}

.pass-card .ghost-btn {
  grid-area: action;
  justify-self: start;
}

/* Station stamps, like postage stamps on a postcard. */
.stamp-album {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.stamp-slot {
  --zone-ink: color-mix(in srgb, var(--zone) 55%, var(--ink));
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 16px 12px 12px;
  border-radius: 6px;
  border: 3px dotted var(--line);
  background: var(--foam);
}

.stamp-slot.is-earned {
  border: 3px dotted var(--zone);
  background: color-mix(in srgb, var(--zone) 8%, var(--foam));
  box-shadow: var(--shadow);
}

.stamp-art {
  display: grid;
  place-items: center;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 3px dashed var(--line);
  color: var(--muted);
}

.stamp-art .icon {
  width: 46px;
  height: 46px;
  stroke-width: 5;
}

.is-earned .stamp-art {
  border: 4px double var(--zone-ink);
  color: var(--zone-ink);
  background: color-mix(in srgb, var(--zone) 15%, var(--foam));
  transform: rotate(-8deg);
}

.stamp-slot h3 {
  margin-top: 12px;
  font-family: var(--display);
  font-weight: 400;
  font-size: 19px;
}

.slot-tier {
  font-family: var(--label);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--zone-ink);
}

.stamp-slot:not(.is-earned) .slot-tier {
  color: var(--muted);
}

.slot-progress,
.slot-mastery {
  margin-top: 6px;
  font-size: 14px;
  color: var(--muted);
}

.slot-play {
  margin-top: auto;
  padding: 10px 6px 0;
  min-height: 44px;
  font-weight: 700;
  color: var(--lagoon-deep);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.backup-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px 32px;
  margin-top: 40px;
  padding: 24px;
  border-radius: var(--radius);
  border: 2px solid var(--line);
  background: var(--foam);
}

.backup-panel p {
  margin-top: 8px;
  max-width: 60ch;
  color: var(--muted);
}

.backup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.file-label {
  cursor: pointer;
}

.file-label:focus-within {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

/* Notebook and grown-ups notes, as postcards. */
.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  margin-bottom: 32px;
}

.notes-grid + section .section-title {
  margin-bottom: 16px;
}

.note {
  --zone: var(--lagoon);
  padding: 20px 22px;
  border-radius: 14px;
  background: var(--foam);
  border: 2px solid var(--line);
  border-top: 8px solid var(--zone);
  box-shadow: var(--shadow);
}

.note h2 {
  margin: 4px 0 8px;
  font-family: var(--display);
  font-weight: 400;
  font-size: 22px;
}

.note-subject {
  font-family: var(--label);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--zone) 55%, var(--ink));
}

.note.is-locked {
  border-top-style: dashed;
  box-shadow: none;
}

.note.is-locked > p:not(.note-subject) {
  color: var(--muted);
  font-style: italic;
}

.note .text-btn {
  margin-top: 10px;
}

/* ---- Lagoon map ------------------------------------------------------------- */

.page-head--tight {
  padding-bottom: 16px;
}

.map-legend {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}

.type-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.type-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 2px solid var(--line);
  background: var(--foam);
  font-family: var(--label);
  font-weight: 600;
}

.type-chip b {
  color: var(--muted);
}

.type-chip:hover {
  border-color: var(--lagoon);
}

.type-chip[aria-pressed='true'] {
  background: var(--selected-bg);
  border-color: var(--selected-bg);
  color: var(--selected-fg);
}

.type-chip[aria-pressed='true'] b {
  color: var(--selected-fg);
}

.type-chip .type-shape {
  --zone: var(--ink);
}

.type-chip[aria-pressed='true'] .type-shape {
  --zone: var(--selected-fg);
}

.chip-short {
  display: none;
}

.type-description {
  max-width: 70ch;
  min-height: 3em;
  color: var(--muted);
}

/* Marker shapes encode the kind of game; the text label repeats it. */
.type-shape {
  --size: 16px;
  display: inline-grid;
  place-items: center;
  flex: none;
  width: var(--size);
  height: var(--size);
  background: var(--zone, currentColor);
  color: var(--foam);
}

.type-shape--circle {
  border-radius: 50%;
}

.type-shape--diamond {
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}

.type-shape--hexagon {
  clip-path: polygon(25% 3%, 75% 3%, 100% 50%, 75% 97%, 25% 97%, 0 50%);
}

/* The island: a drawing with real buttons placed over it at each station. */
.island-map {
  position: relative;
  aspect-ratio: 1000 / 640;
  border-radius: 30px;
  border: 6px solid var(--sand-2);
  background: var(--water-2);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.isle-art {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.isle-sea {
  fill: url(#isle-sea-depth);
}

/* Deeper, bluer water further from the island. */
.isle-sea-near {
  stop-color: var(--water-2);
}

.isle-sea-far {
  stop-color: color-mix(in srgb, var(--water-2) 70%, #1677a8);
}

/* A white line of breaking surf where the shallows meet the sand. */
.isle-surf {
  fill: none;
  stroke: var(--foam);
  stroke-width: 40;
  stroke-linejoin: round;
  opacity: 0.7;
}

.isle-waves path {
  fill: none;
  stroke: var(--surf);
  stroke-width: 4;
  stroke-linecap: round;
}

.isle-shallows {
  fill: var(--water-1);
  stroke: var(--water-1);
  stroke-width: 80;
  stroke-linejoin: round;
}

.isle-reef circle {
  fill: var(--coral);
  opacity: 0.75;
}

.isle-beach {
  fill: var(--beach);
  stroke: var(--beach);
  stroke-width: 26;
  stroke-linejoin: round;
}

.isle-land {
  fill: var(--grass);
}

/* The grass sits slightly raised: a darker lip on the south side, sunlit
   middle. */
.isle-land-edge {
  fill: color-mix(in srgb, var(--grass) 72%, var(--forest));
}

.isle-land-hi {
  fill: color-mix(in srgb, var(--grass) 65%, #fffbe0);
  opacity: 0.55;
}

.isle-hills path {
  fill: color-mix(in srgb, var(--grass) 80%, var(--forest));
}

.isle-hills .isle-hill-shade,
.isle-shadow {
  fill: color-mix(in srgb, var(--forest) 70%, #1d3b26);
  opacity: 0.25;
}

.isle-mountain-shade {
  fill: var(--rock-dark);
  opacity: 0.28;
}

.isle-river {
  fill: none;
  stroke: var(--water-2);
  stroke-width: 12;
  stroke-linecap: round;
}

.isle-mountain {
  fill: var(--rock);
}

.isle-snow,
.isle-dome {
  fill: var(--foam);
}

.isle-dome,
.isle-lighthouse path,
.isle-clinic {
  stroke: var(--rock-dark);
  stroke-width: 2;
}

.isle-trees circle {
  fill: var(--forest);
}

.isle-trees .isle-leaf-hi {
  fill: color-mix(in srgb, var(--forest) 60%, #d8f59a);
  opacity: 0.6;
}

.isle-bushes path {
  fill: color-mix(in srgb, var(--palm) 80%, var(--grass));
}

.isle-hut-wall {
  fill: var(--beach);
  stroke: var(--wood-dark);
  stroke-width: 2;
}

.isle-hut-roof {
  fill: color-mix(in srgb, var(--wood) 70%, #f2c46a);
  stroke: var(--wood-dark);
  stroke-width: 2;
  stroke-linejoin: round;
}

.isle-hut-door {
  fill: var(--wood-dark);
}

.isle-trunk {
  fill: none;
  stroke: var(--wood);
  stroke-width: 5;
  stroke-linecap: round;
}

.isle-palm {
  fill: none;
  stroke: var(--forest);
  stroke-width: 6;
  stroke-linecap: round;
}

.isle-solar-panel {
  fill: var(--solar);
  stroke: var(--foam);
  stroke-width: 2;
  stroke-linejoin: round;
}

.isle-solar-grid {
  fill: none;
  stroke: color-mix(in srgb, var(--solar) 55%, var(--foam));
  stroke-width: 1.5;
}

.isle-solar-leg {
  fill: none;
  stroke: var(--rock-dark);
  stroke-width: 3;
  stroke-linecap: round;
}

.isle-lighthouse path,
.isle-clinic,
.isle-boat path {
  fill: var(--foam);
}

.isle-lighthouse .isle-stripe,
.isle-cross {
  fill: var(--coral);
  stroke: none;
}

/* The footpath: sandy dots ahead, solid gold where the explorer has been. */
.isle-trail path {
  fill: none;
  stroke: var(--trail);
  stroke-width: 7;
  stroke-linecap: round;
  stroke-dasharray: 0.1 15;
}

.isle-trail path.is-walked {
  stroke: var(--trail-walked);
  stroke-width: 6;
  stroke-dasharray: none;
}

.isle-turtle ellipse,
.isle-turtle circle {
  fill: var(--palm);
}

.isle-turtle path {
  fill: none;
  stroke: var(--palm);
  stroke-width: 5;
  stroke-linecap: round;
}

.isle-cave {
  fill: var(--rock);
  stroke: var(--rock-dark);
  stroke-width: 3;
}

.isle-cave-mouth {
  fill: color-mix(in srgb, var(--rock-dark) 80%, #000);
}

.isle-clinic-roof {
  fill: var(--coral);
  stroke: var(--rock-dark);
  stroke-width: 2;
  stroke-linejoin: round;
}

.isle-dock path {
  fill: none;
  stroke: var(--wood);
  stroke-width: 7;
  stroke-linecap: round;
}

.isle-boat path {
  stroke: var(--wood-dark);
  stroke-width: 2;
}

.isle-clouds ellipse {
  fill: var(--surf);
}

.isle-jetty-deck {
  fill: var(--wood);
  stroke: var(--wood-dark);
  stroke-width: 2;
}

.isle-jetty-post {
  fill: none;
  stroke: var(--wood-dark);
  stroke-width: 6;
  stroke-linecap: round;
}

.isle-jetty-planks {
  fill: none;
  stroke: var(--wood-dark);
  stroke-width: 1.5;
}

.isle-region,
.isle-here,
.isle-item {
  position: absolute;
  left: var(--x);
  top: var(--y);
}

.isle-region {
  transform: translate(-50%, -50%);
  padding: 2px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--foam) 75%, transparent);
  font-family: var(--display);
  font-size: clamp(14px, 1.5vw, 19px);
  color: color-mix(in srgb, var(--wing) 55%, var(--ink));
  white-space: nowrap;
  pointer-events: none;
}

.isle-here {
  display: flex;
  align-items: center;
  gap: 6px;
  transform: translate(-50%, -50%);
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--foam);
  font-family: var(--label);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.isle-here i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--coral);
  animation: bob 1.8s ease-in-out infinite;
}

@keyframes bob {
  50% {
    transform: translateY(-3px);
  }
}

.isle-pins {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* The marker's centre sits on the station's spot; its label hangs below. */
/* A pin's pointer touches its landmark: standing pins rise above it with the
   name on top, hanging pins (near the top edge) drop below it. */
.isle-item {
  transform: translate(-50%, -100%);
}

.isle-item--down {
  transform: translate(-50%, 0);
}

.isle-pin {
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 0;
  padding: 0;
  text-align: center;
  transition:
    opacity 0.2s,
    filter 0.2s;
}

.pin-mark {
  position: relative;
  flex: none;
  filter: drop-shadow(0 3px 0 color-mix(in srgb, var(--ink) 25%, transparent));
}

.isle-pin .type-shape {
  --size: 48px;
}

.isle-pin .type-shape .icon {
  width: 26px;
  height: 26px;
  stroke-width: 8;
}

.isle-num {
  position: absolute;
  top: -6px;
  left: -6px;
  display: none;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--shore-badge, var(--ink));
  color: var(--sand);
  font-family: var(--label);
  font-size: 12px;
  font-weight: 600;
}

.isle-item--down .isle-pin {
  flex-direction: column;
}

/* Progress ring: fills with the station's percentage (--p). */
.isle-pin .pin-mark {
  isolation: isolate;
}

.isle-pin .pin-mark::before {
  content: '';
  position: absolute;
  inset: -6px;
  z-index: -1;
  border-radius: 50%;
  background: conic-gradient(var(--zone) calc(var(--p) * 1%), color-mix(in srgb, var(--zone) 22%, var(--foam)) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
}

/* Up next: a slow ripple around the suggested station. */
.isle-item.is-next .pin-mark::after {
  content: '';
  position: absolute;
  inset: -6px;
  z-index: -2;
  border-radius: 50%;
  border: 3px solid var(--zone);
  animation: pin-pulse 1.8s ease-out infinite;
}

@keyframes pin-pulse {
  from {
    transform: scale(1);
    opacity: 0.85;
  }

  to {
    transform: scale(1.75);
    opacity: 0;
  }
}

.isle-next {
  display: inline-block;
  align-self: center;
  margin-top: 2px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--sun);
  color: var(--on-sun);
  font-family: var(--label);
  font-size: 11px;
  font-weight: 600;
}

.key-text .isle-next {
  margin: 0 0 0 4px;
  vertical-align: 1px;
}

.pin-tip {
  width: 0;
  height: 0;
  margin-top: -2px;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 10px solid var(--zone);
  filter: drop-shadow(0 2px 0 color-mix(in srgb, var(--ink) 25%, transparent));
}

.isle-item--down .pin-tip {
  margin: 0 0 -2px;
  border-top: 0;
  border-bottom: 10px solid var(--zone);
  filter: none;
}

.isle-pin .isle-label {
  margin-bottom: 4px;
}

.isle-item--down .isle-label {
  margin: 4px 0 0;
}

.isle-label {
  display: flex;
  flex-direction: column;
  padding: 4px 10px;
  border-radius: 12px;
  border: 2px solid color-mix(in srgb, var(--zone) 40%, var(--line));
  background: var(--foam);
  box-shadow: var(--shadow);
  line-height: 1.2;
  white-space: nowrap;
}

.isle-pin:hover .isle-label,
.isle-pin:focus-visible .isle-label {
  border-color: var(--zone);
}

.isle-name {
  font-weight: 700;
  font-size: 15px;
}

.isle-place {
  font-family: var(--label);
  font-size: 12px;
  color: var(--muted);
}

.pin-stamp {
  position: absolute;
  top: -5px;
  right: -5px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--foam);
  color: var(--palm);
  box-shadow: 0 0 0 2px var(--palm);
}

.pin-stamp .icon,
.key-stamp .icon {
  width: 16px;
  height: 16px;
  stroke-width: 9;
}

.pin-item.is-dimmed .isle-pin,
.pin-item.is-dimmed .key-row {
  opacity: 0.3;
  filter: grayscale(0.8);
}

/* Preview card: one shared card along the bottom of the island, filled in
   for whichever marker was pressed. */
.isle-item.is-previewed {
  z-index: 3;
}

.isle-item.is-previewed .pin-mark {
  transform: scale(1.12);
}

.isle-card {
  position: absolute;
  left: 50%;
  bottom: 12px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(440px, calc(100% - 16px));
  padding: 8px 8px 8px 10px;
  border-radius: 16px;
  border: 2px solid var(--zone);
  background: var(--foam);
  box-shadow: var(--shadow);
  transform: translateX(-50%);
  animation: card-in 0.18s ease-out;
}

.isle-card--top {
  top: 12px;
  bottom: auto;
}

.isle-card[hidden] {
  display: none;
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
}

.isle-card .type-shape {
  --size: 40px;
  flex: none;
}

.isle-card .type-shape .icon {
  width: 22px;
  height: 22px;
}

.isle-card-text {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  line-height: 1.25;
}

.isle-card-name {
  font-family: var(--label);
  font-size: 15px;
}

.isle-card-place,
.isle-card-progress {
  font-size: 12px;
  color: var(--muted);
}

.isle-card-bar {
  display: block;
  height: 5px;
  margin: 3px 0 2px;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    var(--zone) calc(var(--p) * 1%),
    color-mix(in srgb, var(--zone) 18%, var(--foam)) 0
  );
}

.isle-card-play {
  flex: none;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--sun);
  color: var(--on-sun);
  font-family: var(--label);
  font-size: 15px;
  font-weight: 600;
  box-shadow: 0 3px 0 color-mix(in srgb, var(--sun) 60%, var(--ink));
}

.isle-card-close {
  flex: none;
  align-self: flex-start;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}

.isle-card-close:hover {
  background: var(--sand-2);
}

/* Numbered key, grouped by shore, used where the island is too small for
   labels. */
.map-key {
  display: none;
  gap: 12px;
  margin: 14px 0 0;
}

.key-shore-name {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 6px;
  font-family: var(--display);
  font-size: 16px;
  font-weight: 400;
  color: color-mix(in srgb, var(--wing) 55%, var(--ink));
}

.key-shore-name::before {
  content: '';
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--shore-badge);
}

.key-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Number badges take their shore's colour, darkened for white digits. */
.isle-item,
.key-shore {
  --shore-badge: color-mix(in srgb, var(--wing, var(--ink)) 62%, var(--ink));
}

.key-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 56px;
  padding: 8px 10px;
  border-radius: 14px;
  border: 2px solid var(--line);
  background: var(--foam);
  text-align: left;
  transition:
    opacity 0.2s,
    filter 0.2s;
}

.key-row:hover {
  border-color: var(--zone);
}

.key-row .type-shape {
  --size: 36px;
}

.key-row .type-shape .icon {
  width: 20px;
  height: 20px;
  stroke-width: 8;
}

.key-num {
  display: grid;
  place-items: center;
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--shore-badge, var(--ink));
  color: var(--sand);
  font-family: var(--label);
  font-size: 12px;
  font-weight: 600;
}

.key-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}

.key-stamp {
  margin-left: auto;
  color: var(--palm);
}

/* Mid widths: a name-only tag stays under each marker, so the island still
   reads on its own; place, kind and progress move to the key below. */
@media (max-width: 1040px) {
  .isle-label {
    padding: 1px 7px;
    border-width: 1.5px;
    border-radius: 8px;
  }

  .isle-name {
    font-size: 12px;
  }

  .isle-label .isle-place {
    display: none;
  }

  .map-key {
    display: grid;
  }

  .isle-pin .type-shape {
    --size: 40px;
  }

  .isle-pin .type-shape .icon {
    width: 22px;
    height: 22px;
  }
}

/* ---- Play screen ------------------------------------------------------------ */

.playing {
  overflow: hidden;
}

.playing .topbar {
  display: none;
}

/* The game frame takes whatever height the bars leave. */
.play {
  display: flex;
  flex-direction: column;
  height: 100dvh;
}

.playbar {
  position: relative;
  flex: none;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 64px;
  padding: 8px var(--gutter);
  background: var(--sea);
  color: var(--on-sea);
  border-bottom: 4px solid var(--sun);
}

.pb-btn {
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 2px solid color-mix(in srgb, var(--on-sea) 35%, transparent);
  font-family: var(--label);
  font-weight: 600;
  white-space: nowrap;
}

.pb-btn:hover {
  border-color: var(--sun);
}

.pb-title {
  min-width: 0;
  margin-right: auto;
}

.pb-eyebrow {
  font-family: var(--label);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--on-sea) 75%, transparent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#zone-title {
  font-family: var(--display);
  font-weight: 400;
  font-size: 22px;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pb-hud {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--label);
  font-size: 14px;
  font-weight: 600;
}

.hud-station {
  width: 190px;
}

.hud-label {
  display: block;
  margin-bottom: 4px;
  color: color-mix(in srgb, var(--on-sea) 80%, transparent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hud-station progress {
  --zone: var(--sun);
  height: 10px;
  background: color-mix(in srgb, var(--on-sea) 18%, transparent);
}

.hud-station progress::-webkit-progress-bar {
  background: color-mix(in srgb, var(--on-sea) 18%, transparent);
}

.hud-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--foam);
  border: 1px solid var(--line);
  color: var(--lagoon-deep);
  white-space: nowrap;
}

.sync-warning {
  flex: none;
  padding: 10px var(--gutter);
  background: color-mix(in srgb, var(--sun) 30%, var(--foam));
  color: var(--ink);
  font-size: 14px;
  border-bottom: 1px solid var(--line);
}

.loading {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 80px 20px;
  font-family: var(--display);
  font-size: 22px;
  color: var(--lagoon-deep);
}

.loader {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 6px solid color-mix(in srgb, var(--lagoon) 25%, transparent);
  border-top-color: var(--lagoon);
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

#game {
  display: block;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  border: 0;
  background: var(--sand);
}

/* ---- Dialogs and footer --------------------------------------------------- */

dialog {
  width: min(480px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  padding: 28px;
  border-radius: 22px;
  border: 2px solid var(--line);
  color: var(--ink);
  background: var(--foam);
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: color-mix(in srgb, var(--lagoon-deep) 35%, transparent);
  backdrop-filter: blur(3px);
}

dialog h2 {
  margin: 8px 0 18px;
  font-family: var(--display);
  font-weight: 400;
  font-size: 28px;
}

dialog label {
  display: block;
  margin: 14px 0;
  font-weight: 700;
}

dialog input,
dialog select {
  display: block;
  width: 100%;
  min-height: 46px;
  margin-top: 6px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: var(--sand);
}

dialog .close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 44px;
  height: 44px;
  font-size: 28px;
  line-height: 1;
}

.standalone {
  padding: 14px 0;
  margin-bottom: 12px;
  border-block: 1px solid var(--line);
}

.standalone h3 {
  font-size: 16px;
}

.standalone .muted {
  margin: 6px 0 10px;
}

.restore-summary {
  padding-left: 18px;
  margin: 0 0 12px;
}

.restore-summary li {
  margin: 4px 0;
}

.restore-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px 20px;
  padding: 22px var(--gutter);
  border-top: 1px solid var(--line);
  background: var(--sand-2);
  font-size: 14px;
  color: var(--muted);
}

.offline-status.is-ready {
  color: var(--palm);
  font-weight: 700;
}

.offline-status.is-ready::before {
  content: '● ';
}

/* ---- Responsive ----------------------------------------------------------- */

@media (max-width: 900px) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
  }

  /* Lay the scoreboard flat under the hero: title and rank left, stats right. */
  .scoreboard {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
    align-items: center;
    gap: 6px 20px;
    padding: 16px;
  }

  .scoreboard .sb-grid {
    grid-row: span 3;
    grid-column: 2;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: 0;
  }

  .sb-grid > div {
    padding: 8px 10px;
  }

  .sb-grid dd {
    font-size: 23px;
  }

  .pb-hud .hud-pill:last-child {
    display: none;
  }
}

/* Huts become list rows: window, name and progress, play button. */
@media (max-width: 1100px) {
  .wing,
  .wing--life,
  .wing--energy {
    grid-column: span 6;
  }

  .cabinets {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .cabinet {
    display: grid;
    grid-template-columns: 60px minmax(0, 1fr) auto;
    grid-template-areas: 'screen body button';
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: 16px;
    border-left: 8px solid var(--zone);
  }

  .cabinet:hover,
  .cabinet:focus-within {
    transform: none;
  }

  .cab-marquee {
    display: contents;
  }

  .cab-marquee::after,
  .cab-no,
  .cab-tier,
  .cab-last,
  .cab-detail,
  .cab-game {
    display: none;
  }

  /* The stamp badge sits on the window; a new game needs no badge (0% says it). */
  .cab-status {
    grid-area: screen;
    align-self: end;
    justify-self: center;
    z-index: 1;
    margin-bottom: -8px;
    padding: 0 6px;
    font-size: 10px;
  }

  .cab-status:not(.is-stamped) {
    display: none;
  }

  .cab-status .stamp-mark {
    display: none;
  }

  .cab-progress-text .label-full {
    display: none;
  }

  .cab-progress-text .label-short {
    display: inline;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .coin-stack small {
    display: none;
  }

  .cab-screen {
    grid-area: screen;
    width: 60px;
    height: 60px;
    margin: 0;
    border-width: 3px;
  }

  .cab-screen .icon {
    width: 36px;
    height: 36px;
  }

  .cab-body {
    grid-area: body;
    padding: 0;
  }

  .cab-name {
    font-size: 19px;
    margin: 0;
  }

  .cab-subject {
    margin-bottom: 4px;
    font-size: 12px;
  }

  .cabinet .coin-btn {
    grid-area: button;
    margin: 0;
    padding: 4px 14px;
    font-size: 17px;
  }

  .coin-btn--cabinet .coin {
    display: none;
  }
}

@media (max-width: 760px) {
  .topbar {
    flex-wrap: wrap;
    gap: 10px;
    padding-block: 10px;
  }

  .topbar nav {
    order: 3;
    width: 100%;
    justify-content: space-between;
  }

  .topbar nav a {
    padding: 8px 10px;
    font-size: 15px;
  }

  .pass-chip-stats {
    display: none;
  }

  .brand-text {
    font-size: 19px;
  }

  .hero {
    margin-top: 14px;
    border-radius: 22px;
  }

  .hero::before {
    width: 150px;
    height: 150px;
    right: -20px;
    bottom: 30px;
  }

  .wing,
  .wing--life,
  .wing--energy {
    grid-column: 1 / -1;
    padding: 12px;
  }

  .wing-count {
    margin-left: 0;
  }

  /* On phones the scoreboard is just its stats; rank and XP live on the pass. */
  .scoreboard {
    display: block;
    padding: 10px;
  }

  .scoreboard .sb-title,
  .scoreboard .sb-rank,
  .scoreboard .xp-bar,
  .floor-head p {
    display: none;
  }

  .scoreboard .sb-grid {
    margin: 0;
    gap: 6px;
  }

  .sb-grid dt {
    font-size: 11px;
    letter-spacing: 0.02em;
  }

  .sb-grid dd {
    font-size: 20px;
  }

  .sb-grid dd small {
    font-size: 12px;
  }

  .sb-flame {
    font-size: 15px;
  }

  .lead {
    font-size: 15px;
  }

  .hero-actions .ghost-link {
    display: none;
  }

  .pass-card {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      'avatar id'
      'stats stats'
      'xp xp'
      'action action';
    padding: 18px 18px 18px 26px;
  }

  .pass-stats {
    padding: 14px 0 0;
    border-left: 0;
    border-top: 2px dashed var(--line);
  }

  .stamp-album {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .stamp-art {
    width: 60px;
    height: 60px;
  }

  .stamp-art .icon {
    width: 34px;
    height: 34px;
  }

  .stamp-slot h3 {
    font-size: 16px;
  }

  .island-map {
    border-width: 4px;
    border-radius: 20px;
  }

  /* Shore names are too cramped here; the number badges carry each
     shore's colour instead, matching the headings in the key. */
  .isle-region,
  .isle-here {
    display: none;
  }

  .isle-pin .type-shape {
    --size: 28px;
  }

  .isle-pin .type-shape .icon {
    width: 16px;
    height: 16px;
  }

  /* Phones: too small for name tags, so markers are numbered against the key. */
  .isle-label {
    display: none;
  }

  .pin-tip {
    border-left-width: 5px;
    border-right-width: 5px;
    border-top-width: 7px;
  }

  .isle-item--down .pin-tip {
    border-bottom-width: 7px;
  }

  /* Beside the marker, not above it, so pins near the top edge keep theirs. */
  .isle-num {
    display: grid;
    top: 50%;
    left: -13px;
    transform: translateY(-50%);
    width: 17px;
    height: 17px;
    font-size: 11px;
  }

  .isle-pin .pin-stamp {
    display: none;
  }

  .type-chip {
    padding: 6px 12px;
    font-size: 15px;
  }

  .chip-long {
    display: none;
  }

  .chip-short {
    display: inline;
  }

  /* One row on phones: back, title, next. The station's progress becomes
     the sun-coloured line along the bar's bottom edge. */
  .playbar {
    gap: 8px;
    min-height: 0;
    padding: 6px 10px 8px;
    border-bottom-color: color-mix(in srgb, var(--sun) 30%, var(--sea));
  }

  .pb-title {
    flex: 1;
  }

  .pb-eyebrow,
  .pb-long,
  .pb-hud .hud-pill {
    display: none;
  }

  #zone-title {
    font-size: 19px;
  }

  .pb-btn {
    min-height: 40px;
    padding: 6px 12px;
  }

  .pb-hud {
    position: absolute;
    left: 0;
    right: 0;
    bottom: -4px;
  }

  .hud-station {
    width: 100%;
  }

  .hud-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .hud-station progress,
  .hud-station progress::-webkit-progress-bar,
  .hud-station progress::-webkit-progress-value {
    height: 4px;
    border-radius: 0;
    background-color: transparent;
  }

  .hud-station progress::-webkit-progress-value {
    background: var(--sun);
  }
}

@media (max-width: 420px) {
  .pass-chip-text {
    display: none;
  }

  .pass-chip {
    padding-right: 5px;
  }

  .sb-grid > div {
    padding: 6px;
  }

  /* The narrowest phones: smaller markers and a thinner ring, so the
     north-east stations don't touch and the summit pin stays inside. */
  .isle-pin .type-shape {
    --size: 22px;
  }

  .isle-pin .type-shape .icon {
    width: 13px;
    height: 13px;
  }

  .isle-pin .pin-mark::before,
  .isle-item.is-next .pin-mark::after {
    inset: -4px;
  }

  .isle-pin .pin-mark::before {
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
    mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
