:root {
  color-scheme: dark;
  --ink: #0b1b22;
  --panel: #132a31;
  --edge: #526164;
  --gold: #ecc38b;
  --muted: #a3b7b8;
  --paper: #f3ead7;
  --mint: #90c6ad;
  --danger: #dc998b;
  --cell: 64px;
  font-family: Georgia, "Noto Serif SC", "Songti SC", serif;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  color: var(--paper);
  background: var(--ink);
  min-width: 320px;
  background-image:
    linear-gradient(#0b1b22bd, #0b1b22f0 660px), url("./art/expedition.webp");
  background-size: 100% auto;
  background-position: top center;
  background-repeat: no-repeat;
}
button,
input,
select {
  font: inherit;
}
button {
  color: inherit;
  cursor: pointer;
  border: 1px solid #8a795b;
  border-radius: 5px;
  background: #21363a;
  padding: 10px 16px;
  transition:
    background 0.16s,
    transform 0.16s,
    box-shadow 0.16s;
}
button:hover:not(:disabled) {
  background: #365256;
  box-shadow: 0 0 0 1px #d5b68270;
}
button:active:not(:disabled) {
  transform: translateY(1px);
}
button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}
button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}
button.primary {
  background: var(--gold);
  color: #172a2e;
  border-color: #f1d7b5;
  font-weight: 700;
  box-shadow: 0 3px 0 #927453;
}
button.primary:hover:not(:disabled) {
  background: #f8dab2;
}
.quiet {
  border-color: #546266;
  background: #10252d;
}
.small {
  font:
    12px system-ui,
    sans-serif;
  padding: 7px 10px;
}
.danger {
  color: #f1b1a7;
  border-color: #946e68;
}
.eyebrow {
  font:
    10px system-ui,
    sans-serif;
  letter-spacing: 2.2px;
  color: var(--gold);
  text-transform: uppercase;
}
.muted {
  color: var(--muted);
}
h1,
h2,
h3,
p {
  margin: 0;
}
h2 {
  font-size: 22px;
  line-height: 1.35;
}
h3 {
  font-size: 16px;
}
p {
  line-height: 1.65;
}
header {
  max-width: 1360px;
  margin: auto;
  padding: 20px 30px 15px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand img {
  width: 37px;
  height: 37px;
}
.brand strong {
  font-size: 18px;
  letter-spacing: 1px;
}
.brand small {
  display: block;
  font:
    9px system-ui,
    sans-serif;
  letter-spacing: 2px;
  color: var(--gold);
  margin-top: 4px;
}
.toolbar {
  display: flex;
  gap: 7px;
  align-items: center;
}
.wrapper {
  max-width: 1360px;
  margin: auto;
  padding: 0 30px 25px;
}
.progress {
  padding: 12px 18px;
  background: #10262dda;
  border: 1px solid #64727170;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  gap: 15px;
  align-items: center;
}
.route-dots {
  display: flex;
  align-items: center;
  gap: 9px;
}
.dot {
  width: 24px;
  height: 24px;
  border: 1px solid #5b7374;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font:
    10px system-ui,
    sans-serif;
  color: #8fa6a7;
}
.dot.done {
  background: #588672;
  color: #fff;
  border-color: #86b098;
}
.dot.current {
  background: var(--gold);
  color: var(--ink);
  box-shadow: 0 0 16px #f1c78b55;
}
.dot.boss {
  border-radius: 4px;
  transform: rotate(45deg);
}
.dot.boss span {
  transform: rotate(-45deg);
}
.stats {
  display: flex;
  gap: 22px;
  font:
    12px system-ui,
    sans-serif;
}
.stats b {
  font-size: 18px;
  color: var(--gold);
  margin-right: 5px;
}
.game-layout {
  display: grid;
  grid-template-columns: 245px minmax(330px, 1fr) 325px;
  gap: 18px;
  margin-top: 20px;
  align-items: start;
}
.panel {
  border: 1px solid #63716a8c;
  border-radius: 9px;
  background: linear-gradient(135deg, #183139ed, #11262df2);
  box-shadow: 0 6px 24px #0003;
  overflow: hidden;
}
.panel-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 16px 12px;
  border-bottom: 1px solid #61737145;
  gap: 10px;
}
.panel-title p {
  font:
    11px system-ui,
    sans-serif;
  color: var(--muted);
  margin-top: 4px;
}
.journey .portrait {
  width: 100%;
  aspect-ratio: 1.38;
  background-image: url("./art/portraits.webp");
  background-size: 200% 200%;
  border-bottom: 1px solid #8e826761;
  position: relative;
}
.portrait::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(transparent 50%, #10252ddd);
}
.portrait.p0 {
  background-position: 0 0;
}
.portrait.p1 {
  background-position: 100% 0;
}
.portrait.p2 {
  background-position: 0 100%;
}
.portrait.p3 {
  background-position: 100% 100%;
}
.portrait-label {
  position: absolute;
  left: 17px;
  bottom: 13px;
  z-index: 1;
}
.portrait-label h2 {
  font-size: 23px;
}
.journey-body {
  padding: 16px;
}
.chapter-story {
  font-size: 12px;
  color: var(--muted);
  margin: 8px 0 17px;
}
.enemy-stats {
  display: flex;
  gap: 12px;
  font:
    12px system-ui,
    sans-serif;
  color: var(--gold);
  margin: 11px 0;
}
.enemy-hint {
  font-size: 12px;
  line-height: 1.65;
  padding-left: 11px;
  border-left: 2px solid #9bb89a;
  color: #ccd4c8;
  margin: 14px 0;
}
.path-choices {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}
.path-choices button {
  text-align: left;
  padding: 11px 12px;
  position: relative;
}
.path-choices button.active {
  border-color: var(--gold);
  background: #3d463d;
}
.path-choices strong {
  display: block;
  font-size: 13px;
}
.path-choices small {
  display: block;
  font:
    11px/1.5 system-ui,
    sans-serif;
  color: var(--muted);
  margin-top: 5px;
}
.chapter-legend {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font:
    10px system-ui,
    sans-serif;
  color: var(--muted);
  margin-top: 14px;
}
.pack-section {
  padding-bottom: 16px;
}
.pack-meta {
  padding: 13px 17px;
  display: flex;
  gap: 10px;
  font:
    11px system-ui,
    sans-serif;
  color: var(--muted);
  justify-content: space-between;
}
.pack-wrap {
  padding: 14px 10px 6px;
  display: flex;
  justify-content: center;
  position: relative;
}
.backpack {
  position: relative;
  display: grid;
  gap: 3px;
  padding: 11px;
  border: 6px solid #7e593c;
  border-radius: 17px;
  background: #392e27;
  box-shadow:
    0 0 0 2px #bf9668,
    0 7px 0 #231e1b,
    0 12px 24px #0006;
  touch-action: manipulation;
  isolation: isolate;
}
.backpack::before,
.backpack::after {
  content: "";
  position: absolute;
  top: -14px;
  width: 18px;
  height: 21px;
  border-radius: 3px;
  background: #a47a4e;
  box-shadow: inset 0 0 0 3px #e5c695;
}
.backpack::before {
  left: 20px;
}
.backpack::after {
  right: 20px;
}
.cell {
  padding: 0;
  width: var(--cell);
  height: var(--cell);
  border-radius: 4px;
  border: 1px dashed #a4886470;
  background: linear-gradient(145deg, #584231, #413125);
  position: relative;
  z-index: 1;
}
.cell:hover:not(:disabled) {
  background: #886a475c;
}
.cell.preview-valid {
  box-shadow: inset 0 0 0 2px var(--mint);
  background: #52785b77;
}
.cell.preview-invalid {
  box-shadow: inset 0 0 0 2px var(--danger);
  background: #8b4e4277;
}
.cell.key-cursor {
  outline: 2px solid var(--gold);
  outline-offset: -4px;
}
.placed-item {
  position: absolute;
  border: 1px solid #a59169;
  border-radius: 6px;
  z-index: 2;
  padding: 2px;
  background: #112b37;
  box-shadow: inset 0 0 12px #0005;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.placed-item.selected {
  border: 2px solid var(--gold);
  box-shadow: 0 0 14px #e5b36a70;
  z-index: 4;
}
.placed-item.linked {
  border: 2px solid var(--mint);
}
.placed-item .item-art {
  width: min(100%, 62px);
  height: min(100%, 62px);
  flex-shrink: 0;
  border-radius: 4px;
}
.placed-item .facing {
  position: absolute;
  bottom: 3px;
  right: 5px;
  color: var(--gold);
  font:
    20px/1 system-ui,
    sans-serif;
  text-shadow: 0 2px 3px #000;
}
.placed-item .plus {
  position: absolute;
  top: 3px;
  left: 4px;
  font:
    9px system-ui,
    sans-serif;
  color: #b5ead2;
  background: #123d35;
  border-radius: 3px;
  padding: 2px;
}
.item-art {
  background-image: url("./art/items.webp");
  background-repeat: no-repeat;
  background-size: 600% 300%;
  aspect-ratio: 1;
  display: block;
}
.pack-actions {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin: 16px 10px 5px;
}
.selection-detail {
  margin: 12px 15px 0;
  padding: 12px;
  min-height: 113px;
  background: #0a2026;
  border: 1px solid #48606280;
  border-radius: 5px;
}
.selection-head {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 6px;
}
.selection-head .item-art {
  width: 38px;
  border-radius: 4px;
  flex-shrink: 0;
}
.selection-head h3 {
  font-size: 14px;
}
.selection-head small {
  display: block;
  font:
    10px system-ui,
    sans-serif;
  color: var(--gold);
  margin-top: 3px;
}
.selection-detail p {
  font:
    11px/1.6 system-ui,
    sans-serif;
  color: #c1cecb;
}
.selection-detail .buff-line {
  color: var(--mint);
  margin-top: 6px;
}
.depart {
  width: calc(100% - 30px);
  margin: 14px 15px 0;
  padding: 15px;
  font-size: 16px;
}
.shop-grid {
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}
.shop-card {
  padding: 9px;
  text-align: left;
  background: #0e252c;
  border-color: #4d6261;
  min-height: 146px;
  display: flex;
  flex-direction: column;
}
.shop-card .item-art {
  width: 54px;
  height: 54px;
  align-self: center;
  border-radius: 6px;
  margin-bottom: 8px;
}
.shop-card strong {
  font-size: 12px;
}
.shop-card small {
  font:
    10px system-ui,
    sans-serif;
  color: var(--muted);
  margin-top: 4px;
}
.shop-card .price {
  font:
    12px system-ui,
    sans-serif;
  color: var(--gold);
  margin-top: auto;
  padding-top: 7px;
}
.shop-card.empty {
  display: grid;
  place-items: center;
  min-height: 146px;
  opacity: 0.35;
}
.shop-card.selected {
  outline: 1px solid var(--gold);
}
.shop-note {
  font:
    10px/1.5 system-ui,
    sans-serif;
  color: var(--muted);
  padding: 0 14px 12px;
}
.stash {
  padding: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  min-height: 80px;
}
.stash-item {
  width: 52px;
  height: 58px;
  padding: 2px;
  border-color: #5b7774;
  position: relative;
  background: #102633;
}
.stash-item.selected {
  border: 2px solid var(--gold);
}
.stash-item .item-art {
  width: 100%;
  height: 100%;
  border-radius: 3px;
}
.stash-item.placed {
  opacity: 0.52;
}
.stash-empty {
  font-size: 12px;
  color: var(--muted);
  padding: 6px;
}
.utility-row {
  display: flex;
  gap: 6px;
  padding: 0 12px 12px;
  flex-wrap: wrap;
}
.tutorial {
  margin-top: 15px;
  border: 1px solid #b29d71;
  background: linear-gradient(110deg, #384137, #152e33);
  padding: 14px 18px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 15px;
}
.tutorial .step {
  font-size: 25px;
  color: var(--gold);
}
.tutorial .copy {
  flex: 1;
}
.tutorial h3 {
  font-size: 14px;
}
.tutorial p {
  font:
    12px/1.6 system-ui,
    sans-serif;
  color: #d3dbd1;
  margin-top: 4px;
}
.tutorial .actions {
  display: flex;
  gap: 6px;
}
.bottom-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  margin-top: 20px;
  font:
    10px/1.6 system-ui,
    sans-serif;
  color: var(--muted);
}
.bottom-row .links {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
}
.bottom-row button {
  padding: 5px 9px;
  font-size: 10px;
}
.welcome {
  min-height: calc(100vh - 80px);
  position: relative;
  display: flex;
  align-items: center;
  padding: 40px 6vw 70px;
  max-width: 1500px;
  margin: auto;
}
.welcome-copy {
  max-width: 680px;
  padding: 32px 34px;
  background: linear-gradient(100deg, #0b2028f2, #0b2028cf);
  border: 1px solid #b69d6e55;
  border-radius: 8px;
  box-shadow: 0 20px 70px #0005;
}
.welcome h1 {
  font-size: clamp(38px, 4.7vw, 62px);
  line-height: 1.2;
  font-weight: 500;
  letter-spacing: 2px;
  margin: 14px 0 9px;
}
.welcome .subtitle {
  font-size: 19px;
  color: var(--gold);
  letter-spacing: 5px;
}
.welcome .intro {
  font-size: 15px;
  color: #baccc9;
  max-width: 480px;
  margin: 22px 0;
}
.kit-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 20px 0;
}
.kit {
  padding: 12px;
  text-align: left;
  background: #142e35;
  border-color: #516664;
}
.kit.selected {
  border-color: var(--gold);
  background: #3e473b;
}
.kit .item-art {
  width: 47px;
  border-radius: 5px;
  margin-bottom: 10px;
}
.kit strong {
  font-size: 13px;
  display: block;
}
.kit small {
  font:
    10px/1.5 system-ui,
    sans-serif;
  color: #bccbc6;
  display: block;
  margin-top: 6px;
}
.welcome-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.welcome-actions .primary {
  padding: 13px 26px;
}
.welcome-note {
  font:
    10px/1.6 system-ui,
    sans-serif;
  color: #a2b7b5;
  margin-top: 16px;
}
.overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: #061117d9;
  backdrop-filter: blur(7px);
  overflow: auto;
  padding: 5vh 20px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}
.modal {
  width: min(720px, 100%);
  background: #142b32;
  border: 1px solid #ad946a;
  border-radius: 10px;
  box-shadow: 0 25px 100px #000a;
  overflow: hidden;
}
.modal-header {
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid #6d7a674c;
}
.modal-header h2 {
  font-size: 25px;
}
.modal-body {
  padding: 24px;
}
.modal-body p {
  font-size: 13px;
  color: #c5d3cf;
}
.modal-footer {
  padding: 16px 24px 23px;
  display: flex;
  justify-content: flex-end;
  gap: 9px;
}
.modal .small-note {
  font:
    11px/1.6 system-ui,
    sans-serif;
  color: var(--muted);
  margin-top: 15px;
}
.guide-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.guide-card {
  border: 1px solid #506861;
  padding: 16px;
  background: #10262d;
  border-radius: 5px;
}
.guide-card strong {
  font-size: 15px;
  display: block;
  color: var(--gold);
  margin-bottom: 8px;
}
.guide-card p {
  font:
    12px/1.7 system-ui,
    sans-serif;
}
.recipe-list {
  display: grid;
  gap: 12px;
}
.recipe {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid #526662;
  padding: 13px;
  border-radius: 5px;
}
.recipe .icons {
  display: flex;
  gap: 5px;
  align-items: center;
}
.recipe .item-art {
  width: 35px;
  border-radius: 4px;
}
.recipe h3 {
  font-size: 14px;
  margin-bottom: 5px;
}
.recipe p {
  font:
    11px system-ui,
    sans-serif;
}
.codex-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.codex-item {
  padding: 12px;
  background: #0d242c;
  border: 1px solid #53665f70;
  border-radius: 5px;
  display: flex;
  gap: 10px;
}
.codex-item .item-art {
  width: 50px;
  height: 50px;
  flex-shrink: 0;
  border-radius: 6px;
}
.codex-item h3 {
  font-size: 13px;
}
.codex-item p {
  font:
    11px/1.5 system-ui,
    sans-serif;
  margin-top: 6px;
}
.combat-stage {
  padding: 23px;
  display: grid;
  grid-template-columns: 1fr 45px 1fr;
  gap: 10px;
  align-items: center;
}
.fighter {
  text-align: center;
}
.fighter .portrait {
  width: 145px;
  height: 145px;
  max-width: 100%;
  background-image: url("./art/portraits.webp");
  background-size: 200% 200%;
  border: 1px solid #ab9167;
  border-radius: 50%;
  position: relative;
  margin: 0 auto 12px;
  overflow: hidden;
}
.fighter .portrait::after {
  display: none;
}
.fighter h3 {
  font-size: 15px;
}
.fighter .hpbar {
  height: 9px;
  background: #07161c;
  border-radius: 9px;
  overflow: hidden;
  margin-top: 10px;
  border: 1px solid #526e60;
}
.fighter .hpbar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #6d9e88, #9ccc9e);
  width: 100%;
  transition: width 0.15s;
}
.fighter.enemy .hpbar span {
  background: linear-gradient(90deg, #ba786c, #dbac8b);
}
.fighter .hptext {
  font:
    11px system-ui,
    sans-serif;
  color: #bfcfca;
  display: block;
  margin-top: 5px;
}
.versus {
  color: var(--gold);
  font-size: 20px;
  text-align: center;
}
.combat-log {
  height: 140px;
  margin: 0 24px;
  overflow: auto;
  background: #081f27;
  border: 1px solid #47605d;
  border-radius: 5px;
  padding: 10px 13px;
  font:
    11px/1.7 system-ui,
    sans-serif;
  color: #b9cdc4;
}
.combat-log .crit {
  color: var(--gold);
}
.combat-log .heal {
  color: var(--mint);
}
.combat-log .poison {
  color: #c0b7db;
}
.combat-summary {
  padding: 18px 24px;
  text-align: center;
}
.combat-summary h2 {
  color: var(--gold);
}
.combat-summary p {
  font:
    12px/1.7 system-ui,
    sans-serif;
  margin-top: 7px;
}
.rewards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 0 24px 24px;
}
.reward-card {
  padding: 16px 10px;
  background: #15343b;
  text-align: center;
  min-height: 135px;
}
.reward-card .item-art {
  width: 45px;
  border-radius: 4px;
  margin: 0 auto 10px;
}
.reward-card strong {
  display: block;
  font-size: 13px;
}
.reward-card small {
  display: block;
  font:
    11px/1.5 system-ui,
    sans-serif;
  color: var(--muted);
  margin-top: 7px;
}
.chapter-art {
  height: 180px;
  background:
    linear-gradient(transparent, #142b32),
    url("./art/expedition.webp") center/cover;
}
.chapter-modal h2 {
  font-size: 32px;
  color: var(--gold);
  margin-bottom: 15px;
}
.perk-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 20px;
}
.perk-grid button {
  padding: 19px;
  text-align: left;
}
.perk-grid strong {
  display: block;
  font-size: 17px;
  color: var(--gold);
}
.perk-grid small {
  display: block;
  font:
    12px/1.6 system-ui,
    sans-serif;
  margin-top: 8px;
  color: #c3d1cd;
}
.map-chapter {
  padding: 14px 0;
  border-bottom: 1px solid #5e786244;
}
.map-chapter h3 {
  color: var(--gold);
}
.map-encounters {
  display: flex;
  gap: 8px;
  margin-top: 9px;
  flex-wrap: wrap;
}
.map-encounters span {
  font:
    11px system-ui,
    sans-serif;
  background: #0b242d;
  border: 1px solid #576c62;
  border-radius: 5px;
  padding: 10px;
}
.map-encounters span.current {
  border-color: var(--gold);
  color: var(--gold);
}
.map-encounters span.done {
  color: var(--mint);
}
#toast {
  position: fixed;
  left: 50%;
  bottom: 23px;
  transform: translate(-50%, 20px);
  background: #e5cf9e;
  color: #15282b;
  padding: 12px 20px;
  border-radius: 6px;
  font:
    13px/1.6 system-ui,
    sans-serif;
  z-index: 70;
  box-shadow: 0 6px 30px #0006;
  opacity: 0;
  pointer-events: none;
  transition: 0.2s;
  max-width: 90vw;
  min-width: 200px;
  text-align: center;
}
#toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}
.save-warning {
  padding: 10px;
  background: #5d3e30;
  color: #f3dcb3;
  border-radius: 6px;
  font:
    12px system-ui,
    sans-serif;
  margin-top: 12px;
}
.hidden {
  display: none !important;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
@media (min-width: 1500px) {
  body {
    background-size: cover;
    background-attachment: fixed;
  }
  .welcome {
    min-height: calc(100vh - 90px);
  }
}
@media (max-width: 1150px) {
  .wrapper {
    padding: 0 20px 25px;
  }
  .game-layout {
    grid-template-columns: 210px minmax(300px, 1fr) 275px;
    gap: 12px;
  }
  :root {
    --cell: 58px;
  }
  .shop-grid {
    gap: 6px;
    padding: 9px;
  }
  .journey-body {
    padding: 13px;
  }
  .portrait-label h2 {
    font-size: 21px;
  }
  .stats {
    gap: 12px;
  }
  .pack-meta {
    padding: 12px;
  }
  .welcome-copy {
    max-width: 650px;
  }
}
@media (max-width: 920px) {
  header {
    padding: 16px 20px;
  }
  .game-layout {
    grid-template-columns: minmax(300px, 1fr) 290px;
  }
  .journey {
    grid-column: 1/-1;
    display: grid;
    grid-template-columns: 140px 1fr;
  }
  .journey .portrait {
    aspect-ratio: auto;
    height: 100%;
    border-bottom: 0;
  }
  .journey .portrait-label {
    display: none;
  }
  .journey-body {
    display: grid;
    grid-template-columns: 1fr 250px;
    column-gap: 20px;
    padding: 13px 18px;
  }
  .journey-body .eyebrow,
  .journey-body h2,
  .chapter-story,
  .enemy-stats,
  .enemy-hint {
    grid-column: 1;
  }
  .journey-body .path-choices {
    grid-column: 2;
    grid-row: 1/6;
    margin: 0;
    align-self: center;
  }
  .chapter-legend {
    display: none;
  }
  .chapter-story {
    margin: 5px 0 0;
    font-size: 11px;
  }
  .enemy-stats {
    margin: 8px 0;
  }
  .enemy-hint {
    margin: 0;
  }
  .journey-body h2 {
    font-size: 19px;
  }
  .route-dots {
    gap: 5px;
  }
  .dot {
    width: 20px;
    height: 20px;
  }
  .welcome {
    padding: 25px 5vw;
  }
  .welcome-copy {
    padding: 28px;
  }
  .tutorial {
    align-items: flex-start;
  }
  .tutorial .actions {
    flex-direction: column;
  }
}
@media (max-width: 660px) {
  :root {
    --cell: 57px;
  }
  body {
    background-size: auto 620px;
    background-position: 65% top;
  }
  header {
    padding: 14px 13px;
    gap: 7px;
    align-items: center;
  }
  .brand {
    gap: 7px;
  }
  .brand strong {
    font-size: 14px;
  }
  .brand small {
    font-size: 8px;
    letter-spacing: 1.3px;
  }
  .brand img {
    width: 30px;
    height: 30px;
  }
  .toolbar {
    gap: 4px;
  }
  .toolbar .small {
    font-size: 10px;
    padding: 7px 8px;
  }
  .toolbar .desktop-only {
    display: none;
  }
  .wrapper {
    padding: 0 12px 20px;
  }
  .progress {
    padding: 12px;
    display: block;
  }
  .route-dots {
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 11px;
  }
  .stats {
    justify-content: space-between;
    gap: 12px;
  }
  .stats b {
    font-size: 17px;
  }
  .stats {
    font-size: 10px;
  }
  .game-layout {
    grid-template-columns: 1fr;
    gap: 13px;
    margin-top: 13px;
  }
  .journey {
    grid-column: 1;
    grid-template-columns: 85px 1fr;
  }
  .journey-body {
    display: block;
    padding: 12px;
  }
  .journey-body h2 {
    font-size: 18px;
  }
  .journey-body .eyebrow {
    font-size: 8px;
    letter-spacing: 1px;
  }
  .chapter-story {
    display: none;
  }
  .enemy-stats {
    font-size: 10px;
    gap: 9px;
    margin: 6px 0;
  }
  .enemy-hint {
    font-size: 11px;
    margin: 7px 0;
  }
  .path-choices {
    grid-template-columns: 1fr 1fr;
    gap: 6px !important;
    margin-top: 8px !important;
  }
  .path-choices button {
    padding: 7px;
  }
  .path-choices strong {
    font-size: 11px;
  }
  .path-choices small {
    font-size: 9px;
    line-height: 1.4;
  }
  .journey .portrait {
    background-size: auto 200%;
    background-position: 61% 0;
  }
  .journey .portrait.p2 {
    background-position: 11% 100%;
  }
  .journey .portrait.p3 {
    background-position: 93% 100%;
  }
  .pack-section {
    order: 2;
  }
  .supply-column {
    order: 3;
    display: grid;
    grid-template-columns: 1fr;
    gap: 13px;
  }
  .shop-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
    padding: 11px;
  }
  .shop-card {
    padding: 7px;
    min-height: 134px;
  }
  .shop-card .item-art {
    width: 45px;
    height: 45px;
  }
  .shop-card strong {
    font-size: 10px;
    line-height: 1.5;
  }
  .shop-card small {
    font-size: 9px;
  }
  .shop-card .price {
    font-size: 10px;
  }
  .shop-card.empty {
    min-height: 134px;
  }
  .pack-meta {
    padding: 12px 17px;
  }
  .panel-title {
    padding: 13px 16px;
  }
  .pack-wrap {
    padding-top: 15px;
  }
  .selection-detail {
    min-height: 105px;
  }
  .tutorial {
    padding: 13px;
    gap: 10px;
    margin-top: 13px;
  }
  .tutorial .step {
    font-size: 22px;
  }
  .tutorial p {
    font-size: 11px;
  }
  .tutorial .actions button {
    font-size: 10px;
    padding: 6px 8px;
  }
  .tutorial h3 {
    font-size: 12px;
  }
  .bottom-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }
  .bottom-row .links {
    gap: 6px;
  }
  .welcome {
    padding: 13px 13px 40px;
    min-height: calc(100vh - 75px);
    align-items: flex-start;
  }
  .welcome-copy {
    padding: 25px 20px;
    margin-top: 50px;
    background: linear-gradient(100deg, #0b2028ee, #0b2028db);
  }
  .welcome h1 {
    font-size: 36px;
  }
  .welcome .subtitle {
    font-size: 15px;
    letter-spacing: 3px;
  }
  .welcome .intro {
    font-size: 13px;
    margin: 17px 0;
  }
  .kit-grid {
    gap: 7px;
    margin: 16px 0;
  }
  .kit {
    padding: 9px;
  }
  .kit strong {
    font-size: 11px;
  }
  .kit small {
    font-size: 9px;
  }
  .kit .item-art {
    width: 39px;
  }
  .welcome-actions button {
    flex: 1;
    padding: 12px 14px !important;
    font-size: 13px;
  }
  .welcome-note {
    font-size: 9px;
  }
  .overlay {
    padding: 18px 10px;
  }
  .modal-header {
    padding: 17px;
  }
  .modal-header h2 {
    font-size: 21px;
  }
  .modal-body {
    padding: 17px;
  }
  .guide-grid,
  .codex-grid {
    grid-template-columns: 1fr;
  }
  .guide-card {
    padding: 13px;
  }
  .recipe {
    padding: 11px;
    gap: 8px;
  }
  .recipe .icons .item-art {
    width: 28px;
  }
  .recipe h3 {
    font-size: 12px;
  }
  .recipe p {
    font-size: 10px;
  }
  .recipe button {
    font-size: 11px;
    padding: 8px;
  }
  .fighter .portrait {
    width: 115px;
    height: 115px;
  }
  .combat-stage {
    padding: 19px 13px;
    gap: 5px;
    grid-template-columns: 1fr 25px 1fr;
  }
  .fighter h3 {
    font-size: 12px;
  }
  .combat-log {
    margin: 0 15px;
    font-size: 10px;
  }
  .rewards {
    padding: 0 15px 18px;
    gap: 7px;
  }
  .reward-card {
    padding: 12px 8px;
    min-height: 126px;
  }
  .reward-card strong {
    font-size: 11px;
  }
  .reward-card small {
    font-size: 10px;
  }
  .modal-footer {
    padding: 14px 17px 19px;
  }
  .modal-body p {
    font-size: 12px;
  }
  .chapter-modal h2 {
    font-size: 27px;
  }
  .perk-grid {
    gap: 9px;
  }
  .perk-grid button {
    padding: 15px;
  }
  .perk-grid strong {
    font-size: 14px;
  }
  .perk-grid small {
    font-size: 11px;
  }
}
@media (max-width: 365px) {
  :root {
    --cell: 52px;
  }
  .toolbar .small {
    padding: 6px;
  }
  .brand strong {
    font-size: 12px;
  }
  .wrapper {
    padding: 0 8px 20px;
  }
  .welcome h1 {
    font-size: 31px;
  }
  .welcome-copy {
    padding: 20px 15px;
  }
  .kit {
    padding: 7px;
  }
  .shop-grid {
    gap: 5px;
    padding: 8px;
  }
  .shop-card {
    padding: 5px;
  }
  .shop-card .item-art {
    width: 40px;
    height: 40px;
  }
  .pack-actions .small {
    font-size: 10px;
    padding: 7px;
  }
  .fighter .portrait {
    width: 102px;
    height: 102px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}
.backpack:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 5px;
}
