/* ═══════════════════════════════════════════════════════════════════════
   PIRATES RUSH — Path of the Buccaneers
   Original work by Tawajo (https://www.tawajo.com).
   Copyright © 2026 Tawajo. All rights reserved.
   ═══════════════════════════════════════════════════════════════════════ */

/* ═══════════════════════ FONTS (bundled — works offline) ═══════════════════════ */

@font-face {
  font-family: "Cinzel";
  src: url("assets/fonts/cinzel-400-normal.woff2") format("woff2");
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Cinzel Decorative";
  src: url("assets/fonts/cinzel-decorative-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Cinzel Decorative";
  src: url("assets/fonts/cinzel-decorative-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Cinzel Decorative";
  src: url("assets/fonts/cinzel-decorative-900-normal.woff2") format("woff2");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Alegreya Sans";
  src: url("assets/fonts/alegreya-sans-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Alegreya Sans";
  src: url("assets/fonts/alegreya-sans-400-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Alegreya Sans";
  src: url("assets/fonts/alegreya-sans-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Alegreya Sans";
  src: url("assets/fonts/alegreya-sans-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Alegreya Sans";
  src: url("assets/fonts/alegreya-sans-800-normal.woff2") format("woff2");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

/* ═══════════════════════════════════════════════════════════════
   PIRATES RUSH — Path of the Buccaneers
   Handcrafted UI & styling
   ═══════════════════════════════════════════════════════════════ */

:root {
  --gold: #e8b64c;
  --gold-light: #ffe8a4;
  --gold-deep: #9d5f18;
  --gold-dark: #4f2d09;
  --cream: #f8ebc9;
  --cream-dim: #d9c79f;
  --ink: #07171b;
  --ink-soft: #0c252b;
  --teal: #14525a;
  --teal-bright: #2b8588;
  --crimson: #9f2c2f;
  --green: #2e8f6e;
  --panel: rgba(8, 26, 31, .92);
  --panel-edge: rgba(232, 182, 76, .5);
  --shadow: 0 1.2em 3.5em rgba(0, 0, 0, .55);
  --font-display: "Cinzel", Georgia, "Times New Roman", serif;
  --font-logo: "Cinzel Decorative", "Cinzel", Georgia, serif;
  --font-ui: "Alegreya Sans", "Trebuchet MS", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #030e11;
}

body {
  font-family: var(--font-ui);
  color: var(--cream);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

button {
  font-family: inherit;
  border: 0;
  cursor: pointer;
  color: inherit;
  padding: 0;
  background: none;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible {
  outline: .18em solid var(--gold-light);
  outline-offset: .25em;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

#app {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse at 50% 45%, #123a40 0%, #06191d 55%, #020a0c 100%);
}

#stage {
  position: relative;
  width: min(100vw, calc(100vh * 16 / 9));
  height: min(100vh, calc(100vw * 9 / 16));
  overflow: hidden;
  background: #061c20;
  font-size: min(1vw, 1.7778vh);
  box-shadow: 0 0 10em rgba(0, 0, 0, .8);
  isolation: isolate;
}

#app:fullscreen,
#app:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  display: grid;
  place-items: center;
  background: #020a0c;
}

#game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  z-index: 0;
}

#vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  box-shadow:
    inset 0 0 12em rgba(0, 0, 0, .72),
    inset 0 0 3em rgba(0, 0, 0, .45);
  background:
    linear-gradient(180deg, rgba(0, 0, 0, .22), transparent 14%, transparent 82%, rgba(0, 0, 0, .38));
}

#grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  opacity: .055;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='.65'/></svg>");
  mix-blend-mode: screen;
}

.is-hidden {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* ═══════════════════════ SHARED COMPONENTS ═══════════════════════ */

.screen {
  position: absolute;
  inset: 0;
  z-index: 10;
  opacity: 1;
  visibility: visible;
  transition: opacity .45s ease, visibility .45s;
}

.panel {
  position: relative;
  background:
    linear-gradient(160deg, rgba(20, 53, 58, .96), rgba(5, 21, 26, .97) 58%, rgba(9, 31, 36, .98));
  border: .11em solid rgba(232, 182, 76, .55);
  border-radius: .75em;
  box-shadow:
    var(--shadow),
    inset 0 0 0 .13em rgba(255, 229, 156, .07),
    inset 0 .1em 2.5em rgba(38, 127, 127, .12);
}

.panel::before,
.panel::after {
  content: "";
  position: absolute;
  width: 2.1em;
  height: 2.1em;
  pointer-events: none;
  opacity: .6;
  border-color: var(--gold);
}

.panel::before {
  top: .45em;
  left: .45em;
  border-top: .12em solid;
  border-left: .12em solid;
  border-top-left-radius: .4em;
}

.panel::after {
  right: .45em;
  bottom: .45em;
  border-right: .12em solid;
  border-bottom: .12em solid;
  border-bottom-right-radius: .4em;
}

.eyebrow {
  margin: 0 0 .55em;
  color: var(--gold);
  font-family: var(--font-ui);
  font-size: .78em;
  font-weight: 700;
  letter-spacing: .28em;
  line-height: 1.4;
  text-transform: uppercase;
}

.eyebrow-line {
  display: inline-block;
  width: 2.2em;
  height: .08em;
  margin: 0 .8em .22em;
  background: linear-gradient(90deg, transparent, var(--gold));
  vertical-align: middle;
}

.eyebrow-line:last-child {
  transform: scaleX(-1);
}

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .6em;
  min-height: 3.2em;
  padding: .72em 1.45em;
  border: .1em solid rgba(255, 223, 148, .5);
  border-radius: .45em;
  font-family: var(--font-ui);
  font-size: 1.02em;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: transform .18s ease, filter .18s ease, background .18s ease, box-shadow .18s ease;
}

.btn > svg {
  width: 1.25em;
  height: 1.25em;
  fill: currentColor;
  flex: 0 0 auto;
}

.btn:hover { transform: translateY(-.13em); }
.btn:active { transform: translateY(.04em) scale(.985); }

.btn-gold {
  color: #2f1a08;
  border-color: #ffe5a1;
  background:
    linear-gradient(180deg, #fff0b5 0%, #f4c95d 18%, #dfa438 55%, #ad6b1d 100%);
  box-shadow:
    inset 0 .12em 0 rgba(255, 252, 218, .6),
    inset 0 -.18em .25em rgba(84, 42, 4, .5),
    0 0 0 .14em #5d340c,
    0 .45em 1em rgba(0, 0, 0, .38);
  text-shadow: 0 .06em 0 rgba(255, 238, 178, .55);
}

.btn-gold::after {
  content: "";
  position: absolute;
  inset: .14em auto auto .14em;
  width: 34%;
  height: 35%;
  border-radius: .3em;
  background: linear-gradient(135deg, rgba(255,255,255,.38), transparent 72%);
  pointer-events: none;
}

.btn-gold:hover {
  filter: brightness(1.08) saturate(1.05);
  box-shadow:
    inset 0 .12em 0 rgba(255, 252, 218, .7),
    inset 0 -.18em .25em rgba(84, 42, 4, .48),
    0 0 0 .14em #5d340c,
    0 .55em 1.2em rgba(0, 0, 0, .42),
    0 0 1.5em rgba(255, 193, 71, .25);
}

.btn-ghost {
  color: var(--cream);
  border-color: rgba(232, 182, 76, .32);
  background: linear-gradient(180deg, rgba(22, 57, 63, .92), rgba(7, 24, 29, .94));
  box-shadow: inset 0 .1em 0 rgba(255,255,255,.05), 0 .3em .8em rgba(0,0,0,.28);
}

.btn-ghost:hover {
  border-color: rgba(255, 216, 124, .75);
  background: linear-gradient(180deg, rgba(37, 83, 88, .96), rgba(10, 34, 40, .96));
}

.btn-quit {
  color: rgba(224, 195, 157, .75);
  border: 0;
  background: transparent;
  font-size: .8em;
  letter-spacing: .1em;
  text-transform: uppercase;
  text-decoration: underline;
  text-decoration-color: rgba(232, 182, 76, .25);
  text-underline-offset: .35em;
}

.btn-quit:hover { color: var(--gold-light); }

.btn-wide { width: 100%; }
.btn-compact { min-height: 2.8em; padding: .55em 1.2em; font-size: .9em; }

.icon-btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 4.15em;
  height: 4.15em;
  flex: 0 0 auto;
  border-radius: 50%;
  color: #ffd977;
  border: .2em solid #b47929;
  background:
    radial-gradient(circle at 36% 27%, #33454a 0%, #1a2d31 26%, #0a171b 72%, #030b0d 100%);
  box-shadow:
    inset 0 .15em .45em rgba(255, 255, 255, .12),
    inset 0 -.4em .8em rgba(0, 0, 0, .8),
    0 0 0 .13em #4b2d0c,
    0 .42em .9em rgba(0, 0, 0, .5);
  transition: transform .18s ease, filter .18s ease, color .18s ease;
}

.icon-btn > svg {
  width: 2em;
  height: 2em;
  fill: currentColor;
  filter: drop-shadow(0 .1em .08em rgba(0, 0, 0, .55));
}

.icon-btn::before {
  content: "";
  position: absolute;
  inset: .3em;
  border: .07em solid rgba(255, 224, 150, .3);
  border-radius: 50%;
  pointer-events: none;
}

.icon-btn:hover {
  transform: translateY(-.12em) scale(1.035);
  filter: brightness(1.1);
  color: #ffecad;
}

.icon-btn:active { transform: translateY(.04em) scale(.98); }
.icon-btn.is-off { color: #9a7451; filter: saturate(.4) brightness(.85); }
.icon-btn.small { width: 3.35em; height: 3.35em; border-width: .16em; }
.icon-btn.small > svg { width: 1.55em; height: 1.55em; }

.coin-chip {
  display: inline-flex;
  align-items: center;
  gap: .55em;
  min-height: 3.15em;
  padding: .35em 1.15em .35em .65em;
  border: .09em solid rgba(255, 221, 138, .45);
  border-radius: 2em;
  color: var(--gold-light);
  background: rgba(5, 23, 27, .65);
  font-family: var(--font-ui);
  font-size: 1.1em;
  font-weight: 700;
  letter-spacing: .06em;
  box-shadow: inset 0 0 .9em rgba(0,0,0,.4);
}

.coin-chip svg {
  width: 2em;
  height: 2em;
  fill: currentColor;
}

/* ═══════════════════════ MAIN MENU ═══════════════════════ */

.screen-menu {
  background:
    linear-gradient(90deg, rgba(2, 12, 16, .94) 0%, rgba(3, 17, 21, .82) 33%, rgba(4, 21, 25, .28) 62%, rgba(2, 10, 13, .12) 100%),
    linear-gradient(180deg, rgba(0, 0, 0, .3), transparent 25%, transparent 72%, rgba(0, 8, 10, .55));
}

.screen-menu::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 55%;
  background: repeating-linear-gradient(115deg, transparent 0 4em, rgba(255, 255, 255, .008) 4em 4.1em);
  pointer-events: none;
  mask-image: linear-gradient(90deg, #000, transparent);
}

.menu-top {
  position: absolute;
  top: 3.1em;
  left: 4em;
  right: 4em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 3;
}

.mini-brand {
  display: flex;
  align-items: center;
  gap: .75em;
  color: rgba(245, 226, 185, .74);
  font-family: var(--font-ui);
  font-size: .77em;
  font-weight: 700;
  letter-spacing: .26em;
  text-transform: uppercase;
}

.mini-brand svg {
  width: 2.8em;
  height: 2.8em;
  fill: var(--gold);
  opacity: .8;
  filter: drop-shadow(0 .12em .2em rgba(0,0,0,.5));
}

.top-actions { display: flex; gap: .8em; }

.menu-copy {
  position: absolute;
  top: 11.8em;
  left: 5.4em;
  width: 48em;
  z-index: 3;
}

.menu-copy .eyebrow {
  display: flex;
  align-items: center;
  gap: .2em;
  margin-left: .2em;
  color: #d9b766;
  font-size: .76em;
  text-shadow: 0 .2em .4em rgba(0,0,0,.7);
}

.game-logo {
  position: relative;
  width: max-content;
  margin: 0;
  font-size: 1em;
  line-height: .72;
  transform: rotate(-2.3deg);
  filter: drop-shadow(0 .075em 0 #4d2505) drop-shadow(0 .16em .19em rgba(0, 0, 0, .7));
}

.logo-pirates {
  display: block;
  color: transparent;
  font-family: var(--font-logo);
  font-size: 8.35em;
  font-weight: 900;
  letter-spacing: -.035em;
  line-height: .95;
  background: linear-gradient(178deg, #fff9d9 0%, #ffe391 16%, #f6bf4e 35%, #c57a1f 61%, #f2c85d 73%, #ffe9a1 84%, #b46919 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-stroke: .014em rgba(72, 32, 4, .6);
}

.logo-rush {
  position: relative;
  display: block;
  width: max-content;
  margin: .38em 0 0 3.25em;
  color: transparent;
  font-family: var(--font-display);
  font-size: 2.72em;
  font-weight: 700;
  letter-spacing: .28em;
  background: linear-gradient(180deg, #eef6ef 0%, #b7dfc6 40%, #6b9f8b 60%, #e9d38b 100%);
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 .095em 0 #1b342e) drop-shadow(0 .18em .25em rgba(0,0,0,.55));
}

.logo-rush::before,
.logo-rush::after {
  content: "";
  position: absolute;
  top: 53%;
  width: 2.35em;
  height: .055em;
  background: linear-gradient(90deg, transparent, rgba(242, 211, 131, .72));
}

.logo-rush::before { left: -3.3em; }
.logo-rush::after { right: -3.3em; transform: scaleX(-1); }

.logo-ribbon {
  width: max-content;
  margin: 1.15em 0 0 4.8em;
  padding: .38em 1.3em .34em;
  color: #f0d58c;
  font-family: var(--font-ui);
  font-size: .64em;
  font-weight: 700;
  letter-spacing: .38em;
  text-transform: uppercase;
  background: linear-gradient(90deg, #622515, #9e3e23 25%, #79301d 50%, #9e3e23 75%, #622515);
  border-top: .1em solid rgba(255, 210, 121, .45);
  border-bottom: .1em solid rgba(255, 210, 121, .45);
  box-shadow: 0 .3em .7em rgba(0,0,0,.4), inset 0 0 1em rgba(0,0,0,.3);
  clip-path: polygon(4% 0, 96% 0, 100% 50%, 96% 100%, 4% 100%, 0 50%);
}

.menu-tagline {
  margin: .9em 0 0 .4em;
  color: rgba(241, 226, 197, .8);
  font-family: var(--font-ui);
  font-size: 1.02em;
  line-height: 1.6;
  letter-spacing: .02em;
  text-shadow: 0 .15em .35em rgba(0,0,0,.55);
}

.menu-cta {
  position: absolute;
  left: 5.4em;
  bottom: 9.9em;
  z-index: 4;
}

.btn-hero {
  width: 26.5em;
  min-height: 5.15em;
  justify-content: flex-start;
  padding: .75em 1.1em .8em .8em;
  text-align: left;
  font-size: 1.12em;
  border-radius: .58em;
}

.btn-hero-icon {
  display: grid;
  place-items: center;
  width: 3.3em;
  height: 3.3em;
  flex: 0 0 auto;
  border-radius: 50%;
  color: #f9dfa2;
  background: radial-gradient(circle at 38% 28%, #5a3a14, #2a1808 70%);
  border: .08em solid rgba(255, 220, 136, .5);
  box-shadow: inset 0 .12em .3em rgba(255,255,255,.12);
}

.btn-hero-icon svg { width: 2.15em; height: 2.15em; fill: currentColor; }

.btn-hero-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .02em;
  margin-left: .15em;
  line-height: 1.05;
}

.btn-hero-copy strong {
  color: #1f1104;
  font-family: var(--font-ui);
  font-size: 1.35em;
  font-weight: 900;
  letter-spacing: .15em;
  text-shadow: none;
}

.btn-hero-copy small {
  color: #1a0d03;
  font-family: var(--font-ui);
  font-size: .66em;
  font-style: normal;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: none;
  text-shadow: none;
}

.btn-arrow {
  width: 1.45em !important;
  height: 1.45em !important;
  margin-left: auto;
  filter: drop-shadow(0 0 .03em rgba(255,255,255,.3));
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: .55em;
  margin-top: .8em;
  width: 26.5em;
}

.cta-row .btn {
  flex: 1 1 7.6em;
  min-height: 2.95em;
  padding: .55em .6em;
  font-size: .76em;
  letter-spacing: .05em;
  white-space: nowrap;
}

.menu-footer {
  position: absolute;
  left: 4.2em;
  right: 4.2em;
  bottom: 3.2em;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  z-index: 3;
}

.footer-stats { display: flex; gap: .8em; }

.stat-chip {
  display: flex;
  align-items: center;
  gap: .42em;
  padding: .5em 1em .5em .7em;
  color: #f2d58b;
  border: .08em solid rgba(241, 206, 119, .25);
  border-radius: .4em;
  background: rgba(2, 15, 18, .55);
  font-family: var(--font-ui);
  font-size: .8em;
  font-weight: 700;
  letter-spacing: .05em;
}

.stat-chip svg { width: 1.8em; height: 1.8em; fill: currentColor; }
.stat-chip small { color: rgba(235, 218, 178, .5); font-size: .75em; font-weight: 400; letter-spacing: .08em; text-transform: uppercase; }

.menu-credit {
  color: rgba(226, 211, 176, .47);
  font-family: var(--font-ui);
  font-size: .67em;
  font-weight: 700;
  line-height: 1.55;
  letter-spacing: .09em;
  text-align: right;
  text-transform: uppercase;
}

.menu-credit span { color: rgba(226, 211, 176, .25); font-weight: 400; }

/* ═══════════════════════ SUB HEADERS (MAP / HARBOR) ═══════════════════════ */

.sub-header {
  position: relative;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 1.4em;
  padding: 2.2em 3em 0;
}

.header-title { flex: 1; }
.header-title .eyebrow { margin-bottom: .15em; font-size: .66em; color: #c69b45; }
.header-title h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 2.5em;
  font-weight: 600;
  letter-spacing: .045em;
  line-height: 1.1;
  text-shadow: 0 .08em .15em rgba(0,0,0,.25);
}

.header-tools { display: flex; align-items: center; gap: .75em; }
.header-tools .icon-btn { width: 3.35em; height: 3.35em; border-width: .15em; }
.header-tools .icon-btn > svg { width: 1.55em; height: 1.55em; }

.btn-header {
  min-height: 3.05em;
  padding: .45em 1.05em;
  border-color: rgba(101, 73, 31, .35);
  color: #4c3214;
  background: rgba(255, 247, 221, .38);
  box-shadow: inset 0 0 .8em rgba(255,255,255,.2);
  font-size: .83em;
}

.btn-header:hover { background: rgba(255, 247, 221, .62); }

/* ═══════════════════════ MAP SCREEN ═══════════════════════ */

.screen-map {
  color: #3c2b16;
  background:
    radial-gradient(ellipse at 19% 16%, rgba(255, 248, 220, .52), transparent 31%),
    radial-gradient(ellipse at 80% 84%, rgba(98, 66, 30, .16), transparent 35%),
    radial-gradient(ellipse at 50% 42%, #e5d4a8 0%, #d6c18d 52%, #b89b68 100%);
}

.screen-map::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .23;
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='260' height='260'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.65' numOctaves='4' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='.6'/></svg>");
  mix-blend-mode: multiply;
}

.screen-map::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow:
    inset 0 0 9em rgba(73, 46, 17, .46),
    inset 0 0 1.8em rgba(60, 38, 12, .35);
}

.map-header { color: #352712; }
.map-header .eyebrow { color: #8a611f; }
.map-header .icon-btn {
  color: #5c421c;
  border-color: #92733c;
  background: radial-gradient(circle at 36% 27%, #f8efd5, #d7c391 60%, #b39a64);
  box-shadow: inset 0 .1em .3em rgba(255,255,255,.4), 0 0 0 .1em rgba(86,60,23,.5), 0 .25em .55em rgba(75,50,18,.25);
}
.map-header .coin-chip { color: #5d3f16; border-color: rgba(103, 73, 31, .35); background: rgba(255, 250, 231, .42); }
.map-header .icon-btn.is-off { color: #8d7b5b; }

.map-frame {
  position: absolute;
  top: 9.2em;
  left: 3em;
  right: 3em;
  bottom: 8.2em;
  z-index: 3;
  padding: .7em;
  border: .14em solid rgba(79, 56, 24, .5);
  border-radius: .28em;
  box-shadow: 0 .35em 1.2em rgba(73, 49, 16, .16), inset 0 0 0 .12em rgba(255,255,255,.24);
}

.map-frame::before,
.map-frame::after {
  content: "";
  position: absolute;
  width: 4em;
  height: 4em;
  border-color: rgba(78, 55, 23, .55);
  pointer-events: none;
}

.map-frame::before { top: -.5em; left: -.5em; border-top: .2em solid; border-left: .2em solid; }
.map-frame::after { right: -.5em; bottom: -.5em; border-right: .2em solid; border-bottom: .2em solid; }

.map-frame-inner {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border: .08em solid rgba(83, 59, 26, .28);
  background:
    radial-gradient(circle at 72% 18%, rgba(250, 243, 218, .43), transparent 23%),
    radial-gradient(circle at 24% 67%, rgba(250, 243, 218, .28), transparent 26%),
    linear-gradient(140deg, rgba(247, 240, 216, .24), rgba(164, 137, 92, .14));
}

.map-frame-inner::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    repeating-radial-gradient(ellipse at 34% 42%, transparent 0 1.7em, rgba(89, 64, 29, .045) 1.75em 1.82em),
    repeating-radial-gradient(ellipse at 70% 62%, transparent 0 2.3em, rgba(89, 64, 29, .04) 2.35em 2.42em);
  opacity: .6;
  pointer-events: none;
}

.map-heading {
  position: absolute;
  top: 1.25em;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(68, 48, 21, .6);
  font-family: var(--font-ui);
  font-size: .68em;
  font-weight: 700;
  letter-spacing: .46em;
  white-space: nowrap;
}

.map-heading-sub { color: rgba(100, 68, 26, .35); letter-spacing: .24em; }

.map-route {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.route-shadow {
  fill: none;
  stroke: rgba(71, 47, 16, .14);
  stroke-width: 7;
  stroke-linecap: round;
}

.route-dash {
  fill: none;
  stroke: rgba(121, 72, 27, .65);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 3 12;
  animation: routeFlow 30s linear infinite;
}

@keyframes routeFlow { to { stroke-dashoffset: -300; } }

.map-island {
  position: absolute;
  pointer-events: none;
  opacity: .47;
  filter: blur(.02em);
}

.map-island::before,
.map-island::after {
  content: "";
  position: absolute;
  background: rgba(94, 72, 38, .32);
  border-radius: 47% 53% 43% 57% / 62% 48% 52% 38%;
  transform: rotate(-16deg);
}

.map-island::before { width: 7em; height: 2.8em; left: 0; bottom: 0; }
.map-island::after { width: 3.6em; height: 1.5em; left: 4em; bottom: 2.2em; opacity: .55; }

.island-a { left: 23%; top: 20%; transform: scale(.8); }
.island-b { right: 15%; top: 54%; transform: rotate(17deg) scale(1.2); }
.island-c { left: 9%; bottom: 14%; transform: scale(1.35) rotate(-7deg); }
.island-d { right: 28%; top: 8%; transform: scale(.62) rotate(22deg); opacity: .32; }

.map-kraken { position: absolute; right: 7%; bottom: 5%; width: 15em; opacity: .8; pointer-events: none; }
.map-kraken svg { width: 100%; height: auto; }

.map-compass {
  position: absolute;
  left: 2.5em;
  bottom: 2.5em;
  width: 8em;
  opacity: .7;
  pointer-events: none;
}

.map-compass svg { width: 100%; height: 100%; }

.map-nodes { position: absolute; inset: 0; }

.map-node {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .55em;
  z-index: 2;
}

.map-node-button {
  position: relative;
  width: 5.9em;
  height: 5.9em;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #4b3415;
  background:
    radial-gradient(circle at 36% 28%, #fff7d8, #e8d39b 44%, #c3a466 72%, #9d7d43);
  border: .18em solid rgba(87, 58, 18, .75);
  box-shadow:
    inset 0 .15em .4em rgba(255, 255, 255, .5),
    inset 0 -.3em .55em rgba(100, 68, 20, .3),
    0 .35em .65em rgba(70, 46, 13, .28);
  transition: transform .2s ease, filter .2s ease;
}

.map-node-button::before {
  content: "";
  position: absolute;
  inset: .55em;
  border: .07em solid rgba(101, 71, 25, .25);
  border-radius: 50%;
}

.map-node-button::after {
  content: "";
  position: absolute;
  inset: -1.05em;
  border: .09em dashed rgba(116, 78, 24, .25);
  border-radius: 50%;
  opacity: 0;
}

.map-node.unlocked .map-node-button:hover {
  transform: translateY(-.28em) scale(1.045);
  filter: brightness(1.045);
}

.map-node.unlocked.current .map-node-button::after {
  opacity: 1;
  border-color: rgba(131, 82, 21, .48);
  animation: nodeOrbit 16s linear infinite;
}

.map-node.unlocked.current .map-node-button {
  box-shadow:
    inset 0 .15em .4em rgba(255,255,255,.5),
    inset 0 -.3em .55em rgba(100,68,20,.3),
    0 .35em .65em rgba(70,46,13,.28),
    0 0 0 .2em rgba(123, 80, 24, .12),
    0 0 1.8em rgba(176, 122, 37, .18);
}

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

.map-node.locked { cursor: not-allowed; }

.map-node.locked .map-node-button {
  color: #756544;
  filter: grayscale(.75) opacity(.55);
  background: radial-gradient(circle at 36% 28%, #d9ccb1, #bbae8f 48%, #90815f);
  border-color: rgba(80, 62, 31, .45);
}

.node-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .1em;
  z-index: 1;
}

.node-inner .node-number {
  font-family: var(--font-display);
  font-size: 1.7em;
  font-weight: 700;
  line-height: 1;
}

.node-inner .node-icon { width: 1.8em; height: 1.8em; fill: currentColor; opacity: .7; }

.node-inner .node-stars {
  display: flex;
  gap: .05em;
  margin-top: .1em;
  color: #7d5312;
}

.node-inner .node-stars svg { width: .66em; height: .66em; fill: currentColor; }
.node-inner .node-stars svg.off { opacity: .18; }

.node-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .05em;
  min-width: 11em;
  padding: .38em .75em .34em;
  color: #4b3616;
  background: rgba(248, 239, 213, .66);
  border: .07em solid rgba(102, 75, 34, .2);
  border-radius: .22em;
  box-shadow: 0 .15em .25em rgba(79, 54, 19, .1);
  text-align: center;
}

.node-label strong {
  font-family: var(--font-ui);
  font-size: .73em;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.node-label small { color: rgba(84, 59, 22, .62); font-size: .67em; font-style: italic; }
.map-node.locked .node-label { opacity: .55; }
.node-new {
  position: absolute;
  right: -1.2em;
  top: -.6em;
  padding: .22em .55em;
  color: #fff7dc;
  background: #9a3224;
  border-radius: .2em;
  font-family: var(--font-ui);
  font-size: .5em;
  font-weight: 700;
  letter-spacing: .12em;
  box-shadow: 0 .15em .3em rgba(0,0,0,.2);
  transform: rotate(7deg);
}

.map-legend {
  position: absolute;
  left: 2.2em;
  bottom: 1.25em;
  display: flex;
  align-items: center;
  gap: .55em;
  color: rgba(69, 48, 20, .6);
  font-family: var(--font-ui);
  font-size: .65em;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.legend-dot {
  width: .55em;
  height: .55em;
  border-radius: 50%;
  background: #8c5f1d;
}
.legend-star { color: #8c5f1d; font-size: 1.2em; }

.map-footer {
  position: absolute;
  left: 3.2em;
  right: 3.2em;
  bottom: 2.2em;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2em;
}

.map-captain { display: flex; align-items: center; gap: .8em; max-width: 72%; }

.mini-portrait {
  width: 3.1em;
  height: 3.1em;
  flex: 0 0 auto;
  border-radius: 50%;
  border: .12em solid rgba(87, 60, 22, .55);
  overflow: hidden;
  background: #173d40;
}

.mini-portrait svg { width: 100%; height: 100%; }

.map-captain p {
  margin: 0;
  color: rgba(63, 44, 18, .8);
  font-family: var(--font-ui);
  font-size: .98em;
  font-style: italic;
  line-height: 1.4;
}

.map-captain strong { color: #4c3212; font-style: normal; }

.map-progress-label {
  color: rgba(77, 53, 20, .56);
  font-family: var(--font-ui);
  font-size: .67em;
  font-weight: 700;
  letter-spacing: .15em;
  text-transform: uppercase;
}

.map-progress-label strong { color: #4d3315; margin-left: .4em; }

/* ═══════════════════════ HARBOR / UPGRADES ═══════════════════════ */

.screen-harbor {
  background:
    radial-gradient(ellipse at 14% 35%, rgba(34, 109, 107, .26), transparent 34%),
    radial-gradient(ellipse at 90% 80%, rgba(160, 92, 32, .13), transparent 38%),
    linear-gradient(115deg, #061c21 0%, #0a282e 45%, #071e24 100%);
}

.screen-harbor::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(90deg, transparent 0 10em, rgba(255,255,255,.012) 10em 10.12em),
    repeating-linear-gradient(0deg, transparent 0 3.4em, rgba(0,0,0,.06) 3.4em 3.5em);
  opacity: .8;
}

.harbor-header { color: var(--cream); }
.harbor-header .header-title .eyebrow { color: #cfad61; }

.harbor-layout {
  position: absolute;
  top: 9.6em;
  left: 3.2em;
  right: 3.2em;
  bottom: 2.6em;
  display: grid;
  grid-template-columns: minmax(0, .92fr) minmax(0, .94fr) minmax(0, 1.08fr);
  gap: 1.5em;
  z-index: 3;
}

.ship-card {
  padding: 1.6em 1.7em 1.4em;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.ship-card-top,
.upgrade-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1em;
}

.ship-card h3,
.fleet-panel h3,
.upgrade-panel h3 {
  margin: 0;
  color: var(--cream);
  font-family: var(--font-display);
  font-size: 1.72em;
  font-weight: 600;
  letter-spacing: .04em;
}

.ship-rank {
  padding: .32em .8em .28em;
  color: var(--gold-light);
  border: .08em solid rgba(239, 201, 111, .4);
  border-radius: .25em;
  font-family: var(--font-ui);
  font-size: .66em;
  font-weight: 700;
  letter-spacing: .15em;
  text-transform: uppercase;
}

.ship-preview-wrap {
  position: relative;
  flex: 1;
  min-height: 10em;
  margin: 1em -1.7em .3em;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 88%, rgba(90, 191, 178, .16), transparent 54%),
    linear-gradient(180deg, rgba(13, 52, 58, .1), rgba(13, 69, 73, .25));
  border-top: .06em solid rgba(232,182,76,.12);
  border-bottom: .06em solid rgba(232,182,76,.12);
}

.ship-preview-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: cover; object-position: 50% 46%; }

.ship-flavor {
  margin: .8em 0 .9em;
  color: rgba(236, 221, 188, .58);
  font-family: var(--font-ui);
  font-size: .98em;
  font-style: italic;
  line-height: 1.5;
}

.ship-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .55em .9em;
}

.ship-stat {
  display: flex;
  align-items: center;
  gap: .55em;
  padding: .55em .7em;
  border: .06em solid rgba(232, 182, 76, .15);
  border-radius: .28em;
  background: rgba(0, 0, 0, .15);
}

.ship-stat svg { width: 1.45em; height: 1.45em; fill: var(--gold); opacity: .78; flex: 0 0 auto; }
.ship-stat div { display: flex; flex-direction: column; gap: .06em; }
.ship-stat small { color: rgba(234, 214, 170, .46); font-family: var(--font-ui); font-size: .58em; letter-spacing: .12em; text-transform: uppercase; }
.ship-stat strong { color: #f3e3bb; font-family: var(--font-ui); font-size: .88em; font-weight: 700; }
.ship-stat > div { flex: 1; }
.stat-bar { display: block; width: 100%; height: .28em; margin-top: .28em; overflow: hidden; border-radius: 1em; background: rgba(255,255,255,.08); }
.stat-bar i { display: block; height: 100%; border-radius: 1em; background: linear-gradient(90deg, #9b6820, #f0c96b); box-shadow: 0 0 .4em rgba(240,201,107,.35); transition: width .45s cubic-bezier(.2,.8,.2,1); }

/* ─────────────────────── Fleet roster ─────────────────────── */

.fleet-panel {
  padding: 1.55em 1.4em 1.1em;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.panel-watermark {
  position: absolute;
  right: -.5em;
  bottom: 1.4em;
  width: 17em;
  height: 17em;
  color: #e8b64c;
  opacity: .045;
  pointer-events: none;
}
.upgrade-panel { position: relative; overflow: hidden; }

.fleet-list {
  display: flex;
  flex-direction: column;
  gap: .55em;
  margin-top: 1.1em;
  flex: 1;
  overflow-y: auto;
  padding-right: .25em;
  scrollbar-width: thin;
  scrollbar-color: rgba(232,182,76,.3) transparent;
}

.fleet-row {
  display: flex;
  align-items: center;
  gap: .7em;
  padding: .55em .6em;
  border: .07em solid rgba(232, 182, 76, .16);
  border-radius: .35em;
  background: linear-gradient(100deg, rgba(255, 255, 255, .035), rgba(0, 0, 0, .1));
  cursor: pointer;
  transition: background .2s, border-color .2s, transform .2s;
}

.fleet-row:hover {
  background: linear-gradient(100deg, rgba(255, 255, 255, .06), rgba(0, 0, 0, .08));
  border-color: rgba(232, 182, 76, .32);
}

.fleet-row.equipped {
  border-color: rgba(240, 202, 109, .55);
  background: linear-gradient(100deg, rgba(240, 202, 109, .14), rgba(0, 0, 0, .1));
  box-shadow: inset 0 0 1.2em rgba(240, 202, 109, .06);
}

.fleet-row.previewing {
  border-color: rgba(232, 182, 76, .45);
  box-shadow: inset .22em 0 0 rgba(232, 182, 76, .55);
}

.fleet-row.previewing .fleet-badge { border-color: rgba(232, 182, 76, .5); }

.fleet-row.locked .fleet-copy h4 { color: rgba(236, 220, 183, .78); }

.fleet-badge {
  display: grid;
  place-items: center;
  width: 2.5em;
  height: 2.5em;
  flex: 0 0 auto;
  border-radius: 50%;
  color: #d7af58;
  border: .08em solid rgba(232, 182, 76, .28);
  background: radial-gradient(circle at 38% 28%, #163a3d, #081d22);
}

.fleet-row.equipped .fleet-badge {
  color: #ffe8a4;
  border-color: rgba(240, 202, 109, .55);
  box-shadow: 0 0 .6em rgba(240, 202, 109, .18);
}

.fleet-badge svg { width: 1.35em; height: 1.35em; fill: currentColor; }

.fleet-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .14em; }

.fleet-copy h4 {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .4em;
  margin: 0;
  color: #ecdcb7;
  font-family: var(--font-ui);
  font-size: .8em;
  font-weight: 700;
  letter-spacing: .03em;
  line-height: 1.2;
}

.fleet-tag {
  padding: .14em .45em .1em;
  color: #cfad61;
  border: .07em solid rgba(207, 173, 97, .34);
  border-radius: .2em;
  font-size: .66em;
  font-weight: 700;
  letter-spacing: .1em;
}

.fleet-copy p {
  margin: 0;
  color: rgba(235, 218, 177, .45);
  font-family: var(--font-ui);
  font-size: .6em;
  line-height: 1.35;
}

.fleet-row .btn-buy {
  min-height: 2em;
  padding: .22em .55em .22em .42em;
  font-size: .66em;
  flex: 0 0 auto;
}

.fleet-row .btn-buy.equip {
  color: #eafff5;
  border-color: rgba(150, 255, 214, .42);
  background: linear-gradient(180deg, #3aa386, #1f6b58 70%, #145247);
  box-shadow: 0 .15em .35em rgba(0, 0, 0, .35);
}

.fleet-row .btn-buy.maxed { font-size: .6em; opacity: .62; }

.fleet-footer {
  margin-top: .7em;
  padding-top: .75em;
  border-top: .06em solid rgba(232, 182, 76, .12);
}

.fleet-footer p {
  display: flex;
  align-items: flex-start;
  gap: .45em;
  margin: 0;
  color: rgba(235, 218, 177, .43);
  font-family: var(--font-ui);
  font-size: .6em;
  line-height: 1.4;
}

.fleet-footer p svg { width: 1.5em; height: 1.5em; flex: 0 0 auto; fill: currentColor; opacity: .65; }

.upgrade-panel {
  padding: 1.55em 1.7em 1.2em;
  display: flex;
  flex-direction: column;
}

.upgrade-tip {
  color: rgba(235, 217, 175, .4);
  font-family: var(--font-ui);
  font-size: .65em;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.upgrade-heading .btn-paint {
  flex: 0 0 auto;
  min-height: 2.5em;
  padding: .35em .7em .35em .55em;
  font-size: .66em;
  white-space: nowrap;
}

.upgrade-heading .btn-paint svg { width: 1.35em; height: 1.35em; }

.upgrade-list {
  display: flex;
  flex-direction: column;
  gap: .55em;
  margin-top: 1.15em;
  flex: 1;
  overflow-y: auto;
  padding-right: .25em;
  scrollbar-width: thin;
  scrollbar-color: rgba(232,182,76,.3) transparent;
}

/* Compact magazine strip inside the refit panel. */
.armory-panel {
  flex: 0 0 auto;
  margin-top: .85em;
  padding: .55em .65em .5em;
  border: .06em solid rgba(232, 182, 76, .18);
  border-radius: .35em;
  background: rgba(0, 0, 0, .14);
}

.armory-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6em;
  margin-bottom: .35em;
}

.armory-head > span {
  display: flex;
  align-items: center;
  gap: .35em;
  color: #cfad61;
  font-family: var(--font-ui);
  font-size: .62em;
  font-weight: 700;
  letter-spacing: .14em;
}

.armory-head > span svg { width: 1.45em; height: 1.45em; fill: currentColor; opacity: .8; }

.armory-refill {
  min-height: 1.9em;
  padding: .18em .55em .18em .42em;
  font-size: .58em;
}

.armory-list { display: flex; flex-direction: column; gap: .18em; }

.armory-row {
  display: flex;
  align-items: center;
  gap: .45em;
  padding: .24em .25em;
  border-radius: .25em;
}

.armory-row + .armory-row { border-top: .06em solid rgba(232, 182, 76, .1); }
.armory-row.is-full { opacity: .62; }

.armory-icon {
  display: grid;
  place-items: center;
  width: 1.8em;
  height: 1.8em;
  flex: 0 0 auto;
  border-radius: 50%;
  color: #d7af58;
  border: .07em solid rgba(232, 182, 76, .24);
  background: radial-gradient(circle at 38% 28%, #163a3d, #081d22);
}

.armory-icon svg { width: 1.05em; height: 1.05em; fill: currentColor; }

.armory-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .02em; }
.armory-copy strong { color: #ecdcb7; font-family: var(--font-ui); font-size: .7em; font-weight: 700; letter-spacing: .03em; }
.armory-copy small { color: rgba(235, 218, 177, .46); font-family: var(--font-ui); font-size: .56em; }

.armory-row .btn-buy {
  min-height: 1.85em;
  padding: .14em .45em .14em .35em;
  font-size: .58em;
  flex: 0 0 auto;
}

.armory-row .btn-buy svg { width: 1.35em; height: 1.35em; }

.armory-note {
  margin: .35em 0 0;
  color: rgba(235, 218, 177, .4);
  font-family: var(--font-ui);
  font-size: .56em;
  line-height: 1.35;
}

.armory-panel + .upgrade-list { margin-top: .7em; }

.upgrade-row {
  display: flex;
  align-items: center;
  gap: .9em;
  padding: .7em .75em;
  border: .07em solid rgba(232, 182, 76, .16);
  border-radius: .35em;
  background: linear-gradient(100deg, rgba(255, 255, 255, .035), rgba(0, 0, 0, .1));
  transition: background .2s, border-color .2s;
}

.upgrade-row:hover { background: linear-gradient(100deg, rgba(255, 255, 255, .06), rgba(0, 0, 0, .08)); border-color: rgba(232, 182, 76, .28); }

.upgrade-icon {
  display: grid;
  place-items: center;
  width: 3.1em;
  height: 3.1em;
  flex: 0 0 auto;
  border-radius: 50%;
  color: #d7af58;
  border: .08em solid rgba(232, 182, 76, .28);
  background: radial-gradient(circle at 38% 28%, #163a3d, #081d22);
}

.upgrade-icon svg { width: 1.55em; height: 1.55em; fill: currentColor; }
.upgrade-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .16em; }
.upgrade-copy h4 { margin: 0; color: #ecdcb7; font-family: var(--font-ui); font-size: .86em; font-weight: 700; letter-spacing: .04em; }
.upgrade-copy p { margin: 0; color: rgba(235, 218, 177, .45); font-family: var(--font-ui); font-size: .65em; line-height: 1.3; }

.pips { display: flex; gap: .22em; margin-top: .3em; }
.pip { width: 1.35em; height: .36em; border-radius: .2em; background: rgba(255,255,255,.1); }
.pip.on { background: linear-gradient(90deg, #b47927, #f0ca6d); box-shadow: 0 0 .3em rgba(240,202,109,.3); }

.upgrade-action { display: flex; flex-direction: column; align-items: flex-end; gap: .28em; flex: 0 0 auto; }
.upgrade-value {
  color: #f1d697;
  font-family: var(--font-ui);
  font-size: .75em;
  font-weight: 700;
  letter-spacing: .03em;
  white-space: nowrap;
}
.upgrade-value span { color: rgba(235,218,177,.42); font-weight: 400; font-size: .82em; }

.btn-buy {
  display: inline-flex;
  align-items: center;
  gap: .35em;
  min-height: 2.15em;
  padding: .25em .7em .25em .5em;
  color: #3b2408;
  border: .07em solid rgba(255, 231, 158, .6);
  border-radius: .24em;
  background: linear-gradient(180deg, #f6d67c, #d8a33a 65%, #b77920);
  font-family: var(--font-ui);
  font-size: .72em;
  font-weight: 700;
  letter-spacing: .04em;
  box-shadow: 0 .15em .35em rgba(0,0,0,.35);
}

.btn-buy svg { width: 1.5em; height: 1.5em; fill: #6c470e; }
.btn-buy:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-.06em); }
.btn-buy:disabled { opacity: .33; cursor: not-allowed; filter: grayscale(.4); }
.btn-buy.maxed { color: #d5bc81; border-color: rgba(232,182,76,.22); background: rgba(255,255,255,.04); box-shadow: none; }

.upgrade-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.2em;
  padding-top: 1em;
  margin-top: .6em;
  border-top: .06em solid rgba(232, 182, 76, .12);
}

.upgrade-footer p {
  display: flex;
  align-items: flex-start;
  gap: .45em;
  max-width: 26em;
  margin: 0;
  color: rgba(235, 218, 177, .43);
  font-family: var(--font-ui);
  font-size: .62em;
  line-height: 1.4;
}

.upgrade-footer p svg { width: 1.5em; height: 1.5em; flex: 0 0 auto; fill: currentColor; opacity: .65; }

/* ═══════════════════════ IN-BATTLE HUD ═══════════════════════ */

.hud {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  opacity: 1;
  visibility: visible;
  transition: opacity .35s ease, visibility .35s;
}

.hud button { pointer-events: auto; }

.hud-top {
  position: absolute;
  top: 2.35em;
  left: 2.4em;
  right: 2.4em;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1em;
}

.captain-card {
  display: flex;
  align-items: center;
  gap: .8em;
  width: 38em;
  max-width: 40vw;
  filter: drop-shadow(0 .35em .6em rgba(0,0,0,.38));
}

.enemy-card { flex-direction: row; justify-content: flex-end; }

.portrait {
  width: 6.6em;
  height: 6.6em;
  flex: 0 0 auto;
  border-radius: 50%;
  overflow: hidden;
  background: #0a252a;
  border: .17em solid rgba(232, 182, 76, .72);
  box-shadow: 0 0 0 .12em rgba(45, 27, 8, .7), inset 0 0 1.2em rgba(0,0,0,.6);
}

.portrait svg { width: 100%; height: 100%; display: block; }
.portrait-enemy { border-color: rgba(179, 79, 62, .76); }

.bar-stack {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: .25em;
}

.enemy-card .bar-stack { align-items: flex-end; }

.bar-name {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1em;
  width: 100%;
  padding: 0 .65em;
  color: #f1dbad;
  font-family: var(--font-ui);
  font-size: .63em;
  font-weight: 700;
  letter-spacing: .12em;
  text-shadow: 0 .12em .2em rgba(0,0,0,.8);
}

.bar-name span:last-child { color: rgba(244, 227, 188, .7); letter-spacing: .06em; }

.player-ship-tag {
  display: inline-block;
  margin-left: .35em;
  padding: .08em .42em .04em;
  color: #ffda8f;
  border: .08em solid rgba(232, 182, 76, .38);
  border-radius: .2em;
  font-size: .82em;
  font-style: normal;
  letter-spacing: .1em;
  vertical-align: .06em;
}

.repair-tag {
  display: inline-block;
  margin-left: .55em;
  padding: .12em .45em;
  border-radius: .25em;
  background: #8ff0c6;
  color: #0b2a22;
  font-size: .8em;
  font-style: normal;
  letter-spacing: .12em;
  text-shadow: none;
  vertical-align: .06em;
  animation: repairTagPulse 1.5s ease-in-out infinite;
}

@keyframes repairTagPulse {
  0%, 100% { opacity: .65; }
  50% { opacity: 1; }
}

.health-frame {
  position: relative;
  width: 100%;
  height: 2.15em;
  padding: .22em;
  border-radius: .35em;
  background: linear-gradient(180deg, #2a1a0b, #090604);
  border: .11em solid #b8812b;
  box-shadow:
    inset 0 .1em .25em rgba(0,0,0,.8),
    0 0 0 .09em rgba(19, 11, 4, .75),
    0 .3em .55em rgba(0,0,0,.3);
  clip-path: polygon(0 0, 100% 0, 100% 68%, 97% 100%, 0 100%);
}

.health-fill {
  position: relative;
  height: 100%;
  width: 100%;
  border-radius: .16em;
  transition: width .22s ease-out;
  box-shadow: inset 0 0 .65em rgba(0,0,0,.35);
}

.health-player {
  background: linear-gradient(180deg, #8ff0c6 0%, #38b58b 36%, #17765d 70%, #0e503f 100%);
}

.health-player.is-repairing {
  animation: hullRepair 1.5s ease-in-out infinite;
}

@keyframes hullRepair {
  0%, 100% {
    filter: brightness(1);
    box-shadow: inset 0 0 .65em rgba(0,0,0,.35);
  }
  50% {
    filter: brightness(1.35);
    box-shadow: inset 0 0 .65em rgba(0,0,0,.2), 0 0 .8em rgba(120,245,190,.55);
  }
}

.health-enemy {
  margin-left: auto;
  background: linear-gradient(180deg, #f18b84 0%, #c6484b 34%, #8f262f 70%, #5f1721 100%);
}

.health-shine {
  position: absolute;
  left: .5em;
  right: 2.6em;
  top: .25em;
  height: .38em;
  border-radius: .2em;
  background: linear-gradient(90deg, rgba(255,255,255,.34), transparent);
  pointer-events: none;
  opacity: .7;
}

.battle-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .25em;
  padding-top: .2em;
  flex: 0 0 auto;
  min-width: 16em;
}

.skull-medallion {
  display: grid;
  place-items: center;
  width: 5.1em;
  height: 5.1em;
  margin-bottom: .15em;
  border-radius: 50%;
  color: #a2a69a;
  border: .16em solid rgba(227, 198, 135, .55);
  background: radial-gradient(circle at 36% 26%, #30484b, #101f23 65%, #061317);
  box-shadow: inset 0 0 1em rgba(0,0,0,.7), 0 .35em .7em rgba(0,0,0,.35);
  opacity: .85;
}

.skull-medallion svg { width: 3.1em; height: 3.1em; fill: currentColor; filter: drop-shadow(0 .06em .05em rgba(0,0,0,.6)); }
.battle-level {
  color: rgba(245, 226, 184, .82);
  font-family: var(--font-ui);
  font-size: .64em;
  font-weight: 700;
  letter-spacing: .18em;
  text-align: center;
  text-shadow: 0 .12em .3em rgba(0,0,0,.8);
  white-space: nowrap;
}

.battle-timer {
  display: flex;
  align-items: center;
  gap: .35em;
  color: rgba(239, 220, 179, .62);
  font-family: var(--font-ui);
  font-size: .68em;
  font-weight: 700;
  letter-spacing: .08em;
}

.battle-timer svg { width: 1.2em; height: 1.2em; fill: currentColor; opacity: .6; }

.quick-actions {
  position: absolute;
  right: 2.5em;
  top: 12.2em;
  display: flex;
  flex-direction: column;
  gap: .7em;
  pointer-events: none;
}

.hud-bottom {
  position: absolute;
  left: 2.7em;
  right: 2.7em;
  bottom: 2.3em;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1em;
}

.reload-chip {
  display: flex;
  align-items: center;
  gap: .75em;
  padding: .55em .9em .55em .55em;
  border: .08em solid rgba(239, 203, 121, .28);
  border-radius: .5em;
  background: rgba(3, 17, 20, .62);
  box-shadow: 0 .3em .8em rgba(0,0,0,.24), inset 0 0 1em rgba(0,0,0,.2);
  backdrop-filter: blur(.4em);
}

.reload-ring {
  position: relative;
  width: 3.5em;
  height: 3.5em;
  display: grid;
  place-items: center;
}

.reload-ring > svg:first-child { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.reload-track { fill: none; stroke: rgba(237, 208, 137, .17); stroke-width: 3; }
.reload-arc {
  fill: none;
  stroke: #f1c968;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 94.25;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset .1s linear, stroke .2s;
  filter: drop-shadow(0 0 .2em rgba(241,201,104,.4));
}
.reload-cannon { width: 1.85em; height: 1.85em; fill: #e6c26e; opacity: .9; }

.reload-copy { display: flex; flex-direction: column; gap: .14em; min-width: 11.5em; }
.reload-copy strong { color: #f2d287; font-family: var(--font-ui); font-size: .66em; font-weight: 700; letter-spacing: .12em; }
.reload-copy span { color: rgba(241, 222, 181, .42); font-family: var(--font-ui); font-size: .57em; letter-spacing: .03em; }
.reload-chip.cooling .reload-copy strong { color: rgba(241, 222, 181, .62); }

/* Horizontal reload meter: fills as the next broadside is readied. */
.reload-meter {
  position: relative;
  width: 100%;
  height: .32em;
  margin-top: .08em;
  border-radius: 1em;
  background: rgba(237, 208, 137, .16);
  box-shadow: inset 0 0 .3em rgba(0, 0, 0, .4);
  overflow: hidden;
}
.reload-meter > i {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #7a8f6a, #a9c98f);
  transition: width .1s linear, background .2s;
}
.reload-chip.cooling .reload-meter > i {
  background: linear-gradient(90deg, #8f5b2c, #e6a94a 65%, #ffd98b);
}
.reload-chip.is-ready .reload-meter > i {
  background: linear-gradient(90deg, #4f9d7a, #a9e8bf);
  box-shadow: 0 0 .5em rgba(120, 220, 170, .55);
}
.reload-chip.aiming .reload-meter > i {
  background: linear-gradient(90deg, #c79a3d, #ffe48b);
  box-shadow: 0 0 .5em rgba(255, 228, 139, .45);
}
.reload-chip.is-empty .reload-meter > i {
  background: linear-gradient(90deg, #6d332c, #d2694c);
  box-shadow: none;
}
.reload-chip.aiming .reload-copy strong { color: #ffe48b; }
.reload-meter::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -45%;
  width: 45%;
  background: linear-gradient(90deg, transparent, rgba(255, 244, 205, .55), transparent);
  opacity: 0;
}
.reload-chip.cooling .reload-meter::after {
  opacity: 1;
  animation: reload-sweep 1.25s linear infinite;
}
.reload-chip.cooling .reload-cannon {
  animation: reload-wobble 1.1s ease-in-out infinite;
  transform-origin: 50% 62%;
}
.reload-chip.is-ready .reload-ring {
  animation: reload-ready 1.8s ease-in-out infinite;
}
.reload-chip.is-ready .reload-copy strong { color: #c9efcf; }

@keyframes reload-sweep {
  from { left: -45%; }
  to { left: 100%; }
}
@keyframes reload-wobble {
  0%, 100% { transform: rotate(-4deg) translateY(0); }
  50% { transform: rotate(4deg) translateY(.05em); }
}
@keyframes reload-ready {
  0%, 100% { filter: drop-shadow(0 0 .12em rgba(169, 232, 191, .18)); }
  50% { filter: drop-shadow(0 0 .45em rgba(169, 232, 191, .58)); }
}

.battle-coins {
  display: flex;
  align-items: center;
  gap: .42em;
  padding: .45em .9em .45em .65em;
  color: #f6d786;
  border: .08em solid rgba(239, 203, 121, .23);
  border-radius: 2em;
  background: rgba(3, 17, 20, .55);
  font-family: var(--font-ui);
  font-size: .78em;
  font-weight: 700;
  letter-spacing: .06em;
}

.battle-coins svg { width: 1.65em; height: 1.65em; fill: currentColor; }

.hud-right {
  display: flex;
  align-items: center;
  gap: .5em;
}

.battle-ammo {
  display: flex;
  align-items: center;
  gap: .42em;
  padding: .45em .9em .45em .65em;
  color: #d8e9df;
  border: .08em solid rgba(159, 231, 207, .24);
  border-radius: 2em;
  background: rgba(3, 17, 20, .55);
  font-family: var(--font-ui);
  font-size: .78em;
  font-weight: 700;
  letter-spacing: .06em;
  transition: color .2s, border-color .2s, background .2s;
}

.battle-ammo svg { width: 1.65em; height: 1.65em; fill: currentColor; }
.battle-ammo.is-low { color: #ffd37a; border-color: rgba(255, 211, 122, .45); }
.battle-ammo.is-empty { color: #ff9a7a; border-color: rgba(255, 154, 122, .55); background: rgba(66, 18, 12, .45); }

/* Free-roam career HUD */
.career-bar {
  position: absolute;
  left: 50%;
  bottom: 2.2em;
  transform: translateX(-50%);
  display: flex;
  gap: .45em;
  pointer-events: none;
  filter: drop-shadow(0 .3em .7em rgba(0,0,0,.3));
}

.career-chip {
  display: flex;
  align-items: center;
  gap: .4em;
  padding: .38em .75em .38em .58em;
  color: #f1d694;
  border: .08em solid rgba(239, 203, 121, .24);
  border-radius: .42em;
  background: rgba(3, 17, 20, .6);
  font-family: var(--font-ui);
  font-size: .72em;
  font-weight: 700;
  letter-spacing: .04em;
  backdrop-filter: blur(.35em);
  white-space: nowrap;
}

.career-chip svg { width: 1.3em; height: 1.3em; fill: currentColor; opacity: .8; }
.career-chip small {
  color: rgba(241, 222, 181, .4);
  font-size: .72em;
  font-weight: 400;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.career-anchor {
  position: absolute;
  left: 50%;
  bottom: 6.6em;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: .7em;
  padding: .55em .9em .55em .6em;
  color: #f9e6b0;
  border: .08em solid rgba(255, 216, 125, .55);
  border-radius: .55em;
  background: linear-gradient(100deg, rgba(30, 78, 76, .92), rgba(8, 32, 36, .92));
  box-shadow: 0 .35em 1.1em rgba(0, 0, 0, .4), inset 0 0 1.2em rgba(241, 201, 104, .08);
  font-family: var(--font-ui);
  text-align: left;
  pointer-events: auto;
  animation: anchorPulse 2.2s ease-in-out infinite;
}

@keyframes anchorPulse {
  0%, 100% { box-shadow: 0 .35em 1.1em rgba(0,0,0,.4), 0 0 0 0 rgba(255, 214, 120, 0); }
  50% { box-shadow: 0 .35em 1.1em rgba(0,0,0,.4), 0 0 1.1em .15em rgba(255, 214, 120, .2); }
}

.career-anchor-icon {
  display: grid;
  place-items: center;
  width: 2.45em;
  height: 2.45em;
  border-radius: 50%;
  color: #ffe29a;
  border: .08em solid rgba(255, 220, 136, .45);
  background: radial-gradient(circle at 38% 28%, #396f65, #0b2b2c 75%);
}

.career-anchor-icon svg { width: 1.4em; height: 1.4em; fill: currentColor; }
.career-anchor-copy { display: flex; flex-direction: column; gap: .08em; }
.career-anchor-copy strong { font-size: .78em; letter-spacing: .1em; text-transform: uppercase; }
.career-anchor-copy small { color: rgba(241, 224, 183, .62); font-size: .65em; letter-spacing: .02em; }
.career-anchor-arrow { width: 1.1em; height: 1.1em; fill: currentColor; opacity: .6; }

.game-hint {
  position: absolute;
  left: 50%;
  bottom: 7.2em;
  transform: translate(-50%, .8em);
  padding: .48em 1.3em .44em;
  color: rgba(249, 232, 193, .78);
  border: .06em solid rgba(236, 206, 137, .22);
  border-radius: 2em;
  background: rgba(3, 16, 19, .55);
  font-family: var(--font-ui);
  font-size: .68em;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity .35s, transform .35s;
  pointer-events: none;
  backdrop-filter: blur(.3em);
  white-space: nowrap;
}

.game-hint.show { opacity: 1; transform: translate(-50%, 0); }

.battle-banner {
  position: absolute;
  top: 29%;
  left: 50%;
  width: 52em;
  max-width: 82%;
  transform: translate(-50%, -50%) scale(.94);
  padding: 1.4em 2em 1.25em;
  color: var(--cream);
  border-top: .09em solid rgba(232, 182, 76, .48);
  border-bottom: .09em solid rgba(232, 182, 76, .48);
  background: linear-gradient(90deg, transparent, rgba(3, 17, 20, .76) 16%, rgba(3, 17, 20, .76) 84%, transparent);
  text-align: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity .5s ease, transform .5s ease, visibility .5s;
  text-shadow: 0 .15em .45em rgba(0,0,0,.8);
}

.battle-banner.show { opacity: 1; visibility: visible; transform: translate(-50%, -50%) scale(1); }

.banner-kicker {
  display: block;
  margin-bottom: .45em;
  color: var(--gold);
  font-family: var(--font-ui);
  font-size: .59em;
  font-weight: 700;
  letter-spacing: .45em;
}

.banner-title {
  display: block;
  font-family: var(--font-display);
  font-size: 2.45em;
  font-weight: 600;
  letter-spacing: .08em;
  line-height: 1;
}

.banner-sub {
  display: block;
  margin-top: .5em;
  color: rgba(242, 226, 190, .62);
  font-family: var(--font-ui);
  font-size: .95em;
  font-style: italic;
}

/* ═══════════════════════ PAUSE / RESULTS / MODALS ═══════════════════════ */

.overlay-screen,
.modal {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  opacity: 1;
  visibility: visible;
  transition: opacity .35s ease, visibility .35s;
}

.modal { z-index: 50; }

.backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 45%, rgba(10, 43, 48, .34), rgba(1, 8, 10, .82) 68%),
    rgba(0, 6, 8, .6);
  backdrop-filter: blur(.45em) saturate(.8);
}

.backdrop.darker { background: radial-gradient(circle at 50% 45%, rgba(50, 17, 17, .24), rgba(1, 6, 8, .9) 68%), rgba(0, 4, 5, .72); }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 8, 10, .72); backdrop-filter: blur(.55em); }

.pause-panel {
  z-index: 1;
  width: 33em;
  padding: 2.8em 3em 2em;
  text-align: center;
  animation: panelIn .4s cubic-bezier(.2,.8,.2,1);
}

@keyframes panelIn {
  from { transform: translateY(1.5em) scale(.97); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.panel-ornament {
  width: 5em;
  height: .55em;
  margin: 0 auto 1.5em;
  background:
    linear-gradient(90deg, transparent, rgba(232,182,76,.7) 20%, rgba(232,182,76,.7) 80%, transparent);
  clip-path: polygon(0 50%, 15% 0, 85% 0, 100% 50%, 85% 100%, 15% 100%);
  opacity: .65;
}

.panel-title {
  margin: 0;
  color: #f4e3bb;
  font-family: var(--font-display);
  font-size: 2.5em;
  font-weight: 600;
  letter-spacing: .045em;
  line-height: 1.05;
  text-shadow: 0 .12em .3em rgba(0,0,0,.55);
}

.panel-sub {
  margin: .65em 0 1.5em;
  color: rgba(238, 221, 184, .55);
  font-family: var(--font-ui);
  font-size: 1em;
  font-style: italic;
  line-height: 1.45;
}

.pause-panel .btn-wide { margin-bottom: 1em; }

.pause-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .55em;
  margin-bottom: 1.1em;
}

.pause-grid .btn {
  font-size: .78em;
  min-height: 2.8em;
  padding: .45em .5em;
}

.key-hint {
  margin: 1.1em 0 0;
  color: rgba(232, 215, 176, .28);
  font-family: var(--font-ui);
  font-size: .62em;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.key-hint span { margin: 0 .35em; opacity: .5; }
.pause-credit { margin: .7em 0 0; color: rgba(226, 211, 176, .23); font-family: var(--font-ui); font-size: .58em; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; }
.pause-credit span { margin: 0 .3em; opacity: .5; }
.pause-credit strong { color: rgba(217, 178, 93, .62); font-weight: 700; }

/* Results */
.result-screen .backdrop { background: radial-gradient(circle at 50% 42%, rgba(30, 67, 62, .2), rgba(1, 7, 9, .89) 68%), rgba(0, 5, 7, .66); }
.result-screen .backdrop.darker { background: radial-gradient(circle at 50% 42%, rgba(76, 22, 20, .16), rgba(1, 5, 6, .93) 68%), rgba(0, 3, 4, .75); }

.result-rays {
  position: absolute;
  width: 70em;
  height: 70em;
  border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(245, 200, 105, .035) 0deg 7deg, transparent 7deg 16deg);
  animation: raysTurn 80s linear infinite;
  pointer-events: none;
  z-index: 0;
}

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

.result-panel {
  z-index: 1;
  width: 39em;
  padding: 2.1em 3.2em 2.1em;
  text-align: center;
  animation: panelIn .55s cubic-bezier(.18,.87,.25,1.08);
}

.result-crest {
  display: grid;
  place-items: center;
  width: 5.6em;
  height: 5.6em;
  margin: -4.9em auto 1.1em;
  border-radius: 50%;
  color: #f7dc91;
  border: .16em solid #d7a43f;
  background: radial-gradient(circle at 36% 26%, #536b63, #1b3736 40%, #0a1c20 78%);
  box-shadow: 0 0 0 .16em rgba(14, 36, 37, .9), 0 .6em 1.4em rgba(0,0,0,.6);
}

.result-crest svg { width: 3.1em; height: 3.1em; fill: currentColor; filter: drop-shadow(0 .05em .2em rgba(0,0,0,.4)); }
.result-crest.dark { color: #b79070; border-color: #744e3d; background: radial-gradient(circle at 36% 26%, #3a3d3a, #1b1a19 42%, #080a0a 78%); }

.gold-title { color: #ffe49b; text-shadow: 0 .05em 0 #754012, 0 .16em .35em rgba(0,0,0,.6); }
.red-title { color: #d5a190; text-shadow: 0 .05em 0 #55231f, 0 .16em .35em rgba(0,0,0,.6); }

.star-row {
  display: flex;
  justify-content: center;
  gap: .4em;
  margin: -.15em 0 1em;
  color: #f3c95e;
}

.star-row svg {
  width: 2.6em;
  height: 2.6em;
  fill: currentColor;
  opacity: .18;
  filter: drop-shadow(0 .08em .1em rgba(0,0,0,.4));
  transform: scale(.68) rotate(-8deg);
  transition: opacity .2s, transform .5s cubic-bezier(.2,.9,.3,1.4);
}

.star-row svg.earned { opacity: 1; transform: scale(1) rotate(0); }
.star-row svg:nth-child(2) { width: 3.15em; height: 3.15em; }

.result-stats {
  display: flex;
  justify-content: center;
  gap: 0;
  margin: 1.15em auto 1.45em;
  padding: 1.1em 0;
  border-top: .07em solid rgba(232, 182, 76, .16);
  border-bottom: .07em solid rgba(232, 182, 76, .16);
}

.result-stats > div {
  display: flex;
  flex-direction: column;
  gap: .25em;
  min-width: 8.4em;
  padding: 0 1.2em;
  border-right: .06em solid rgba(232, 182, 76, .13);
}

.result-stats > div:last-child { border-right: 0; }
.result-stats small { color: rgba(236, 215, 171, .35); font-family: var(--font-ui); font-size: .55em; font-weight: 700; letter-spacing: .16em; }
.result-stats strong { display: inline-flex; align-items: center; justify-content: center; gap: .3em; color: #f2dfb0; font-family: var(--font-ui); font-size: 1.23em; font-weight: 700; letter-spacing: .04em; }
.result-stats strong svg { width: 1.25em; height: 1.25em; fill: var(--gold); }
.reward-stat strong { color: #f6d477; }

.result-actions { display: flex; flex-wrap: wrap; gap: .55em; justify-content: center; }
.result-actions .btn-gold { flex: 1 1 13em; }
.result-actions .btn-ghost { flex: 1 1 11em; font-size: .82em; }
.result-actions .btn-quit { flex: 1 0 100%; margin-top: .35em; }

/* Free-roam career panels */
.career-panel { width: 43em; }

.career-detail { margin: 1.05em 0 1.35em; }

.career-stat-row {
  display: flex;
  justify-content: center;
  margin: 0 0 1em;
  padding: .95em 0;
  border-top: .07em solid rgba(232, 182, 76, .16);
  border-bottom: .07em solid rgba(232, 182, 76, .16);
}

.career-stat-row > div {
  display: flex;
  flex-direction: column;
  gap: .25em;
  flex: 1 1 0;
  min-width: 0;
  padding: 0 .8em;
  border-right: .06em solid rgba(232, 182, 76, .13);
}

.career-stat-row > div:last-child { border-right: 0; }
.career-stat-row small {
  color: rgba(236, 215, 171, .38);
  font-family: var(--font-ui);
  font-size: .53em;
  font-weight: 700;
  letter-spacing: .14em;
}
.career-stat-row strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .25em;
  color: #f2dfb0;
  font-family: var(--font-ui);
  font-size: .92em;
  font-weight: 700;
  letter-spacing: .02em;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.career-stat-row strong svg { width: 1.2em; height: 1.2em; fill: var(--gold); flex: 0 0 auto; }

.career-flavor {
  max-width: 32em;
  margin: 0 auto;
  color: rgba(236, 220, 185, .58);
  font-size: .84em;
  font-style: italic;
  line-height: 1.55;
}

.career-actions { flex-direction: column; align-items: stretch; }
.career-actions .btn-gold,
.career-actions .btn-ghost,
.career-actions .btn-quit { flex: 0 0 auto; width: 100%; }

.career-choice {
  flex-direction: column;
  align-items: flex-start;
  gap: .1em;
  text-align: left;
  padding: .7em 1.1em;
}

.career-choice-title {
  font-family: var(--font-ui);
  font-size: .98em;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.career-choice-meta {
  color: rgba(239, 220, 178, .55);
  font-family: var(--font-ui);
  font-size: .78em;
  letter-spacing: .02em;
}

.career-choice:disabled { opacity: .32; cursor: not-allowed; }

/* Harbor dock */
.dock-panel {
  width: 48em;
  max-width: 94%;
  max-height: 93%;
  padding: 2.1em 2.8em 1.9em;
  overflow-y: auto;
  animation: panelIn .45s cubic-bezier(.18,.87,.25,1.08);
}

.dock-crest { margin-top: -4.3em; }
.dock-panel .panel-sub { margin-bottom: 1em; }
.dock-panel .panel-title { font-size: 2.4em; }
.dock-stats { margin-bottom: .85em; }

.dock-services {
  display: flex;
  flex-direction: column;
  gap: .5em;
  margin: 0 0 1.2em;
  text-align: left;
}

.dock-service {
  display: flex;
  align-items: center;
  gap: .75em;
  padding: .55em .75em;
  border: .06em solid rgba(232, 182, 76, .16);
  border-radius: .5em;
  background: linear-gradient(100deg, rgba(14, 41, 45, .72), rgba(6, 24, 28, .55));
}

.dock-service.is-off { opacity: .66; }

.dock-service-icon {
  display: grid;
  place-items: center;
  width: 2.3em;
  height: 2.3em;
  flex: 0 0 auto;
  border-radius: 50%;
  border: .06em solid rgba(232, 182, 76, .25);
  background: rgba(8, 26, 30, .65);
}

.dock-service-icon svg { width: 1.35em; height: 1.35em; fill: var(--gold); opacity: .85; }

.dock-service-copy {
  display: flex;
  flex-direction: column;
  gap: .1em;
  flex: 1 1 auto;
  min-width: 0;
}

.dock-service-copy strong {
  color: #f2dfb0;
  font-family: var(--font-ui);
  font-size: .82em;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.dock-service-copy small {
  color: rgba(236, 220, 185, .5);
  font-size: .7em;
  line-height: 1.35;
}

.dock-service-actions {
  display: flex;
  gap: .38em;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.btn-dock {
  display: inline-flex;
  align-items: center;
  gap: .35em;
  padding: .45em .68em;
  color: #f7e3ae;
  border: .07em solid rgba(232, 182, 76, .45);
  border-radius: .4em;
  background: linear-gradient(180deg, rgba(232, 182, 76, .16), rgba(146, 96, 26, .12));
  font-family: var(--font-ui);
  font-size: .7em;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: transform .15s, filter .15s;
}

.dock-status { display: inline-flex; align-items: center; padding: .42em .7em; color: rgba(143, 226, 187, .8); border: .06em solid rgba(120, 214, 173, .24); border-radius: .35em; background: rgba(56, 120, 94, .12); font-family: var(--font-ui); font-size: .68em; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }

.btn-dock:hover:not(:disabled) { filter: brightness(1.12); transform: translateY(-.05em); }
.btn-dock:disabled { opacity: .35; cursor: not-allowed; }
.btn-dock > svg { width: 1.2em; height: 1.2em; flex: 0 0 auto; fill: currentColor; }

.dock-price { display: inline-flex; align-items: center; gap: .15em; color: #f7d071; }
.dock-price svg { width: 1.25em; height: 1.25em; fill: var(--gold); }
.dock-price.is-sell { color: #94e7bb; }
.dock-price.is-sell svg { fill: #94e7bb; }

.dock-actions { gap: .55em; }
.dock-actions .btn-ghost { flex: 1 1 12em; font-size: .78em; }
.dock-actions .btn-gold { flex: 1 1 13em; }

/* How-to modal */
.howto-card {
  width: 58em;
  max-width: 90%;
  max-height: 90%;
  padding: 2.2em 3em 2em;
  text-align: center;
  overflow-y: auto;
  animation: panelIn .4s cubic-bezier(.2,.8,.2,1);
}

.modal-close {
  position: absolute;
  top: 1.1em;
  right: 1.1em;
  width: 2.4em;
  height: 2.4em;
  display: grid;
  place-items: center;
  color: rgba(244, 223, 178, .6);
  border: .08em solid rgba(232,182,76,.2);
  border-radius: 50%;
  background: rgba(255,255,255,.03);
  transition: color .2s, border-color .2s, transform .2s;
}
.modal-close:hover { color: var(--gold-light); border-color: rgba(232,182,76,.5); transform: rotate(90deg); }
.modal-close svg { width: 1.1em; height: 1.1em; fill: currentColor; }

.control-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .9em;
  margin: 1.6em 0 1.25em;
}

.control-card {
  padding: 1.1em 1em 1em;
  border: .07em solid rgba(232, 182, 76, .18);
  border-radius: .45em;
  background: linear-gradient(180deg, rgba(255,255,255,.035), rgba(0,0,0,.1));
  text-align: center;
}

.control-art { height: 4.6em; display: grid; place-items: center; margin-bottom: .5em; }
.control-art svg { width: 4.2em; height: 4.2em; }
.control-card h4 { margin: 0 0 .4em; color: #f2ddb0; font-family: var(--font-ui); font-size: .95em; letter-spacing: .06em; text-transform: uppercase; }
.control-card p { margin: 0; color: rgba(237, 219, 180, .52); font-family: var(--font-ui); font-size: .72em; line-height: 1.45; }

.keyboard-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: .42em;
  padding: .75em 1em;
  border-top: .06em solid rgba(232,182,76,.12);
  border-bottom: .06em solid rgba(232,182,76,.12);
  color: rgba(235,217,177,.4);
  font-family: var(--font-ui);
  font-size: .66em;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.keyboard-strip > span { margin-right: .7em; color: rgba(232,182,76,.62); font-weight: 700; letter-spacing: .14em; }
.keyboard-strip kbd { padding: .15em .45em; color: #dcc998; border: .06em solid rgba(232,182,76,.26); border-radius: .2em; background: rgba(0,0,0,.24); font-family: var(--font-ui); font-size: 1em; box-shadow: 0 .1em 0 rgba(0,0,0,.4); }
.keyboard-strip em { margin-right: .55em; font-style: normal; color: rgba(235,217,177,.45); }

.howto-extra {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .45em;
  margin: 1.05em 0 1.2em;
  color: rgba(240, 220, 178, .55);
  font-family: var(--font-ui);
  font-size: .74em;
  line-height: 1.4;
}

.howto-extra svg { width: 1.55em; height: 1.55em; fill: var(--gold); flex: 0 0 auto; }

/* Toast */
.toast {
  position: absolute;
  left: 50%;
  bottom: 8.5em;
  z-index: 70;
  padding: .65em 1.3em;
  color: #f8e8bd;
  border: .07em solid rgba(232, 182, 76, .32);
  border-radius: .35em;
  background: rgba(4, 20, 23, .9);
  font-family: var(--font-ui);
  font-size: .78em;
  font-weight: 700;
  letter-spacing: .06em;
  box-shadow: 0 .7em 1.6em rgba(0,0,0,.45);
  opacity: 0;
  transform: translate(-50%, .6em);
  transition: opacity .25s, transform .25s;
  pointer-events: none;
  white-space: nowrap;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.gold { color: #f5d477; border-color: rgba(232,182,76,.55); }

/* Rotate overlay */
.rotate-hint {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 2.4vmin, 20px);
  padding: clamp(24px, 6vmin, 56px);
  color: #f2e0b5;
  background: #05191d;
  text-align: center;
}

.rotate-hint svg { width: clamp(54px, 16vmin, 110px); height: auto; animation: rotateHint 3s ease-in-out infinite; }
.rotate-hint strong { font-size: clamp(18px, 4.6vmin, 30px); font-weight: 400; letter-spacing: .04em; }
.rotate-hint span { max-width: 32ch; color: rgba(239, 222, 181, .58); font-family: var(--font-ui); font-size: clamp(12px, 2.8vmin, 17px); line-height: 1.5; }

@keyframes rotateHint {
  0%, 15% { transform: rotate(0); }
  55%, 80% { transform: rotate(90deg); }
  100% { transform: rotate(0); }
}

/* ═══════════════════════════════════════════════════════════════
   POLISH PASS — loading, chart, tutorial, credits & micro-interactions
   ═══════════════════════════════════════════════════════════════ */

/* ── Loading screen ── */
.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .9em;
  color: #e7c773;
  background:
    radial-gradient(ellipse at 50% 38%, #123c43 0%, #071f25 45%, #020b0e 100%);
  transition: opacity .7s ease, visibility .7s;
}

.loading-screen.is-done { opacity: 0; visibility: hidden; pointer-events: none; }

.loading-mark { width: 6.4em; height: 6.4em; color: #d9b25d; filter: drop-shadow(0 0 1.4em rgba(232,182,76,.25)); animation: markBreathe 3.2s ease-in-out infinite; }
.loading-mark svg { width: 100%; height: 100%; }

@keyframes markBreathe {
  0%, 100% { transform: scale(1); opacity: .85; }
  50% { transform: scale(1.045); opacity: 1; }
}

.loading-title {
  margin: .15em 0 0;
  color: #f6dda0;
  font-family: var(--font-logo);
  font-size: clamp(24px, 3.1vw, 42px);
  font-weight: 900;
  letter-spacing: .06em;
  line-height: 1;
  text-shadow: 0 .05em 0 #5b2f08, 0 .18em .45em rgba(0,0,0,.7);
}
.loading-title em { color: #bfe2c9; font-style: normal; }

.loading-sub {
  margin: 0;
  color: rgba(231, 199, 115, .55);
  font-family: var(--font-display);
  font-size: clamp(9px, .72vw, 12px);
  font-weight: 600;
  letter-spacing: .52em;
  text-indent: .52em;
}

.loading-bar {
  position: relative;
  width: min(24em, 46vw);
  height: .32em;
  margin-top: 1.4em;
  overflow: hidden;
  border: .06em solid rgba(232,182,76,.22);
  border-radius: 2em;
  background: rgba(0,0,0,.4);
}
.loading-bar span {
  display: block;
  width: 12%;
  height: 100%;
  border-radius: 2em;
  background: linear-gradient(90deg, #9b6820, #f3cd72 60%, #fff0bb);
  box-shadow: 0 0 .8em rgba(243,205,114,.5);
  transition: width .6s cubic-bezier(.2,.8,.2,1);
}

.loading-status {
  margin: 0;
  color: rgba(236, 217, 174, .5);
  font-family: var(--font-ui);
  font-size: .8em;
  letter-spacing: .06em;
}

.loading-studio {
  position: absolute;
  bottom: 2.6em;
  margin: 0;
  color: rgba(226, 207, 164, .32);
  font-family: var(--font-ui);
  font-size: .66em;
  font-weight: 700;
  letter-spacing: .34em;
  text-indent: .34em;
  text-transform: uppercase;
}
.loading-studio strong { color: rgba(239, 201, 111, .75); font-weight: 800; }

/* ── Menu refinements ── */
.mini-brand-copy { display: flex; flex-direction: column; gap: .16em; }
.mini-brand-copy strong {
  color: #f1d28a;
  font-family: var(--font-display);
  font-size: 1.28em;
  font-weight: 700;
  letter-spacing: .32em;
  line-height: 1;
  text-indent: .03em;
}
.mini-brand-copy small {
  color: rgba(245, 226, 185, .5);
  font-family: var(--font-ui);
  font-size: .72em;
  font-weight: 500;
  letter-spacing: .17em;
}

.game-logo { animation: logoArrive 1.1s cubic-bezier(.18,.9,.24,1.02) both; }
@keyframes logoArrive {
  from { transform: rotate(-2.3deg) translateY(.55em); opacity: 0; filter: blur(.12em) drop-shadow(0 .075em 0 #4d2505); }
  to { transform: rotate(-2.3deg) translateY(0); opacity: 1; }
}

.logo-pirates {
  background-image:
    linear-gradient(180deg, rgba(255,255,255,.55) 0%, rgba(255,255,255,0) 26%),
    linear-gradient(178deg, #fff9d9 0%, #ffe391 16%, #f6bf4e 35%, #c57a1f 61%, #f2c85d 73%, #ffe9a1 84%, #b46919 100%);
  background-size: 100% 100%, 100% 100%;
  animation: logoGlint 7s ease-in-out infinite;
}
@keyframes logoGlint {
  0%, 76%, 100% { filter: brightness(1); }
  83% { filter: brightness(1.14) saturate(1.08); }
  90% { filter: brightness(1); }
}

.logo-ribbon { box-shadow: 0 .35em .9em rgba(0,0,0,.5), inset 0 0 1.1em rgba(0,0,0,.35), inset 0 .1em .25em rgba(255, 221, 150, .16); }

.menu-copy > * { animation: riseIn .8s cubic-bezier(.2,.8,.2,1) both; }
.menu-copy .game-logo { animation-delay: .08s; }
.menu-copy .logo-ribbon { animation-delay: .18s; }
.menu-copy .menu-tagline { animation-delay: .26s; }
.menu-copy .eyebrow { animation-delay: .02s; }
@keyframes riseIn {
  from { opacity: 0; transform: translateY(.7em); }
  to { opacity: 1; transform: none; }
}

.btn-hero { overflow: hidden; isolation: isolate; }
.btn-hero::before {
  content: "";
  position: absolute;
  top: -40%;
  left: -30%;
  width: 22%;
  height: 180%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.5), transparent);
  transform: skewX(-22deg) translateX(-260%);
  animation: heroSheen 6.5s ease-in-out infinite;
  pointer-events: none;
  z-index: 2;
}
@keyframes heroSheen {
  0%, 72%, 100% { transform: skewX(-22deg) translateX(-260%); }
  82% { transform: skewX(-22deg) translateX(760%); }
}
.btn-hero > * { position: relative; z-index: 1; }

.cta-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .55em;
  width: 28.4em;
}
.cta-row .btn { min-height: 2.85em; font-size: .78em; }
.cta-row .btn-tutorial { border-color: rgba(146, 215, 195, .42); color: #cfeee0; }
.cta-row .btn-tutorial:hover { border-color: rgba(146, 255, 214, .8); }

.menu-footer { align-items: flex-end; }
.menu-credit { display: flex; flex-direction: column; gap: .12em; }
.credit-dev {
  color: rgba(226, 211, 176, .52) !important;
  font-family: var(--font-ui);
  font-size: 1em;
  font-weight: 500;
  letter-spacing: .12em;
}
.credit-dev strong {
  color: #f0cd7e;
  font-family: var(--font-display);
  font-size: 1.18em;
  font-weight: 700;
  letter-spacing: .18em;
  text-shadow: 0 .08em .25em rgba(0,0,0,.5);
}
.credit-meta { color: rgba(226, 211, 176, .27) !important; font-size: .84em; font-weight: 400; letter-spacing: .08em; }
.credit-link {
  align-self: flex-end;
  margin-top: .2em;
  color: rgba(232, 196, 112, .45);
  font-family: var(--font-ui);
  font-size: .82em;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  text-decoration: underline;
  text-decoration-color: rgba(232, 182, 76, .25);
  text-underline-offset: .25em;
  transition: color .2s;
}
.credit-link:hover { color: #f4d993; }

/* ── Panels & buttons ── */
.panel {
  box-shadow:
    var(--shadow),
    inset 0 0 0 .13em rgba(255, 229, 156, .08),
    inset 0 .12em 0 rgba(255, 234, 176, .1),
    inset 0 .1em 2.5em rgba(38, 127, 127, .12);
}

.btn-gold:focus-visible, .btn-ghost:focus-visible { outline-offset: .3em; }

/* ── The Buccaneer's Chart ── */
.screen-map { color: #3c2b16; }

.map-frame { box-shadow: 0 .5em 1.8em rgba(73,49,16,.22), inset 0 0 0 .12em rgba(255,255,255,.24), inset 0 0 3.5em rgba(120,88,40,.1); }

.map-frame-inner { background: #e3d0a5; }

.map-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  filter: saturate(.94) contrast(1.02);
}

.map-cartouche {
  position: absolute;
  left: 2.2em;
  top: 1.6em;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: .06em;
  padding: .8em 1.6em .72em 2.4em;
  color: #453014;
  background:
    linear-gradient(100deg, rgba(248, 238, 208, .92), rgba(230, 210, 166, .72) 68%, rgba(248, 238, 208, .5));
  border: .06em solid rgba(92, 66, 28, .35);
  border-left: .28em solid rgba(126, 83, 26, .6);
  box-shadow: 0 .25em .6em rgba(80, 54, 18, .14);
  clip-path: polygon(0 0, 100% 0, 97% 50%, 100% 100%, 0 100%);
  pointer-events: none;
}
.map-cartouche::before {
  content: "";
  position: absolute;
  left: .85em;
  top: 50%;
  width: 1em;
  height: 1em;
  border: .08em solid rgba(110, 74, 25, .42);
  border-radius: 50%;
  transform: translateY(-50%) rotate(45deg);
}
.cartouche-kicker { color: rgba(94, 65, 24, .62); font-family: var(--font-ui); font-size: .56em; font-weight: 800; letter-spacing: .38em; text-transform: uppercase; }
.map-cartouche strong { font-family: var(--font-display); font-size: 1.42em; font-weight: 700; letter-spacing: .07em; line-height: 1.1; }
.cartouche-sub { color: rgba(92, 64, 24, .5); font-family: var(--font-ui); font-size: .56em; font-weight: 500; letter-spacing: .1em; }

.map-sea-label {
  position: absolute;
  z-index: 1;
  color: rgba(92, 63, 24, .36);
  font-family: var(--font-display);
  font-size: .62em;
  font-weight: 600;
  letter-spacing: .3em;
  text-indent: .3em;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
  transform: translate(-50%, -50%) rotate(-4deg);
}
.map-sea-label.sea-a { left: 52%; top: 33%; }
.map-sea-label.sea-b { left: 15%; top: 46%; transform: translate(-50%, -50%) rotate(7deg); }
.map-sea-label.sea-c { left: 63%; top: 18%; transform: translate(-50%, -50%) rotate(-7deg); }
.map-sea-label.sea-d { left: 77%; top: 84%; font-size: .54em; color: rgba(104, 54, 20, .3); transform: translate(-50%, -50%) rotate(-9deg); }

.map-route { z-index: 2; }
.route-shadow { stroke: rgba(71, 47, 16, .16); stroke-width: 8; }
.route-dash { stroke: rgba(112, 61, 20, .75); stroke-width: 2.6; filter: drop-shadow(0 0 .05em rgba(255,240,200,.5)); }

.map-node { z-index: 4; }

.map-node-button {
  width: 6.1em;
  height: 6.1em;
  background:
    radial-gradient(circle at 38% 28%, #fffaea, #edd9a7 38%, #c8a96c 68%, #9f7c40 100%);
  border: .16em solid rgba(83, 55, 16, .82);
  box-shadow:
    inset 0 .18em .45em rgba(255,255,255,.55),
    inset 0 -.34em .6em rgba(100,68,20,.32),
    0 .38em .7em rgba(70,46,13,.3);
}

.map-node-button::before { inset: .5em; border-color: rgba(101,71,25,.3); }

.map-node.unlocked .map-node-button:hover {
  transform: translateY(-.35em) scale(1.06);
  filter: brightness(1.06);
  box-shadow: inset 0 .18em .45em rgba(255,255,255,.6), 0 .6em 1.1em rgba(70,46,13,.36), 0 0 1.6em rgba(226, 178, 78, .25);
}
.map-node.unlocked.current .map-node-button::after {
  inset: -1.15em;
  opacity: 1;
  border-style: solid;
  border-width: .08em;
  border-color: rgba(125, 79, 20, .32);
  box-shadow: 0 0 0 .45em rgba(240, 205, 126, .09);
  animation: nodeOrbit 22s linear infinite;
}

.node-inner { gap: .06em; }
.node-inner .node-number { font-family: var(--font-display); font-size: 1.75em; font-weight: 700; letter-spacing: .04em; }
.node-inner .node-stars svg { width: .7em; height: .7em; }

.node-label {
  min-width: 12.2em;
  padding: .42em .8em .38em;
  background: linear-gradient(180deg, rgba(250, 242, 219, .85), rgba(238, 223, 187, .72));
  border-color: rgba(102, 75, 34, .28);
  box-shadow: 0 .18em .4em rgba(79, 54, 19, .12), inset 0 .06em 0 rgba(255,255,255,.4);
}
.node-label strong { font-size: .72em; letter-spacing: .1em; }
.node-label small { font-size: .66em; }
.map-node.locked .node-label { filter: grayscale(.3); }

.node-new {
  right: -1.6em;
  top: -.5em;
  padding: .26em .6em .22em;
  font-size: .52em;
  text-transform: uppercase;
  box-shadow: 0 .18em .35em rgba(0,0,0,.25);
}
.node-tutorial {
  position: absolute;
  left: -1.9em;
  top: -.45em;
  padding: .26em .58em .22em;
  color: #1d4038;
  background: linear-gradient(180deg, #b6f0d6, #6fc7a8);
  border: .06em solid rgba(35, 94, 76, .5);
  border-radius: .25em;
  font-family: var(--font-ui);
  font-size: .48em;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  transform: rotate(-7deg);
  box-shadow: 0 .15em .3em rgba(20, 60, 48, .25);
}

.map-legend {
  right: 2.4em;
  bottom: 1.35em;
  left: auto;
  padding: .4em .85em;
  color: rgba(69, 48, 20, .65);
  background: rgba(245, 234, 204, .5);
  border: .06em solid rgba(100, 73, 32, .18);
  border-radius: .22em;
  font-size: .6em;
}
.map-legend .legend-dot { background: #8c5f1d; }

/* Voyage briefing */
.briefing-card {
  width: 44em;
  max-width: 92%;
  max-height: 92%;
  padding: 2.1em 2.8em 2em;
  overflow-y: auto;
  text-align: left;
  animation: panelIn .45s cubic-bezier(.18,.87,.25,1.08);
}

.briefing-head {
  display: flex;
  align-items: center;
  gap: 1.2em;
  margin-bottom: 1em;
  padding-right: 2.6em;
}
.briefing-medallion {
  display: grid;
  place-items: center;
  width: 5.2em;
  height: 5.2em;
  flex: 0 0 auto;
  color: #f6dc95;
  border-radius: 50%;
  border: .14em solid rgba(222, 173, 71, .75);
  background: radial-gradient(circle at 36% 26%, #3c5a58, #173535 45%, #091c20 80%);
  box-shadow: inset 0 0 1em rgba(0,0,0,.6), 0 0 0 .14em rgba(20,48,48,.85);
}
.briefing-medallion svg { width: 2.9em; height: 2.9em; fill: currentColor; }
.briefing-heading { flex: 1; min-width: 0; }
.briefing-heading .eyebrow { margin-bottom: .15em; font-size: .62em; }
.briefing-heading .panel-title { font-size: 2.15em; }
.briefing-captain { margin: .3em 0 0; color: rgba(239, 220, 179, .6); font-family: var(--font-ui); font-size: .86em; font-style: italic; }
.briefing-stars { display: flex; gap: .1em; color: #f0c65b; }
.briefing-stars svg { width: 1.5em; height: 1.5em; fill: currentColor; }
.briefing-stars svg.off { opacity: .18; }

.briefing-lore {
  margin: 0 0 1.2em;
  padding: .9em 1.1em;
  color: rgba(240, 224, 190, .74);
  border-left: .16em solid rgba(232, 182, 76, .45);
  background: linear-gradient(90deg, rgba(232, 182, 76, .08), transparent);
  font-family: var(--font-ui);
  font-size: .94em;
  font-style: italic;
  line-height: 1.55;
}

.briefing-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  margin-bottom: 1.1em;
  padding: .95em 0;
  border-top: .06em solid rgba(232, 182, 76, .16);
  border-bottom: .06em solid rgba(232, 182, 76, .16);
}
.briefing-stats > div { display: flex; flex-direction: column; align-items: center; gap: .18em; padding: 0 .7em; border-right: .06em solid rgba(232,182,76,.12); }
.briefing-stats > div:last-child { border-right: 0; }
.briefing-stats small { color: rgba(236, 215, 171, .35); font-family: var(--font-ui); font-size: .56em; font-weight: 700; letter-spacing: .16em; }
.briefing-stats strong { color: #f2dfb0; font-family: var(--font-ui); font-size: .95em; font-weight: 700; letter-spacing: .03em; }
.briefing-stats .briefing-reward { display: inline-flex; align-items: center; gap: .25em; color: #f6d477; }
.briefing-reward svg { width: 1.25em; height: 1.25em; fill: var(--gold); }

.briefing-goal {
  display: flex;
  align-items: center;
  gap: .5em;
  margin-bottom: 1.2em;
  color: rgba(241, 224, 184, .58);
  font-family: var(--font-ui);
  font-size: .8em;
  line-height: 1.4;
}
.briefing-goal svg { width: 1.35em; height: 1.35em; fill: var(--gold); flex: 0 0 auto; }

/* ── Tutorial card ── */
.tutorial-card {
  position: absolute;
  left: 2.6em;
  top: 12.2em;
  z-index: 8;
  width: 27em;
  max-width: 46vw;
  padding: .85em 1em .7em;
  pointer-events: auto;
  border: .08em solid rgba(232, 182, 76, .32);
  border-radius: .5em;
  background:
    linear-gradient(145deg, rgba(9, 38, 42, .94), rgba(3, 20, 24, .93));
  box-shadow: 0 .55em 1.5em rgba(0,0,0,.45), inset 0 0 1.2em rgba(232,182,76,.05);
  backdrop-filter: blur(.35em);
  animation: tutorialIn .45s cubic-bezier(.2,.8,.2,1);
}
.tutorial-card.is-complete { border-color: rgba(120, 214, 173, .4); }
.tutorial-card.is-complete::before { background: linear-gradient(180deg, transparent, #6fd3a7, transparent); }
.tutorial-card.is-complete .tutorial-skip { display: none; }
.tutorial-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: .7em;
  bottom: .7em;
  width: .16em;
  border-radius: 2em;
  background: linear-gradient(180deg, transparent, #e8b64c, transparent);
  opacity: .7;
}
@keyframes tutorialIn {
  from { opacity: 0; transform: translateX(-1em); }
  to { opacity: 1; transform: none; }
}

.tutorial-top { display: flex; align-items: center; justify-content: space-between; gap: 1em; margin-bottom: .55em; }
.tutorial-kicker { color: #e8b64c; font-family: var(--font-ui); font-size: .56em; font-weight: 800; letter-spacing: .24em; text-transform: uppercase; }
.tutorial-count { color: rgba(241, 222, 181, .45); font-family: var(--font-ui); font-size: .58em; font-weight: 700; letter-spacing: .1em; }
.tutorial-row { display: flex; align-items: flex-start; gap: .75em; }
.tutorial-icon {
  display: grid;
  place-items: center;
  width: 2.9em;
  height: 2.9em;
  flex: 0 0 auto;
  border-radius: 50%;
  color: #ffe29a;
  border: .08em solid rgba(232, 182, 76, .35);
  background: radial-gradient(circle at 38% 28%, #2a5353, #0a272b 76%);
  box-shadow: inset 0 0 1em rgba(0,0,0,.4);
}
.tutorial-icon svg { width: 1.55em; height: 1.55em; fill: currentColor; }
.tutorial-copy { min-width: 0; }
.tutorial-copy strong { display: block; color: #f7e3b3; font-family: var(--font-display); font-size: .98em; font-weight: 600; letter-spacing: .03em; line-height: 1.2; }
.tutorial-copy p { margin: .22em 0 0; color: rgba(240, 224, 184, .58); font-family: var(--font-ui); font-size: .77em; line-height: 1.42; }
.tutorial-footer { display: flex; align-items: center; justify-content: space-between; gap: 1em; margin-top: .7em; padding-top: .55em; border-top: .05em solid rgba(232,182,76,.1); pointer-events: auto; }
.tutorial-dots { display: flex; gap: .28em; }
.tutorial-dots span { width: .5em; height: .5em; border-radius: 50%; background: rgba(255,255,255,.14); transition: background .25s, transform .25s; }
.tutorial-dots span.on { background: #e8b64c; box-shadow: 0 0 .5em rgba(232,182,76,.55); transform: scale(1.15); }
.tutorial-dots span.done { background: rgba(120, 214, 173, .75); }
.tutorial-skip {
  color: rgba(232, 211, 169, .4);
  font-family: var(--font-ui);
  font-size: .6em;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  text-decoration: underline;
  text-underline-offset: .25em;
}
.tutorial-skip:hover { color: #f4d993; }

/* ── Welcome / credits / how-to ── */
.welcome-card {
  width: 47em;
  max-width: 93%;
  max-height: 93%;
  padding: 2.2em 3em 1.8em;
  overflow-y: auto;
  text-align: center;
  animation: panelIn .55s cubic-bezier(.18,.87,.25,1.08);
}
.welcome-crest { width: 6em; height: 6em; margin: -.4em auto .7em; color: #e0bb69; filter: drop-shadow(0 0 1.4em rgba(232,182,76,.25)); }
.welcome-crest svg { width: 100%; height: 100%; }
.welcome-lead { max-width: 34em; margin: .85em auto 1.25em; color: rgba(240, 224, 190, .66); font-family: var(--font-ui); font-size: 1em; line-height: 1.55; }
.welcome-lead em { color: #f0ce83; font-style: italic; }
.welcome-features { display: grid; grid-template-columns: repeat(3, 1fr); gap: .7em; margin-bottom: 1.15em; text-align: left; }
.welcome-features > div {
  display: flex;
  flex-direction: column;
  gap: .18em;
  padding: .8em .85em;
  border: .06em solid rgba(232, 182, 76, .16);
  border-radius: .4em;
  background: linear-gradient(180deg, rgba(255,255,255,.035), rgba(0,0,0,.12));
}
.welcome-features svg { width: 1.5em; height: 1.5em; fill: var(--gold); opacity: .85; margin-bottom: .12em; }
.welcome-features strong { color: #f2ddb0; font-family: var(--font-ui); font-size: .78em; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.welcome-features span { color: rgba(238, 220, 180, .46); font-family: var(--font-ui); font-size: .7em; line-height: 1.35; }
.welcome-tutorial-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5em;
  margin: 0 0 1.2em;
  color: rgba(235, 217, 177, .55);
  font-family: var(--font-ui);
  font-size: .78em;
  line-height: 1.4;
}
.welcome-tutorial-note svg { width: 1.5em; height: 1.5em; fill: var(--gold); flex: 0 0 auto; }
.welcome-actions { display: flex; gap: .6em; justify-content: center; flex-wrap: wrap; }
.welcome-actions .btn { flex: 1 1 12em; max-width: 17em; }
.welcome-credit { margin: 1.3em 0 0; color: rgba(226, 211, 176, .3); font-family: var(--font-ui); font-size: .66em; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; }
.welcome-credit strong { color: #d9b25d; }

.credits-card {
  width: 38em;
  max-width: 92%;
  max-height: 93%;
  padding: 2.2em 2.8em 2em;
  overflow-y: auto;
  text-align: center;
  animation: panelIn .5s cubic-bezier(.18,.87,.25,1.08);
}
.credits-mark { width: 5.4em; height: 5.4em; margin: -.2em auto .8em; color: #dcb667; }
.credits-mark svg { width: 100%; height: 100%; }
.credits-sub { margin: .3em 0 1.4em; color: rgba(238, 221, 184, .45); font-family: var(--font-ui); font-size: .76em; font-weight: 600; letter-spacing: .38em; text-transform: uppercase; }
.credits-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .55em .9em; margin-bottom: 1.4em; text-align: left; }
.credits-grid > div { padding: .55em .8em; border: .06em solid rgba(232, 182, 76, .14); border-radius: .35em; background: rgba(255,255,255,.025); }
.credits-grid small { display: block; color: rgba(236, 215, 171, .35); font-family: var(--font-ui); font-size: .55em; font-weight: 700; letter-spacing: .15em; text-transform: uppercase; }
.credits-grid strong { display: block; margin-top: .12em; color: #f0dcb0; font-family: var(--font-ui); font-size: .8em; font-weight: 700; letter-spacing: .03em; }
.credits-thanks { margin: 0 0 .5em; color: rgba(240, 224, 184, .62); font-family: var(--font-ui); font-size: .9em; font-style: italic; }
.credits-copyright { margin: 0 0 1.3em; color: rgba(226, 211, 176, .3); font-family: var(--font-ui); font-size: .66em; line-height: 1.5; }

.howto-actions { display: flex; gap: .6em; justify-content: center; flex-wrap: wrap; }
.howto-actions .btn { flex: 1 1 12em; max-width: 18em; }
.howto-credit { margin: 1.1em 0 0; color: rgba(226, 211, 176, .28); font-family: var(--font-ui); font-size: .64em; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; }
.howto-credit strong { color: #d9b25d; }

/* ── Paint shop ── */
.paint-card {
  width: 56em;
  max-width: 94%;
  max-height: 92%;
  padding: 2em 2.5em 1.6em;
  overflow-y: auto;
  text-align: center;
  animation: panelIn .45s cubic-bezier(.18,.87,.25,1.08);
}

.paint-card .panel-sub { margin-bottom: .7em; }

.paint-preview-wrap {
  position: relative;
  width: min(30em, 100%);
  aspect-ratio: 760 / 400;
  height: auto;
  margin: .55em auto .9em;
  overflow: hidden;
  border-top: .06em solid rgba(232, 182, 76, .14);
  border-bottom: .06em solid rgba(232, 182, 76, .14);
  background: linear-gradient(180deg, rgba(8, 39, 45, .25), rgba(4, 21, 26, .55));
}

.paint-preview-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.paint-section { margin-top: .8em; text-align: left; }

.paint-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1em;
  padding-bottom: .3em;
  border-bottom: .06em solid rgba(232, 182, 76, .13);
}

.paint-section-head span {
  color: #cfad61;
  font-family: var(--font-ui);
  font-size: .64em;
  font-weight: 700;
  letter-spacing: .16em;
}

.paint-section-head small {
  color: rgba(236, 219, 179, .5);
  font-family: var(--font-ui);
  font-size: .62em;
  font-style: italic;
}

.paint-schemes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .42em;
  margin-top: .5em;
}

.paint-scheme {
  display: flex;
  align-items: center;
  gap: .6em;
  padding: .48em .6em;
  color: inherit;
  text-align: left;
  border: .07em solid rgba(232, 182, 76, .16);
  border-radius: .35em;
  background: linear-gradient(100deg, rgba(255, 255, 255, .03), rgba(0, 0, 0, .12));
  transition: background .18s, border-color .18s, transform .18s;
}

.paint-scheme:hover { border-color: rgba(232, 182, 76, .38); background: linear-gradient(100deg, rgba(255,255,255,.055), rgba(0,0,0,.1)); transform: translateY(-.04em); }
.paint-scheme.is-active { border-color: rgba(240, 202, 109, .7); background: linear-gradient(100deg, rgba(240, 202, 109, .14), rgba(0, 0, 0, .12)); box-shadow: inset .2em 0 0 rgba(240, 202, 109, .7); }

.paint-dots { display: flex; gap: .16em; flex: 0 0 auto; }
.paint-dots i {
  display: block;
  width: 1.05em;
  height: 1.05em;
  border-radius: 50%;
  border: .06em solid rgba(255, 240, 204, .22);
  box-shadow: 0 .08em .2em rgba(0, 0, 0, .35);
}

.paint-copy { display: flex; flex-direction: column; gap: .04em; min-width: 0; }
.paint-copy strong { color: #efdcb2; font-family: var(--font-ui); font-size: .76em; font-weight: 700; letter-spacing: .03em; }
.paint-copy small { color: rgba(235, 218, 177, .44); font-family: var(--font-ui); font-size: .61em; line-height: 1.3; }

.paint-emblems {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(6.4em, 1fr));
  gap: .35em;
  margin-top: .55em;
}

.paint-emblem {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .12em;
  padding: .38em .25em .32em;
  color: inherit;
  border: .07em solid rgba(232, 182, 76, .15);
  border-radius: .32em;
  background: rgba(0, 0, 0, .14);
  transition: border-color .18s, background .18s, transform .18s;
}

.paint-emblem:hover { border-color: rgba(232, 182, 76, .38); transform: translateY(-.04em); }
.paint-emblem.is-active { border-color: rgba(240, 202, 109, .7); background: rgba(240, 202, 109, .12); box-shadow: inset 0 0 1em rgba(240, 202, 109, .08); }
.paint-emblem-art { width: 2.1em; height: 2.1em; display: block; }
.paint-emblem span { color: rgba(235, 218, 177, .58); font-family: var(--font-ui); font-size: .56em; line-height: 1.2; text-align: center; }
.paint-emblem.is-active span { color: #f2d99f; }

.paint-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: .55em; margin-top: 1.15em; }
.paint-actions .btn { flex: 1 1 12em; max-width: 17em; }

/* ── Battle HUD type polish ── */
.battle-level, .bar-name, .battle-timer, .reload-copy strong, .reload-copy span, .battle-coins, .career-chip { font-family: var(--font-ui); }
.health-frame { border-radius: .3em; }
.health-fill { transition: width .28s cubic-bezier(.2,.8,.2,1); position: relative; z-index: 1; }
.health-shine { z-index: 3; }
.health-ghost {
  position: absolute;
  left: .22em;
  top: .22em;
  bottom: .22em;
  width: 100%;
  z-index: 0;
  border-radius: .16em;
  background: linear-gradient(180deg, #ffe3a6, #e0915a 45%, #a24c2c);
  opacity: .5;
  transition: width .58s cubic-bezier(.2,.8,.2,1) .16s;
}
.health-ghost-enemy { left: auto; right: .22em; background: linear-gradient(180deg, #ffd4a4, #d97948 45%, #8c3a24); }
.health-frame::after {
  content: "";
  position: absolute;
  inset: .22em;
  z-index: 2;
  pointer-events: none;
  border-radius: .16em;
  background: repeating-linear-gradient(90deg, transparent 0 calc(25% - .09em), rgba(5, 16, 16, .34) calc(25% - .09em) 25%);
  opacity: .55;
}
.health-player.is-critical:not(.is-repairing) { animation: criticalPulse 1.1s ease-in-out infinite; }
@keyframes criticalPulse {
  0%, 100% { filter: brightness(.92) saturate(1.1); box-shadow: inset 0 0 .65em rgba(0,0,0,.35); }
  50% { filter: brightness(1.18) saturate(1.2); box-shadow: inset 0 0 .65em rgba(0,0,0,.2), 0 0 .85em rgba(255, 96, 72, .6); }
}
.captain-card.is-hit { animation: hudHit .26s ease-out; }
@keyframes hudHit {
  0% { transform: translateX(0); filter: drop-shadow(0 0 .6em rgba(255,90,60,.55)); }
  30% { transform: translateX(-.28em); }
  60% { transform: translateX(.22em); }
  100% { transform: translateX(0); filter: none; }
}

/* ═══════════════════════════════════════════════════════════════
   ART DIRECTION POLISH
   One icon family, one material language, one motion curve.
   Everything here layers over the base rules above.
   ═══════════════════════════════════════════════════════════════ */

:root {
  --ease-out: cubic-bezier(.22, .68, .24, 1);
  --ease-spring: cubic-bezier(.2, .9, .25, 1.08);
  --dur-fast: .16s;
  --dur: .24s;
  --dur-slow: .48s;
  --focus-ring: .17em solid #ffe8a4;
  --surface-hi: rgba(255, 255, 255, .05);
  --surface-lo: rgba(0, 0, 0, .16);
  --line: rgba(232, 182, 76, .18);
  --text-dim: rgba(238, 223, 190, .66);
  --text-mute: rgba(238, 223, 190, .48);
  --radius-sm: .3em;
  --radius: .55em;
  --radius-lg: .85em;
}

/* Dynamic viewport units keep the stage centred when mobile browser chrome
   slides in and out, while the safe-area insets keep it off notches. */
@supports (height: 100dvh) {
  #stage {
    width: min(
      calc(100vw - env(safe-area-inset-left) - env(safe-area-inset-right)),
      calc(100dvh * 16 / 9)
    );
    height: min(
      calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom)),
      calc((100vw - env(safe-area-inset-left) - env(safe-area-inset-right)) * 9 / 16)
    );
  }
}

#stage { overscroll-behavior: none; }
button, [role="button"] { touch-action: manipulation; }

/* ── Entrance choreography ─────────────────────────────────────────────
   The loader covers the stage for the first second. Gate the menu's
   arrival on #app.is-ready so the player actually sees it. */
#app:not(.is-ready) .menu-top,
#app:not(.is-ready) .menu-copy > *,
#app:not(.is-ready) .menu-cta,
#app:not(.is-ready) .menu-footer,
#app:not(.is-ready) .game-logo {
  animation: none !important;
}

#app.is-ready .menu-top { animation: menuFadeIn .7s var(--ease-out) .05s both; }
#app.is-ready .menu-copy > * { animation: riseIn .8s var(--ease-out) both; }
#app.is-ready .menu-copy .eyebrow { animation-delay: .02s; }
#app.is-ready .menu-copy .game-logo {
  animation: logoArrive 1.1s cubic-bezier(.18, .9, .24, 1.02) .08s both;
}
#app.is-ready .menu-copy .logo-ribbon { animation-delay: .18s; }
#app.is-ready .menu-copy .menu-tagline { animation-delay: .26s; }
#app.is-ready .menu-cta { animation: riseIn .75s var(--ease-out) .34s both; }
#app.is-ready .menu-footer { animation: menuFadeIn .8s ease .42s both; }

@keyframes menuFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ── Shared surface material ─────────────────────────────────────────── */
.panel {
  background:
    radial-gradient(130% 90% at 50% -10%, rgba(255, 229, 158, .085), transparent 55%),
    repeating-linear-gradient(112deg, rgba(255, 255, 255, .014) 0 1px, transparent 1px 6px),
    linear-gradient(160deg, rgba(20, 53, 58, .96), rgba(5, 21, 26, .97) 58%, rgba(9, 31, 36, .98));
  border-radius: var(--radius-lg);
}

/* ── Interactive states: hover, focus, press, disabled ───────────────── */
.btn,
.icon-btn,
.btn-buy,
.fleet-row,
.upgrade-row,
.dock-service,
.map-node-button,
.node-label {
  transition:
    transform var(--dur) var(--ease-out),
    filter var(--dur) var(--ease-out),
    background var(--dur) var(--ease-out),
    border-color var(--dur) var(--ease-out),
    box-shadow var(--dur) var(--ease-out),
    color var(--dur) var(--ease-out);
}

.btn:disabled,
.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: .46;
  cursor: not-allowed;
  filter: grayscale(.35);
  transform: none !important;
}

.btn:focus-visible,
.icon-btn:focus-visible,
.btn-buy:focus-visible,
.modal-close:focus-visible,
.fleet-row:focus-visible,
.map-node-button:focus-visible {
  outline: var(--focus-ring);
  outline-offset: .24em;
}

.fleet-row:focus-visible { outline-offset: .12em; }

@media (hover: hover) and (pointer: fine) {
  .fleet-row:hover { transform: translateY(-.06em); box-shadow: 0 .28em .7em rgba(0, 0, 0, .22); }
  .upgrade-row:hover { transform: translateY(-.03em); }
  .dock-service:hover { border-color: rgba(232, 182, 76, .3); }
  .map-node.unlocked:hover .node-label {
    transform: translateY(-.1em);
    border-color: rgba(102, 75, 34, .42);
  }
  .btn-hero:hover { filter: brightness(1.06) saturate(1.04); }
}

.fleet-row:active,
.upgrade-row:active,
.map-node.unlocked .map-node-button:active {
  transform: translateY(.04em) scale(.995);
}

/* Coarse pointers need forgiving targets. */
@media (pointer: coarse) {
  .modal-close { width: 3.1em; height: 3.1em; }
  .icon-btn.small { width: 3.65em; height: 3.65em; }
  .fleet-row .btn-buy { min-height: 2.6em; padding: .36em .85em; }
  .map-node-button { width: 6.4em; height: 6.4em; }
}

/* ── Scroll areas ────────────────────────────────────────────────────── */
.fleet-list,
.upgrade-list,
.dock-panel,
.briefing-card,
.howto-card,
.welcome-card,
.credits-card,
.paint-card {
  scrollbar-width: thin;
  scrollbar-color: rgba(232, 182, 76, .34) transparent;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.fleet-list::-webkit-scrollbar,
.upgrade-list::-webkit-scrollbar,
.dock-panel::-webkit-scrollbar,
.briefing-card::-webkit-scrollbar,
.howto-card::-webkit-scrollbar,
.welcome-card::-webkit-scrollbar,
.credits-card::-webkit-scrollbar,
.paint-card::-webkit-scrollbar {
  width: .42em;
}

.fleet-list::-webkit-scrollbar-thumb,
.upgrade-list::-webkit-scrollbar-thumb,
.dock-panel::-webkit-scrollbar-thumb,
.briefing-card::-webkit-scrollbar-thumb,
.howto-card::-webkit-scrollbar-thumb,
.welcome-card::-webkit-scrollbar-thumb,
.credits-card::-webkit-scrollbar-thumb,
.paint-card::-webkit-scrollbar-thumb {
  border-radius: 1em;
  background: rgba(232, 182, 76, .3);
}

/* ── Type contrast & hierarchy ───────────────────────────────────────── */
.menu-copy .eyebrow::before {
  content: "";
  width: 1.7em;
  height: .07em;
  margin-right: .15em;
  background: linear-gradient(90deg, transparent, var(--gold));
  opacity: .8;
}

.menu-tagline {
  color: rgba(244, 231, 204, .88);
  text-shadow: 0 1.5px 6px rgba(0, 0, 0, .7);
}

.menu-tagline::after {
  content: "";
  display: block;
  width: 8.5em;
  height: .06em;
  margin-top: .95em;
  background: linear-gradient(90deg, rgba(232, 182, 76, .55), transparent);
}

.panel-sub { color: rgba(238, 221, 184, .68); }
.fleet-copy p { color: rgba(238, 223, 190, .62); }
.upgrade-copy p { color: rgba(235, 218, 177, .64); }
.upgrade-value span { color: rgba(235, 218, 177, .58); }
.credit-meta { color: rgba(226, 211, 176, .42) !important; }
.briefing-stats small { color: rgba(236, 215, 171, .55); }
.dock-service-copy small { color: rgba(236, 220, 185, .66); }
.career-anchor-copy small { color: rgba(241, 224, 183, .72); }
.node-label { color: #3f2d10; }
.node-label small { color: rgba(84, 59, 22, .72); }
.map-legend { color: rgba(69, 48, 20, .78); }

/* ── The chart: richer material, calmer labels ───────────────────────── */
.map-frame-inner::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 42%, transparent 52%, rgba(92, 62, 22, .13) 100%),
    linear-gradient(180deg, rgba(255, 250, 232, .12), transparent 18%, transparent 82%, rgba(92, 62, 22, .08));
  box-shadow: inset 0 0 4.5em rgba(84, 56, 20, .2);
}

.map-art { filter: saturate(.93) contrast(1.03); }
.map-route { z-index: 2; }
.map-node { z-index: 4; }

.map-node-button { -webkit-tap-highlight-color: transparent; }

.node-label {
  backdrop-filter: blur(.18em);
  box-shadow: 0 .18em .4em rgba(79, 54, 19, .14), inset 0 .06em 0 rgba(255, 255, 255, .45);
}

.legend-star {
  width: 1.15em;
  height: 1.15em;
  fill: currentColor;
  vertical-align: -.18em;
}

/* ── Harbor & dock ───────────────────────────────────────────────────── */
/* The crest used to sit half outside a scroll container and get clipped.
   Give the panel real top padding and keep the medallion inside it. */
.dock-panel {
  padding-top: 3.4em;
  scrollbar-gutter: stable;
}

.dock-crest { margin-top: -2.6em; }

.fleet-row[role="button"] { outline-offset: .1em; }

.fleet-row .btn-buy {
  box-shadow: inset 0 .08em 0 rgba(255, 250, 220, .35), 0 .16em .38em rgba(0, 0, 0, .35);
}

.modal-close { width: 2.8em; height: 2.8em; }

/* ── Toasts & hints never share the same strip ───────────────────────── */
.toast {
  bottom: 10.4em;
  max-width: min(46em, 88%);
  white-space: normal;
  text-align: center;
  line-height: 1.35;
}

.game-hint {
  bottom: 7.2em;
  max-width: 88%;
  white-space: normal;
  text-align: center;
  line-height: 1.3;
}

/* ── Keep hidden screens cheap ───────────────────────────────────────── */
.is-hidden,
.is-hidden * {
  animation-play-state: paused !important;
}

/* ── Reduced motion: keep the layout, drop the theatrics ─────────────── */
@media (prefers-reduced-motion: reduce) {
  .btn-hero::before { display: none; }
  .map-node.unlocked.current .map-node-button::after { animation: none; }
  #app.is-ready .menu-copy > *,
  #app.is-ready .menu-copy .game-logo,
  #app.is-ready .menu-top,
  #app.is-ready .menu-cta,
  #app.is-ready .menu-footer { animation: none !important; }
  .logo-pirates { animation: none; }
}

/* Keep the tutorial card clear of the enemy card on narrower stages */
@media (max-width: 1180px) {
  .tutorial-card { width: 24em; }
  .menu-copy { width: 44em; }
}


/* ── Compact landscape phones & short displays ── */
@media (max-height: 480px) and (orientation: landscape) {
  #stage { font-size: min(1.3vw, 2.32vh) !important; }

  .screen-map { font-size: .92em; }
  .screen-harbor { font-size: .88em; }

  .menu-top { top: 1.8em; }
  .menu-copy { top: 8.2em; left: 4.4em; }
  .menu-copy .eyebrow { font-size: .56em; }
  .logo-pirates { font-size: 6.3em; }
  .logo-rush { font-size: 2.05em; margin-left: 2.7em; letter-spacing: .24em; }
  .logo-ribbon { font-size: .46em; margin-top: .4em; margin-left: 3.1em; padding: .3em 1.1em .26em; }
  .menu-tagline { display: block; margin: .55em 0 0 .4em; font-size: .74em; line-height: 1.35; }
  .menu-cta { left: 4.4em; bottom: 5.1em; }
  .btn-hero { min-height: 4.2em; font-size: 1em; width: 25em; }
  .btn-hero-icon { width: 2.8em; height: 2.8em; }
  .btn-hero-copy strong { font-size: 1.2em; }
  .btn-hero-copy small { font-size: .56em; }
  .cta-row { margin-top: .5em; gap: .4em; width: 25em; }
  .cta-row .btn { min-height: 2.4em; font-size: .68em; }
  .menu-footer { left: 3.4em; right: 3.4em; bottom: 1.3em; }
  .stat-chip { font-size: .66em; padding: .35em .75em .35em .55em; }
  .menu-credit { font-size: .58em; }
  .credit-dev { font-size: .95em; }
  .credit-meta { font-size: .78em; }
  .credit-link { font-size: .76em; }

  .map-frame { top: 7.6em; bottom: 5.6em; left: 2.2em; right: 2.2em; }
  .map-node-button { width: 4.8em; height: 4.8em; }
  .map-node { gap: .32em; }
  .node-inner .node-number { font-size: 1.55em; }
  .node-label { min-width: 9.2em; padding: .3em .55em .26em; }
  .node-label strong { font-size: .82em; }
  .node-label small { display: none; }
  .node-new { font-size: .48em; right: -1.1em; }
  .node-tutorial { font-size: .42em; left: -1.3em; }
  .map-cartouche { left: 1.4em; top: 1em; padding: .55em 1.1em .5em 1.8em; }
  .map-cartouche strong { font-size: 1.3em; }
  .map-cartouche .cartouche-kicker, .map-cartouche .cartouche-sub { font-size: .52em; }
  .map-cartouche::before { left: .55em; width: .75em; height: .75em; }
  .map-sea-label { display: none; }
  .map-legend { display: none; }
  .map-footer { bottom: 1.2em; }
  .map-captain p { font-size: .86em; }

  .harbor-layout { top: 9.2em; bottom: 1.6em; left: 2.2em; right: 2.2em; gap: 1em; }
  .ship-card { padding: 1.1em 1.2em .9em; }
  .fleet-panel, .upgrade-panel { padding: 1.1em 1.1em .8em; }
  .ship-preview-wrap { margin: .7em -1.2em .2em; }
  .ship-card h3, .fleet-panel h3, .upgrade-panel h3 { font-size: 1.45em; }
  .ship-flavor { font-size: .9em; margin: .55em 0 .6em; }
  .ship-stat { padding: .35em .5em; }
  .upgrade-row { padding: .55em .55em; }
  .fleet-row { padding: .5em .55em; }
  .upgrade-copy p, .fleet-copy p { font-size: .7em; }
  .fleet-row .btn-buy { min-height: 2.3em; }
  .panel-watermark { width: 12em; height: 12em; }
  .upgrade-heading .btn-paint { font-size: .58em; }

  .paint-card { padding: 1.5em 1.8em 1.2em; }
  .paint-preview-wrap { width: min(24em, 100%); }
  .paint-copy small { display: none; }
  .paint-emblems { grid-template-columns: repeat(auto-fill, minmax(5.4em, 1fr)); }

  .armory-panel { margin-top: .45em; padding: .3em .4em; }
  .armory-head { margin-bottom: .2em; }
  .armory-head > span, .armory-copy small { display: none; }
  .armory-row { padding: .16em .2em; }
  .armory-refill, .armory-row .btn-buy { font-size: .5em; }
  .armory-icon { width: 1.5em; height: 1.5em; }

  .tutorial-card { top: 10.6em; left: 1.8em; width: 24em; }
  .tutorial-copy p { font-size: .8em; }
  .battle-banner { width: 44em; }
  .banner-title { font-size: 2em; }

  /* Modals are the one place where a little extra scale is worth the room. */
  .briefing-card,
  .result-panel,
  .modal-card,
  .pause-panel { font-size: 1.14em; }

  /* Keep the way out of the dock reachable when the service list scrolls. */
  .dock-panel { max-height: 97%; padding-top: 1.9em; }
  .dock-crest { width: 3.9em; height: 3.9em; margin-top: -1.6em; }
  .dock-panel .panel-title { font-size: 1.8em; }
  .dock-panel .panel-sub { margin-bottom: .55em; }
  .dock-stats { margin-bottom: .55em; }
  .dock-services { gap: .35em; margin-bottom: .7em; }
  .dock-service { padding: .38em .6em; }
  .dock-service-copy small { display: none; }
  .dock-panel .dock-actions {
    position: sticky;
    bottom: 0;
    z-index: 3;
    margin-top: .25em;
    padding: .55em 0 .05em;
    border-top: .06em solid rgba(232, 182, 76, .16);
    background: rgba(7, 27, 31, .97);
  }
}

@media (orientation: portrait) and (max-width: 900px) {
  .rotate-hint { display: flex; }
}

/* Reduce motion preference */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
