@font-face {
  font-family: Alegreya;
  src: url('./assets/fonts/alegreya.woff2') format('woff2');
  font-weight: 500 900;
  font-display: swap;
}

@font-face {
  font-family: Barlow;
  src: url('./assets/fonts/barlow-medium.woff2') format('woff2');
  font-weight: 400 600;
  font-display: swap;
}

@font-face {
  font-family: Barlow;
  src: url('./assets/fonts/barlow-bold.woff2') format('woff2');
  font-weight: 650 900;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --night: #0c151b;
  --deep: #101c23;
  --panel: #1b2b32;
  --paper: #f4e7cd;
  --soft: #d3c6ae;
  --muted: #a7b3b0;
  --quiet: #839694;
  --gold: #efbd82;
  --dark-gold: #9e7755;
  --line: #395058;
  --aqua: #90d9cc;
  --red: #ff9a88;
  --violet: #d5b9ef;
  --accent: #9cc9bc;
  --stage-wash: #203d41;
  --serif: Alegreya, Georgia, serif;
  --sans: Barlow, 'Arial Narrow', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; background: var(--night); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { color: var(--paper); font: 500 17px/1.35 var(--sans); }
button, summary { font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, summary:focus-visible { outline: 2px solid #a9ebe3; outline-offset: 3px; z-index: 4; }
img { display: block; max-width: 100%; user-select: none; -webkit-user-drag: none; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: var(--serif); }
button, .chart { user-select: none; -webkit-user-select: none; }

body, main, dialog { scrollbar-color: #587375 #111b20; scrollbar-width: thin; }
.icon { display: inline-block; flex: 0 0 auto; width: 1.15em; height: 1.15em; vertical-align: -.16em; }
kbd { color: var(--gold); font: 700 .88em/1 var(--sans); border: 1px solid #63635a; padding: 1px 5px 2px; border-radius: 3px; }
.small-caps { display: inline-flex; gap: .45em; align-items: center; color: var(--gold); font-size: .79rem; font-weight: 700; letter-spacing: .15em; text-transform: uppercase; }
.small-caps i { width: 3px; height: 3px; margin-inline: .35em; background: currentColor; transform: rotate(45deg); }
#game { display: flex; flex-direction: column; width: 100%; height: 100vh; height: 100dvh; overflow: hidden; }
#game > main { flex: 1 1 auto; min-height: 0; }
#run-header { flex: 0 0 auto; z-index: 4; }
.theme-brass { --accent: #e7af79; --stage-wash: #56392b; }
.theme-outer { --accent: #c6b7ef; --stage-wash: #3b3659; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .57em;
  min-height: 44px;
  padding: .58em 1em;
  border: 1px solid #526461;
  border-radius: 5px;
  background: linear-gradient(180deg, #263840, #18262d);
  color: var(--paper);
  font-weight: 700;
  line-height: 1;
  text-align: center;
  transition: background-color .15s, border-color .15s, box-shadow .15s, color .15s;
}
.button.primary {
  color: #271b14;
  border-color: #f4ce98;
  background: linear-gradient(180deg, #f8d7a1, #dca670);
  box-shadow: inset 0 0 0 2px #51321b35, 0 4px 13px #05080b60;
  font-weight: 800;
}
.button.ghost { border-color: #78918b50; background: #101d24bb; color: var(--soft); }
.button.text-button { border-color: transparent; background: transparent; color: var(--red); }
.button:disabled, .choice:disabled, .kit:disabled { opacity: .58; }
.button.icon-btn { width: 44px; min-width: 44px; height: 44px; padding: 0; font-size: 19px; }
.button.danger-button { border-color: #a3564b; background: #422622; color: #ffc0ab; }

@media (hover: hover) {
  .button:not(:disabled):hover { border-color: var(--gold); color: var(--paper); }
  .button.primary:not(:disabled):hover { color: #20150e; background: linear-gradient(180deg, #ffe3b5, #eab57a); }
}

.harbor { position: relative; display: flex; align-items: center; isolation: isolate; overflow: auto; }
.harbor-art, .harbor-border { position: absolute; z-index: -1; pointer-events: none; }
.harbor-art {
  inset: 0;
  background: linear-gradient(90deg, #090e14 0%, #090e14c9 20%, #090e1460 42%, #090e1404 70%),
    linear-gradient(0deg, #0a1116a6, transparent 39%),
    url('./assets/cover.webp') center 53% / cover no-repeat;
}
.harbor-border { inset: 15px; border: 1px solid #d6bd8b45; border-radius: 2px; }
.harbor-border::before, .harbor-border::after { position: absolute; content: ''; width: 16px; height: 16px; border-color: #bea67a; border-style: solid; }
.harbor-border::before { top: -1px; left: -1px; border-width: 2px 0 0 2px; }
.harbor-border::after { bottom: -1px; right: -1px; border-width: 0 2px 2px 0; }
.harbor-tools { position: absolute; z-index: 2; top: max(28px, env(safe-area-inset-top)); right: 29px; display: flex; gap: 7px; }
.harbor-tools .button { background-color: #0b171cde; color: #ead9b9; }
.harbor-content { width: min(670px, 52vw); margin: auto 0 auto clamp(55px, 8.25vw, 154px); padding: 38px 0 36px; }
.title-mark { width: clamp(55px, 6vw, 89px); color: var(--gold); transform: rotate(-10deg); margin: 0 0 13px 10px; }
.seal { display: block; width: 100%; height: auto; }
.game-title { text-transform: uppercase; letter-spacing: -.038em; font-weight: 800; line-height: .80; text-shadow: 0 4px 17px #05080c90; }
.game-title span, .game-title strong { display: block; white-space: nowrap; }
.game-title span { font-size: clamp(52px, 6.35vw, 106px); font-weight: 750; }
.game-title strong { color: var(--gold); font-size: clamp(103px, 12.2vw, 212px); letter-spacing: -.058em; font-weight: 850; padding-bottom: .07em; }
.harbor-flourish { display: flex; align-items: center; gap: 8px; width: min(280px, 76%); margin: 11px 0 15px; color: #c99d6d; font-size: 13px; }
.harbor-flourish i { height: 1px; flex: 1; background: linear-gradient(90deg, #ac855e, #667d7560); }
.harbor-flourish i:first-child { flex: 0 0 35px; }
.harbor-story { font: 500 clamp(20px, 2.15vw, 31px)/1.16 var(--serif); color: #e4d7bf; text-shadow: 0 2px 7px #060e13; }
.harbor-launch { display: flex; align-items: flex-start; flex-direction: column; margin-top: clamp(20px, 3.2vh, 39px); gap: 7px; }
.launch { width: clamp(225px, 23vw, 310px); padding-inline: 16px; justify-content: flex-start; min-height: 58px; font-size: 22px; }
.launch-arrow { margin-left: auto; }
.launch-note { color: #c7b99f; font-size: 15px; letter-spacing: .035em; }
.harbor-nav { display: flex; flex-wrap: wrap; gap: 7px; margin-top: clamp(16px, 2.7vh, 28px); }
.menu-link { min-height: 44px; padding: .55em .85em; font-size: 17px; color: #e2d5bd; background: #131f25e0; border-color: #a2b9ae50; }
.menu-link .icon { color: var(--gold); }
.pending { width: 6px; height: 6px; background: var(--aqua); border-radius: 50%; }

.runbar { height: 61px; border-bottom: 1px solid #b5c5b62a; background: #101c23; }
.runbar-inner { height: 100%; width: min(100% - 48px, 1370px); margin: auto; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; }
.run-where { display: flex; align-items: center; gap: 10px; min-width: 0; }
.district-number { display: inline-grid; place-items: center; min-width: 27px; height: 27px; border: 1px solid #927856; color: var(--gold); border-radius: 3px; font: 800 17px/1 var(--serif); }
.district-name { color: var(--paper); font: 700 1.42rem/1 var(--serif); white-space: nowrap; }
.run-progress { display: flex; align-items: center; gap: 5px; margin-left: 5px; }
.run-progress i { width: 6px; height: 6px; border: 1px solid #7f8e87; transform: rotate(45deg); border-radius: 1px; }
.run-progress .filled { background: var(--gold); border-color: var(--gold); }
.run-vitals { display: flex; gap: 10px; align-items: center; }
.vital { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 4px 9px; font: 700 20px/1 var(--sans); border: 1px solid #7d69605c; border-radius: 5px; background: #221e20; white-space: nowrap; }
.vital .icon { width: 15px; height: 15px; }
.vital.health { color: #ffc0ac; }
.vital.health span { color: #e5b6a5; font-size: .85em; }
.vital.danger { background: #5a2929; border-color: #a85a50; color: #ffd1bc; }
.vital.marks { color: var(--gold); background: #24261f; border-color: #98845e5f; }
.run-tools { display: flex; align-items: center; justify-content: end; gap: 6px; }
.run-tools .icon-btn { width: 42px; min-width: 42px; height: 42px; min-height: 42px; }

.combat { display: flex; flex-direction: column; background: #0d171d; }
.battlefield { position: relative; flex: 1 1 auto; min-height: 0; isolation: isolate; }
.stage-backdrop {
  position: absolute; inset: 0; z-index: -2;
  background: linear-gradient(180deg, #0c171fed 0%, #0c171f64 27%, #10232c05 55%, #0c171e 99%),
    var(--scene) center 68% / 100% 100% no-repeat, var(--stage-wash);
}
.stage-grain { position: absolute; inset: 0; z-index: -1; background: radial-gradient(ellipse at 53% 54%, transparent 36%, #08131990 94%); pointer-events: none; }
.arena { position: relative; width: min(100%, 1350px); height: 100%; margin-inline: auto; isolation: isolate; }
.foe-stage {
  position: absolute;
  top: clamp(92px, 20%, 122px); bottom: 11%;
  left: 52.3%; width: min(40%, 450px); transform: translateX(-50%);
  display: grid; place-items: end center; z-index: 0; pointer-events: none;
}
.foe-stage.boss-art { width: min(49%, 520px); bottom: 9%; }
.foe-art {
  position: absolute; inset: 0;
  margin: auto auto 0; width: 100%; height: 100%; object-fit: contain; object-position: center bottom;
  filter: drop-shadow(0 11px 9px #080f15b0);
  transform-origin: 50% 82%;
  animation: rise .34s cubic-bezier(.15,.83,.33,1) both;
}
@keyframes rise { from { opacity: .5; transform: translateY(9px) scale(.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
.foe-reflection { width: 78%; height: 26px; border-radius: 50%; background: #060e1680; filter: blur(7px); transform: translateY(6px); }
.enemy-hud, .player-hud, .battle-effects { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.enemy-hud button, .player-hud button { pointer-events: auto; }
.foe-vitals { position: absolute; top: clamp(10px, 5%, 26px); left: 52.3%; transform: translateX(-50%); width: min(460px, 87%); display: grid; justify-items: center; text-align: center; text-shadow: 0 2px 7px #070d12; }
.foe-rank { display: block; min-height: 14px; color: var(--gold); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .15em; }
.foe-rank:empty { min-height: 4px; }
.foe-vitals h1 { font-size: clamp(31px, 5.2vh, 59px); line-height: .98; font-weight: 750; margin: 0 0 8px; }
.meter { display: block; position: relative; isolation: isolate; width: min(236px, 68%); height: 22px; overflow: hidden; border: 1px solid #a25b55; border-radius: 4px; background: #261b22; color: #fff2df; font: 800 15px/1 var(--sans); text-shadow: 0 1px 3px #160906; }
.meter i { position: absolute; inset: 1px auto 1px 1px; z-index: -1; width: calc(var(--level) - 2px); background: linear-gradient(180deg, #a5524a, #78373c); border-radius: 2px; }
.meter b { display: grid; height: 100%; grid-auto-flow: column; justify-content: center; gap: 4px; align-items: center; }
.meter b span { color: #ffd7c3; }
.foe-statuses { display: flex; justify-content: center; gap: 4px; margin-top: 6px; }
.status-chip { display: inline-flex; position: relative; align-items: center; justify-content: center; gap: 4px; padding: 2px 7px; min-height: 29px; border: 1px solid #69837e; border-radius: 4px; background: #16272cf0; color: var(--aqua); white-space: nowrap; font-size: 14px; line-height: 1; }
.status-chip span { font-size: .92em; }
.status-chip.salt, .status-chip.dull { color: var(--violet); border-color: #8d78a9; }
.status-chip.expose, .status-chip.power { color: #ffd588; border-color: #9b7a59; }
.status-chip.guard { color: #a4d5ec; border-color: #57778a; }
.status-chip.main-guard { min-height: 38px; font-size: 19px; padding-inline: 9px; }
.courier-hud { position: absolute; left: 4%; bottom: 22px; display: flex; align-items: center; gap: 12px; }
.courier-portrait { border-radius: 50%; width: 66px; height: 66px; padding: 3px; background: #19262e; border: 1px solid #b69a72; overflow: hidden; }
.courier-portrait img { height: 100%; width: 100%; border-radius: 50%; object-fit: cover; }
.courier-field { min-width: 0; }
.courier-head { display: flex; align-items: baseline; gap: 7px; text-shadow: 0 2px 7px #070d12; }
.courier-head strong { font: 750 25px/1.15 var(--serif); }
.courier-head > span { color: #ded8c4; font-size: 14px; white-space: nowrap; }
.courier-status { display: flex; align-items: end; gap: 4px; flex-wrap: wrap; max-width: 240px; }
.battle-log { position: absolute; left: 4%; top: 16px; display: inline-flex; align-items: center; gap: 5px; padding: 0 9px; min-height: 36px; color: #c1d0c8; background: #101d24aa; border: 1px solid #778f8a48; border-radius: 4px; font-size: 15px; }

.intent-position { position: absolute; right: 5%; bottom: 25%; width: clamp(190px, 21vw, 278px); }
.intent { width: 100%; display: flex; gap: 9px; padding: 7px 8px; align-items: center; text-align: left; min-height: 61px; background: #301f23ed; border: 1px solid #b16a60; border-radius: 5px; box-shadow: 0 3px 14px #070d1370; color: #ffc8b5; }
.intent-mark { display: grid; justify-items: center; grid-auto-flow: column; align-items: center; gap: 4px; min-width: 45px; min-height: 38px; background: #663b38; color: #ffd0bd; padding: 4px 6px; border-radius: 3px; white-space: nowrap; font-size: 20px; line-height: 1; }
.intent-mark .icon { width: 18px; height: 18px; }
.intent-copy { display: grid; min-width: 0; line-height: 1.08; }
.intent-copy b { font-size: 18px; font-weight: 700; color: #ffdfcf; }
.intent-copy small { color: #ffc0ac; margin-top: 4px; font-size: 14px; }
.intent-copy small.safe { color: var(--aqua); }
.intent-info { margin-left: auto; width: 14px; height: 14px; opacity: .8; }
.intent.prepare, .intent.broken { color: var(--aqua); background: #15292de8; border-color: #668f83; }
.intent.prepare .intent-mark, .intent.broken .intent-mark { background: #28504c; color: #a8e8d8; }
.intent.prepare .intent-copy b, .intent.broken .intent-copy b { color: #dcf4e6; }
.intent.salt-lethal { color: #e8d2ff; background: #281f37; border-color: #9c87af; }
.intent.salt-lethal .intent-mark { background: #523e69; color: #efdfff; }
.intent.salt-lethal .intent-copy b, .intent.salt-lethal .intent-copy small { color: #ead9f5; }
.interrupt-label { display: flex; align-items: center; gap: 5px; margin: 4px 0 0; padding: 3px 6px; color: #f1d6ae; background: #182126ec; border-left: 2px solid #b99064; font-size: 14px; line-height: 1.05; }

.combat-dock {
  flex: 0 0 auto; min-width: 0;
  padding: 0 max(6px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(6px, env(safe-area-inset-left));
  background: radial-gradient(ellipse at 50% 0%, #293a3d60, transparent 70%), linear-gradient(180deg, #0c171e80, #142128 60%, #101a21);
  border-top: 1px solid #8eaa9b30;
  box-shadow: 0 -7px 22px #0e171c50;
  z-index: 2;
}
.dock-inner { width: min(100%, 1070px); margin: auto; }
.action-rail { display: grid; grid-template-columns: minmax(140px, max-content) 1fr; align-items: center; gap: 15px; min-height: 63px; padding: 7px 9px; }
.mail-slot { display: flex; gap: 8px; align-items: center; min-width: 150px; max-width: 280px; min-height: 43px; padding: 3px 8px 3px 4px; border: 1px dashed #aa8b64; border-radius: 5px; background: #302924bb; text-align: left; color: var(--gold); }
.mail-slot.filled { border-style: solid; background: #413127; }
.post-emblem { width: 35px; height: 34px; display: grid; place-items: center; flex: 0 0 auto; font-size: 20px; border-radius: 4px; background: #513c2e; }
.post-copy { min-width: 0; display: grid; line-height: 1.05; }
.post-copy b { font-size: 17px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.post-copy small { margin-top: 3px; color: #dfc8a9; font-size: 13px; }
.field-tip { display: block; color: #d3d9cd; font-size: 16px; line-height: 1.16; }
.selected-rail { grid-template-columns: minmax(0, 1fr) max-content; }
.selected-copy { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 10px; }
.selected-caption { display: inline-flex; gap: 5px; flex-wrap: wrap; align-items: baseline; }
.selected-copy .selected-caption b { color: var(--paper); font: 750 24px/1.05 var(--serif); }
.selected-caption em { color: #b7efd9; border: 1px solid #6aa28d83; border-radius: 3px; padding: 1px 3px; background: #203d3b; white-space: nowrap; font-size: 13px; font-style: normal; }
.selected-copy > span { color: #d7ddce; font-size: 15px; line-height: 1.15; }
.selected-copy > span b { color: var(--gold); }
.selected-actions { display: flex; gap: 6px; align-items: center; }
.mail-button, .play-button { min-width: 86px; }
.mail-button { color: var(--gold); }
.play-cost { display: inline-flex; align-items: center; gap: .1em; margin-left: 3px; }
.play-cost .icon { width: .9em; }

.hand-scroller { position: relative; }
.hand {
  display: flex; justify-content: safe center; align-items: stretch; gap: 8px;
  min-height: clamp(127px, 19.8vh, 191px);
  overflow: auto hidden; overscroll-behavior-x: contain;
  scrollbar-width: none; scroll-snap-type: x proximity; scroll-padding-inline: 8px;
  padding: 4px 8px 8px; touch-action: pan-x;
}
.hand::-webkit-scrollbar { display: none; }
.hand .card {
  flex: 0 0 clamp(98px, 11vw, 142px);
  width: clamp(98px, 11vw, 142px);
  height: clamp(127px, 19.8vh, 191px);
  scroll-snap-align: start;
  touch-action: pan-x;
}
.hand .card .card-image { height: 44%; min-height: 48px; }
.hand-more { display: none; }
.hand-scroller.overflowing .hand-more {
  display: grid; place-items: center; position: absolute; z-index: 3;
  right: 2px; bottom: 4px; width: 39px; height: 39px; border: 1px solid #9a8b69;
  border-radius: 50%; background: #141d23ef; color: #f3d9ac; box-shadow: 0 2px 9px #0008;
}
.hand-scroller.at-end .hand-more .icon { transform: rotate(180deg); }
.empty-hand { margin: auto; color: var(--muted); font-style: italic; }

.card {
  --card-accent: #d5ad87;
  display: flex; flex-direction: column; position: relative; min-width: 0; min-height: 0;
  padding: 0; overflow: hidden; text-align: left;
  border: 1px solid #92685b; border-radius: 7px; color: #fbebd9;
  background: linear-gradient(#382723, #201c20 78%);
  box-shadow: inset 0 0 0 2px #e6ba8024, 0 4px 8px #0005;
  transition: transform .12s, border-color .12s, box-shadow .12s, opacity .12s;
}
.card.skill { --card-accent: #a4decd; background: linear-gradient(#203c3a, #14272c 78%); border-color: #668d80; }
.card.rig { --card-accent: #dbcaf4; background: linear-gradient(#37314c, #221e32 78%); border-color: #907da8; }
.card.rarity-uncommon { border-color: #83b9aa; }
.card.rarity-rare { border-color: #e0b87f; box-shadow: inset 0 0 0 2px #f8d49f4a, 0 4px 12px #10080490; }
.card.upgraded .card-title { color: #bbedd1; }
.card-image { position: relative; display: block; width: 100%; height: 92px; flex: 0 0 auto; background-color: #152429; border-bottom: 1px solid color-mix(in srgb, var(--card-accent) 52%, transparent); }
.card-image img { height: 100%; width: 100%; object-fit: cover; object-position: 50% 53%; }
.card-image::after { content: ''; position: absolute; inset: 0; box-shadow: inset 0 0 14px #08080d99; pointer-events: none; }
.card-cost { display: grid; place-items: center; position: absolute; z-index: 1; top: 5px; left: 5px; width: 27px; height: 27px; border: 1px solid #ffe2aa; border-radius: 50%; color: #291d15; background: #eab981; box-shadow: 0 1px 6px #05090baa; font: 800 18px/1 var(--sans); }
.card-key { position: absolute; z-index: 1; bottom: 4px; right: 5px; min-width: 17px; padding: 2px 4px; background: #11191de8; color: #ead9c0; text-align: center; font-size: 12px; }
.card-mail { position: absolute; z-index: 1; top: 5px; right: 5px; width: 25px; height: 24px; display: grid; place-items: center; background: #413124; border: 1px solid #e3b074; border-radius: 4px; color: #ffdb9c; }
.card-title { display: block; padding: 6px 8px 3px; color: #f7e9d2; font: 750 21px/.99 var(--serif); text-wrap: balance; }
.card-rules { display: flex; flex-direction: column; flex: 1; gap: 1px; overflow: hidden; padding: 1px 8px 5px; color: #eee3d2; font-size: 15px; line-height: 1.12; }
.card-rules b { color: var(--card-accent); font-weight: 800; }
.card-type { display: flex; gap: 5px; align-items: center; padding: 5px 8px 6px; color: var(--card-accent); font-size: 12px; line-height: 1; }
.card-type i { display: inline-block; width: 3px; height: 3px; transform: rotate(45deg); background: currentColor; }
.card-footer { width: 100%; display: flex; justify-content: center; align-items: center; gap: 5px; min-height: 40px; margin-top: auto; border-top: 1px solid #a9896b80; color: #ffdfaa; background: #181f23d9; font-size: 17px; font-weight: 800; }
.card.delivered { border-color: #ecc28b; box-shadow: 0 0 0 1px #e3b98660, 0 0 17px #dca15f39; }
.card.delivered .card-cost { background: #efda96; }
.card.dim { opacity: .63; }
.card:disabled { opacity: .6; }
.card.selected { opacity: 1; transform: translateY(-2px); border-color: #f5cd94; box-shadow: 0 0 0 1px #f4ca89, 0 0 15px #e6b07f65; }
.card:focus-visible { outline-offset: -2px; }
@media (hover: hover) { button.card:not(:disabled):hover { border-color: #f5cd94; transform: translateY(-2px); } }

.turnbar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 9px; min-height: 61px; padding: 5px 8px 7px; border-top: 1px solid #8eaa9b30; }
.charge-button, .pile-button { display: flex; align-items: center; min-height: 43px; border: 1px solid #6c7d7450; border-radius: 5px; background: #17252bd9; }
.charge-button { justify-self: start; padding: 0 8px 0 4px; gap: 5px; color: #ffe0aa; }
.charge-value { display: flex; align-items: center; justify-content: center; min-width: 43px; height: 34px; background: #4a3b2b; border-radius: 3px; font-size: 26px; line-height: 1; }
.charge-value .icon { width: 19px; height: 19px; }
.charge-detail { display: flex; align-items: start; flex-direction: column; gap: 4px; color: #e6cfaa; font-size: 13px; line-height: 1; }
.pips { display: flex; gap: 4px; }
.pips i { display: block; width: 5px; height: 5px; border: 1px solid #a1927d; border-radius: 1px; transform: rotate(45deg); }
.pips .lit { background: #ffd59b; border-color: #ffd59b; }
.piles { display: flex; gap: 5px; align-items: center; }
.pile-button { justify-content: center; gap: 5px; min-width: 77px; padding: 3px 6px; color: #c8d7d0; font-size: 15px; line-height: 1; }
.pile-button strong { color: #ecebdc; font-size: 17px; }
.pile-button .icon { color: #94bab0; }
.end-turn { justify-self: end; min-width: 127px; color: #f5eddb; background: linear-gradient(#3c5556, #22353d); border-color: #85aaa0; font-size: 18px; }
.end-turn.salt-end { background: linear-gradient(#554161, #2d243b); border-color: #b19dce; color: #f2e5ff; }

.battle-effects { z-index: 3; overflow: hidden; }
.float-note { position: absolute; color: #fff1dc; font: 800 clamp(22px, 4vh, 38px)/1 var(--serif); text-shadow: 0 2px 3px #0a131a, 0 3px 12px #091013; white-space: nowrap; transform: translateX(-50%); animation: float-away .8s cubic-bezier(.12,.65,.52,1) both; }
.float-note.foe-hurt, .float-note.salt-hit { left: 54%; top: 39%; color: #ffc5a0; }
.float-note.salt-hit { color: #ebd0ff; }
.float-note.player-hurt, .float-note.player-guard { left: max(80px, 15%); bottom: 52px; color: #ffc1af; font-size: 25px; }
.float-note.player-guard { color: #b6e2fc; }
.float-note.post-flash, .float-note.break-flash { left: 52%; bottom: 14%; color: #ffdda7; }
.float-note.break-flash { color: #b6f7de; bottom: 29%; }
@keyframes float-away { 0% { opacity: 0; margin-top: 9px; } 11% { opacity: 1; } 61% { opacity: 1; } 100% { opacity: 0; margin-top: -35px; translate: 0 -22px; } }

.map-view { overflow: auto; background: radial-gradient(ellipse at 67% 35%, var(--stage-wash), #142128 60%, #0d181e 95%); }
.map-layout {
  display: grid; grid-template-columns: minmax(280px, .75fr) minmax(390px, 1.25fr); grid-template-areas: 'side chart' 'legend chart';
  grid-template-rows: 1fr auto; align-items: center; column-gap: clamp(18px, 4vw, 72px); row-gap: 22px;
  width: min(100% - 56px, 1200px); min-height: 100%; margin: auto; padding: clamp(20px, 4vh, 58px) 0;
}
.map-side { grid-area: side; align-self: center; min-width: 0; }
.map-side h1 { margin-top: 3px; font: 800 clamp(43px, 5.6vw, 88px)/.93 var(--serif); letter-spacing: -.036em; }
.district-line { max-width: 380px; margin-top: 12px; color: #d9e3d8; font: 500 clamp(19px, 2.3vw, 26px)/1.19 var(--serif); }
.next-stops { display: grid; gap: 7px; margin-top: clamp(14px, 5vh, 45px); }
.next-stops h2 { font-size: 23px; color: var(--gold); }
.choice {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 58px; padding: 7px 10px;
  border: 1px solid #67827b8a; border-radius: 5px; background: linear-gradient(120deg, #23363df2, #17242cfa);
  text-align: left; line-height: 1.13;
}
.choice-symbol { display: inline-grid; place-items: center; flex: 0 0 auto; width: 38px; height: 38px; color: var(--gold); border: 1px solid #a689615f; border-radius: 5px; background: #3c3329; font-size: 21px; }
.choice-copy { display: grid; flex: 1; min-width: 0; gap: 2px; }
.choice-copy strong { font: 750 21px/1.05 var(--serif); color: var(--paper); }
.choice-copy small { color: #d0dad1; font-size: 15px; line-height: 1.15; }
.choice-aside { color: var(--gold); font-weight: 700; white-space: nowrap; }
.choice-arrow { margin-left: 0; color: #d5c09d; opacity: .78; }
.choice.battle .choice-symbol, .choice.elite .choice-symbol, .choice.boss .choice-symbol { color: #ffc1a8; background: #4a2d2b; border-color: #a6745f; }
.choice.rest .choice-symbol { color: #abe2c8; background: #24413a; border-color: #5b9984; }
.choice.event .choice-symbol { color: #dfcef7; background: #3b334e; border-color: #8f7ca5; }
@media (hover: hover) { .choice:not(:disabled):hover { border-color: var(--gold); background: #2b3e43; } }

.chart {
  grid-area: chart; align-self: stretch; position: relative; isolation: isolate; min-height: 485px; overflow: hidden;
  border: 1px solid #9b9a757a; border-radius: 7px;
  background: #10232b; box-shadow: inset 0 0 0 4px #0b161b80, 0 10px 24px #060b1060;
}
.chart-engraving { position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, #10212622, #12252b30), url('./assets/chart.webp') 47% 54% / cover no-repeat; }
.theme-brass .chart-engraving { filter: sepia(.55) hue-rotate(339deg) saturate(.95); }
.theme-outer .chart-engraving { filter: hue-rotate(49deg) saturate(.85); }
.route-lines { position: absolute; inset: 0; width: 100%; height: 100%; }
.route-line { fill: none; stroke: #91aaa27d; stroke-width: 1.25; stroke-dasharray: 4 5; vector-effect: non-scaling-stroke; }
.route-line.reachable { stroke: #e0b57eeb; stroke-width: 2.5; stroke-dasharray: 5 4; }
.route-line.crossed { stroke: #a5e0c3; stroke-width: 2.65; stroke-dasharray: none; }
.map-node {
  --pin-color: #c1ccc4;
  position: absolute; left: var(--x); top: var(--y); transform: translate(-50%, -50%);
  display: grid; place-items: center; width: 49px; height: 49px; padding: 0;
  border: 0; border-radius: 50%; background: none; color: var(--pin-color); font-size: 22px;
}
.map-node.battle { --pin-color: #f5af99; }
.map-node.elite { --pin-color: #eea59e; }
.map-node.boss { --pin-color: #ffd29c; }
.map-node.shop { --pin-color: #e6c283; }
.map-node.rest { --pin-color: #a0debb; }
.map-node.event { --pin-color: #ddc3ef; }
.map-pin { display: grid; place-items: center; width: 41px; height: 41px; border: 1px solid #516b6c; border-radius: 50%; background: #13262c; box-shadow: 0 0 0 2px #101a1eb0; color: #a7bbb6; }
.map-node.boss .map-pin { color: var(--pin-color); }
.map-node.reachable .map-pin { width: 46px; height: 46px; color: var(--pin-color); border-color: #e4bf87; background: #283b3c; box-shadow: 0 0 0 3px #dcb9873a, 0 0 17px #dcb98763; }
.map-node.crossed .map-pin { color: #a7dcca; border-color: #81b7a7; background: #1c3c39; }
.map-node.current .map-pin { box-shadow: 0 0 0 3px #a5e0c340, 0 0 14px #a5e0c344; }
.map-tag { position: absolute; top: calc(100% + 1px); font-size: 13px; font-weight: 700; color: var(--paper); letter-spacing: .06em; white-space: nowrap; text-shadow: 0 2px 5px #03080c; }
.map-node.reachable:hover .map-pin { background: #4c4434; }
.map-legend { grid-area: legend; display: flex; flex-wrap: wrap; justify-content: start; gap: 6px 13px; color: #bdccc3; font-size: 14px; }
.map-legend span { display: inline-flex; gap: 3px; align-items: center; }
.map-legend .icon { color: var(--gold); }
.notice { display: flex; gap: 6px; align-items: center; width: fit-content; margin: 9px auto; padding: 4px 9px; border-left: 2px solid #82c0a6; background: #23413d9c; color: #c8efda; font-size: 15px; line-height: 1.2; text-align: left; }
.map-side .notice { margin-inline: 0; }

.run-page { position: relative; isolation: isolate; overflow: auto; background: var(--night); }
.run-page::before {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(180deg, #121c25bc, #101c23dc 57%, #101a20 100%), var(--page-art) center 45% / cover no-repeat, var(--stage-wash);
}
.page-inner { width: min(100% - 40px, 1020px); margin: 0 auto; padding: clamp(21px, 6vh, 73px) 0 max(28px, env(safe-area-inset-bottom)); text-align: center; }
.page-heading { display: grid; justify-items: center; gap: 7px; margin: 0 auto 21px; }
.page-heading h1 { max-width: 880px; color: var(--paper); font: 800 clamp(36px, 6vw, 77px)/.94 var(--serif); letter-spacing: -.031em; text-wrap: balance; }
.page-heading p { max-width: 610px; color: #dce1d2; font: 500 clamp(18px, 2.4vw, 24px)/1.18 var(--serif); text-wrap: pretty; }
.page-symbol { display: grid; place-items: center; width: 46px; height: 46px; margin-bottom: 4px; border: 1px solid #9e7c56; border-radius: 9px; color: var(--gold); background: #312a25ec; box-shadow: 0 0 0 3px #76614a50; font-size: 24px; transform: rotate(5deg); }
.page-symbol .icon { transform: rotate(-5deg); }
.page-actions, .sheet-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 7px; margin: 16px auto 0; }
.page-actions .primary { min-width: 190px; }
.offer-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(8px, 2vw, 20px); width: min(100%, 626px); margin: auto; }
.offer-grid .card { min-height: clamp(222px, 38vh, 300px); }
.offer-grid .card-image { height: clamp(85px, 18vh, 135px); }
.offer-grid .card-title { font-size: clamp(20px, 2.5vw, 29px); }
.offer-grid .card-rules { font-size: 17px; min-height: 54px; }
.option-stack { display: grid; gap: 8px; width: min(100%, 530px); margin-inline: auto; }
.option-stack .choice { min-height: 65px; }
.market-services { margin-top: 14px; width: min(100%, 626px); }
.market-services .choice { min-height: 52px; padding-block: 4px; }
.market .page-inner { padding-top: clamp(16px, 4vh, 43px); }
.encounter-body { display: grid; grid-template-columns: minmax(240px, .8fr) minmax(340px, 1.2fr); gap: 0; max-width: 860px; margin: auto; overflow: hidden; border: 1px solid #7c826664; border-radius: 8px; background: #121e25ed; box-shadow: 0 12px 28px #080d13b0; }
.encounter-art { background: linear-gradient(90deg, #10303900 55%, #112128c0), var(--encounter) center / cover no-repeat; min-height: 420px; }
.encounter-copy { padding: clamp(18px, 4vw, 43px); }
.encounter-copy .page-heading { gap: 9px; }
.encounter-copy h1 { font-size: clamp(31px, 4.65vw, 59px); }
.encounter-copy .page-heading p { color: #ded9c8; font-size: clamp(18px, 2.15vw, 23px); }
.crossing .page-inner, .result .page-inner { display: grid; place-items: center; min-height: 100%; }
.result.win::before { background: linear-gradient(90deg, #17242cc7, #111e25a3 52%, #18262b79), linear-gradient(0deg, #121b20ca, transparent 70%), var(--page-art) center 52% / cover no-repeat; }
.crossing-content, .result-content { width: min(100%, 740px); margin: auto; }
.crossing-seal, .result-seal { width: clamp(74px, 12vw, 138px); margin: 0 auto 14px; color: var(--gold); }
.crossing-content .page-symbol, .result-content .page-symbol { display: none; }
.crossing-health { color: #bae2ce; font-size: 20px; }
.result-stats { width: min(100%, 525px); margin: 0 auto; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.result-stats > div { display: grid; align-content: center; padding: 8px 5px 10px; border: 1px solid #81948a70; border-radius: 5px; background: #18282ed9; text-align: center; }
.result-stats strong { color: var(--gold); font: 750 36px/1 var(--serif); }
.result-stats span { color: #dae0d4; font-size: 15px; }
.unlock-strip { display: flex; flex-wrap: wrap; gap: 4px 12px; justify-content: center; margin: 11px auto 0; color: #c9ead4; font-size: 15px; }
.unlock-strip .icon { color: var(--gold); }
.library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(138px, 1fr)); align-items: stretch; gap: 8px; text-align: left; }
.library-grid .card { min-height: 169px; }
.library-grid .card-image { height: 75px; }
.library-grid .card-title { font-size: 19px; }
.library-grid .card-type { margin-top: auto; }
.pick-change { display: grid; grid-template-columns: minmax(0, 171px) auto minmax(0, 171px); align-items: center; justify-content: center; gap: 12px; }
.pick-change.one { grid-template-columns: minmax(0, 171px); }
.pick-change .card { align-self: stretch; min-height: 201px; }
.pick-change > .icon { font-size: 24px; color: var(--gold); }
.pick-confirm .page-actions { margin-top: 10px; }

.sheet {
  position: fixed; inset: 0; width: min(100% - 28px, 520px); max-width: none;
  max-height: calc(100vh - 26px); max-height: calc(100dvh - 26px);
  margin: auto; padding: 0; overscroll-behavior: contain; overflow: auto;
  border: 1px solid #aa9576; border-radius: 9px;
  color: var(--paper); background: #111f26; box-shadow: 0 16px 70px #030709c9;
}
.sheet.wide { width: min(100% - 28px, 825px); }
.sheet::backdrop { background: #03090dda; }
.sheet-box { position: relative; padding: clamp(16px, 4vw, 29px); background: linear-gradient(140deg, #25363b, #142129 63%); }
.sheet-box > .icon-btn:first-child { position: absolute; top: 10px; right: 10px; z-index: 1; background: #121e25; }
.sheet-heading { display: flex; align-items: flex-start; gap: 12px; margin: 0 42px 18px 0; }
.sheet-icon { display: grid; place-items: center; flex: 0 0 auto; width: 43px; height: 43px; border: 1px solid #9a7f61; border-radius: 6px; color: var(--gold); background: #3d332a; font-size: 22px; }
.sheet-heading h2 { font: 800 clamp(28px, 5vw, 47px)/.96 var(--serif); letter-spacing: -.024em; }
.sheet-heading p { margin-top: 7px; color: #d7ddce; font-size: 17px; line-height: 1.24; }
.sheet-actions { justify-content: flex-start; margin-top: 15px; }
.sheet-footnote { margin-block: 10px; color: #b7c8c0; font-size: 15px; }
.subheading { font-size: 24px; margin: 16px 0 6px; color: var(--gold); }
.empty-note { padding: 13px 10px; border: 1px dashed #7b8a795f; border-radius: 4px; color: #c5d0c3; }
.help-steps { display: grid; gap: 10px; padding: 0; list-style: none; }
.help-steps li { display: flex; gap: 9px; }
.help-steps li > .icon { width: 21px; height: 21px; margin-top: 3px; color: var(--gold); }
.help-steps h3 { font-size: 21px; line-height: 1.08; }
.help-steps p, .rules-detail p { color: #d9e0d3; font-size: 16px; }
.rules-detail { margin-top: 7px; border: 1px solid #647c775e; border-radius: 4px; background: #101d24aa; }
.rules-detail summary { padding: 9px; cursor: pointer; color: var(--gold); }
.rules-detail p { padding: 0 9px 9px; }
.glossary { margin: 0; padding: 1px 9px 8px; }
.glossary > div + div { margin-top: 8px; }
.glossary dt { font-weight: 700; color: #f0dfc0; }
.glossary dt .icon { color: var(--gold); }
.glossary dd { margin: 0 0 0 20px; color: #d0dbd0; font-size: 16px; }
.settings-toggles { display: grid; gap: 6px; }
.setting-toggle { display: flex; align-items: center; gap: 10px; padding: 8px 9px; min-height: 54px; width: 100%; text-align: left; background: #121f26; border: 1px solid #506760; border-radius: 5px; }
.setting-toggle > .icon { color: var(--gold); }
.setting-toggle > span { display: grid; flex: 1; gap: 2px; line-height: 1.05; }
.setting-toggle b { font-size: 18px; }
.setting-toggle small { color: #bfcdc4; font-size: 14px; }
.toggle-knob { position: relative; flex: 0 0 auto; width: 39px; height: 22px; border: 1px solid #5b807d; border-radius: 13px; background: #253137; }
.toggle-knob::before { content: ''; position: absolute; top: 3px; left: 3px; height: 14px; width: 14px; border-radius: 50%; background: #93a6a0; }
.setting-toggle.on .toggle-knob { background: #3c7268; }
.setting-toggle.on .toggle-knob::before { left: 20px; background: #d9f3d9; }
.settings-bottom { margin-top: 14px; border-top: 1px solid #82988b37; padding-top: 4px; }

.courier-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.kit { display: flex; flex-direction: column; min-width: 0; padding: 0; overflow: hidden; border: 1px solid #5e7977; border-radius: 6px; background: #192b32; text-align: left; }
.kit.active { border-color: #eabe85; box-shadow: 0 0 0 1px #eabe855e; }
.kit:disabled { opacity: .75; }
.kit-image { display: block; position: relative; width: 100%; aspect-ratio: 1.53; background: #080f15; border-bottom: 1px solid #64776c9b; }
.kit-image img { width: 100%; height: 100%; object-fit: cover; object-position: center 45%; }
.kit.locked img { filter: saturate(.62); }
.kit-state { position: absolute; top: 5px; left: 5px; background: #151e24ef; border: 1px solid #b39f7a; border-radius: 4px; color: #f0d7b1; padding: 3px 6px; font-size: 13px; line-height: 1; }
.kit-copy { display: flex; flex: 1; flex-direction: column; padding: 9px; color: #e8dfcd; }
.kit-copy > strong { font: 800 29px/.99 var(--serif); }
.kit-copy em { color: var(--gold); font: 600 18px/1.1 var(--serif); }
.kit-copy small { flex: 1; color: #cedbd2; margin-top: 6px; font-size: 15px; line-height: 1.12; }
.kit-unlock { margin-top: 8px; padding-top: 5px; border-top: 1px solid #83928b56; color: #e6d0ad; font-size: 14px; }
.tide-panel { margin-top: 15px; }
.tide-panel h3 { color: var(--gold); font-size: 23px; }
.tide-list { display: flex; flex-wrap: wrap; gap: 5px; margin: 4px 0 5px; }
.tide-option.active, .tab.active { border-color: #d6aa78; color: #ffe6b6; background: #49382c; }
.tide-panel p, .locked-tide { margin-top: 9px; color: #b5c7bf; font-size: 15px; }
.dispatch-today { display: flex; align-items: center; gap: 13px; padding: 8px; border: 1px solid #a68e685b; border-radius: 7px; background: #18262d; }
.dispatch-portrait { width: 104px; height: 105px; border-radius: 5px; object-fit: cover; }
.dispatch-today h3 { font-size: 29px; line-height: 1; }
.dispatch-today p { margin-block: 4px; color: #dfdfd1; font-size: 16px; line-height: 1.15; }
.dispatch-kit { color: #e4c59c; font-size: 14px; }
.daily-best, .dispatch-saved { margin: 8px 0; color: #c4e6d6; }
.daily-best b { color: var(--gold); margin-left: 4px; }
.tabs { display: flex; gap: 5px; margin-bottom: 11px; }
.tab { flex: 1 1 0; padding-inline: 5px; min-width: 0; font-size: 16px; }
.log-stats { width: 100%; }
.log-list, .combat-log-list { list-style: none; padding: 0; margin: 0; }
.log-list li, .combat-log-list li { display: flex; justify-content: space-between; gap: 6px; padding: 7px 8px; border-bottom: 1px solid #82988b37; color: #d7ded1; }
.log-list li > span:first-child { display: inline-flex; gap: 6px; align-items: center; }
.log-list li .icon { color: var(--gold); }
.log-list li small { color: #b9c9c0; font-size: 13px; }
.medal-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.medal, .keepsake-list > div { display: flex; align-items: center; gap: 8px; padding: 7px; border: 1px solid #6f8d7e55; border-radius: 5px; background: #13232a; }
.medal:not(.earned) .choice-symbol { background: #253338; border-color: #798c8555; color: #a4b9b0; }
.medal.earned { border-color: #bc9a69; }
.medal h3, .keepsake-list h3 { font-size: 22px; line-height: 1; }
.medal p, .keepsake-list p { font-size: 15px; color: #c3d4c9; line-height: 1.15; margin-top: 2px; }
.intent-details { display: grid; gap: 6px; padding: 0; margin: 2px 0 12px; list-style: none; color: #e2e7d8; }
.intent-details .icon, .enemy-trait .icon { color: var(--gold); margin-right: 4px; }
.intent-next { display: grid; gap: 2px; padding: 8px 11px; border: 1px solid #69837c6c; border-radius: 5px; background: #172a31; }
.intent-next strong { font: 750 24px/1.03 var(--serif); }
.intent-next small { color: #c3d5cc; font-size: 15px; }
.enemy-trait { margin: 6px 0 10px; color: #f4d8b2; }
.relic-inline { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 7px 0 13px; color: #e7d5b9; }
.relic-inline > span { margin-right: 3px; }
.relic-medallion { display: grid; place-items: center; width: 39px; height: 39px; padding: 0; border: 1px solid #937952; border-radius: 50%; color: var(--gold); background: #3a322a; }
.keepsake-list { display: grid; gap: 7px; }
.combat-log-list li.good { color: #bbecce; }
.combat-log-list li.bad { color: #ffc0ad; }
.modal-health { margin: 5px 0 9px; }
.chart-mini { min-height: 350px; }
.still *, .still *::before, .still *::after { animation-duration: .001ms !important; scroll-behavior: auto !important; transition-duration: .001ms !important; }
.still .float-note { animation: none !important; }

@media (max-width: 900px) {
  .run-progress { display: none; }
  .intent-position { right: 3%; }
  .map-layout { width: calc(100% - 30px); grid-template-columns: minmax(210px, .75fr) minmax(290px, 1.25fr); gap: 14px; }
}

@media (max-width: 680px) {
  .harbor { align-items: end; }
  .harbor-art {
    background: linear-gradient(180deg, #0b15172f 0%, #0b15170a 26%, #0b15173d 45%, #0b1318df 68%, #0a1117 94%),
      url('./assets/cover-mobile.webp') 55% 0 / 100% auto no-repeat, #0a1117;
  }
  .harbor-border { inset: 8px; }
  .harbor-tools { top: max(16px, env(safe-area-inset-top)); right: 15px; gap: 4px; }
  .harbor-tools .button { width: 42px; min-width: 42px; height: 42px; min-height: 42px; }
  .harbor-content { width: calc(100% - 36px); margin: auto 18px 0; padding: 62px 0 max(22px, env(safe-area-inset-bottom)); }
  .title-mark { width: 53px; margin: 0 0 11px 1px; }
  .game-title span { font-size: clamp(44px, 12.75vw, 73px); }
  .game-title strong { font-size: clamp(90px, 24.7vw, 138px); line-height: .80; }
  .harbor-flourish { width: 61%; margin: 5px 0 10px; }
  .harbor-story { font-size: 23px; }
  .harbor-launch { margin-top: 17px; gap: 4px; }
  .launch { min-height: 50px; width: min(100%, 300px); font-size: 20px; }
  .launch-note { font-size: 14px; }
  .harbor-nav { display: grid; grid-template-columns: .92fr 1.27fr .92fr; gap: 4px; margin-top: 14px; }
  .menu-link { min-height: 43px; padding-inline: 5px; gap: .28em; font-size: 15.5px; white-space: nowrap; }

  .runbar { height: 52px; }
  .runbar-inner { width: calc(100% - 14px); gap: 4px; grid-template-columns: minmax(0, 1fr) auto auto; }
  .run-where { gap: 4px; }
  .district-number { min-width: 23px; height: 23px; font-size: 15px; }
  .district-name { font-size: clamp(14px, 4.65vw, 21px); overflow: hidden; text-overflow: ellipsis; }
  .run-vitals { gap: 4px; }
  .vital { min-height: 41px; gap: 3px; padding: 3px 5px; font-size: 16px; }
  .vital .icon { width: 13px; height: 13px; }
  .run-tools { gap: 3px; }
  .run-tools .icon-btn { width: 35px; min-width: 35px; height: 41px; min-height: 41px; font-size: 17px; }

  .stage-backdrop {
    background: linear-gradient(180deg, #0b181fd1, #0b181f27 47%, #10242b16 68%, #0c171ef3),
      var(--mobile-scene) center 56% / cover no-repeat, var(--stage-wash);
  }
  .foe-vitals { top: max(4%, 9px); left: 50%; width: 87%; }
  .foe-vitals h1 { font-size: clamp(28px, 7vw, 40px); margin-bottom: 6px; }
  .foe-rank { font-size: 11px; min-height: 13px; }
  .foe-rank:empty { min-height: 3px; }
  .meter { height: 20px; width: min(185px, 63%); }
  .foe-statuses { margin-top: 4px; }
  .status-chip { min-height: 30px; padding: 2px 5px; font-size: 13px; }
  .status-chip.main-guard { min-height: 36px; font-size: 15px; padding-inline: 5px; }
  .foe-stage { top: clamp(68px, 26%, 103px); bottom: 20%; left: 50%; width: min(70%, 330px); }
  .foe-stage.boss-art { width: min(76%, 390px); bottom: 17.5%; }
  .foe-reflection { height: 16px; filter: blur(5px); }
  .battle-log { top: 8px; left: 7px; width: 38px; min-height: 41px; justify-content: center; padding: 0; }
  .battle-log > span { display: none; }
  .courier-hud { bottom: 9px; left: 7px; gap: 4px; max-width: 43%; }
  .courier-portrait { width: 37px; height: 37px; padding: 2px; flex: 0 0 auto; }
  .courier-head { gap: 5px; }
  .courier-head strong { font-size: 18px; }
  .courier-head > span { font-size: 13px; }
  .courier-status { gap: 2px; }
  .courier-status .status-chip { min-height: 25px; padding-inline: 3px; gap: 2px; }
  .courier-status .main-guard { min-height: 31px; }
  .intent-position { width: clamp(151px, 47%, 240px); right: 7px; bottom: 9px; }
  .intent { padding: 4px 5px; min-height: 53px; gap: 5px; }
  .intent-mark { min-width: 37px; min-height: 34px; padding: 3px 4px; gap: 3px; font-size: 17px; }
  .intent-mark .icon { width: 14px; height: 14px; }
  .intent-copy b { font-size: 15px; }
  .intent-copy small { font-size: 13px; margin-top: 2px; }
  .intent-info { width: 12px; height: 12px; }
  .interrupt-label { padding: 2px 4px; font-size: 12px; min-height: 16px; }
  .action-rail { min-height: 60px; padding: 5px 2px; gap: 7px; grid-template-columns: minmax(109px, .78fr) 1fr; }
  .selected-rail { grid-template-columns: minmax(0, 1fr) max-content; }
  .mail-slot { min-width: 0; min-height: 44px; padding: 3px 4px 3px 3px; gap: 5px; }
  .post-emblem { width: 29px; height: 32px; font-size: 17px; }
  .post-copy b { font-size: 15px; }
  .post-copy small { font-size: 12px; }
  .field-tip { font-size: 14px; }
  .selected-copy { display: grid; gap: 2px; }
  .selected-copy .selected-caption b { font-size: 21px; }
  .selected-caption em { font-size: 12px; }
  .selected-copy > span { font-size: 14px; }
  .selected-actions { gap: 4px; }
  .mail-button, .play-button { min-width: 0; padding-inline: 8px; gap: 4px; font-size: 16px; min-height: 44px; }
  .mail-button .icon { width: 1em; }
  .play-cost { margin-left: 0; }
  .hand { min-height: clamp(113px, 20.25dvh, 167px); gap: 4px; padding: 4px 2px 7px; scroll-padding-inline: 2px; }
  .hand .card {
    flex-basis: calc((100vw - 35px) / 5); width: calc((100vw - 35px) / 5);
    height: clamp(113px, 20.25dvh, 167px); min-width: 54px;
  }
  .hand .card .card-image { min-height: 37px; height: 41%; }
  .hand .card-title { font-size: clamp(13.5px, 3.98vw, 18px); padding: 4px 4px 3px; }
  .hand .card-rules { padding: 0 4px 3px; font-size: clamp(12px, 3.45vw, 15px); line-height: 1.08; }
  .hand .card-cost { width: 21px; height: 21px; top: 3px; left: 3px; font-size: 15px; }
  .hand .card-mail { width: 18px; height: 18px; top: 3px; right: 3px; font-size: 12px; }
  .card-key { display: none; }
  .hand-scroller.overflowing .hand-more { width: 34px; height: 37px; bottom: 8px; right: 0; font-size: 15px; }
  .turnbar { min-height: 52px; padding: 3px 0 4px; gap: 3px; }
  .charge-button { padding: 0 4px 0 3px; gap: 3px; }
  .charge-value { min-width: 34px; height: 32px; font-size: 21px; }
  .charge-value .icon { width: 14px; height: 14px; }
  .charge-detail { font-size: 12px; gap: 3px; }
  .pips { gap: 3px; }
  .pips i { width: 4px; height: 4px; }
  .piles { gap: 2px; }
  .pile-button { gap: 2px; min-width: 44px; padding: 2px 4px; font-size: 13px; }
  .pile-button strong { font-size: 15px; }
  .pile-button .icon { width: 13px; height: 13px; }
  .end-turn { min-width: 0; min-height: 44px; padding-inline: 8px; font-size: 16px; gap: 3px; white-space: nowrap; }
  .end-turn .icon { width: 15px; height: 15px; }

  .map-layout { display: flex; flex-direction: column; align-items: stretch; gap: 10px; width: calc(100% - 24px); padding: 12px 0; }
  .map-side { align-self: stretch; }
  .map-side h1 { font-size: 45px; }
  .district-line { margin-top: 5px; font-size: 19px; line-height: 1.12; }
  .next-stops { margin-top: 9px; gap: 4px; }
  .next-stops h2 { font-size: 20px; }
  .next-stops .choice { min-height: 49px; padding: 4px 6px; }
  .choice-symbol { width: 34px; height: 34px; font-size: 18px; }
  .choice-copy strong { font-size: 19px; }
  .choice-copy small { font-size: 14px; }
  .chart { min-height: min(355px, 57dvh); }
  .map-node { width: 44px; height: 44px; font-size: 19px; }
  .map-pin { width: 34px; height: 34px; }
  .map-node.reachable .map-pin { width: 40px; height: 40px; }
  .map-tag { top: 90%; }
  .map-legend { gap: 4px 9px; font-size: 13px; }
  .page-inner { width: calc(100% - 20px); padding-top: 23px; }
  .page-heading { gap: 5px; margin-bottom: 14px; }
  .page-heading h1 { font-size: clamp(36px, 10.2vw, 55px); }
  .page-heading p { font-size: 19px; padding-inline: 3px; }
  .page-symbol { width: 37px; height: 37px; font-size: 21px; }
  .offer-grid { gap: 5px; }
  .offer-grid .card { min-height: clamp(214px, 36vh, 257px); }
  .offer-grid .card-image { height: clamp(66px, 13vh, 103px); }
  .offer-grid .card-title { padding: 5px 4px 3px; font-size: clamp(17px, 5vw, 23px); }
  .offer-grid .card-rules { padding-inline: 4px; font-size: clamp(13px, 3.9vw, 16px); min-height: 37px; }
  .offer-grid .card-type { padding: 4px; font-size: 11px; gap: 3px; }
  .offer-grid .card-footer { min-height: 39px; font-size: 15px; }
  .market .page-inner { padding-top: 14px; }
  .market .page-heading { margin-bottom: 8px; }
  .market .page-symbol { display: none; }
  .market-services { margin-top: 9px; gap: 4px; }
  .market-services .choice { min-height: 48px; }
  .market .page-actions { margin-top: 9px; }
  .encounter-body { grid-template-columns: 1fr; }
  .encounter-art { min-height: 0; height: clamp(82px, 21dvh, 170px); background-position: center 43%; }
  .encounter-copy { padding: 12px 8px; }
  .encounter-copy .page-symbol { display: none; }
  .encounter-copy .page-heading { gap: 5px; }
  .encounter-copy h1 { font-size: clamp(31px, 8.6vw, 47px); }
  .encounter-copy .page-heading p { font-size: 18px; }
  .option-stack .choice { min-height: 57px; }
  .market-services .choice { min-height: 48px; }
  .library-grid { grid-template-columns: repeat(auto-fill, minmax(97px, 1fr)); gap: 5px; }
  .library-grid .card { min-height: 159px; }
  .library-grid .card-image { height: 60px; }
  .library-grid .card-title { font-size: 17px; padding-inline: 5px; }
  .library-grid .card-rules { font-size: 14px; padding-inline: 5px; }
  .library-grid .card-type { font-size: 11px; padding-inline: 5px; }
  .pick-change { grid-template-columns: minmax(0, 138px) auto minmax(0, 138px); gap: 6px; }
  .pick-change .card { min-height: 182px; }
  .pick-change .card-image { height: 69px; }
  .pick-change .card-title { font-size: 19px; }
  .crossing-health { font-size: 17px; }
  .result-stats strong { font-size: 29px; }
  .result-stats span { font-size: 14px; }
  .sheet { width: min(100% - 18px, 520px); }
  .sheet.wide { width: min(100% - 18px, 825px); }
  .sheet-heading { gap: 8px; }
  .sheet-icon { width: 36px; height: 36px; font-size: 20px; }
  .sheet-box > .icon-btn:first-child { top: 7px; right: 7px; }
  .courier-grid { grid-template-columns: 1fr; gap: 6px; }
  .kit { flex-direction: row; }
  .kit-image { width: 100px; min-height: 110px; height: 100%; border-bottom: 0; border-right: 1px solid #64776c9b; aspect-ratio: auto; flex: 0 0 auto; align-self: stretch; }
  .kit-image img { position: absolute; inset: 0; }
  .kit-state { padding: 3px 4px; }
  .kit-copy { padding: 6px; }
  .kit-copy > strong { font-size: 25px; }
  .kit-copy em { font-size: 16px; }
  .kit-copy small { margin-top: 4px; font-size: 14px; }
  .kit-unlock { margin-top: 4px; font-size: 13px; }
  .medal-list { grid-template-columns: 1fr; }
  .dispatch-portrait { width: 81px; height: 91px; }
  .chart-mini { min-height: 300px; }
}

@media (max-width: 380px) {
  .run-tools .icon-btn { width: 32px; min-width: 32px; }
  .vital { padding-inline: 4px; }
  .piles .pile-button { min-width: 42px; }
  .turnbar .pips { display: none; }
  .turnbar .charge-button { padding-right: 3px; }
  .courier-portrait { width: 31px; height: 31px; }
}

@media (max-height: 680px) and (max-width: 680px) {
  .map-layout .district-line { display: none; }
  .map-layout .chart { min-height: min(308px, 49dvh); }
  .map-side h1 { font-size: 39px; }
}

@media (max-height: 520px) and (min-aspect-ratio: 1/1) {
  .harbor { align-items: center; }
  .harbor-art { background: linear-gradient(90deg, #0a1216ee, #0a121674 51%, #0a12160c 80%), url('./assets/cover.webp') center 53% / cover no-repeat; }
  .harbor-content { width: min(580px, 61vw); margin: auto 0 auto 6vw; padding: 12px 0; }
  .title-mark { display: none; }
  .game-title span { font-size: clamp(35px, 7vw, 76px); }
  .game-title strong { font-size: clamp(56px, 11vw, 115px); }
  .harbor-flourish { margin: 4px 0 6px; }
  .harbor-story { font-size: clamp(17px, 3.1vw, 24px); }
  .harbor-launch { margin-top: 9px; gap: 3px; }
  .launch { min-height: 44px; }
  .harbor-nav { display: flex; margin-top: 6px; }
  .menu-link { min-height: 39px; }
  .runbar { height: 50px; }
  .runbar-inner { width: calc(100% - 16px); }
  .combat { display: grid; grid-template-columns: minmax(220px, .81fr) minmax(300px, 1.19fr); overflow: hidden; }
  .battlefield { height: 100%; }
  .stage-backdrop {
    background: linear-gradient(180deg, #0b181fd1, #0b181f27 47%, #10242b16 68%, #0c171ef3),
      var(--mobile-scene) center 56% / cover no-repeat, var(--stage-wash);
  }
  .foe-vitals { left: 50%; top: 8px; }
  .foe-vitals h1 { font-size: clamp(27px, 4.25vw, 38px); }
  .foe-stage { left: 50%; top: 73px; bottom: 76px; width: min(80%, 340px); }
  .foe-stage.boss-art { width: min(88%, 375px); bottom: 68px; }
  .battle-log { top: 5px; left: 4px; }
  .courier-hud { left: 4px; bottom: 7px; gap: 4px; max-width: 43%; }
  .courier-head strong { font-size: 18px; }
  .courier-head > span { font-size: 13px; }
  .courier-portrait { width: 32px; height: 32px; padding: 2px; }
  .courier-status { gap: 2px; }
  .courier-status .status-chip { padding-inline: 3px; gap: 2px; min-height: 24px; }
  .courier-status .main-guard { font-size: 14px; min-height: 28px; }
  .intent-position { right: 4px; bottom: 8px; width: min(56%, 235px); }
  .intent { min-height: 47px; padding: 3px 4px; gap: 4px; }
  .intent-copy b { font-size: 14px; }
  .intent-copy small { font-size: 12px; margin-top: 2px; }
  .intent-mark { min-width: 33px; min-height: 28px; font-size: 15px; }
  .intent-info { display: none; }
  .combat-dock { border-top: 0; border-left: 1px solid #8eaa9b30; align-content: center; display: grid; }
  .action-rail { min-height: 59px; padding-block: 4px; }
  .hand { min-height: clamp(112px, 36dvh, 153px); }
  .hand .card { flex-basis: clamp(65px, 11vw, 123px); width: clamp(65px, 11vw, 123px); height: clamp(112px, 36dvh, 153px); }
  .hand .card-title { font-size: clamp(13px, 2.4vw, 19px); }
  .hand .card-rules { font-size: clamp(12px, 2.08vw, 15px); }
  .hand .card-image { min-height: 37px; }
  .turnbar { min-height: 48px; }
  .map-layout { display: grid; grid-template-columns: minmax(200px, .8fr) minmax(255px, 1.2fr); align-content: start; padding: 9px 0; }
  .map-layout .chart { min-height: 302px; }
  .map-side h1 { font-size: 40px; }
  .map-side .district-line { display: none; }
  .page-inner { padding-top: 14px; }
  .page-heading { gap: 4px; margin-bottom: 9px; }
  .page-heading h1 { font-size: 40px; }
  .page-symbol { display: none; }
  .offer-grid .card { min-height: 188px; }
  .offer-grid .card-image { height: 60px; }
  .offer-grid .card-title { font-size: 21px; }
  .offer-grid .card-rules { font-size: 15px; min-height: 34px; }
  .offer-grid .card-footer { min-height: 31px; }
  .offer-grid .card-type { padding-block: 3px; }
  .page-actions { margin-top: 9px; }
}
