:root {
  --ink-line: #2a1810;
  --wood: #d4923a;
  --wood-dark: #8b5a22;
  --sail: #f2e6c8;
  --cyan: #3db7ff;
  --sea: #32b8d2;
  --foam: #68e0ee;
  --gold: #ffd24a;
  --danger: #e85a4a;
  --text: #2a1810;
  --muted: #6a4a28;
  --hp: #3ecf8e;
  --chart: var(--sail);
  --chart-strong: #f6edcf;
  --hair: var(--ink-line);
  --glass: var(--sail);
  --glass-strong: #f6edcf;
  --accent: var(--cyan);
  --panel: #f6edcf;
  --line: var(--ink-line);
  --bg: #62c4e8;
  --stick-size: 116px;
  --stick-knob: 40px;
  --skill-aa: 84px;
  --skill-n: 66px;
  --skill-ult: 76px;
  --skill-cluster: 244px;
  --chrono-size: 82px;
  --hud-pad-top: max(8px, env(safe-area-inset-top));
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background: #1c7eb8;
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  user-select: none;
  touch-action: none;
  display: flex;
  align-items: center;
  justify-content: center;
  overscroll-behavior: none;
}

body.is-touch {
  position: fixed;
  display: block;
  top: var(--vv-top, 0px);
  left: var(--vv-left, 0px);
  width: var(--vv-w, 100vw);
  height: var(--vv-h, 100dvh);
}

#phone-frame {
  position: relative;
  width: min(100vw - 16px, calc((100vh - 16px) * 16 / 9));
  height: min(100vh - 16px, calc((100vw - 16px) * 9 / 16));
  max-width: 1280px;
  background: #061018;
  border: 4px solid var(--ink-line);
  box-shadow: inset 0 0 0 5px var(--wood);
  border-radius: 12px;
  overflow: hidden;
}

#app {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
}

#hud-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 8;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: start;
  gap: 8px;
  padding: 8px 10px;
  padding-top: max(8px, env(safe-area-inset-top));
  padding-left: max(10px, env(safe-area-inset-left));
  padding-right: max(10px, env(safe-area-inset-right));
  pointer-events: none;
}

.hud-cluster {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}

.hud-left {
  justify-content: flex-start;
  align-items: flex-start;
}

.hud-left-stack {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  min-width: 0;
}
.hud-center {
  position: absolute;
  left: 50%;
  top: var(--hud-pad-top);
  transform: translateX(-50%);
  flex-direction: column;
  align-items: center;
  gap: 4px;
  z-index: 1;
}
.hud-right {
  justify-content: flex-end;
  align-items: flex-start;
  padding-right: 48px;
}

.label {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.wood-plate {
  background:
    repeating-linear-gradient(90deg, rgba(90, 50, 20, 0.1) 0 3px, transparent 3px 12px),
    var(--sail);
  border: 3px solid var(--ink-line);
  box-shadow: 0 4px 0 var(--ink-line);
  border-radius: 8px;
}

.hull-plate,
.locker,
.lantern,
.course,
#toast,
.panel,
.shop-item,
#hud-sys button {
  background:
    repeating-linear-gradient(90deg, rgba(90, 50, 20, 0.1) 0 3px, transparent 3px 12px),
    var(--sail);
  border: 3px solid var(--ink-line);
  box-shadow: 0 4px 0 var(--ink-line);
  border-radius: 8px;
}

/* 左：漆木水线牌 + 冲浪板青条 */
.hull-plate {
  position: relative;
  min-width: 148px;
  padding: 8px 8px 7px;
  overflow: hidden;
}

.hull-plate::before,
.locker::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 4px;
  background: var(--cyan);
  border-bottom: 2px solid var(--ink-line);
}

.hud-hp-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  margin: 2px 0 5px;
}

#hud-hp {
  font-size: 12px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: #1a6a62;
}

.hud-hp-track,
.hud-xp-track {
  position: relative;
  height: 5px;
  background: #2a1810;
  border: 2px solid var(--ink-line);
  overflow: hidden;
}

.hud-hp-track { height: 9px; }

#hud-hp-fill {
  position: relative;
  height: 100%;
  width: 100%;
  background: linear-gradient(180deg, #8af0d8 0%, #32b8d2 55%, #1c7eb8 100%);
}

#hud-hp-wrap.low #hud-hp { color: var(--danger); }
#hud-hp-wrap.low #hud-hp-fill {
  background: linear-gradient(180deg, #ff9a82 0%, #e85a4a 60%, #b42222 100%);
}

.draft-marks {
  margin-top: 4px;
  height: 5px;
  background: repeating-linear-gradient(
    90deg,
    var(--ink-line) 0 3px,
    transparent 3px 18%
  );
  opacity: 0.35;
}

.pennant {
  position: relative;
  width: 132px;
  padding: 10px 22px 10px 12px;
  background: var(--sail);
  color: var(--ink-line);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  white-space: nowrap;
  text-align: center;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%);
  filter:
    drop-shadow(3px 0 0 var(--ink-line))
    drop-shadow(-3px 0 0 var(--ink-line))
    drop-shadow(0 3px 0 var(--ink-line))
    drop-shadow(0 -3px 0 var(--ink-line))
    drop-shadow(0 6px 0 var(--ink-line));
}

#hud-mode.ship {
  background: var(--wood);
  color: #fff6e0;
}

/* 中：漆木救生圈时计 */
.chrono {
  position: relative;
  width: var(--chrono-size);
  height: var(--chrono-size);
  display: grid;
  place-items: center;
  color: var(--ink-line);
  border-radius: 50%;
  background: repeating-conic-gradient(var(--sail) 0 18deg, var(--cyan) 18deg 36deg);
  border: 4px solid var(--ink-line);
  box-shadow: 0 5px 0 var(--ink-line);
}

.chrono-ticks {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.chrono::before {
  content: "";
  position: absolute;
  inset: 15px;
  border-radius: 50%;
  background: var(--sail);
  border: 3px solid var(--ink-line);
}

#hud-timer {
  position: relative;
  z-index: 1;
  font-size: 15px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  line-height: 1;
  color: #fff6e0;
  text-shadow:
    -2px -2px 0 #2a1810,
    2px -2px 0 #2a1810,
    -2px 2px 0 #2a1810,
    2px 2px 0 #2a1810;
}

.chrono.urgent {
  background: repeating-conic-gradient(var(--sail) 0 18deg, var(--danger) 18deg 36deg);
}
.chrono.urgent #hud-timer { color: #ffe0d8; }

.course {
  padding: 3px 8px;
  color: var(--ink-line);
}

#hud-goal {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

/* 右：货舱 + 号灯 */
.locker {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 7px;
  overflow: visible;
}

.locker-stats {
  appearance: none;
  -webkit-appearance: none;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 2px 4px 2px 2px;
  border: none;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  pointer-events: auto;
  font-family: inherit;
  color: inherit;
  text-align: left;
  border-radius: 6px;
  -webkit-touch-callout: none;
}

.locker-stats:hover {
  background: rgba(255, 246, 224, 0.45);
}

.locker-stats[aria-pressed="true"] {
  background: rgba(61, 183, 255, 0.22);
}

.bestiary-btn {
  width: 36px;
  height: 36px;
  padding: 4px;
  flex-shrink: 0;
  cursor: pointer;
  pointer-events: auto;
  background: var(--sail);
  border: 3px solid var(--ink-line);
  box-shadow: 0 3px 0 var(--ink-line);
  border-radius: 8px;
}

.bestiary-btn img {
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

.bestiary-btn:hover {
  background: #fff6e0;
}

.bestiary-btn[aria-pressed="true"] {
  background: var(--wood);
}

.bestiary-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--ink-line);
}

.hud-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 48px;
}

.gold-readout {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.gold-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: block;
}

.hud-gold .gold-icon {
  width: 18px;
  height: 18px;
}

#hud-gold,
#shop-gold {
  display: inline-block;
  min-width: 3ch;
  font-size: 16px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  color: #c48410;
  line-height: 1;
  text-shadow:
    -1px -1px 0 #2a1810,
    1px -1px 0 #2a1810,
    -1px 1px 0 #2a1810,
    1px 1px 0 #2a1810;
}

#shop-gold { font-size: 14px; }

#hud-level {
  font-weight: 900;
  color: var(--ink-line);
}

.hud-lv { min-width: 48px; }

.hud-xp-track { margin-top: 5px; }

#hud-xp-fill {
  height: 100%;
  width: 0;
  background: var(--cyan);
}

.hud-stat .sub {
  font-size: 9px;
  font-weight: 800;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.lantern {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 96px;
  flex-shrink: 0;
  padding: 8px 8px 7px;
}

.lantern-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 16px;
}

.lantern-cap {
  width: 12px;
  height: 5px;
  background: var(--ink-line);
  clip-path: polygon(12% 100%, 50% 0, 88% 100%);
}

.lantern-glass {
  width: 12px;
  height: 16px;
  margin-top: 1px;
  border: 2px solid var(--ink-line);
  background: #4a4030;
  border-radius: 2px;
}

.lantern-base {
  width: 14px;
  height: 4px;
  background: var(--wood-dark);
  border: 2px solid var(--ink-line);
  border-top: none;
}

.lantern-meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

#hud-ship-cd {
  display: block;
  width: 4.6em;
  font-size: 12px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  color: var(--muted);
  white-space: nowrap;
  text-align: left;
}

.tnum {
  display: inline-block;
  min-width: 4ch;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  text-align: right;
}

#hud-mode .tnum {
  min-width: 4ch;
}

#hud-ship.ready .lantern-glass {
  background: var(--gold);
  box-shadow: inset 0 -4px 0 #c48410;
}
#hud-ship.ready #hud-ship-cd { color: #c48410; }

#hud-ship.sailing .lantern-glass {
  background: var(--cyan);
  box-shadow: inset 0 -4px 0 #1c7eb8;
}
#hud-ship.sailing #hud-ship-cd { color: #1c7eb8; }

#hud-ship.cooling .lantern-glass {
  background: #6a5a48;
}

#hud-sys {
  display: flex;
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
  z-index: 22;
  flex-direction: column;
  gap: 8px;
  pointer-events: auto;
}

body:not(.is-touch) #btn-pause,
body:not(.is-touch) #btn-hud-fs { display: none; }

#btn-hud-mute.muted,
#btn-mute.muted {
  filter: grayscale(0.55);
  opacity: 0.72;
}

body.is-touch #hud-ship { display: none; }

body.is-touch #toast {
  bottom: calc(var(--skill-cluster) + 52px);
}

#hud-sys button {
  width: 44px;
  min-height: 32px;
  padding: 4px 3px;
  color: var(--ink-line);
  font-size: 10px;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

#stage {
  flex: 1;
  position: relative;
  min-height: 0;
}

#game {
  width: 100%;
  height: 100%;
  position: relative;
  min-width: 0;
  min-height: 0;
  background: #62c4e8;
  touch-action: none;
}

#game canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

#fx-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 4;
}

.hp-float {
  position: absolute;
  left: 0;
  top: 0;
  width: 88px;
  height: 10px;
  background: #140c0c;
  border: 3px solid var(--ink-line);
  border-radius: 3px;
  pointer-events: none;
  z-index: 5;
  overflow: hidden;
  opacity: 0;
  will-change: transform, opacity;
}

.hp-float-fill {
  height: 100%;
  width: 100%;
  background: var(--hp);
}

.hp-float-player {
  width: 104px;
  height: 12px;
}

.hp-float-player .hp-float-fill {
  background: linear-gradient(180deg, #6ef0b4 0%, #3ecf8e 55%, #2aa56e 100%);
}

.dmg {
  position: absolute;
  left: 0;
  top: 0;
  font-weight: 900;
  font-size: 30px;
  line-height: 1;
  color: #fff6e0;
  text-shadow:
    -2px -2px 0 #2a1208,
    2px -2px 0 #2a1208,
    -2px 2px 0 #2a1208,
    2px 2px 0 #2a1208,
    0 0 10px rgba(0,0,0,0.7);
  white-space: nowrap;
  will-change: transform, opacity;
}

.dmg-ship {
  font-size: 42px;
  color: #ffe08a;
  text-shadow:
    -3px -3px 0 #4a2208,
    3px -3px 0 #4a2208,
    -3px 3px 0 #4a2208,
    3px 3px 0 #4a2208,
    0 0 16px rgba(255, 176, 60, 0.85);
}

.dmg-poison {
  font-size: 22px;
  color: #8dff7a;
}

.gold-pop {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 900;
  font-size: 26px;
  line-height: 1;
  color: #ffd24a;
  text-shadow:
    -2px -2px 0 #4a2e08,
    2px -2px 0 #4a2e08,
    -2px 2px 0 #4a2e08,
    2px 2px 0 #4a2e08,
    0 0 12px rgba(255, 196, 60, 0.85);
  white-space: nowrap;
  will-change: transform, opacity;
}

.banner {
  position: absolute;
  left: 50%;
  top: calc(var(--hud-pad-top) + var(--chrono-size) + 52px);
  transform: translateX(-50%);
  padding: 6px 22px 6px 12px;
  background: var(--wood);
  color: #fff6e0;
  font-weight: 900;
  font-size: 13px;
  letter-spacing: 0.1em;
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 50%, calc(100% - 16px) 100%, 0 100%);
  filter:
    drop-shadow(3px 0 0 var(--ink-line))
    drop-shadow(-3px 0 0 var(--ink-line))
    drop-shadow(0 3px 0 var(--ink-line))
    drop-shadow(0 -3px 0 var(--ink-line))
    drop-shadow(0 6px 0 var(--ink-line));
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 6;
  white-space: nowrap;
}

.callout {
  position: absolute;
  left: 50%;
  top: 26%;
  transform: translate(-50%, -50%);
  z-index: 12;
  pointer-events: none;
  opacity: 0;
  color: #fff6e0;
  font-size: clamp(28px, 5.6vw, 52px);
  font-weight: 900;
  letter-spacing: 0.18em;
  line-height: 1;
  white-space: nowrap;
  text-shadow:
    -3px -3px 0 var(--ink-line),
    3px -3px 0 var(--ink-line),
    -3px 3px 0 var(--ink-line),
    3px 3px 0 var(--ink-line),
    0 8px 0 var(--wood-dark),
    0 0 18px rgba(255, 210, 74, 0.55);
  transition: opacity 0.28s ease-out;
}

.callout.first,
.callout.multi,
.callout.insta {
  animation: callout-in 0.48s cubic-bezier(0.18, 1.4, 0.32, 1) both;
}

.callout.first { color: #ffd24a; }
.callout.multi { color: #ff8a3a; }
.callout.insta { color: #7ee7ff; }

.callout::after {
  content: "";
  display: block;
  width: 72%;
  height: 5px;
  margin: 10px auto 0;
  background: currentColor;
  border: 2px solid var(--ink-line);
  box-shadow: 0 3px 0 var(--ink-line);
  border-radius: 2px;
}

@keyframes callout-in {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.42) rotate(-6deg);
  }
  58% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.12) rotate(1.5deg);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1) rotate(0deg);
  }
}

#boss-hp {
  position: absolute;
  left: 50%;
  top: calc(var(--hud-pad-top) + var(--chrono-size) + 12px);
  transform: translateX(-50%);
  width: min(54%, 420px);
  z-index: 7;
  pointer-events: none;
  text-align: center;
}

#boss-hp.hidden { display: none; }

.boss-hp-name {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.16em;
  color: #fff6e0;
  text-shadow:
    -1px -1px 0 #2a1810,
    1px -1px 0 #2a1810,
    -1px 1px 0 #2a1810,
    1px 1px 0 #2a1810;
  margin-bottom: 4px;
}

.boss-hp-track {
  height: 10px;
  background: #2a1010;
  border: 3px solid var(--ink-line);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 3px 0 var(--ink-line);
}

#boss-hp-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(180deg, #ff6a55 0%, #d42222 70%, #9a1414 100%);
  transition: width 0.12s linear;
}

#boss-hp.enraged .boss-hp-name {
  color: #ff6a4a;
  animation: rageName 0.4s ease-in-out infinite alternate;
}

#boss-hp.enraged .boss-hp-track {
  box-shadow: 0 3px 0 var(--ink-line), 0 0 14px rgba(255, 48, 32, 0.55);
}

#boss-hp.enraged #boss-hp-fill {
  background: linear-gradient(180deg, #ff8a66 0%, #ff2a22 55%, #8a0808 100%);
}

@keyframes rageName {
  from { text-shadow: -1px -1px 0 #2a1810, 1px 1px 0 #2a1810, 0 0 6px #ff4422; }
  to { text-shadow: -1px -1px 0 #2a1810, 1px 1px 0 #2a1810, 0 0 14px #ff2200; }
}

/* 厚木舷窗 */
#minimap-port {
  position: relative;
  flex-shrink: 0;
  width: 152px;
  height: 152px;
  z-index: 8;
  padding: 11px;
  border-radius: 50%;
  background: var(--wood);
  border: 4px solid var(--ink-line);
  box-shadow:
    inset 0 0 0 6px var(--wood-dark),
    0 5px 0 var(--ink-line);
  pointer-events: none;
}

.minimap-disc {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--ink-line);
}

#minimap {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #123848;
}

.port-rose {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  color: #fff6e0;
  pointer-events: none;
}

.cardinal {
  position: absolute;
  font-size: 9px;
  font-weight: 900;
  color: #fff6e0;
  line-height: 1;
  text-shadow:
    -1px -1px 0 #2a1810,
    1px -1px 0 #2a1810,
    -1px 1px 0 #2a1810,
    1px 1px 0 #2a1810;
}
.cardinal.n { top: 4px; left: 0; right: 0; text-align: center; }
.cardinal.s { bottom: 4px; left: 0; right: 0; text-align: center; }
.cardinal.e { right: 6px; top: 0; bottom: 0; display: flex; align-items: center; }
.cardinal.w { left: 6px; top: 0; bottom: 0; display: flex; align-items: center; }

#hints {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
  margin: 0 0 18px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.6;
  color: var(--muted);
  text-align: left;
}

#hints kbd {
  display: inline-block;
  padding: 1px 6px;
  border: 3px solid var(--ink-line);
  background: var(--wood);
  color: #fff6e0;
  font-size: 12px;
  font-weight: 900;
  border-radius: 4px;
}

#hints .dev {
  grid-column: 1 / -1;
  color: #8a6a48;
}

#toast {
  position: absolute;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 40;
  max-width: min(70%, 420px);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 800;
  color: var(--ink-line);
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}

#toast.warn {
  background: #f6d0c0;
  color: #7a1c14;
  font-size: 13px;
  animation: toast-pop 0.28s ease;
}

@keyframes toast-pop {
  0% { transform: translateX(-50%) scale(0.92); }
  55% { transform: translateX(-50%) scale(1.06); }
  100% { transform: translateX(-50%) scale(1); }
}

#toast:empty { visibility: hidden; }

#bestiary-toast {
  position: absolute;
  left: max(12px, env(safe-area-inset-left));
  bottom: 16px;
  z-index: 9;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: min(44%, 220px);
  padding: 4px 8px 4px 6px;
  font-size: 11px;
  font-weight: 800;
  color: var(--ink-line);
  background: var(--sail);
  border: 3px solid var(--ink-line);
  box-shadow: 0 2px 0 var(--ink-line);
  border-radius: 8px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}

#bestiary-toast:empty { visibility: hidden; }

#bestiary-toast img {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: block;
}

body.is-touch #bestiary-toast {
  bottom: calc(var(--stick-size) + 92px);
}

#touch {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  touch-action: none;
}

#touch:not(.hidden) .stick,
#touch:not(.hidden) .skill {
  pointer-events: auto;
}

.stick {
  position: absolute;
  left: max(36px, calc(env(safe-area-inset-left) + 12px));
  bottom: max(80px, calc(env(safe-area-inset-bottom) + 64px));
  width: var(--stick-size);
  height: var(--stick-size);
  border-radius: 50%;
  background: rgba(242, 230, 200, 0.55);
  border: 4px solid var(--ink-line);
  box-shadow: 0 4px 0 var(--ink-line);
  touch-action: none;
}

#stick-knob {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--stick-knob);
  height: var(--stick-knob);
  border-radius: 50%;
  background: var(--cyan);
  border: 3px solid var(--ink-line);
}

.touch-skills {
  position: absolute;
  right: max(36px, calc(env(safe-area-inset-right) + 20px));
  bottom: max(40px, calc(env(safe-area-inset-bottom) + 24px));
  width: var(--skill-cluster);
  height: var(--skill-cluster);
}

.skill {
  position: absolute;
  display: grid;
  place-items: center;
  padding: 0;
  margin: 0;
  border-radius: 50%;
  overflow: visible;
  cursor: pointer;
  color: var(--ink-line);
  font-family: inherit;
  background: var(--sail);
  border: 3px solid var(--ink-line);
  box-shadow: 0 4px 0 var(--ink-line);
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

.skill img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  pointer-events: none;
  display: block;
  z-index: 0;
}

.skill-aa {
  width: var(--skill-aa);
  height: var(--skill-aa);
  right: 0;
  bottom: 0;
}

.skill-1 {
  width: var(--skill-n);
  height: var(--skill-n);
  right: calc(var(--skill-aa) + 22px);
  bottom: 4px;
}

.skill-2 {
  width: var(--skill-n);
  height: var(--skill-n);
  right: calc(var(--skill-aa) + 20px);
  bottom: calc(var(--skill-aa) + 14px);
}

.skill-3 {
  width: var(--skill-ult);
  height: var(--skill-ult);
  right: 6px;
  bottom: calc(var(--skill-aa) + 22px);
}

.skill-name {
  position: absolute;
  left: 50%;
  bottom: -6px;
  transform: translateX(-50%);
  z-index: 2;
  padding: 1px 6px;
  background: var(--ink-line);
  border-radius: 8px;
  font-size: 10px;
  font-weight: 900;
  line-height: 1.2;
  color: #fff6e0;
  white-space: nowrap;
  pointer-events: none;
  letter-spacing: 0.04em;
}

.skill-aa .skill-name {
  bottom: -7px;
  font-size: 12px;
  padding: 2px 8px;
}

.skill-3 .skill-name {
  font-size: 11px;
}

.skill-cost {
  position: absolute;
  left: 50%;
  top: -7px;
  bottom: auto;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 30px;
  height: 15px;
  padding: 0 5px;
  background: var(--ink-line);
  color: var(--gold);
  font-size: 10px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  line-height: 1;
  border-radius: 8px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 2;
}

.skill-cost .gold-icon {
  width: 9px;
  height: 9px;
}

.skill-cd {
  position: absolute;
  inset: 3px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(20, 12, 8, 0.58);
  color: #fff6e0;
  font-size: 16px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  letter-spacing: 0;
  line-height: 1;
  width: auto;
  min-width: 0;
  text-align: center;
  pointer-events: none;
  z-index: 2;
}

.skill-1 .skill-cd,
.skill-2 .skill-cd {
  font-size: 14px;
}

.skill.poor {
  filter: grayscale(0.35);
  opacity: 0.72;
}

.skill:active,
.skill.holding {
  transform: translateY(2px);
  box-shadow: 0 2px 0 var(--ink-line);
}

.skill.inspecting {
  box-shadow: 0 4px 0 var(--ink-line), 0 0 0 3px var(--cyan);
}

.hidden { display: none !important; }

#overlay, #shop, #pause, #home, #guide, #bestiary {
  position: absolute;
  inset: 0;
  background: rgba(28, 80, 120, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 24;
}

#home {
  z-index: 20;
  background:
    linear-gradient(180deg,
      rgba(12, 48, 78, 0.58) 0%,
      rgba(28, 80, 120, 0.18) 48%,
      rgba(18, 62, 96, 0.42) 100%);
  pointer-events: auto;
}

.home-lockup {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px 16px;
  max-width: min(520px, 92%);
  width: 100%;
  margin: 0 auto;
}

.home-kicker {
  margin: 0 -0.28em 8px 0 !important;
  font-size: 12px !important;
  font-weight: 800 !important;
  letter-spacing: 0.28em;
  color: var(--gold) !important;
  text-shadow: 0 2px 0 var(--ink-line);
}

#home h1 {
  margin: 0 0 10px;
  margin-right: -0.06em;
  font-size: clamp(40px, 8vw, 72px);
  font-weight: 900;
  letter-spacing: 0.06em;
  line-height: 0.95;
  color: #fff6e0;
  text-shadow:
    -3px -3px 0 var(--ink-line),
    3px -3px 0 var(--ink-line),
    -3px 3px 0 var(--ink-line),
    3px 3px 0 var(--ink-line),
    0 7px 0 var(--wood-dark);
}

.home-tag {
  margin: 0 0 22px !important;
  font-size: 15px !important;
  font-weight: 800 !important;
  color: var(--sail) !important;
  text-shadow: 0 2px 0 rgba(18, 12, 8, 0.55);
}

#btn-start {
  min-width: 188px;
  padding: 12px 36px;
  font-size: 18px;
  justify-content: center;
  align-self: center;
}

#btn-start:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--ink-line);
}

.home-how {
  margin-top: 18px;
  padding: 8px 14px;
  background: var(--sail);
  border: 3px solid var(--ink-line);
  box-shadow: 0 3px 0 var(--ink-line);
  border-radius: 8px;
}

.home-how p {
  margin: 0 !important;
  color: var(--muted) !important;
  font-size: 12px !important;
  font-weight: 800 !important;
}

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

#phone-frame.on-home #hud-top,
#phone-frame.on-home #touch,
#phone-frame.on-home #btn-pause,
#phone-frame.on-home #gm-bar,
#phone-frame.on-home #guide,
#phone-frame.on-home .callout,
#phone-frame.on-home .banner {
  display: none !important;
}

#phone-frame:has(#guide:not(.hidden)) #gm-bar {
  display: none !important;
}

#guide {
  z-index: 25;
  overflow: hidden;
  align-items: flex-start;
  padding-top: min(52px, 9vh);
  pointer-events: auto;
}

#guide.spotted {
  background: transparent;
  justify-content: flex-start;
  padding-left: max(16px, 5%);
}

#guide-spot {
  position: absolute;
  z-index: 0;
  pointer-events: none;
  border-radius: 50%;
  box-shadow:
    0 0 0 4px var(--gold),
    0 0 0 9999px rgba(18, 50, 78, 0.55);
  animation: guide-pulse 1.2s ease-in-out infinite;
}

#guide-spot.rect {
  border-radius: 12px;
}

@keyframes guide-pulse {
  0%, 100% {
    box-shadow:
      0 0 0 4px var(--gold),
      0 0 0 9999px rgba(18, 50, 78, 0.55);
  }
  50% {
    box-shadow:
      0 0 0 7px #ffe08a,
      0 0 0 9999px rgba(18, 50, 78, 0.55);
  }
}

.guide-panel {
  position: relative;
  z-index: 1;
  width: min(400px, 90%);
  padding: 14px 18px 16px;
}

.guide-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.guide-kicker {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.2em;
  color: var(--muted);
}

.guide-panel .guide-skip {
  padding: 4px 10px;
  font-size: 12px;
  background: var(--sail);
  color: var(--muted);
  box-shadow: 0 2px 0 var(--ink-line);
}

.guide-panel .guide-skip:hover {
  background: var(--chart-strong);
  color: var(--ink-line);
}

.guide-icon-wrap {
  width: 64px;
  height: 64px;
  margin: 2px auto 8px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--cyan);
  border: 3px solid var(--ink-line);
  box-shadow: 0 3px 0 var(--ink-line);
}

.guide-icon-wrap img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.guide-goals {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 10px;
}

.guide-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  background: var(--wood);
  color: #fff6e0;
  border: 3px solid var(--ink-line);
  box-shadow: 0 2px 0 var(--ink-line);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
}

.guide-panel h2 {
  margin-bottom: 6px;
}

.guide-panel p {
  margin-bottom: 8px;
  line-height: 1.55;
}

.guide-panel .guide-hint {
  margin-bottom: 10px;
  color: var(--ink-line);
  font-size: 12px;
}

.guide-hint kbd {
  display: inline-block;
  padding: 1px 6px;
  border: 3px solid var(--ink-line);
  background: var(--wood);
  color: #fff6e0;
  font-size: 11px;
  font-weight: 900;
  border-radius: 4px;
}

.guide-panel .gold-amt {
  vertical-align: -3px;
}

.guide-panel .gold-amt .gold-icon {
  width: 14px;
  height: 14px;
}

.guide-dots {
  display: flex;
  justify-content: center;
  gap: 7px;
  margin: 2px 0 12px;
}

.guide-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--sail);
  border: 2px solid var(--ink-line);
  box-shadow: 0 1px 0 var(--ink-line);
}

.guide-dot.on {
  background: var(--cyan);
}

.guide-panel #btn-guide-next {
  min-width: 148px;
}

.panel {
  position: relative;
  width: min(420px, 92vw);
  padding: 18px;
  text-align: center;
}

.panel h1, .panel h2 {
  margin-bottom: 10px;
  font-weight: 900;
}
.panel h1 { font-size: 22px; }
.panel h2 { font-size: 16px; }
.panel p { color: var(--muted); margin-bottom: 14px; font-weight: 700; font-size: 13px; }

.pause-fs-hint {
  font-size: 13px !important;
  margin-top: -8px;
}

.pause-audio {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 0 0 14px;
  flex-wrap: wrap;
}

.pause-audio #btn-mute {
  min-width: 88px;
}

.vol-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
}

.vol-row input[type="range"] {
  width: 120px;
  accent-color: var(--wood);
  cursor: pointer;
}

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

.panel button, .shop-item button, .shop-tip-actions button, #home button {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: var(--wood);
  color: #fff6e0;
  border: 3px solid var(--ink-line);
  box-shadow: 0 3px 0 var(--ink-line);
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 800;
  font-family: inherit;
}

.panel button:hover, .shop-item button:hover, .shop-tip-actions button:hover, #home button:hover {
  background: #e0a44a;
}

#home #btn-guide {
  margin-top: 10px;
  background: transparent;
  color: var(--sail);
  border-color: transparent;
  box-shadow: none;
  padding: 4px 10px;
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

#home #btn-guide:hover {
  background: transparent;
  color: var(--gold);
}

#home #btn-guide:active {
  transform: none;
  box-shadow: none;
}

.shop-panel {
  width: min(640px, 96vw);
  max-height: 86vh;
  overflow: hidden;
  text-align: left;
  display: flex;
  flex-direction: column;
}

.bestiary-panel {
  width: min(640px, 96vw);
  max-height: 86vh;
  overflow: hidden;
  text-align: left;
  display: flex;
  flex-direction: column;
}

.bestiary-head-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.bestiary-tabs {
  display: flex;
  gap: 6px;
}

#bestiary .bestiary-tab {
  cursor: pointer;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 800;
  font-family: inherit;
  background: var(--sail);
  color: var(--ink-line);
  border: 3px solid var(--ink-line);
  box-shadow: 0 2px 0 var(--ink-line);
  border-radius: 8px;
  touch-action: manipulation;
}

#bestiary .bestiary-tab.on {
  background: var(--wood);
  color: #fff6e0;
}

#bestiary .bestiary-tab:hover {
  background: #fff6e0;
}

#bestiary .bestiary-tab.on:hover {
  background: #e0a44a;
}

#bestiary .bestiary-tab:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 var(--ink-line);
}

.achieve-card .trophy,
.achieve-card .medal {
  width: 72%;
  max-width: 92px;
  aspect-ratio: 1;
  padding: 6px;
  background: #4aa8c8;
  border-radius: 6px;
  display: block;
}

.achieve-card.locked .trophy,
.achieve-card.locked .medal {
  background: #4a525c;
}

.achieve-card.on .trophy,
.achieve-card.on .medal {
  background: #3a8aaa;
}

.achieve-count {
  font-size: 10px;
  font-weight: 900;
  color: var(--muted);
  line-height: 1;
}

.bestiary-card.on .achieve-count {
  color: #fff6e0;
}

#bestiary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  min-height: 0;
  overflow: auto;
}

#bestiary .bestiary-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 4px 7px;
  min-width: 0;
  width: 100%;
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  background: var(--sail);
  color: var(--ink-line);
  border: 3px solid var(--ink-line);
  box-shadow: 0 3px 0 var(--ink-line);
  border-radius: 8px;
  touch-action: manipulation;
}

#bestiary .bestiary-card:hover {
  background: #fff6e0;
}

#bestiary .bestiary-card.on {
  background: var(--wood);
  color: #fff6e0;
}

#bestiary .bestiary-card.on .bestiary-card-name {
  color: #fff6e0;
}

#bestiary .bestiary-card.locked {
  filter: grayscale(0.15);
}

.bestiary-card canvas {
  width: 100%;
  aspect-ratio: 1;
  height: auto;
  display: block;
  border-radius: 6px;
  background: #4aa8c8;
  pointer-events: none;
}

.bestiary-card.locked canvas {
  background: #4a525c;
}

.bestiary-card-name {
  width: 100%;
  font-size: 11px;
  font-weight: 900;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
  color: var(--ink-line);
}

.bestiary-detail {
  margin-top: 10px;
  padding: 8px 10px;
  background: var(--sail);
  border: 3px solid var(--ink-line);
  box-shadow: 0 3px 0 var(--ink-line);
  border-radius: 8px;
  min-height: 72px;
}

.bestiary-detail h3 {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 900;
}

.bestiary-detail p {
  margin: 0 0 6px !important;
  font-size: 12px !important;
  color: var(--muted);
}

.bestiary-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  font-size: 12px;
  font-weight: 800;
  color: var(--ink-line);
}

.bestiary-stats span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.shop-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.shop-paused {
  margin-left: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.shop-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px !important;
  color: var(--muted) !important;
}

#shop-slots {
  display: inline-block;
  font-weight: 900;
}

.shop-meta .nudge {
  animation: shop-nudge 0.42s ease;
  color: var(--danger) !important;
}

.shop-meta .nudge #shop-gold {
  color: var(--danger);
}

@keyframes shop-nudge {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}

.gold-amt {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.gold-amt .gold-icon,
.gold-pop .gold-icon {
  width: 18px;
  height: 18px;
}

.gold-pop .gold-icon {
  width: 22px;
  height: 22px;
}

.gold-pop.small {
  gap: 2px;
  font-size: 15px;
  text-shadow:
    -1px -1px 0 #4a2e08,
    1px -1px 0 #4a2e08,
    -1px 1px 0 #4a2e08,
    1px 1px 0 #4a2e08,
    0 0 8px rgba(255, 196, 60, 0.5);
}

.gold-pop.small .gold-icon {
  width: 13px;
  height: 13px;
}

.shop-section {
  grid-column: 1 / -1;
  font-size: 13px;
  font-weight: 900;
  color: var(--muted);
}

.shop-empty {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

#shop-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
  overflow: auto;
  min-height: 0;
  flex: 1;
}

.shop-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 6px 7px;
  min-width: 0;
  cursor: pointer;
  touch-action: manipulation;
}

.shop-item .mod-icon {
  width: 38px;
  height: 38px;
  border-radius: 8px;
}

.shop-item-name {
  width: 100%;
  font-size: 11px;
  font-weight: 900;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.shop-item-price {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 18px;
}

.shop-item-price .gold-amt {
  font-size: 11px;
  font-weight: 900;
  color: #c48410;
}

.shop-item-price .gold-icon {
  width: 14px;
  height: 14px;
}

.shop-loadout {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  padding-top: 10px;
  margin-top: 4px;
  border-top: 3px solid var(--ink-line);
}

.shop-loadout-label {
  font-size: 11px;
  font-weight: 900;
  color: var(--muted);
  white-space: nowrap;
}

#shop-owned {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.shop-owned-slot {
  position: relative;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border: 3px solid var(--ink-line);
  border-radius: 10px;
  background: #fff6e0;
  box-shadow: 0 3px 0 var(--ink-line);
  cursor: pointer;
}

.shop-owned-slot.empty {
  background:
    repeating-linear-gradient(90deg, rgba(90, 50, 20, 0.08) 0 3px, transparent 3px 10px),
    #d8c8a0;
  box-shadow: none;
  opacity: 0.55;
  cursor: default;
}

.shop-owned-slot .mod-icon {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 7px;
  box-shadow: none;
}

#shop-tip {
  position: absolute;
  z-index: 25;
  width: 240px;
  padding: 10px 12px;
  background:
    repeating-linear-gradient(90deg, rgba(90, 50, 20, 0.1) 0 3px, transparent 3px 12px),
    var(--sail);
  border: 3px solid var(--ink-line);
  box-shadow: 0 4px 0 var(--ink-line);
  border-radius: 8px;
  pointer-events: auto;
  text-align: left;
}

#shop-tip h3 {
  font-size: 13px;
  font-weight: 900;
  margin-bottom: 6px;
}

#shop-tip p {
  font-size: 11px;
  margin-bottom: 0;
  line-height: 1.4;
  font-weight: 700;
}

.shop-tip-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.shop-tip-actions button {
  padding: 6px 10px;
  font-size: 12px;
}

.mod-icon {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border: 3px solid var(--ink-line);
  border-radius: 10px;
  background: #fff6e0;
  box-shadow: 0 3px 0 var(--ink-line);
}

#hud-mods {
  position: relative;
  left: auto;
  top: auto;
  z-index: 8;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  pointer-events: none;
}

.hud-mod {
  position: relative;
  width: 32px;
  height: 32px;
  pointer-events: auto;
  cursor: pointer;
}

.hud-mod .mod-icon {
  width: 32px;
  height: 32px;
  border-radius: 7px;
}

.hud-mod-tier {
  position: absolute;
  right: -3px;
  bottom: -3px;
  min-width: 13px;
  height: 13px;
  padding: 0 2px;
  background: var(--wood);
  border: 2px solid var(--ink-line);
  border-radius: 4px;
  color: #fff6e0;
  font-size: 8px;
  font-weight: 900;
  line-height: 9px;
  text-align: center;
}

#shop-tip .shop-base,
#shop-tip .shop-effect,
.inspect-tip .shop-base,
.inspect-tip .shop-effect {
  font-size: 13px;
  margin-bottom: 0;
  line-height: 1.45;
}

.inspect-tip {
  position: absolute;
  z-index: 18;
  width: min(268px, calc(100% - 16px));
  padding: 10px 12px;
  background:
    repeating-linear-gradient(90deg, rgba(90, 50, 20, 0.1) 0 3px, transparent 3px 12px),
    var(--sail);
  border: 3px solid var(--ink-line);
  box-shadow: 0 4px 0 var(--ink-line);
  border-radius: 8px;
  pointer-events: auto;
  text-align: left;
}

.inspect-tip h3 {
  font-size: 13px;
  font-weight: 900;
  margin-bottom: 6px;
}

.inspect-tip p {
  font-size: 11px;
  margin-bottom: 0;
  line-height: 1.4;
  font-weight: 700;
}

.inspect-meta {
  color: var(--muted);
  font-weight: 800;
  margin-bottom: 6px !important;
}

.inspect-meta .gold-amt {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.inspect-meta .gold-icon {
  width: 11px;
  height: 11px;
}

.inspect-unit {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 2px solid var(--ink-line);
}

.inspect-unit-head {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: var(--ink-line);
  margin-bottom: 4px;
}

.inspect-unit-stats {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  margin-bottom: 6px;
}

.inspect-abilities {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.inspect-abilities li {
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--ink-line);
}

.inspect-abilities b {
  color: #1a6fb8;
  font-weight: 900;
  margin-right: 4px;
}

#stat-hud {
  width: min(300px, calc(100% - 16px));
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px 12px;
}

.stat-cell {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.stat-cell .k {
  font-size: 10px;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.stat-cell .v {
  font-size: 12px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  color: var(--ink-line);
  white-space: nowrap;
}

.shop-base {
  color: var(--muted);
  font-weight: 800;
}

.shop-effect {
  margin-top: 4px;
  color: #1a6fb8;
  font-weight: 800;
}

body.is-touch #phone-frame {
  width: 100%;
  height: 100%;
  max-width: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

#phone-frame:fullscreen,
#phone-frame:-webkit-full-screen {
  width: 100%;
  height: 100%;
  max-width: none;
  border: none;
  border-radius: 0;
}

@media (max-width: 900px) {
  #phone-frame {
    width: 100%;
    height: 100%;
    max-width: none;
    border: none;
    border-radius: 0;
    box-shadow: none;
  }
  :root { --chrono-size: 70px; }
  .chrono::before { inset: 13px; }
  #hud-timer { font-size: 13px; }
  .hull-plate { min-width: 132px; }
  #minimap-port {
    width: 136px;
    height: 136px;
    padding: 10px;
  }
  #touch.hidden { display: block !important; }
  #toast { bottom: calc(var(--skill-cluster) + 48px); }
  #bestiary-toast { bottom: calc(var(--stick-size) + 92px); }
}

@media (max-height: 480px) {
  #home h1 { font-size: clamp(32px, 7vw, 52px); }
  .home-tag { margin-bottom: 14px !important; font-size: 13px !important; }
  .home-how { margin-top: 12px; padding: 6px 10px; }
  #btn-start { min-width: 160px; padding: 10px 28px; font-size: 16px; }
  .guide-panel { padding: 10px 14px 12px; width: min(380px, 92%); }
  .guide-icon-wrap { width: 48px; height: 48px; margin-bottom: 4px; }
  .guide-panel h2 { font-size: 15px; margin-bottom: 4px; }
  .guide-panel p { margin-bottom: 6px; font-size: 12px; }
  .guide-dots { margin-bottom: 8px; }
  .guide-panel #btn-guide-next { padding: 8px 14px; font-size: 13px; }
  #hud-top {
    padding: 8px 10px;
    padding-top: max(8px, env(safe-area-inset-top));
    padding-left: max(10px, env(safe-area-inset-left));
    padding-right: max(10px, env(safe-area-inset-right));
  }
  .hud-right { padding-right: 44px; }
  #hud-sys button { min-height: 28px; width: 40px; font-size: 9px; }
  :root { --chrono-size: 62px; }
  .chrono::before { inset: 11px; }
  #hud-timer { font-size: 12px; }
  #minimap-port {
    width: 118px;
    height: 118px;
    padding: 9px;
  }
  #boss-hp { width: min(46%, 300px); }
  #shop-list { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  #bestiary-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .shop-item { padding: 6px 4px; }
  .shop-item .mod-icon { width: 36px; height: 36px; }
  .shop-owned-slot { width: 40px; height: 40px; }
  .pennant { width: 118px; font-size: 12px; padding: 8px 20px 8px 10px; }
}

#gm-bar {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  z-index: 21;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  max-width: 96%;
  padding: 7px 10px;
  background: var(--panel);
  border: 3px solid var(--ink-line);
  box-shadow: 0 3px 0 var(--ink-line);
  border-radius: 10px;
  pointer-events: auto;
  touch-action: manipulation;
}
#gm-bar.hidden { display: none !important; }

.gm-title {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 2px 6px;
  border: 3px solid var(--ink-line);
  border-radius: 6px;
  background: #efe0b8;
}

.gm-time {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 800;
  color: var(--text);
  cursor: pointer;
}

.gm-time input[type="range"] {
  width: min(180px, 28vw);
  accent-color: var(--wood);
  cursor: pointer;
}

#gm-time-read {
  min-width: 2.6em;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
}

#gm-bar button {
  cursor: pointer;
  background: var(--wood);
  color: #fff6e0;
  border: 3px solid var(--ink-line);
  box-shadow: 0 2px 0 var(--ink-line);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
  font-family: inherit;
}

#gm-bar button:hover { background: #e0a44a; }
#gm-bar button:active { transform: translateY(1px); box-shadow: 0 1px 0 var(--ink-line); }

#gm-god.on {
  background: #3ecf8e;
  color: #14351f;
}
#gm-ghost.on {
  background: #8a6bb5;
  color: #fff6e0;
}

body.is-touch #gm-bar {
  left: max(10px, env(safe-area-inset-left));
  right: auto;
  bottom: auto;
  top: max(10px, env(safe-area-inset-top));
  transform: none;
  max-width: min(360px, calc(100% - 70px));
}

/* 触屏竖持时把整局转成横屏，避免走竖版布局 */
@media (pointer: coarse) and (orientation: portrait) {
  html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
  }
  body {
    position: fixed;
    display: block;
    top: var(--vv-top, 0px);
    left: var(--vv-left, 0px);
    width: var(--vv-w, 100vw);
    height: var(--vv-h, 100dvh);
  }
  #phone-frame,
  body.is-touch #phone-frame,
  #phone-frame:fullscreen,
  #phone-frame:-webkit-full-screen {
    position: absolute;
    top: 0;
    left: 100%;
    width: var(--vv-h, 100dvh);
    height: var(--vv-w, 100vw);
    max-width: none;
    border: none;
    border-radius: 0;
    box-shadow: none;
    transform: rotate(90deg);
    transform-origin: top left;
  }
}
