:root {
  color-scheme: dark;
  --ink: #f7f4e8;
  --muted: #c2c7bd;
  --quiet: #88948c;
  --panel: rgba(12, 24, 25, 0.88);
  --panel-solid: #102123;
  --line: rgba(222, 231, 211, 0.2);
  --leaf: #9bdc8d;
  --cyan: #8ce3d1;
  --amber: #ffc56d;
  --rust: #d77a43;
  --danger: #ff9b80;
  --green: var(--leaf);
  --red: var(--danger);
  --safe-top: max(14px, env(safe-area-inset-top));
  --safe-right: max(14px, env(safe-area-inset-right));
  --safe-bottom: max(14px, env(safe-area-inset-bottom));
  --safe-left: max(14px, env(safe-area-inset-left));
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #071416;
  color: var(--ink);
}

button,
select,
input { font: inherit; }

button,
a { -webkit-tap-highlight-color: transparent; }

button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 3px;
}

canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.boss-render-canvas {
  z-index: 0;
  visibility: hidden;
  pointer-events: none;
}

.boss-render-canvas.is-active { visibility: visible; }

#archipelago-canvas.is-boss-render-hidden { visibility: hidden; }

[hidden] { display: none !important; }

.screen {
  position: fixed;
  inset: 0;
  z-index: 20;
}

.eyebrow {
  display: block;
  margin: 0 0 0.45rem;
  color: var(--cyan);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  line-height: 1.25;
  text-transform: uppercase;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(14px);
}

.button,
.icon-button,
.interaction-panel button,
.choice-buttons button,
.island-card button,
.mobile-controls button {
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
  font-weight: 750;
}

.button {
  min-height: 46px;
  padding: 0.75rem 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.button:hover,
.icon-button:hover,
.island-card button:hover { background: rgba(255, 255, 255, 0.15); }

.button-primary {
  border-color: rgba(255, 197, 109, 0.65);
  color: #16201d;
  background: linear-gradient(180deg, #ffe0a5, #f5b85f);
}

.button-primary:hover { background: linear-gradient(180deg, #ffebc2, #ffc66f); }
.button-arcade { border-color: rgba(255, 194, 71, 0.7); color: #fff3bd; background: linear-gradient(155deg, rgba(213, 104, 31, 0.48), rgba(39, 167, 157, 0.28)); }
.button-arcade:hover { background: linear-gradient(155deg, rgba(241, 133, 38, 0.64), rgba(48, 204, 188, 0.38)); }
.button-secondary { border-color: rgba(140, 227, 209, 0.4); }
.button-text { border-color: transparent; background: transparent; color: var(--cyan); }
.button-danger { border-color: rgba(255, 155, 128, 0.48); color: #ffd4c8; background: rgba(122, 33, 19, 0.35); }
.button-row { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.stacked-actions { display: grid; gap: 0.7rem; }

.render-preflight-screen {
  display: grid;
  place-items: center;
  overflow: auto;
  padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  background: #0b1b1d;
}

.render-preflight-card {
  width: min(980px, 100%);
  padding: clamp(1.1rem, 3vw, 2.2rem);
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #102123;
  box-shadow: 0 20px 64px rgba(0, 0, 0, 0.32);
}

.render-preflight-card > header { max-width: 720px; }
.render-preflight-card h1 { margin: 0.25rem 0 0.7rem; font: 650 clamp(2rem, 5vw, 3.6rem)/1 ui-serif, Georgia, serif; }
.render-preflight-card header > p:last-child { margin: 0; color: var(--muted); line-height: 1.55; }

.render-profile-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
  margin-top: 1.6rem;
}

.render-profile-option,
.render-compatibility-option {
  border: 1px solid var(--line);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.035);
  cursor: pointer;
  text-align: left;
}

.render-profile-option {
  min-height: 190px;
  padding: 1rem;
  border-radius: 14px;
}

.render-profile-option:hover,
.render-compatibility-option:hover { border-color: rgba(140, 227, 209, 0.58); background: rgba(140, 227, 209, 0.07); }
.render-profile-option.is-recommended { border-color: rgba(255, 197, 109, 0.56); }
.render-profile-option > span { display: block; min-height: 1.25rem; color: var(--cyan); font-size: 0.68rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.render-profile-option.is-recommended > span { color: var(--amber); }
.render-profile-option strong { display: block; margin: 0.7rem 0 0.55rem; font: 650 1.35rem/1.1 ui-serif, Georgia, serif; }
.render-profile-option small,
.render-compatibility-option small { display: block; color: var(--muted); font-size: 0.82rem; line-height: 1.45; }
.render-profile-option:disabled,
.render-compatibility-option:disabled { cursor: wait; opacity: 0.62; }

.render-compatibility-option {
  width: 100%;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.8rem;
  padding: 0.8rem 1rem;
  border-radius: 12px;
}

.render-compatibility-option strong { display: block; margin-bottom: 0.2rem; }
.render-compatibility-option b { flex: 0 0 auto; color: var(--cyan); font-size: 0.8rem; }
.render-preflight-note { margin: 1rem 0 0; color: var(--quiet); font-size: 0.78rem; }

.loading-screen {
  display: grid;
  place-items: center;
  padding: 1rem;
  background:
    radial-gradient(circle at 50% 70%, rgba(56, 109, 91, 0.28), transparent 42%),
    linear-gradient(160deg, #081719, #102627 55%, #071416);
}

.loading-card {
  width: min(460px, 100%);
  text-align: center;
}

.loading-card h1 { margin: 0.4rem 0; font: 650 clamp(1.8rem, 5vw, 3rem)/1.05 ui-serif, Georgia, serif; }
.loading-card p { color: var(--muted); }

.loading-orbit {
  position: relative;
  width: 84px;
  height: 84px;
  margin: 0 auto 1.3rem;
  border: 1px solid rgba(140, 227, 209, 0.25);
  border-radius: 50%;
  animation: slow-spin 9s linear infinite;
}

.loading-orbit span {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--leaf);
  box-shadow: 0 0 22px rgba(155, 220, 141, 0.5);
}

.loading-orbit span:nth-child(1) { left: 4px; top: 40px; }
.loading-orbit span:nth-child(2) { right: 8px; top: 12px; background: var(--amber); }
.loading-orbit span:nth-child(3) { right: 1px; bottom: 8px; background: var(--cyan); }

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

.progress,
.quest-progress,
.recall-progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
}

.progress span,
.quest-progress span,
.recall-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--amber));
  transition: width 240ms ease;
}

.loading-count { font-size: 0.8rem; }

.intro-screen {
  display: flex;
  align-items: center;
  padding: clamp(1.2rem, 6vw, 5rem);
  background: linear-gradient(90deg, rgba(4, 13, 15, 0.9) 0%, rgba(4, 13, 15, 0.62) 48%, rgba(4, 13, 15, 0.1) 80%);
}

.intro-vignette { position: absolute; inset: 0; background: linear-gradient(0deg, rgba(2, 9, 10, 0.64), transparent 44%); pointer-events: none; }
.intro-copy { position: relative; width: min(650px, 100%); }
.intro-copy h1 { margin: 0 0 1rem; max-width: 620px; font: 650 clamp(2.6rem, 7vw, 5.4rem)/0.96 ui-serif, Georgia, serif; letter-spacing: -0.045em; }
.intro-deck { max-width: 600px; margin: 0 0 1.4rem; color: var(--muted); font-size: clamp(1rem, 2vw, 1.25rem); line-height: 1.55; }

.daily-preview {
  width: min(540px, 100%);
  margin-bottom: 1.25rem;
  padding: 1rem 1.1rem;
  border-left: 3px solid var(--amber);
  background: rgba(10, 28, 27, 0.68);
}

.daily-preview span { display: block; color: var(--amber); font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.12em; }
.daily-preview strong { display: block; margin: 0.3rem 0; font-size: 1.25rem; }
.daily-preview p { margin: 0; color: var(--muted); }
.version-links { display: flex; flex-wrap: wrap; gap: 0.8rem 1rem; margin-top: 1.2rem; color: var(--quiet); font-size: 0.84rem; }
.version-links a { color: var(--cyan); }

.hud-top {
  position: fixed;
  z-index: 5;
  top: var(--safe-top);
  left: var(--safe-left);
  right: var(--safe-right);
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  pointer-events: none;
}

.brand-panel,
.condition-panel { min-height: 56px; padding: 0.65rem 0.8rem; pointer-events: auto; }
.brand-panel { width: 160px; }
.brand-panel strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.condition-panel { display: flex; align-items: center; gap: 1rem; color: var(--muted); font-size: 0.78rem; }
.condition-panel b { color: var(--ink); }
.hud-buttons { margin-left: auto; display: flex; gap: 0.4rem; pointer-events: auto; }
.icon-button { min-height: 44px; padding: 0.55rem 0.75rem; background: var(--panel); backdrop-filter: blur(14px); }
.icon-button b { color: var(--amber); }

.quest-panel {
  position: fixed;
  z-index: 5;
  top: calc(var(--safe-top) + 72px);
  left: var(--safe-left);
  width: min(330px, calc(100vw - 28px));
  padding: 0.9rem 1rem;
}

.quest-panel h2 { margin: 0 0 0.35rem; font: 650 1.25rem/1.15 ui-serif, Georgia, serif; }
.quest-panel p:not(.eyebrow) { margin: 0 0 0.8rem; color: var(--muted); font-size: 0.88rem; line-height: 1.4; }
.quest-panel small { display: block; margin-top: 0.4rem; color: var(--quiet); }

.arcade-hud {
  position: fixed;
  z-index: 6;
  top: calc(var(--safe-top) + 72px);
  left: var(--safe-left);
  width: min(360px, calc(100vw - 28px));
  padding: 0.85rem 1rem;
  border-top: 3px solid var(--amber);
}
.arcade-hud strong { display: block; font: 650 1.12rem/1.2 ui-serif, Georgia, serif; }
.arcade-counters { display: flex; justify-content: space-between; gap: 1rem; margin-top: 0.7rem; }
.coin-counter { color: var(--amber); font-size: 1.05rem; }
.coin-counter b { font-size: 1.35rem; }
.heart-counter { display: flex; align-items: center; gap: 0.32rem; min-height: 30px; }
.heart-counter i { color: #ff647f; font: normal 1.65rem/1 system-ui, sans-serif; text-shadow: 0 0 12px rgba(255, 77, 128, 0.72); transform-origin: center; }
.heart-counter i.is-empty { color: rgba(255, 255, 255, 0.16); text-shadow: none; }
.heart-counter i.is-hit { animation: heart-hit 420ms ease-out; }
@keyframes heart-hit {
  0% { transform: scale(1); filter: brightness(1); }
  35% { transform: scale(1.55) rotate(-12deg); filter: brightness(2.2); }
  100% { transform: scale(1); filter: brightness(1); }
}
.boss-meter { display: grid; grid-template-columns: 1fr auto; gap: 0.45rem; align-items: center; margin-top: 0.7rem; padding-top: 0.6rem; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.78rem; }
.boss-meter div { display: flex; gap: 0.38rem; }
.boss-meter i { width: 28px; height: 9px; border-radius: 999px; background: var(--rust); box-shadow: 0 0 9px rgba(215, 122, 67, 0.5); }
.boss-meter i.is-repaired { background: var(--cyan); box-shadow: 0 0 12px rgba(88, 244, 228, 0.75); }
.arcade-channel { margin-top: 0.65rem; padding-top: 0.6rem; border-top: 1px solid var(--line); color: var(--cyan); font-size: 0.76rem; }
.arcade-channel > div { height: 9px; margin-top: 0.38rem; overflow: hidden; border: 1px solid rgba(88, 244, 228, 0.5); border-radius: 999px; background: rgba(4, 15, 16, 0.82); }
.arcade-channel i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--cyan), var(--amber)); box-shadow: 0 0 14px rgba(88, 244, 228, 0.75); transition: width 80ms linear; }

.arcade-card { width: min(760px, 100%); }
.arcade-card > h2 { margin: 0 0 1rem; font: 650 clamp(2rem, 5vw, 3.4rem)/1 ui-serif, Georgia, serif; }
.tutorial-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.8rem; margin: 1.2rem 0 1.4rem; }
.tutorial-grid article { position: relative; min-height: 190px; padding: 1rem; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,0.035); }
.tutorial-grid article > b { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; color: #241607; background: var(--amber); }
.tutorial-grid h3 { margin: 1rem 0 0.4rem; }
.tutorial-grid p { margin: 0; color: var(--muted); line-height: 1.45; }
.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.7rem; margin: 1.2rem 0; }
.result-stats div { padding: 1rem; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,0.035); }
.result-stats dt { color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; }
.result-stats dd { margin: 0.35rem 0 0; color: var(--amber); font: 650 1.8rem/1 ui-serif, Georgia, serif; }

.interaction-panel {
  position: fixed;
  z-index: 6;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 38px);
  width: min(390px, calc(100vw - 28px));
  padding: 0.75rem;
  transform: translateX(-50%);
  text-align: center;
}

.interaction-panel span { display: block; margin-bottom: 0.45rem; color: var(--muted); font-size: 0.8rem; }
.interaction-panel button { width: 100%; min-height: 44px; border-color: rgba(255, 197, 109, 0.52); background: rgba(255, 197, 109, 0.16); }
.interaction-panel small { display: block; margin-top: 0.35rem; color: var(--quiet); }

.choice-panel {
  position: fixed;
  z-index: 12;
  top: 50%;
  left: 50%;
  width: min(520px, calc(100vw - 28px));
  padding: 1.25rem;
  transform: translate(-50%, -50%);
}

.choice-panel h2 { margin: 0 0 0.5rem; font: 650 1.8rem/1.1 ui-serif, Georgia, serif; }
.choice-panel p:not(.eyebrow) { color: var(--muted); }
.choice-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.choice-buttons button { min-height: 62px; padding: 0.8rem; border-color: rgba(140, 227, 209, 0.42); }

.toast {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 18px);
  max-width: min(640px, calc(100vw - 28px));
  margin: 0;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(255, 197, 109, 0.45);
  border-radius: 12px;
  color: #fff6df;
  background: rgba(39, 29, 14, 0.94);
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
}

.desktop-help { position: fixed; z-index: 4; right: var(--safe-right); bottom: var(--safe-bottom); margin: 0; color: rgba(255, 255, 255, 0.58); font-size: 0.72rem; text-shadow: 0 1px 4px #000; }
.recall-panel { position: fixed; z-index: 7; left: 50%; top: 44%; width: min(320px, calc(100vw - 28px)); padding: 0.8rem; transform: translate(-50%, -50%); text-align: center; }
.recall-panel span { display: block; margin-bottom: 0.5rem; }

.card-screen {
  display: grid;
  place-items: center;
  padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  background: rgba(3, 10, 11, 0.76);
  backdrop-filter: blur(12px);
}

.vault-cutscene { display: grid; place-items: center; padding: max(1rem, env(safe-area-inset-top)); background: #03090a; }
.vault-cutscene-card { position: relative; width: min(1180px, 100%); max-height: calc(100vh - 2rem); overflow: hidden auto; border: 1px solid rgba(88, 244, 228, 0.34); border-radius: 20px; background: #071313; box-shadow: 0 32px 100px rgba(0,0,0,0.72); }
.vault-cutscene-card img { display: block; width: 100%; max-height: 72vh; object-fit: cover; }
.vault-cutscene-copy { position: absolute; inset: auto 0 0; padding: clamp(1rem, 4vw, 2.2rem); background: linear-gradient(transparent, rgba(3, 12, 13, 0.96) 28%); }
.vault-cutscene-copy h2 { max-width: 720px; margin: 0 0 0.5rem; font: 650 clamp(2rem, 5vw, 4rem)/1 ui-serif, Georgia, serif; }
.vault-cutscene-copy p:not(.eyebrow) { max-width: 660px; margin: 0 0 1rem; color: var(--muted); }

.boss-portal-screen {
  display: grid;
  place-items: center;
  padding: max(1.25rem, env(safe-area-inset-top)) max(1.25rem, env(safe-area-inset-right)) max(1.25rem, env(safe-area-inset-bottom)) max(1.25rem, env(safe-area-inset-left));
  background: #020a0c;
}
.boss-portal-copy { width: min(620px, 100%); text-align: center; }
.boss-portal-copy h2 { margin: 1rem 0 0.55rem; color: #fff8df; font: 650 clamp(2rem, 6vw, 4rem)/1 ui-serif, Georgia, serif; }
.boss-portal-copy > p:not(.eyebrow) { max-width: 520px; margin: 0 auto; color: #c6d8d5; line-height: 1.55; }
.boss-portal-window { position: relative; width: min(42vw, 360px); min-width: 220px; aspect-ratio: 1; margin: 1.2rem auto 0; border-radius: 50%; }
.boss-portal-ring { position: absolute; border: 2px solid rgba(88, 244, 228, 0.72); border-radius: 50%; box-shadow: inset 0 0 34px rgba(88, 244, 228, 0.1), 0 0 28px rgba(88, 244, 228, 0.12); }
.boss-portal-ring::before,
.boss-portal-ring::after { content: ""; position: absolute; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: #ffc56d; box-shadow: 0 0 18px rgba(255, 197, 109, 0.82); }
.boss-portal-ring::before { left: 9%; top: 20%; }
.boss-portal-ring::after { right: 12%; bottom: 16%; }
.boss-portal-ring-outer { inset: 0; border-style: dashed; animation: boss-portal-spin 6s linear infinite; }
.boss-portal-ring-middle { inset: 13%; border-color: rgba(255, 197, 109, 0.62); animation: boss-portal-spin-reverse 4.2s linear infinite; }
.boss-portal-ring-inner { inset: 27%; animation: boss-portal-pulse 1.15s ease-in-out infinite alternate; }
.boss-portal-path { position: absolute; inset: 39%; border: 2px solid rgba(255, 248, 223, 0.72); border-radius: 50%; box-shadow: 0 0 42px rgba(88, 244, 228, 0.36); }
.boss-portal-mote { position: absolute; left: calc(50% - 0.42rem); top: calc(50% - 0.42rem); width: 0.84rem; height: 0.84rem; border-radius: 50%; background: #fff8df; box-shadow: 0 0 26px 8px rgba(88, 244, 228, 0.64); animation: boss-portal-mote 1.1s ease-in-out infinite alternate; }
.boss-portal-progress { width: min(320px, 70vw); height: 3px; margin: 1.25rem auto 0; overflow: hidden; background: rgba(255,255,255,0.12); }
.boss-portal-progress span { display: block; width: 44%; height: 100%; background: #58f4e4; animation: boss-portal-progress 1.25s ease-in-out infinite; }
body[data-boss-portal="ready"] .boss-portal-ring,
body[data-boss-portal="safe-direct"] .boss-portal-ring { border-color: rgba(255, 197, 109, 0.82); }
@keyframes boss-portal-spin { to { transform: rotate(360deg); } }
@keyframes boss-portal-spin-reverse { to { transform: rotate(-360deg); } }
@keyframes boss-portal-pulse { from { transform: scale(0.94); opacity: 0.65; } to { transform: scale(1.04); opacity: 1; } }
@keyframes boss-portal-mote { from { transform: translate(-22px, 14px) scale(0.72); } to { transform: translate(20px, -16px) scale(1.08); } }
@keyframes boss-portal-progress { from { transform: translateX(-120%); } to { transform: translateX(280%); } }

.screen-card {
  width: min(980px, 100%);
  max-height: min(88vh, 820px);
  overflow: auto;
  padding: clamp(1rem, 3vw, 2rem);
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(160deg, rgba(20, 44, 43, 0.98), rgba(10, 26, 28, 0.99));
  box-shadow: 0 32px 90px rgba(0, 0, 0, 0.5);
}

.arcade-outcome-card {
  width: min(1180px, 100%);
  max-height: calc(100dvh - 2rem);
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.75fr);
  overflow: hidden auto;
  padding: 0;
  border-color: rgba(88, 244, 228, 0.34);
}
.arcade-outcome-art { min-width: 0; min-height: 520px; margin: 0; background: #061416; }
.arcade-outcome-art img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center; }
.arcade-outcome-copy { min-width: 0; align-self: center; padding: clamp(1.2rem, 3vw, 2.4rem); }
.arcade-outcome-copy h2 { margin: 0 0 0.7rem; font: 650 clamp(1.9rem, 3vw, 3rem)/1.02 ui-serif, Georgia, serif; }
.arcade-outcome-copy > p:not(.eyebrow) { margin: 0 0 1.2rem; color: var(--muted); line-height: 1.5; }
.arcade-outcome-defeat { border-color: rgba(255, 197, 109, 0.34); }

.compact-card { width: min(430px, 100%); }
.screen-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.screen-heading h2,
.compact-card h2 { margin: 0; font: 650 clamp(1.65rem, 4vw, 2.5rem)/1.05 ui-serif, Georgia, serif; }
.screen-intro { max-width: 720px; color: var(--muted); line-height: 1.55; }
.close-button { width: 42px; height: 42px; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 50%; color: var(--ink); background: transparent; cursor: pointer; font-size: 1.5rem; }

.island-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 1.4rem; }
.island-card { min-height: 250px; display: flex; flex-direction: column; padding: 1rem; border: 1px solid var(--line); border-radius: 15px; background: rgba(255, 255, 255, 0.035); }
.island-card[data-island="canopy-crown"] { border-top: 4px solid #78cd7d; }
.island-card[data-island="emberglass"] { border-top: 4px solid #e78951; }
.island-card[data-island="tidelight-atoll"] { border-top: 4px solid #68d7c8; }
.island-card.is-locked { opacity: 0.58; filter: saturate(0.45); }
.island-card.is-complete { box-shadow: inset 0 0 0 1px rgba(120, 205, 125, 0.42), 0 0 22px rgba(120, 205, 125, 0.1); }
.island-card h3 { margin: 0 0 0.4rem; font: 650 1.4rem/1.1 ui-serif, Georgia, serif; }
.island-card p { margin: 0 0 1rem; color: var(--muted); font-size: 0.9rem; line-height: 1.45; }
.island-card ul { margin: 0 0 1rem; padding-left: 1.15rem; color: var(--quiet); font-size: 0.8rem; }
.island-card button { min-height: 44px; margin-top: auto; }
.island-card .button + .button { margin-top: 0.55rem; }
.island-card button:disabled { cursor: default; color: var(--quiet); opacity: 0.65; }
.ship-status { margin-top: 1rem; padding: 0.8rem; display: flex; justify-content: space-between; border-top: 1px solid var(--line); color: var(--muted); }
.ship-status strong { color: var(--ink); }

.drift-list { display: grid; gap: 0.7rem; margin: 1.2rem 0; }
.drift-entry { display: grid; grid-template-columns: 100px 1fr auto; gap: 1rem; align-items: center; padding: 0.9rem; border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, 0.025); }
.drift-entry time { color: var(--quiet); font-size: 0.78rem; }
.drift-entry h3 { margin: 0 0 0.2rem; font-size: 1rem; }
.drift-entry p { margin: 0; color: var(--muted); font-size: 0.84rem; }
.drift-entry button { min-height: 38px; padding: 0.45rem 0.75rem; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: rgba(255,255,255,0.07); cursor: pointer; }
.drift-entry.is-complete { opacity: 0.68; }
.milestone-card { display: grid; grid-template-columns: 1fr auto; gap: 0.2rem 1rem; padding: 1rem; border-left: 3px solid var(--amber); background: rgba(255, 197, 109, 0.08); }
.milestone-card span { color: var(--muted); }
.milestone-card strong { grid-row: span 2; font: 650 2.5rem/1 ui-serif, Georgia, serif; color: var(--amber); }
.milestone-card p { margin: 0; color: var(--quiet); }

.ecology-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 1.2rem; }
.ecology-island { padding: 1rem; border: 1px solid var(--line); border-radius: 14px; }
.ecology-island h3 { margin: 0 0 0.8rem; font: 650 1.25rem/1.1 ui-serif, Georgia, serif; }
.ecology-reading { margin-bottom: 0.7rem; }
.ecology-reading div { display: flex; justify-content: space-between; margin-bottom: 0.25rem; color: var(--muted); font-size: 0.78rem; }
.ecology-meter { height: 7px; border-radius: 999px; background: rgba(255,255,255,0.08); overflow: hidden; }
.ecology-meter span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--rust), var(--amber), var(--leaf)); }
.ecology-residents { display: grid; gap: 0.45rem; margin-top: 0.9rem; padding-top: 0.75rem; border-top: 1px solid var(--line); }
.ecology-residents h4 { margin: 0 0 0.15rem; color: var(--cyan); font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; }
.ecology-resident { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 0.6rem; }
.ecology-resident div { min-width: 0; display: grid; gap: 0.12rem; }
.ecology-resident strong { overflow: hidden; color: var(--ink); font-size: 0.82rem; text-overflow: ellipsis; white-space: nowrap; }
.ecology-resident small { overflow: hidden; color: var(--quiet); font-size: 0.68rem; text-overflow: ellipsis; white-space: nowrap; }
.ecology-resident button { min-height: 34px; padding: 0.25rem 0.65rem; border: 1px solid rgba(140, 227, 209, 0.42); border-radius: 999px; color: var(--ink); background: rgba(140, 227, 209, 0.1); cursor: pointer; }
.ecology-resident button:disabled { opacity: 0.44; cursor: default; }
.phenomenon-card { margin-top: 1rem; padding: 1rem; border: 1px solid rgba(140, 227, 209, 0.26); border-radius: 14px; background: rgba(140, 227, 209, 0.06); }
.phenomenon-card h3 { margin: 0 0 0.3rem; }
.phenomenon-card p { margin: 0; color: var(--muted); }

.league-roster { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; margin: 1rem 0; }
.league-human { padding: 1rem; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,0.03); }
.league-human h3 { margin: 0; }
.league-human p { color: var(--muted); font-size: 0.84rem; }
.composure { height: 7px; border-radius: 999px; background: rgba(255,255,255,0.08); overflow: hidden; }
.composure span { display: block; height: 100%; background: var(--amber); }
.league-result { min-height: 1.4rem; color: var(--cyan); }

.settings-card { width: min(620px, 100%); }
.settings-card > label { display: grid; grid-template-columns: 1fr minmax(140px, 240px); align-items: center; gap: 1rem; padding: 0.8rem 0; border-bottom: 1px solid var(--line); }
.settings-card select,
.settings-card input[type="range"] { width: 100%; }
.check-row input { justify-self: end; width: 22px; height: 22px; }
.costume-card { margin-top: 1rem; padding: 1rem; border: 1px solid var(--line); border-radius: 12px; background: rgba(140, 227, 209, 0.035); }
.costume-card h3 { margin: 0 0 0.25rem; }
.costume-card > p { margin: 0 0 0.8rem; color: var(--muted); font-size: 0.86rem; }
.costume-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.55rem; }
.costume-option { min-height: 48px; display: flex; align-items: center; gap: 0.65rem; padding: 0.55rem 0.7rem; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: rgba(255,255,255,0.035); text-align: left; cursor: pointer; }
.costume-option::before { content: ""; width: 20px; height: 20px; flex: 0 0 auto; border-radius: 50%; background: var(--coat, #6ab4c8); box-shadow: inset 0 0 0 4px rgba(255,255,255,0.18); }
.costume-option[aria-pressed="true"] { border-color: var(--cyan); background: rgba(140, 227, 209, 0.1); }
.costume-option:disabled { cursor: default; opacity: 0.4; }
.memory-card { margin-top: 1rem; padding: 1rem; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,0.025); }
.memory-card h3 { margin-top: 0; }
.memory-card p { color: var(--muted); }
.diagnostics-readout { color: var(--quiet); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 0.72rem; }

.postprocessing-lab,
.runtime-performance-debugger {
  position: fixed;
  z-index: 40;
  right: var(--safe-right);
  width: min(340px, calc(100vw - var(--safe-left) - var(--safe-right)));
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: rgba(4, 17, 20, 0.96);
  box-shadow: 0 18px 70px rgba(0, 0, 0, 0.5);
  font: 11px/1.35 ui-monospace, SFMono-Regular, Consolas, monospace;
  pointer-events: auto;
}

.postprocessing-lab {
  top: var(--safe-top);
  max-height: calc(50dvh - var(--safe-top) - 0.5rem);
  padding: 12px;
}

.postprocessing-lab summary {
  cursor: pointer;
  color: var(--cyan);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.postprocessing-lab-controls {
  display: grid;
  gap: 10px;
  padding-top: 12px;
}

.postprocessing-lab label { display: grid; gap: 5px; min-width: 0; }
.postprocessing-lab-toggle { grid-template-columns: auto 1fr; align-items: center; }
.postprocessing-lab-label { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); }
.postprocessing-lab-label > * { min-width: 0; overflow-wrap: anywhere; }
.postprocessing-lab input[type="range"] { width: 100%; accent-color: var(--cyan); }
.postprocessing-lab select { width: 100%; min-height: 32px; padding: 5px 8px; }

.runtime-performance-debugger {
  bottom: var(--safe-bottom);
  max-height: calc(50dvh - var(--safe-bottom) - 0.5rem);
  padding: 12px;
}

.runtime-performance-debugger > strong { color: var(--cyan); letter-spacing: 0.08em; text-transform: uppercase; }
.runtime-performance-overall { float: right; color: var(--muted); text-transform: uppercase; }
.runtime-performance-debugger dl { display: grid; gap: 4px; margin: 10px 0 0; }
.runtime-performance-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 4px 0; border-top: 1px solid rgba(255, 255, 255, 0.07); }
.runtime-performance-row dt { min-width: 0; color: var(--muted); overflow-wrap: anywhere; }
.runtime-performance-row dd { min-width: 0; margin: 0; text-align: right; overflow-wrap: anywhere; }

[data-status="green"] { color: var(--green); }
[data-status="amber"] { color: var(--amber); }
[data-status="red"] { color: var(--red); }
[data-status="unavailable"] { color: var(--muted); }

.travel-screen { display: grid; place-items: center; background: rgba(2, 12, 15, 0.42); }
.travel-copy { width: min(480px, calc(100vw - 28px)); padding: 1.3rem; border: 1px solid var(--line); border-radius: 18px; background: rgba(8, 25, 28, 0.9); text-align: center; }
.travel-copy h2 { margin: 0 0 0.5rem; font: 650 2rem/1.05 ui-serif, Georgia, serif; }
.travel-copy p:not(.eyebrow) { color: var(--muted); }

.mobile-controls { position: fixed; z-index: 8; left: var(--safe-left); right: var(--safe-right); bottom: var(--safe-bottom); align-items: end; justify-content: space-between; pointer-events: none; }

/* Query-gated visual QA: keep the close robot orbit unobstructed without
   changing the normal HUD presentation. */
body[data-qa-robot-view="true"] #game-hud { display: none !important; }
.move-pad { width: 150px; display: grid; grid-template-columns: repeat(3, 48px); grid-template-rows: repeat(2, 48px); gap: 3px; }
.move-pad button { pointer-events: auto; min-width: 48px; min-height: 48px; background: rgba(10, 26, 28, 0.72); touch-action: none; }
.move-pad button:nth-child(1) { grid-column: 2; }
.move-pad button:nth-child(2) { grid-column: 1; grid-row: 2; }
.move-pad button:nth-child(3) { grid-column: 3; grid-row: 2; }
.move-pad button:nth-child(4) { grid-column: 2; grid-row: 2; }
.mobile-actions { display: flex; align-items: end; gap: 0.4rem; }
.mobile-actions button { pointer-events: auto; min-width: 58px; min-height: 58px; padding: 0.35rem; background: rgba(10, 26, 28, 0.76); font-size: 0.7rem; touch-action: none; }
.mobile-actions button[data-action] { min-width: 72px; min-height: 72px; border-color: rgba(255, 197, 109, 0.6); background: rgba(255, 197, 109, 0.18); }
.mobile-actions button[data-action].is-channeling { border-color: var(--cyan); background: rgba(88, 244, 228, 0.32); box-shadow: 0 0 18px rgba(88, 244, 228, 0.55); }
.mobile-actions button[data-jump] { min-width: 72px; min-height: 72px; border-color: rgba(122, 255, 242, 0.72); background: rgba(38, 215, 211, 0.2); }
.pressed { transform: scale(0.94); background: rgba(255, 197, 109, 0.28) !important; }

@media (max-width: 800px) {
  .render-profile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .render-profile-option { min-height: 160px; }
  .condition-panel span:nth-child(2) { display: none; }
  .hud-buttons .icon-button { font-size: 0; width: 44px; padding: 0; }
  .hud-buttons .icon-button::after { content: attr(data-short); font-size: 0.68rem; }
  .icon-button b { display: none; }
  .island-grid,
  .ecology-grid { grid-template-columns: 1fr; }
  .league-roster { grid-template-columns: 1fr; }
  .screen-card { max-height: 94vh; }
  .arcade-outcome-card { grid-template-columns: 1fr; max-height: 94dvh; }
  .arcade-outcome-art { min-height: 0; aspect-ratio: 16 / 9; }
  .arcade-outcome-copy { align-self: auto; padding: 1.1rem; }
}

@media (max-width: 600px), (pointer: coarse) {
  .render-preflight-screen { place-items: start center; }
  .render-preflight-card { padding: 1rem; border-radius: 14px; }
  .render-profile-grid { grid-template-columns: 1fr; gap: 0.55rem; margin-top: 1rem; }
  .render-profile-option { min-height: 0; padding: 0.85rem; }
  .render-profile-option strong { margin: 0.35rem 0; }
  .render-compatibility-option { align-items: flex-start; }
  .render-compatibility-option b { display: none; }
  .desktop-help { display: none; }
  .mobile-controls { display: flex; }
  .hud-top { align-items: stretch; }
  .brand-panel { width: 126px; }
  .condition-panel { flex: 1; justify-content: center; padding-inline: 0.45rem; }
  .condition-panel span:first-child { display: none; }
  .hud-buttons { position: fixed; right: var(--safe-right); top: calc(var(--safe-top) + 64px); display: grid; grid-template-columns: repeat(2, 44px); }
  .hud-buttons .icon-button:nth-child(4) { display: none; }
  .quest-panel { top: calc(var(--safe-top) + 64px); width: min(270px, calc(100vw - 110px)); padding: 0.7rem 0.8rem; }
  .quest-panel h2 { font-size: 1rem; }
  .arcade-hud { top: calc(var(--safe-top) + 64px); width: min(270px, calc(100vw - 110px)); padding: 0.65rem 0.75rem; }
  .arcade-hud strong { font-size: 0.95rem; }
  .quest-panel p:not(.eyebrow) { display: none; }
  .interaction-panel { bottom: calc(var(--safe-bottom) + 84px); width: min(270px, calc(100vw - 180px)); }
  .choice-buttons { grid-template-columns: 1fr; }
  .intro-screen { align-items: end; padding-bottom: max(1.4rem, env(safe-area-inset-bottom)); background: linear-gradient(0deg, rgba(3, 12, 13, 0.96), rgba(3, 12, 13, 0.38) 76%); }
  .intro-copy h1 { font-size: clamp(2.2rem, 12vw, 3.7rem); }
  .intro-deck { font-size: 0.95rem; }
  .daily-preview { padding: 0.75rem; }
  .drift-entry { grid-template-columns: 1fr auto; gap: 0.35rem 0.7rem; }
  .drift-entry time { grid-column: 1 / -1; }
  .settings-card > label { grid-template-columns: 1fr; gap: 0.45rem; }
  .costume-grid { grid-template-columns: 1fr; }
  .tutorial-grid,
  .result-stats { grid-template-columns: 1fr; }
  .tutorial-grid article { min-height: 0; }
  .vault-cutscene { align-items: end; padding: 0; }
  .vault-cutscene-card { max-height: 100vh; border-radius: 0; }
  .vault-cutscene-card img { min-height: 68vh; object-fit: cover; object-position: 50% center; }
  .vault-cutscene-copy { position: relative; margin-top: -38%; padding-top: 30%; }
  .card-screen:has(.arcade-outcome-card) { align-items: start; overflow: auto; }
  .arcade-outcome-card { max-height: none; border-radius: 14px; }
  .arcade-outcome-copy .button-row { display: grid; grid-template-columns: 1fr; }
  .move-pad { width: 126px; grid-template-columns: repeat(3, 40px); grid-template-rows: repeat(2, 40px); }
  .move-pad button { min-width: 40px; min-height: 40px; }
  .mobile-actions { display: grid; grid-template-columns: repeat(3, 50px); gap: 0.25rem; }
  .mobile-actions button,
  .mobile-actions button[data-action],
  .mobile-actions button[data-jump] { min-width: 50px; min-height: 50px; }
  .postprocessing-lab,
  .runtime-performance-debugger { width: min(300px, calc(100vw - var(--safe-left) - var(--safe-right))); }
}

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

/* Maritime explorer interface: the world remains the primary visual surface. */
:root {
  --ui-scale: 1;
  --navy-950: #06141b;
  --navy-900: #0a2029;
  --navy-800: #12323d;
  --parchment: #fff8df;
  --parchment-muted: #d8d8c5;
  --sea-glass: #7ee1d1;
  --coral: #ff8f70;
  --sun-gold: #ffd47f;
  --console-line: rgba(190, 237, 224, 0.22);
  --console-surface: rgba(17, 56, 68, 0.97);
}

body { font-size: calc(16px * var(--ui-scale)); }
body[data-hud-contrast="high"] { --parchment-muted: #fffbe9; --console-line: rgba(255, 255, 255, 0.58); }
body[data-hud-opacity="high"] .objective-ribbon,
body[data-hud-opacity="high"] .world-chip,
body[data-hud-opacity="high"] .arcade-hud { --hud-alpha: 0.97; }
body[data-hud-opacity="subtle"] .objective-ribbon,
body[data-hud-opacity="subtle"] .world-chip,
body[data-hud-opacity="subtle"] .arcade-hud { --hud-alpha: 0.72; }

button,
a,
select,
input { accent-color: var(--sea-glass); }

button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 3px solid var(--sun-gold);
  outline-offset: 4px;
  box-shadow: 0 0 0 6px rgba(4, 18, 24, 0.78);
}

.hud-top {
  inset: var(--safe-top) var(--safe-right) auto var(--safe-left);
  align-items: flex-start;
  justify-content: space-between;
  pointer-events: none;
}

.objective-ribbon {
  --hud-alpha: 0.9;
  position: relative;
  width: min(450px, calc(100vw - 190px));
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 0.75rem;
  padding: 0.72rem 1.25rem 0.75rem 0.8rem;
  overflow: hidden;
  border: 1px solid rgba(157, 224, 211, 0.24);
  border-left: 3px solid var(--sea-glass);
  border-radius: 7px 24px 24px 7px;
  color: var(--parchment);
  background: linear-gradient(100deg, rgba(5, 24, 31, var(--hud-alpha)), rgba(8, 35, 43, calc(var(--hud-alpha) - 0.08)) 74%, rgba(8, 35, 43, 0));
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.22);
  pointer-events: auto;
}

.objective-route { display: flex; flex-direction: column; align-items: center; padding-top: 0.15rem; }
.objective-route::before { content: ""; position: absolute; top: 1.35rem; bottom: 1.25rem; width: 1px; background: rgba(126, 225, 209, 0.35); }
.objective-route i { z-index: 1; width: 7px; height: 7px; margin-bottom: 0.55rem; border: 1px solid var(--sea-glass); border-radius: 50%; background: var(--navy-950); }
.objective-route i:first-child { background: var(--sea-glass); box-shadow: 0 0 12px rgba(126, 225, 209, 0.8); }
.objective-copy { min-width: 0; }
.objective-copy > p:first-child { display: flex; align-items: center; gap: 0.75rem; margin: 0; }
.objective-copy .eyebrow { margin: 0; color: var(--sea-glass); font-size: 0.62rem; }
.objective-copy #island-name { color: var(--parchment-muted); font-size: 0.72rem; white-space: nowrap; }
.objective-ribbon h2 { margin: 0.2rem 0 0.15rem; overflow: hidden; font: 700 1.08rem/1.2 ui-serif, Georgia, serif; text-overflow: ellipsis; white-space: nowrap; }
.objective-ribbon #quest-brief { display: none; }
.objective-ribbon small { display: block; margin-top: 0.32rem; color: var(--parchment-muted); font-size: 0.68rem; }
.objective-ribbon .quest-progress { height: 3px; margin-top: 0.48rem; background: rgba(255, 255, 255, 0.1); }

.status-cluster { display: flex; align-items: flex-start; gap: 0.45rem; pointer-events: auto; }
.world-chip {
  --hud-alpha: 0.86;
  min-height: 48px;
  display: grid;
  align-content: center;
  padding: 0.4rem 0.75rem;
  border: 1px solid rgba(157, 224, 211, 0.2);
  border-radius: 18px 7px 7px 18px;
  color: var(--parchment-muted);
  background: rgba(5, 24, 31, var(--hud-alpha));
  font-size: 0.64rem;
  text-align: right;
}
.world-chip span:first-child { color: var(--sea-glass); font-weight: 750; }
.world-chip span:nth-child(2) { display: none; }
.compass-button {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  padding: 0.25rem;
  border: 1px solid rgba(157, 224, 211, 0.28);
  border-radius: 50%;
  color: var(--parchment);
  background: rgba(5, 24, 31, 0.9);
  cursor: pointer;
}
.compass-button span { font-size: 1.05rem; line-height: 1; }
.compass-button small { font-size: 0.55rem; letter-spacing: 0.05em; text-transform: uppercase; }
.quiet-control { width: 42px; height: 42px; margin-top: 4px; opacity: 0.78; }

.arcade-hud {
  --hud-alpha: 0.9;
  top: calc(var(--safe-top) + 62px);
  left: var(--safe-left);
  width: min(420px, calc(100vw - 190px));
  border: 0;
  border-left: 3px solid var(--sun-gold);
  border-radius: 5px 22px 22px 5px;
  background: linear-gradient(100deg, rgba(5, 24, 31, var(--hud-alpha)), rgba(8, 35, 43, 0.58));
  box-shadow: none;
  backdrop-filter: none;
}
.arcade-hud strong { font: 700 1rem/1.2 ui-serif, Georgia, serif; }

.context-action {
  bottom: calc(var(--safe-bottom) + 22px);
  width: auto;
  min-width: 220px;
  padding: 0;
  color: var(--parchment);
  background: transparent;
  pointer-events: none;
}
.context-action > span { margin-bottom: 0.35rem; color: var(--parchment); font-weight: 700; text-shadow: 0 2px 6px #000; }
.context-action button {
  width: auto;
  min-width: 180px;
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.45rem 1rem 0.45rem 0.5rem;
  border-color: rgba(255, 212, 127, 0.6);
  border-radius: 999px;
  background: rgba(5, 24, 31, 0.92);
  pointer-events: auto;
}
.context-action kbd,
.console-footer kbd,
.control-guide kbd { border: 1px solid rgba(255,255,255,0.3); border-radius: 7px; color: var(--navy-950); background: var(--sun-gold); font: 800 0.78rem/1 system-ui; }
.context-action kbd { min-width: 38px; padding: 0.7rem 0.45rem; }
.context-action small { color: rgba(255,255,255,0.7); text-shadow: 0 1px 4px #000; }

.recall-panel {
  top: auto;
  bottom: calc(var(--safe-bottom) + 18px);
  width: min(310px, calc(100vw - 28px));
  padding: 0.65rem 0.9rem;
  border: 1px solid rgba(126, 225, 209, 0.35);
  border-radius: 999px;
  color: var(--parchment);
  background: rgba(5, 24, 31, 0.9);
  transform: translateX(-50%);
}

.fauna-observation {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 18px);
  z-index: 12;
  max-width: min(520px, calc(100vw - 28px));
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.72rem;
  padding: 0.52rem 0.58rem 0.52rem 0.8rem;
  border: 1px solid rgba(126, 225, 209, 0.44);
  border-radius: 999px;
  color: var(--parchment);
  background: linear-gradient(105deg, rgba(5, 24, 31, 0.95), rgba(11, 51, 58, 0.88));
  box-shadow: 0 8px 30px rgba(0,0,0,0.28), inset 0 0 20px rgba(126,225,209,0.05);
  transform: translateX(-50%);
  pointer-events: auto;
}
.fauna-observation[hidden] { display: none; }
.fauna-observation > span { color: var(--sea-glass); font-size: 1.2rem; text-shadow: 0 0 12px rgba(126,225,209,0.7); }
.fauna-observation div { min-width: 0; display: grid; }
.fauna-observation small { color: var(--sea-glass); font-size: 0.56rem; letter-spacing: 0.1em; text-transform: uppercase; }
.fauna-observation strong,
.fauna-observation em { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fauna-observation strong { font: 700 0.92rem/1.2 ui-serif, Georgia, serif; }
.fauna-observation em { color: rgba(255,255,255,0.7); font-size: 0.68rem; font-style: normal; }
.fauna-observation button { min-height: 36px; padding: 0.3rem 0.72rem; border: 0; border-radius: 999px; color: var(--navy-950); background: var(--sun-gold); cursor: pointer; font-weight: 800; }

.toast {
  right: var(--safe-right);
  left: auto;
  bottom: calc(var(--safe-bottom) + 18px);
  border: 0;
  border-left: 3px solid var(--sun-gold);
  border-radius: 5px 18px 18px 5px;
  color: var(--parchment);
  background: rgba(5, 24, 31, 0.94);
  transform: none;
  text-align: left;
}

.field-console-screen {
  display: grid;
  place-items: center;
  padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
  background: radial-gradient(circle at 82% 15%, rgba(68, 145, 151, 0.16), transparent 30%), rgba(2, 13, 19, 0.84);
}
.field-console-shell {
  width: min(1180px, 100%);
  height: min(840px, calc(100dvh - var(--safe-top) - var(--safe-bottom)));
  display: grid;
  grid-template: "mast mast" auto "nav content" minmax(0, 1fr) "nav footer" auto / 190px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--console-line);
  border-radius: 10px 34px 10px 22px;
  color: var(--parchment);
  background: var(--console-surface);
  box-shadow: 0 28px 90px rgba(0,0,0,0.52);
}
.console-masthead { grid-area: mast; min-height: 92px; display: flex; justify-content: space-between; gap: 1rem; padding: 1.15rem 1.35rem 0.9rem; border-bottom: 1px solid var(--console-line); }
.console-masthead h2 { margin: 0; font: 700 clamp(1.55rem, 3vw, 2.35rem)/1 ui-serif, Georgia, serif; }
.console-masthead p:not(.eyebrow) { margin: 0.35rem 0 0; color: var(--parchment-muted); font-size: 0.82rem; }
.console-navigation { grid-area: nav; min-height: 0; display: flex; flex-direction: column; gap: 0.2rem; padding: 0.9rem 0.65rem; overflow: auto; border-right: 1px solid var(--console-line); background: rgba(255,255,255,0.018); }
.console-navigation button {
  min-height: 52px;
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.65rem;
  border: 0;
  border-left: 2px solid transparent;
  border-radius: 3px 14px 14px 3px;
  color: var(--parchment-muted);
  background: transparent;
  cursor: pointer;
  text-align: left;
}
.console-navigation button > span { color: var(--sea-glass); font-size: 1.05rem; text-align: center; }
.console-navigation button small { min-width: 1.4rem; color: var(--sun-gold); text-align: center; }
.console-navigation button:hover { background: rgba(126, 225, 209, 0.07); }
.console-navigation button[aria-current="true"] { border-left-color: var(--sun-gold); color: var(--parchment); background: linear-gradient(90deg, rgba(255,212,127,0.13), rgba(126,225,209,0.05)); }
.console-content { grid-area: content; min-width: 0; min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-color: var(--sea-glass) transparent; }
.console-panel { min-height: 100%; }
.console-panel > .screen-card {
  width: 100%;
  max-height: none;
  min-height: 100%;
  overflow: visible;
  padding: clamp(1.1rem, 3vw, 2.2rem);
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.console-content .screen-heading > .close-button { display: none; }
.console-footer { grid-area: footer; min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.45rem 1rem; border-top: 1px solid var(--console-line); color: var(--parchment-muted); font-size: 0.72rem; }
.console-footer button { min-height: 34px; padding: 0.3rem 0.65rem; border: 0; border-radius: 999px; color: var(--parchment); background: rgba(255,255,255,0.06); cursor: pointer; }
.console-footer kbd { padding: 0.3rem 0.38rem; margin-right: 0.35rem; }

.island-grid { grid-template-columns: 1fr; gap: 0; margin-top: 1rem; border-top: 1px solid var(--console-line); }
.island-card {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(170px, 0.65fr) minmax(220px, 1fr) minmax(150px, 0.55fr);
  gap: 0.7rem 1.2rem;
  align-items: center;
  padding: 1rem 0.4rem 1rem 0.9rem;
  border: 0;
  border-bottom: 1px solid var(--console-line);
  border-left: 3px solid var(--sea-glass);
  border-radius: 0;
  background: transparent;
}
.island-card[data-island] { border-top: 0; }
.island-card h3 { margin: 0; }
.island-card p,
.island-card ul { margin: 0; }
.island-card button { min-height: 44px; margin: 0; border-radius: 999px; }
.island-card .button + .button { margin-top: 0.4rem; }
.ship-status { padding-inline: 0; }

.drift-list { gap: 0; border-top: 1px solid var(--console-line); }
.drift-entry { padding-inline: 0.35rem; border: 0; border-bottom: 1px solid var(--console-line); border-radius: 0; background: transparent; }
.drift-entry button { border-radius: 999px; }
.ecology-island,
.league-human,
.phenomenon-card,
.costume-card,
.memory-card { border-radius: 4px 18px 18px 4px; background: rgba(126,225,209,0.035); }

.settings-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.2rem; }
.settings-group { min-width: 0; margin: 0; padding: 0.9rem 0; border: 0; border-top: 2px solid var(--sea-glass); }
.settings-group legend { padding: 0 0.4rem 0 0; color: var(--sea-glass); font-size: 0.72rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.settings-group > label { min-height: 52px; display: grid; grid-template-columns: 1fr minmax(110px, 170px); align-items: center; gap: 0.75rem; border-bottom: 1px solid rgba(190,237,224,0.11); }
.settings-group select,
.settings-group input[type="range"] { width: 100%; }
.settings-group input[type="checkbox"] { width: 24px; height: 24px; justify-self: end; }

.control-guide { margin: 1.3rem 0; border-top: 1px solid var(--console-line); }
.control-guide > div { display: grid; grid-template-columns: minmax(190px, 0.7fr) 1fr; gap: 1rem; align-items: center; padding: 0.85rem 0; border-bottom: 1px solid var(--console-line); }
.control-guide dt { display: flex; align-items: center; gap: 0.75rem; color: var(--parchment-muted); }
.control-guide kbd { min-width: 54px; padding: 0.55rem; text-align: center; }
.control-guide dd { margin: 0; font-weight: 750; }
.controls-note { max-width: 720px; color: var(--parchment-muted); line-height: 1.55; }

.tutorial-grid { display: block; margin: 1.4rem 0 0.8rem; }
.tutorial-grid article { min-height: 170px; padding: 1rem 1rem 1rem 1.35rem; border: 0; border-left: 3px solid var(--sea-glass); border-radius: 0 22px 22px 0; background: linear-gradient(90deg, rgba(126,225,209,0.08), transparent); }
.tutorial-progress { display: flex; gap: 0.45rem; margin-bottom: 1rem; }
.tutorial-progress i { width: 24px; height: 4px; border-radius: 999px; background: rgba(255,255,255,0.14); }
.tutorial-progress i.is-current { background: var(--sun-gold); }

.choice-panel.panel { border: 0; border-left: 3px solid var(--sun-gold); border-radius: 5px 24px 24px 5px; background: rgba(5,24,31,0.97); backdrop-filter: none; }
.result-stats { gap: 0; border-block: 1px solid var(--console-line); }
.result-stats div { border: 0; border-radius: 0; background: transparent; }

.mobile-controls { pointer-events: none; }
.touch-stick-zone { position: fixed; z-index: 1; left: var(--safe-left); bottom: var(--safe-bottom); width: min(44vw, 300px); height: min(42vh, 300px); pointer-events: auto; touch-action: none; --stick-x: 74px; --stick-y: calc(100% - 72px); }
.touch-stick-base { position: absolute; left: var(--stick-x); top: var(--stick-y); width: 104px; height: 104px; border: 1px solid rgba(255,255,255,0.22); border-radius: 50%; background: radial-gradient(circle, rgba(126,225,209,0.1), rgba(5,24,31,0.28) 62%, rgba(5,24,31,0.55)); transform: translate(-50%, -50%); opacity: 0.55; transition: opacity 150ms ease; }
.touch-stick-base::after { content: ""; position: absolute; inset: 34px; border: 1px solid rgba(126,225,209,0.4); border-radius: 50%; }
.touch-stick-base i { position: absolute; left: calc(50% - 23px); top: calc(50% - 23px); width: 46px; height: 46px; border: 1px solid rgba(255,255,255,0.34); border-radius: 50%; background: rgba(9,35,43,0.88); box-shadow: 0 5px 16px rgba(0,0,0,0.3); }
.touch-stick-zone.is-active .touch-stick-base { opacity: 1; }
body[data-touch-layout="floating"] .move-pad { display: none !important; }
body[data-touch-layout="dpad"] .touch-stick-zone { display: none; }
body[data-touch-layout="dpad"] .move-pad { display: grid; }
.mobile-actions { position: relative; z-index: 2; pointer-events: none; }
.mobile-actions button { min-width: 62px; min-height: 62px; display: grid; place-items: center; gap: 0; padding: 0.3rem; border-radius: 50%; color: var(--parchment); background: rgba(5,24,31,0.72); pointer-events: auto; }
.mobile-actions button span { font-size: 1.12rem; line-height: 1; }
.mobile-actions button small { font-size: 0.58rem; text-transform: uppercase; }
.mobile-actions .primary-action,
.mobile-actions .jump-action { min-width: 72px; min-height: 72px; }
.mobile-actions .primary-action { border-color: rgba(255,212,127,0.58); }
.mobile-actions .jump-action { border-color: rgba(126,225,209,0.65); }
.mobile-actions .recall-action { opacity: 0.76; }

@media (max-width: 760px), (pointer: coarse) {
  .hud-top { gap: 0.5rem; }
  .objective-ribbon { width: min(62vw, 340px); grid-template-columns: 18px minmax(0, 1fr); padding: 0.58rem 0.8rem 0.6rem 0.55rem; }
  .objective-route i { width: 5px; height: 5px; margin-bottom: 0.42rem; }
  .objective-copy #island-name,
  .objective-ribbon small { display: none; }
  .objective-ribbon h2 { font-size: 0.9rem; }
  .objective-copy .eyebrow { font-size: 0.54rem; }
  .world-chip { display: none; }
  .compass-button { width: 46px; height: 46px; }
  .quiet-control { width: 38px; height: 38px; display: grid; }
  .arcade-hud { top: calc(var(--safe-top) + 57px); width: min(72vw, 360px); padding: 0.55rem 0.7rem; }
  .context-action { bottom: calc(var(--safe-bottom) + 82px); min-width: 0; }
  .context-action > span,
  .context-action small { display: none; }
  .context-action button { min-width: 128px; min-height: 48px; }
  .toast { right: 50%; bottom: calc(var(--safe-bottom) + 92px); max-width: calc(100vw - 32px); transform: translateX(50%); }
  .recall-panel { bottom: calc(var(--safe-bottom) + 88px); }
  .fauna-observation { bottom: calc(var(--safe-bottom) + 92px); max-width: calc(100vw - 24px); }
  .fauna-observation em { max-width: 48vw; }
  .field-console-screen { padding: 0; align-items: stretch; }
  .field-console-shell { width: 100%; height: 100dvh; grid-template: "mast" auto "content" minmax(0, 1fr) "nav" auto / 1fr; border: 0; border-radius: 0; }
  .console-masthead { min-height: 78px; padding: max(0.8rem, env(safe-area-inset-top)) max(0.9rem, env(safe-area-inset-right)) 0.7rem max(0.9rem, env(safe-area-inset-left)); }
  .console-masthead h2 { font-size: 1.45rem; }
  .console-masthead p:not(.eyebrow) { display: none; }
  .console-navigation { min-width: 0; flex-direction: row; gap: 0.15rem; padding: 0.45rem max(0.45rem, env(safe-area-inset-right)) max(0.45rem, env(safe-area-inset-bottom)) max(0.45rem, env(safe-area-inset-left)); overflow: auto hidden; border: 0; border-top: 1px solid var(--console-line); }
  .console-navigation button { min-width: 72px; min-height: 58px; grid-template: 22px auto / 1fr; gap: 0.1rem; justify-items: center; padding: 0.3rem; border: 0; border-bottom: 2px solid transparent; border-radius: 12px; text-align: center; }
  .console-navigation button[aria-current="true"] { border-bottom-color: var(--sun-gold); }
  .console-navigation button small { position: absolute; margin: -28px 0 0 35px; }
  .console-navigation button b { font-size: 0.64rem; }
  .console-content { padding-bottom: 0.5rem; }
  .console-footer { display: none; }
  .console-panel > .screen-card { padding: 1rem max(1rem, env(safe-area-inset-right)) 1.25rem max(1rem, env(safe-area-inset-left)); }
  .island-card { grid-template-columns: 1fr; padding: 1rem 0.25rem; }
  .island-card button { width: 100%; }
  .settings-groups { grid-template-columns: 1fr; }
  .settings-group > label { grid-template-columns: 1fr minmax(110px, 45%); }
  .control-guide > div { grid-template-columns: 1fr auto; }
  .control-guide dt span { display: none; }
  .mobile-controls { display: flex; align-items: end; }
  .mobile-actions { display: flex; align-items: flex-end; gap: 0.45rem; margin-left: auto; }
  body[data-touch-layout="dpad"] .move-pad { width: 146px; grid-template-columns: repeat(3, 46px); grid-template-rows: repeat(2, 46px); }
  body[data-touch-layout="dpad"] .move-pad button { min-width: 46px; min-height: 46px; border-radius: 50%; }
}

@media (max-height: 520px) and (orientation: landscape) {
  .objective-ribbon { width: min(52vw, 390px); }
  .mobile-actions button { min-width: 56px; min-height: 56px; }
  .mobile-actions button.primary-action,
  .mobile-actions button.jump-action { min-width: 62px; min-height: 62px; }
  .touch-stick-zone { height: 56vh; }
  .console-masthead { min-height: 64px; }
  .console-masthead .eyebrow { display: none; }
}

@media (max-width: 760px), (pointer: coarse) {
  .mobile-actions button.recall-action { min-width: 58px; min-height: 58px; }
  .mobile-actions button.primary-action,
  .mobile-actions button.jump-action { min-width: 72px; min-height: 72px; }
}

@media (prefers-reduced-motion: reduce) {
  .touch-stick-base,
  .objective-ribbon,
  .field-console-shell { transition: none !important; animation: none !important; }
}
