:root {
  --sky-1: #78cdf7;
  --sky-2: #d8f6ff;
  --sky-3: #fff1bd;
  --ink: #111c46;
  --ink-soft: #33466f;
  --muted: #5c6c8d;
  --panel: rgba(247, 253, 255, 0.86);
  --panel-strong: rgba(255, 255, 255, 0.94);
  --line: rgba(28, 48, 91, 0.14);
  --line-strong: rgba(28, 48, 91, 0.24);
  --blue: #247ed9;
  --blue-deep: #173f8f;
  --teal: #1598a8;
  --mint: #66d6a5;
  --gold: #ffd45a;
  --gold-deep: #f3a92f;
  --pink: #ff87ba;
  --shadow-soft: 0 16px 45px rgba(39, 97, 153, 0.18);
  --shadow-stage: 0 28px 80px rgba(24, 76, 132, 0.26), 0 8px 20px rgba(17, 28, 70, 0.08);
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --page-max: 1240px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
  overscroll-behavior-x: none;
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  background:
    radial-gradient(circle at 8% 14%, rgba(255, 255, 255, 0.72) 0 72px, transparent 74px),
    radial-gradient(circle at 82% 18%, rgba(255, 255, 255, 0.5) 0 54px, transparent 56px),
    linear-gradient(180deg, var(--sky-1) 0%, var(--sky-2) 57%, var(--sky-3) 100%);
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
}

button,
a {
  font: inherit;
}

button {
  min-height: 44px;
  border: 1px solid rgba(17, 28, 70, 0.08);
  border-radius: 12px;
  padding: 10px 16px;
  color: var(--ink);
  background: linear-gradient(180deg, #ffffff, #edf8ff);
  box-shadow: 0 9px 22px rgba(39, 97, 153, 0.14);
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
  -webkit-tap-highlight-color: transparent;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(39, 97, 153, 0.18);
}

button:active,
button.is-pressed {
  transform: translateY(1px);
  background: linear-gradient(180deg, #dff5ff, #ffffff);
}

button:focus-visible,
a:focus-visible {
  outline: 4px solid rgba(255, 212, 90, 0.68);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 20;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--ink);
  background: #ffffff;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.page-shell {
  width: min(var(--page-max), calc(100% - 32px));
  margin: 0 auto;
  padding: 16px 0 40px;
}

.page-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  margin-bottom: 14px;
}

.title-lockup {
  text-align: center;
}

.back-link {
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.eyebrow {
  margin: 0 0 4px;
  color: #176d83;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 4px;
  font-size: clamp(2rem, 5vw, 3.8rem);
  line-height: 0.96;
}

.intro {
  margin: 0;
  color: var(--ink-soft);
  font-size: clamp(0.98rem, 1.7vw, 1.12rem);
  line-height: 1.45;
}

.trust-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: flex-end;
}

.trust-row span {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border: 1px solid rgba(21, 152, 168, 0.2);
  border-radius: 999px;
  padding: 7px 10px;
  color: #075d68;
  background: rgba(255, 255, 255, 0.74);
  font-size: 0.8rem;
  font-weight: 900;
  white-space: nowrap;
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 300px);
  gap: 16px;
  align-items: start;
}

.game-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: var(--radius-lg);
  padding: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(235, 250, 255, 0.86)),
    radial-gradient(circle at 20% 0%, rgba(255, 212, 90, 0.18), transparent 34%);
  box-shadow: var(--shadow-stage);
}

.game-card::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(36, 126, 217, 0.08);
  border-radius: calc(var(--radius-lg) - 8px);
  pointer-events: none;
}

.stage-topline {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.stage-topline span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stage-topline strong {
  display: block;
  color: var(--ink);
  font-size: 1rem;
}

.stage-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.stage-actions button {
  min-height: 38px;
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 0.86rem;
  font-weight: 900;
}

.stage-actions #mapButton,
.stage-actions #albumButton {
  border-color: rgba(21, 152, 168, 0.2);
  background: linear-gradient(180deg, #e9fff8, #ffffff);
}

.stage-objective {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 3px;
  margin-bottom: 10px;
  border: 1px solid rgba(21, 152, 168, 0.18);
  border-radius: 14px;
  padding: 10px 12px;
  background: linear-gradient(180deg, rgba(255, 250, 221, 0.88), rgba(255, 255, 255, 0.74));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.74);
}

.stage-objective span {
  color: #176d83;
  font-size: 0.68rem;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stage-objective strong {
  color: var(--ink);
  font-size: clamp(0.95rem, 1.7vw, 1.12rem);
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.hud {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1.35fr 0.8fr 0.85fr 0.75fr 1fr 1.25fr;
  gap: 7px;
  margin-bottom: 10px;
}

.hud-pill {
  min-width: 0;
  border: 1px solid rgba(36, 126, 217, 0.1);
  border-radius: 12px;
  padding: 8px 9px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.hud-pill span {
  display: block;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hud-pill strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: clamp(0.85rem, 1.1vw, 1rem);
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow-wrap: anywhere;
}

.ability-panel {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  margin: -2px 0 10px;
  border: 1px solid rgba(36, 126, 217, 0.1);
  border-radius: 13px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.62);
}

.ability-button {
  min-width: 170px;
  min-height: 42px;
  padding: 8px 13px;
  font-size: 0.86rem;
  font-weight: 950;
}

.ability-button[data-state="ready"],
.touch-ability[data-state="ready"] {
  border-color: rgba(21, 152, 168, 0.26);
  background: linear-gradient(180deg, #e9fff8, #ffffff);
  box-shadow: 0 0 0 3px rgba(102, 214, 165, 0.18);
}

.ability-button[data-state="active"],
.touch-ability[data-state="active"] {
  border-color: rgba(243, 169, 47, 0.38);
  background: linear-gradient(180deg, #fff4b8, #ffffff);
  box-shadow: 0 0 0 4px rgba(255, 212, 90, 0.2), 0 10px 22px rgba(243, 169, 47, 0.16);
}

.ability-button[data-state="cooldown"],
.ability-button[data-state="locked"],
.touch-ability[data-state="cooldown"],
.touch-ability[data-state="locked"] {
  opacity: 0.72;
}

#abilityStatus {
  min-width: 0;
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 850;
  line-height: 1.2;
}

.canvas-wrap {
  position: relative;
  z-index: 1;
  overflow: hidden;
  border: 1px solid rgba(17, 28, 70, 0.16);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.14), transparent),
    #9edfff;
  box-shadow:
    inset 0 0 0 4px rgba(255, 255, 255, 0.48),
    inset 0 -28px 50px rgba(255, 231, 156, 0.18),
    0 15px 36px rgba(35, 92, 148, 0.18);
}

.canvas-wrap[data-overlay-state="missionMap"],
.canvas-wrap[data-overlay-state="missionBriefing"],
.canvas-wrap[data-overlay-state="skyLocker"],
.canvas-wrap[data-overlay-state="album"] {
  min-height: 540px;
}

.canvas-wrap[data-overlay-state="missionMap"],
.canvas-wrap[data-overlay-state="skyLocker"],
.canvas-wrap[data-overlay-state="album"] {
  min-height: 620px;
}

.canvas-wrap[data-overlay-state="missionMap"] canvas,
.canvas-wrap[data-overlay-state="missionBriefing"] canvas,
.canvas-wrap[data-overlay-state="skyLocker"] canvas,
.canvas-wrap[data-overlay-state="album"] canvas {
  height: 540px !important;
}

.canvas-wrap[data-overlay-state="missionMap"] canvas,
.canvas-wrap[data-overlay-state="skyLocker"] canvas,
.canvas-wrap[data-overlay-state="album"] canvas {
  height: 620px !important;
}

canvas {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.overlay {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  padding: 22px;
  text-align: center;
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.78) 38%, rgba(226, 248, 255, 0.72) 72%),
    linear-gradient(180deg, rgba(238, 249, 255, 0.72), rgba(255, 246, 204, 0.7));
  backdrop-filter: blur(2px);
}

.overlay.is-visible {
  display: grid;
}

.overlay::before {
  content: "";
  position: absolute;
  width: min(860px, calc(100% - 34px));
  min-height: min(88%, 500px);
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.42);
  box-shadow: 0 20px 50px rgba(25, 80, 140, 0.14);
}

.overlay > * {
  position: relative;
  z-index: 1;
  max-width: min(780px, 100%);
}

.pip-badge {
  position: relative;
  width: 54px;
  height: 62px;
  margin-bottom: 8px;
}

.pip-head {
  position: absolute;
  top: 0;
  left: 7px;
  width: 40px;
  height: 32px;
  border: 3px solid #30406c;
  border-radius: 14px;
  background: linear-gradient(135deg, #ecfbff, #b9eff8);
  box-shadow: inset 9px 0 rgba(255, 255, 255, 0.46);
}

.pip-head::before,
.pip-head::after {
  content: "";
  position: absolute;
  top: 12px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #30406c;
}

.pip-head::before {
  left: 10px;
}

.pip-head::after {
  right: 10px;
}

.pip-body {
  position: absolute;
  bottom: 0;
  left: 13px;
  width: 29px;
  height: 30px;
  border: 3px solid #30406c;
  border-radius: 12px;
  background: linear-gradient(180deg, #fff3a3, #ffd45a);
}

.overlay-kicker {
  margin-bottom: 6px;
  color: #246778;
  font-size: 0.95rem;
  font-weight: 900;
}

.overlay h2 {
  margin-bottom: 9px;
  color: var(--ink);
  font-size: clamp(1.85rem, 4.8vw, 3.2rem);
  line-height: 1.02;
}

.canvas-wrap[data-overlay-state="missionMap"] .overlay h2,
.canvas-wrap[data-overlay-state="missionBriefing"] .overlay h2 {
  font-size: clamp(1.55rem, 4vw, 2.35rem);
}

.canvas-wrap[data-overlay-state="missionMap"] .pip-badge {
  display: none;
}

.canvas-wrap[data-overlay-state="missionMap"] .overlay,
.canvas-wrap[data-overlay-state="skyLocker"] .overlay,
.canvas-wrap[data-overlay-state="album"] .overlay {
  align-content: start;
  justify-items: center;
  overflow-y: auto;
  padding-top: 28px;
  padding-bottom: 28px;
}

.canvas-wrap[data-overlay-state="missionMap"] .overlay-kicker {
  margin-bottom: 3px;
}

.canvas-wrap[data-overlay-state="missionMap"] .overlay p,
.canvas-wrap[data-overlay-state="album"] .overlay p {
  margin-bottom: 8px;
  font-size: 0.92rem;
  line-height: 1.28;
}

.overlay p {
  width: min(500px, 100%);
  margin-right: auto;
  margin-left: auto;
  color: var(--ink-soft);
  font-size: clamp(0.95rem, 1.8vw, 1.05rem);
  line-height: 1.45;
}

.mission-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: min(500px, 100%);
  margin: 12px auto;
}

.intro-stats {
  width: min(620px, 100%);
}

.mission-map-wrap {
  grid-template-columns: minmax(0, 1.45fr) minmax(220px, 0.9fr);
  align-items: stretch;
  width: min(780px, 100%);
}

.mission-map {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.mission-node {
  display: grid;
  min-height: 76px;
  border-radius: 16px;
  padding: 7px;
  text-align: left;
  white-space: normal;
  box-shadow: 0 8px 18px rgba(39, 97, 153, 0.12);
}

.mission-node[aria-pressed="true"] {
  outline: 4px solid rgba(255, 212, 90, 0.74);
  outline-offset: 1px;
}

.mission-node:disabled {
  cursor: not-allowed;
  opacity: 0.62;
  transform: none;
}

.mission-node[data-state="completed"] {
  background: linear-gradient(180deg, #e6fff4, #ffffff);
  border-color: rgba(69, 196, 134, 0.28);
}

.mission-node[data-state="current"] {
  background: linear-gradient(180deg, #fff4b8, #ffffff);
  border-color: rgba(243, 169, 47, 0.36);
}

.mission-node[data-state="locked"] {
  background: linear-gradient(180deg, #eef4fb, #ffffff);
}

.mission-node[data-zone="sunny-meadows"],
.selected-mission-card[data-zone="sunny-meadows"] {
  border-color: rgba(102, 214, 165, 0.42);
  background: linear-gradient(180deg, #fff8cf, #ffffff);
}

.mission-node[data-zone="rainbow-rapids"],
.selected-mission-card[data-zone="rainbow-rapids"] {
  border-color: rgba(255, 139, 189, 0.42);
  background: linear-gradient(180deg, #f7eaff, #ffffff);
}

.mission-node[data-zone="moonbeam-harbor"],
.selected-mission-card[data-zone="moonbeam-harbor"] {
  border-color: rgba(138, 165, 255, 0.42);
  background: linear-gradient(180deg, #e8edff, #ffffff);
}

.mission-node[data-zone="storm-puff-ridge"],
.selected-mission-card[data-zone="storm-puff-ridge"] {
  border-color: rgba(180, 154, 255, 0.42);
  background: linear-gradient(180deg, #efeaff, #ffffff);
}

.mission-node-number {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  color: #173f8f;
  background: rgba(255, 255, 255, 0.86);
  font-size: 0.9rem;
  font-weight: 950;
}

.mission-node-type {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: max-content;
  max-width: 100%;
  border-radius: 999px;
  padding: 3px 7px;
  color: #173f8f;
  background: rgba(255, 255, 255, 0.82);
  font-size: 0.58rem;
  font-weight: 950;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.mission-node-title {
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 950;
  line-height: 1.08;
}

.mission-node-zone,
.mission-node-reward {
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 850;
  line-height: 1.15;
}

.selected-mission-card {
  display: grid;
  align-content: start;
  gap: 7px;
  border: 1px solid rgba(36, 126, 217, 0.12);
  border-radius: 16px;
  padding: 13px;
  background: rgba(255, 255, 255, 0.82);
  text-align: left;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.selected-mission-card span {
  color: #176d83;
  font-size: 0.72rem;
  font-weight: 950;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.selected-mission-card strong {
  color: var(--ink);
  font-size: 1.02rem;
  line-height: 1.12;
}

.selected-mission-card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.84rem;
  line-height: 1.26;
}

.briefing-stats {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mission-stats span {
  border: 1px solid rgba(36, 126, 217, 0.08);
  border-radius: 13px;
  padding: 9px 11px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  font-weight: 900;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.reward-wrap {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: min(700px, 100%);
}

.reward-panel {
  grid-column: 1 / -1;
  border: 1px solid rgba(243, 169, 47, 0.24);
  border-radius: 14px;
  padding: 12px;
  background: linear-gradient(180deg, rgba(255, 249, 215, 0.92), rgba(255, 255, 255, 0.82));
  text-align: left;
}

.restoration-panel {
  display: grid;
  grid-column: 1 / -1;
  gap: 8px;
  border: 1px solid rgba(21, 152, 168, 0.18);
  border-radius: 14px;
  padding: 12px;
  background: linear-gradient(180deg, rgba(226, 252, 255, 0.94), rgba(255, 255, 255, 0.84));
  text-align: left;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.restoration-panel h3 {
  margin: 0;
  color: var(--ink);
  font-size: 0.9rem;
}

.restoration-panel p {
  width: auto;
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.82rem;
  line-height: 1.3;
}

.restoration-meter {
  overflow: hidden;
  height: 10px;
  border-radius: 999px;
  background: rgba(36, 126, 217, 0.12);
}

.restoration-meter span {
  display: block;
  height: 100%;
  border: 0;
  border-radius: inherit;
  padding: 0;
  background: linear-gradient(90deg, #45c486, #ffd45a);
  box-shadow: none;
}

.reward-panel h3,
.locker-section h3 {
  margin: 0 0 7px;
  color: var(--ink);
  font-size: 0.9rem;
}

.reward-panel p {
  width: auto;
  margin: 0 0 9px;
  font-size: 0.84rem;
}

.reward-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.reward-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border-color: rgba(21, 152, 168, 0.18);
  background: rgba(255, 255, 255, 0.84);
  font-size: 0.78rem;
}

.reward-chip[data-new="true"] {
  border-color: rgba(243, 169, 47, 0.4);
  background: linear-gradient(180deg, #fff4b8, #ffffff);
}

.sky-locker {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: min(780px, 100%);
  text-align: left;
}

.album-wrap {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: min(820px, 100%);
  text-align: left;
}

.album-zone {
  display: grid;
  gap: 9px;
  border: 1px solid rgba(36, 126, 217, 0.12);
  border-radius: 14px;
  padding: 11px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.74);
}

.album-zone[data-zone="sunny-meadows"] {
  background: linear-gradient(180deg, #fff8cf, rgba(255, 255, 255, 0.86));
}

.album-zone[data-zone="rainbow-rapids"] {
  background: linear-gradient(180deg, #f7eaff, rgba(255, 255, 255, 0.86));
}

.album-zone[data-zone="moonbeam-harbor"] {
  background: linear-gradient(180deg, #e8edff, rgba(255, 255, 255, 0.88));
}

.album-zone[data-zone="storm-puff-ridge"] {
  background: linear-gradient(180deg, #efeaff, rgba(255, 255, 255, 0.88));
}

.album-zone-header {
  display: grid;
  gap: 2px;
}

.album-zone-header h3 {
  margin: 0;
  color: var(--ink);
  font-size: 0.95rem;
}

.album-zone-header p,
.postcard-card p,
.critter-card p {
  width: auto;
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.76rem;
  line-height: 1.24;
}

.postcard-card {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  border: 1px solid rgba(243, 169, 47, 0.18);
  border-radius: 12px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.postcard-card[data-state="locked"] {
  opacity: 0.72;
}

.postcard-card strong {
  display: block;
  color: var(--ink);
  font-size: 0.8rem;
}

.postcard-art {
  position: relative;
  overflow: hidden;
  height: 42px;
  border: 2px solid rgba(255, 255, 255, 0.88);
  border-radius: 8px;
  background: linear-gradient(180deg, #8fd8ff, #fff4b8);
  box-shadow: 0 0 0 1px rgba(17, 28, 70, 0.14);
}

.postcard-card[data-zone="rainbow-rapids"] .postcard-art {
  background: linear-gradient(135deg, #8fd8ff, #ff8bbd 58%, #fff4b8);
}

.postcard-card[data-zone="moonbeam-harbor"] .postcard-art {
  background: linear-gradient(180deg, #415189, #8aa5ff);
}

.postcard-card[data-zone="storm-puff-ridge"] .postcard-art {
  background: linear-gradient(180deg, #6f7fb1, #efeaff);
}

.postcard-art span {
  position: absolute;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
}

.postcard-art span:nth-child(1) {
  right: 7px;
  top: 6px;
  width: 14px;
  height: 14px;
}

.postcard-art span:nth-child(2) {
  left: 6px;
  bottom: 6px;
  width: 36px;
  height: 11px;
}

.postcard-art span:nth-child(3) {
  left: 24px;
  bottom: 12px;
  width: 44px;
  height: 14px;
}

.album-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.critter-card {
  display: grid;
  gap: 5px;
  min-width: 0;
  border: 1px solid rgba(36, 126, 217, 0.1);
  border-radius: 12px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.82);
}

.critter-card[data-state="mystery"] {
  filter: saturate(0.74);
  opacity: 0.78;
}

.critter-card strong {
  color: var(--ink);
  font-size: 0.78rem;
  line-height: 1.1;
}

.critter-card em {
  color: #176d83;
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 900;
}

.critter-art {
  position: relative;
  width: 46px;
  height: 40px;
  margin: 0 auto;
}

.critter-ear,
.critter-face,
.critter-mark {
  position: absolute;
  display: block;
}

.critter-ear {
  top: 1px;
  width: 12px;
  height: 20px;
  border: 2px solid #526084;
  border-radius: 999px;
  background: var(--critter-fill);
}

.critter-ear.left {
  left: 8px;
  transform: rotate(-22deg);
}

.critter-ear.right {
  right: 8px;
  transform: rotate(22deg);
}

.critter-face {
  left: 6px;
  bottom: 0;
  width: 34px;
  height: 31px;
  border: 2px solid #526084;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 28%, #ffffff 0 7px, var(--critter-fill) 8px);
}

.critter-face::before,
.critter-face::after {
  content: "";
  position: absolute;
  top: 12px;
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: #26345f;
}

.critter-face::before {
  left: 9px;
}

.critter-face::after {
  right: 9px;
}

.critter-mark {
  left: 19px;
  top: 8px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--critter-accent);
  box-shadow: 8px 15px 0 -5px var(--critter-accent), -8px 15px 0 -5px var(--critter-accent);
}

.critter-card[data-trait="bolt"] .critter-mark {
  width: 7px;
  height: 18px;
  border-radius: 1px;
  clip-path: polygon(52% 0, 100% 0, 62% 44%, 100% 44%, 36% 100%, 52% 55%, 8% 55%);
}

.album-wrap span {
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

.locker-note {
  display: grid;
  gap: 5px;
  border: 1px solid rgba(21, 152, 168, 0.16);
  border-radius: 14px;
  padding: 10px;
  background: linear-gradient(180deg, rgba(233, 255, 248, 0.9), rgba(255, 255, 255, 0.82));
}

.locker-note h3,
.locker-note p,
.locker-section h3,
.locker-section p {
  margin: 0;
}

.locker-note p,
.locker-section p {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.25;
}

.locker-section {
  display: grid;
  gap: 7px;
  border: 1px solid rgba(36, 126, 217, 0.1);
  border-radius: 14px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.72);
}

.locker-grid {
  display: grid;
  gap: 6px;
}

.locker-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 8px;
  align-items: center;
  min-height: 44px;
  border: 1px solid rgba(36, 126, 217, 0.1);
  border-radius: 12px;
  padding: 7px 9px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: none;
  text-align: left;
}

.locker-item strong,
.locker-item span:not(.locker-swatch) {
  min-width: 0;
}

.locker-item strong {
  color: var(--ink);
  font-size: 0.78rem;
  line-height: 1.14;
}

.locker-item span:not(.locker-swatch) {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 850;
  line-height: 1.14;
}

.locker-swatch {
  grid-row: span 2;
  width: 24px;
  height: 24px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  box-shadow: 0 0 0 1px rgba(17, 28, 70, 0.16);
}

.locker-item[data-state="selected"] {
  border-color: rgba(243, 169, 47, 0.45);
  background: linear-gradient(180deg, #fff4b8, #ffffff);
}

.locker-item[data-state="locked"] {
  opacity: 0.68;
}

.overlay-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.primary-btn {
  color: #17213d;
  background: linear-gradient(180deg, #ffe982, #ffc247);
  font-weight: 950;
  box-shadow: 0 12px 24px rgba(202, 132, 27, 0.2);
}

.quiet-btn {
  background: rgba(255, 255, 255, 0.58);
  box-shadow: none;
}

.touch-pad {
  display: none;
  position: absolute;
  right: max(12px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom));
  left: max(12px, env(safe-area-inset-left));
  z-index: 4;
  grid-template-columns: 58px 58px 58px minmax(8px, 1fr) minmax(82px, 112px);
  grid-template-areas:
    ". up . . ability"
    "left . right . ability"
    ". down . . ability";
  gap: 7px;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 20px;
  padding: 8px;
  background: linear-gradient(180deg, rgba(238, 249, 255, 0.18), rgba(16, 55, 95, 0.18));
  pointer-events: auto;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
}

.touch-pad button {
  min-width: 0;
  min-height: 54px;
  border: 1px solid rgba(17, 28, 70, 0.12);
  border-radius: 999px;
  padding: 8px;
  color: #13234a;
  font-weight: 950;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(229, 247, 255, 0.88));
  box-shadow: 0 8px 18px rgba(17, 45, 87, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.8);
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
}

.touch-pad [data-touch="up"] {
  grid-area: up;
}

.touch-pad [data-touch="left"] {
  grid-area: left;
}

.touch-pad [data-touch="right"] {
  grid-area: right;
}

.touch-pad [data-touch="down"] {
  grid-area: down;
}

.touch-ability {
  grid-area: ability;
  min-height: 100%;
  border-radius: 18px !important;
  color: #17213d;
  background: linear-gradient(180deg, #ffe982, #ffc247) !important;
}

.canvas-wrap[data-overlay-state]:not([data-overlay-state="playing"]) > .touch-pad {
  display: none !important;
}

.control-hint {
  position: relative;
  z-index: 1;
  margin: 8px 0 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 850;
  text-align: center;
}

.help-panel {
  display: grid;
  gap: 10px;
}

.panel-card,
.noscript {
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}

.panel-card {
  padding: 16px;
}

.panel-card h2 {
  margin-bottom: 7px;
  color: var(--ink);
  font-size: 1rem;
}

.panel-card p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.48;
}

.panel-card p + p {
  margin-top: 9px;
}

.key-line {
  border-top: 1px solid var(--line);
  padding-top: 9px;
  color: var(--ink-soft) !important;
  font-weight: 800;
}

.parent-note {
  background: rgba(255, 250, 221, 0.82);
}

.noscript {
  margin-top: 16px;
  padding: 18px;
  color: var(--ink);
  font-weight: 800;
  text-align: center;
}

@media (pointer: coarse) {
  .touch-pad {
    display: grid;
  }
}

@media (max-width: 1100px) {
  .page-header {
    grid-template-columns: 1fr;
    gap: 8px;
    text-align: center;
  }

  .trust-row {
    justify-content: center;
  }

  .game-layout {
    grid-template-columns: 1fr;
  }

  .help-panel {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .page-shell {
    width: min(100% - 20px, var(--page-max));
    padding-top: 12px;
  }

  .page-header {
    margin-bottom: 10px;
  }

  h1 {
    font-size: clamp(2rem, 12vw, 3.4rem);
  }

  .stage-topline {
    align-items: flex-start;
  }

  .stage-actions {
    max-width: 230px;
  }

  .hud {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .help-panel {
    grid-template-columns: 1fr;
  }

  .touch-pad {
    display: grid;
  }
}

@media (max-width: 560px) {
  .page-shell {
    width: 100%;
    max-width: var(--page-max);
    overflow-x: hidden;
    padding: 8px max(7px, env(safe-area-inset-right)) 32px max(7px, env(safe-area-inset-left));
  }

  .back-link {
    font-size: 0.9rem;
  }

  .eyebrow {
    font-size: 0.7rem;
  }

  h1 {
    max-width: 280px;
    margin-right: auto;
    margin-left: auto;
    font-size: clamp(1.45rem, 7.4vw, 1.8rem);
    line-height: 1.02;
    text-wrap: balance;
    overflow-wrap: anywhere;
  }

  .intro {
    max-width: 330px;
    margin: 0 auto;
    font-size: 0.95rem;
  }

  .trust-row {
    gap: 5px;
  }

  .trust-row span {
    min-height: 28px;
    padding: 5px 8px;
    font-size: 0.72rem;
  }

  .game-card {
    display: flex;
    flex-direction: column;
    width: calc(100% - 14px);
    min-width: 0;
    margin-right: auto;
    margin-left: auto;
    border-radius: 18px;
    padding: 10px;
  }

  .stage-topline {
    display: block;
    order: 1;
  }

  .stage-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: stretch;
    justify-items: stretch;
    width: 100%;
    max-width: none;
    margin-top: 8px;
  }

  .stage-actions button {
    min-width: 0;
    min-height: 42px;
    padding: 8px 7px;
    font-size: 0.76rem;
    line-height: 1.05;
    white-space: normal;
  }

  .hud {
    order: 3;
    grid-template-columns: 1.1fr 0.7fr 1.2fr;
    gap: 5px;
    margin: 7px 0 8px;
  }

  .ability-panel {
    display: none;
  }

  .hud-pill-score,
  .hud-pill-stars,
  .hud-pill-power {
    display: none;
  }

  .hud-pill {
    padding: 6px 7px;
  }

  .hud-pill span {
    font-size: 0.58rem;
  }

  .hud-pill strong {
    font-size: 0.76rem;
  }

  .canvas-wrap {
    order: 4;
    border-radius: 14px;
  }

  .canvas-wrap[data-overlay-state="missionMap"],
  .canvas-wrap[data-overlay-state="missionBriefing"],
  .canvas-wrap[data-overlay-state="skyLocker"],
  .canvas-wrap[data-overlay-state="album"] {
    min-height: 720px;
  }

  .canvas-wrap[data-overlay-state="missionMap"] canvas,
  .canvas-wrap[data-overlay-state="missionBriefing"] canvas,
  .canvas-wrap[data-overlay-state="skyLocker"] canvas,
  .canvas-wrap[data-overlay-state="album"] canvas {
    height: 720px !important;
  }

  .canvas-wrap[data-overlay-state="missionMap"] .overlay,
  .canvas-wrap[data-overlay-state="missionBriefing"] .overlay,
  .canvas-wrap[data-overlay-state="skyLocker"] .overlay,
  .canvas-wrap[data-overlay-state="album"] .overlay {
    align-content: start;
    justify-items: center;
    place-items: start center;
    overflow-y: auto;
    padding-top: 14px;
    padding-bottom: 14px;
  }

  .stage-objective {
    order: 2;
    margin-bottom: 8px;
    padding: 8px 10px;
  }

  .stage-objective span {
    font-size: 0.58rem;
  }

  .stage-objective strong {
    font-size: 0.82rem;
  }

  .overlay {
    padding: 10px;
  }

  .overlay::before {
    width: calc(100% - 20px);
    min-height: calc(100% - 20px);
    border-radius: 18px;
  }

  .pip-badge {
    display: none;
  }

  .overlay-kicker {
    margin-bottom: 4px;
    font-size: 0.78rem;
  }

  .overlay h2 {
    margin-bottom: 5px;
    font-size: clamp(1.28rem, 7vw, 1.72rem);
  }

  .canvas-wrap[data-overlay-state="missionMap"] .overlay h2,
  .canvas-wrap[data-overlay-state="missionBriefing"] .overlay h2,
  .canvas-wrap[data-overlay-state="album"] .overlay h2 {
    font-size: clamp(1.35rem, 7vw, 1.8rem);
  }

  .canvas-wrap[data-overlay-state="missionMap"] .overlay > p,
  .canvas-wrap[data-overlay-state="album"] .overlay > p {
    display: none;
  }

  .overlay p {
    display: block;
    width: min(100%, 300px);
    margin-bottom: 8px;
    font-size: 0.8rem;
    line-height: 1.28;
  }

  .mission-stats {
    display: none;
  }

  .intro-stats,
  .mission-map-wrap,
  .briefing-stats,
  .sky-locker,
  .album-wrap,
  .reward-wrap {
    display: grid;
    grid-template-columns: 1fr;
    gap: 7px;
    max-height: none;
    overflow-y: auto;
    padding-right: 2px;
  }

  .sky-locker,
  .album-wrap {
    max-height: 470px;
  }

  .album-grid {
    grid-template-columns: 1fr;
  }

  .album-zone {
    padding: 9px;
  }

  .postcard-card {
    grid-template-columns: 58px minmax(0, 1fr);
  }

  .reward-wrap {
    max-height: 520px;
  }

  .reward-panel {
    padding: 9px;
  }

  .locker-section {
    padding: 8px;
  }

  .locker-grid {
    gap: 5px;
  }

  .locker-item {
    min-height: 42px;
    padding: 6px 8px;
  }

  .mission-map {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .mission-node {
    min-height: 86px;
    border-radius: 13px;
    padding: 8px;
  }

  .mission-node-number {
    width: 24px;
    height: 24px;
    font-size: 0.78rem;
  }

  .mission-node-title {
    font-size: 0.74rem;
  }

  .mission-node-zone,
  .mission-node-reward,
  .selected-mission-card p {
    font-size: 0.68rem;
  }

  .selected-mission-card {
    padding: 9px;
  }

  .overlay-actions button {
    width: 100%;
    min-width: 0;
    min-height: 38px;
    padding: 8px 11px;
    font-size: 0.78rem;
    line-height: 1.08;
  }

  .overlay-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: min(100%, 320px);
    gap: 7px;
  }

  .overlay-actions .primary-btn {
    grid-column: 1 / -1;
  }

  .touch-pad {
    position: relative;
    right: auto;
    bottom: auto;
    left: auto;
    grid-template-columns: 50px 50px 50px minmax(4px, 1fr) minmax(76px, 96px);
    grid-template-areas:
      ". up . . ability"
      "left . right . ability"
      ". down . . ability";
    gap: 5px;
    margin: -1px 0 0;
    padding: 7px;
    border-width: 1px 0 0;
    border-radius: 0;
    background: linear-gradient(180deg, rgba(238, 249, 255, 0.82), rgba(222, 245, 255, 0.94));
  }

  .touch-pad button {
    min-height: 48px;
    padding: 6px;
    font-size: 0.75rem;
  }

  .touch-ability {
    grid-column: auto;
    font-size: 0.72rem !important;
    line-height: 1.05;
  }

  .control-hint {
    display: none;
  }

  .help-panel {
    display: none;
  }
}

@media (max-height: 760px) and (min-width: 900px) {
  .page-shell {
    padding-top: 10px;
  }

  .page-header {
    grid-template-columns: auto minmax(0, 1fr) auto;
    margin-bottom: 10px;
  }

  h1 {
    font-size: clamp(2rem, 4vw, 3.05rem);
  }

  .intro {
    font-size: 0.98rem;
  }

  .panel-card {
    padding: 13px;
  }
}

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

  button:hover,
  button:active {
    transform: none;
  }
}
