:root {
  --journal-paper: #f7f0df;
  --journal-ink: #192d28;
  --journal-muted: #4e6256;
  --journal-line: #cfc4ab;
  --journal-action: #be442b;
  --journal-gold: #f3cc7c;
}
.expedition-home, .expedition-route {
  color: var(--journal-ink);
  background: var(--journal-paper);
  font-family: "PingFang SC", "Hiragino Sans GB", system-ui, sans-serif;
}
.journal-wrap, .route-wrap { width: min(1180px, calc(100% - 96px)); margin: 0 auto; }
.journal-header {
  min-height: 83px; display: flex; justify-content: space-between; align-items: center; gap: 18px;
}
.journal-brand { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 950; letter-spacing: .18em; }
.journal-brand img { width: 33px; height: 33px; image-rendering: pixelated; }
.journal-header nav { display: flex; gap: 30px; }
.journal-header nav button {
  padding: 10px 0; border: 0; color: var(--journal-ink); background: transparent; font: inherit; font-size: 13px; font-weight: 800; cursor: pointer;
}
.journal-header nav button:hover { color: var(--journal-action); }
.journal-hero {
  isolation: isolate; position: relative; display: grid; grid-template-columns: 43% 57%; align-items: center;
  min-height: clamp(440px, 67vh, 660px); overflow: hidden; border-radius: 24px; border: 1px solid #345349;
  color: #fff5da; background: #173931;
}
.journal-hero::before, .journal-hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
}
.journal-hero::before {
  background: url('assets/bg/coast.webp') 70% center / cover;
  filter: saturate(.76); opacity: .57;
}
.journal-hero::after {
  background: linear-gradient(90deg,#132e27 3%,#132e27f5 24%,#12312670 56%,#1231260a 82%),
    linear-gradient(0deg,#10291fe0,transparent 44%);
}
.journal-copy { z-index: 3; padding: 42px 0 45px clamp(34px, 6vw, 90px); }
.journal-location { display: flex; align-items: center; gap: 9px; margin: 0; font-size: 13px; font-weight: 800; letter-spacing: .08em; }
.journal-location img { width: 24px; height: 24px; image-rendering: pixelated; }
.journal-copy .journal-location { color: var(--journal-gold); }
.journal-copy h1 {
  font-size: clamp(52px, 7.2vw, 108px); line-height: 1.04; letter-spacing: -.08em; margin: 19px 0 24px;
  font-weight: 950; color: #fff6de; text-shadow: 0 4px 0 #102a21;
}
.journal-copy h1 span { display: block; }
.journal-subtitle { line-height: 1.75; margin: 0 0 28px; font-size: 16px; color: #e9e8cd; }
.journal-primary {
  display: inline-flex; align-items: center; gap: 34px; padding: 14px 20px; border: 1px solid #ef8e65;
  border-radius: 9px; background: var(--journal-action); color: #fffaf0; cursor: pointer;
  font: inherit; font-weight: 900; box-shadow: 0 5px 0 #743422; transition: transform .16s, background-color .16s;
}
.journal-primary:hover { transform: translateY(-3px); background: #d04b30; }
.journal-primary:active { transform: translateY(2px); }
.journal-art { position: absolute; right: 0; width: 68%; height: 100%; bottom: 0; pointer-events: none; }
.journal-sun {
  position: absolute; inset: 5% 10% auto auto; width: 48%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle, #fce2a75e 0%, #fce2a726 51%, #f6cb6600 72%);
}
.journal-art img { position: absolute; height: auto; object-fit: contain; filter: drop-shadow(0 12px 6px #13271d6f); }
.art-charizard { width: 76%; top: -18%; right: 0; }
.art-venusaur { width: 50%; bottom: 0; right: 20%; }
.art-blastoise { width: 54%; bottom: -4%; right: -8%; }
.art-pikachu { width: 34%; bottom: -8%; left: 8%; z-index: 2; }
.journal-shelf { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 15px; margin: 18px 0 27px; }
.journal-tile {
  display: grid; grid-template-columns: 47px 1fr auto; align-items: center; gap: 12px; border: 1px solid var(--journal-line);
  border-radius: 13px; background: #fff9ec; color: var(--journal-ink); cursor: pointer; text-align: left; padding: 12px 16px; font: inherit;
}
.journal-tile:hover { background: #fffcf5; border-color: #a68553; }
.journal-tile img { width: 42px; height: 42px; image-rendering: pixelated; background: #eee5ce; border-radius: 9px; }
.journal-tile strong, .journal-tile small { display: block; }
.journal-tile small { color: var(--journal-muted); margin-top: 3px; font-size: 12px; }

.expedition-route { padding: 107px 0 38px; scroll-padding-block: 107px 42px; background-image: radial-gradient(#94795131 1px, transparent 1px); background-size: 21px 21px; }
.route-wrap { max-width: 850px; }
.route-header { display: flex; justify-content: space-between; align-items: end; gap: 12px; padding-bottom: 20px; border-bottom: 1px solid var(--journal-line); }
.route-header h1 { margin: 4px 0 0; font-size: clamp(30px, 5vw, 48px); line-height: 1.1; }
.route-progress { display: grid; gap: 4px; text-align: right; flex-shrink: 0; font-size: 13px; color: var(--journal-muted); }
.route-progress strong { color: var(--journal-ink); font-size: 18px; }
.route-region { margin: 19px 0 12px 46px; font-size: 14px; display: flex; align-items: center; gap: 7px; }
.route-region::before { content: ""; width: 11px; height: 11px; background: var(--region); border-radius: 50%; }
.route-floor-body { display: grid; grid-template-columns: 38px 1fr; gap: 8px; align-items: center; }
.route-number { font-size: 13px; color: var(--journal-muted); font-variant-numeric: tabular-nums; font-weight: 800; }
.route-slots { display: grid; grid-template-columns: repeat(var(--slots), minmax(0,1fr)); gap: 9px; }
.route-node {
  position: relative; z-index: 1; width: min(100%, 200px); min-height: 61px; justify-self: center; display: flex;
  align-items: center; justify-content: center; gap: 6px; padding: 8px 5px; border: 1px solid #bdb09a; border-radius: 11px;
  background: #f1e9d8; color: #354a41; text-align: left; font: inherit;
}
.route-node:disabled { color: #546359; opacity: .87; }
.route-node:enabled { cursor: pointer; border: 2px solid #9f3e26; background: #fff8eb; color: #522919; box-shadow: 0 3px 0 #cf9d84; }
.route-node:enabled:hover { background: #ffe3cb; transform: translateY(-2px); }
.route-node.cleared { background: #dce6d5; color: #20412d; border-color: #8ba589; }
.route-node img { width: 27px; height: 27px; flex-shrink: 0; image-rendering: pixelated; }
.route-node strong { font-size: 13px; display: block; }
.route-node small { display: block; font-size: 11px; margin-top: 3px; }
.route-edges { position: relative; margin-left: 46px; height: 30px; }
.route-edges span { position: absolute; inset: 0; background: #c0b197; clip-path: polygon(calc(var(--from) - 1px) 0,calc(var(--from) + 1px) 0,calc(var(--to) + 1px) 100%,calc(var(--to) - 1px) 100%); }
.route-edges .open { background: #b34d30; z-index: 1; }
.route-edges .traveled { background: #528161; z-index: 1; }
:is(.expedition-home,.expedition-route) button:focus-visible { outline: 3px solid #326a87; outline-offset: 3px; }
@media (max-width: 780px) {
  .journal-wrap, .route-wrap { width: calc(100% - 32px); }
  .journal-header { min-height: 64px; }
  .journal-header nav { gap: 14px; }
  .journal-hero { min-height: 490px; }
  .journal-art { width: 77%; height: 70%; }
  .journal-copy { align-self: start; padding-top: 45px; }
  .journal-copy h1 { font-size: clamp(48px,10vw,75px); }
  .art-charizard { top: -6%; }
}
@media (max-width: 520px) {
  .journal-brand { font-size: 12px; gap: 4px; }
  .journal-brand img { width: 24px; height: 24px; }
  .journal-header nav { gap: 10px; }
  .journal-header nav button { font-size: 11px; }
  .journal-hero { display: block; min-height: 580px; border-radius: 16px; }
  .journal-hero::after { background: linear-gradient(155deg,#132e27 8%,#132e27d9 36%,#132e2720 74%),linear-gradient(0deg,#132e27b0,transparent 50%); }
  .journal-copy { position: relative; padding: 29px 21px 0; }
  .journal-copy h1 { margin: 15px 0; }
  .journal-copy h1 span { display: inline; }
  .journal-subtitle { font-size: 14px; margin-bottom: 16px; }
  .journal-art { width: 100%; height: 58%; }
  .art-charizard { top: 0; }
  .art-venusaur { bottom: 5%; }
  .art-pikachu { bottom: 0; }
  .journal-shelf { grid-template-columns: 1fr; gap: 9px; }
  .route-floor-body { grid-template-columns: 23px 1fr; gap: 3px; }
  .route-region, .route-edges { margin-left: 26px; }
  .route-node { flex-direction: column; text-align: center; gap: 3px; padding: 4px 2px; min-height: 78px; }
  .route-node strong { font-size: 11px; }
  .route-node small { font-size: 10px; }
  .route-slots { gap: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  .journal-primary, .route-node { transition: none; }
}

.trainer-option, .starter-card { text-align: left; font: inherit; }
.title-play-btn:disabled { opacity: .65; cursor: default; box-shadow: none; transform: none; }
.journal-profile {
  width: min(760px, 100%); color: var(--journal-ink); background: #fff9eb; border-color: #a99c7e;
}
.journal-profile-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.journal-profile-head h2 { font-size: 30px; margin: 3px 0 10px; overflow-wrap: anywhere; }
.journal-profile-stats { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 6px; }
.journal-profile-stats span { display: grid; gap: 4px; padding: 9px; border: 1px solid var(--journal-line); border-radius: 8px; font-size: 12px; }
.journal-profile-stats strong { font-size: 16px; }
.journal-profile-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.journal-profile h3 { margin: 15px 0 8px; font-size: 15px; }
.journal-profile ul { padding: 0; margin: 0; list-style: none; }
.journal-profile li { display: flex; align-items: center; gap: 7px; min-height: 30px; padding: 3px 0; font-size: 12px; border-bottom: 1px solid #e5dbc6; }
.journal-profile li img { width: 26px; height: 26px; object-fit: contain; image-rendering: pixelated; }
.journal-profile li small { display: block; color: var(--journal-muted); }
.journal-note { font-size: 12px; line-height: 1.5; }
.journal-account { margin-top: 14px; }
.journal-account-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.journal-account label { display: grid; gap: 5px; font-size: 13px; font-weight: 700; }
.journal-account input { width: 100%; border: 1px solid var(--journal-line); border-radius: 7px; background: #fffdf7; color: var(--journal-ink); padding: 9px; font: inherit; user-select: auto; }
.journal-account-actions { display: flex; gap: 9px; margin-top: 10px; }
.journal-account .journal-primary { padding: 8px 13px; }
.journal-error { color: #9b2d20; font-size: 13px; }
@media (max-width: 660px) {
  .trainer-screen, .starter-screen { padding: 15px; }
  .trainer-layout { grid-template-columns: 1fr; gap: 12px; }
  .trainer-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  .trainer-option { padding: 5px; }
  .starter-grid { width: 100%; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; }
  .starter-card { width: 100%; min-width: 0; padding: 8px; }
  .starter-top { flex-direction: column; align-items: center; text-align: center; }
  .journal-profile-columns { grid-template-columns: 1fr; gap: 0; }
}

.journal-art img { image-rendering: pixelated; }
.art-charizard { width: 63%; max-width: 480px; top: 6%; right: 8%; transform: scaleX(-1); }
.art-venusaur { width: 42%; max-width: 335px; right: 35%; bottom: 14%; }
.art-blastoise { width: 37%; max-width: 310px; right: 1%; bottom: 7%; }
.art-pikachu { width: 21%; max-width: 160px; left: 14%; bottom: 5%; }
@media (max-width: 900px) {
  .pk-hud { flex-wrap: wrap; gap: 5px; left: 8px; right: 8px; top: 7px; }
  .pk-avatar-ring { width: 44px; height: 44px; border-width: 2px; }
  .pk-avatar-ring img { width: 36px; height: 36px; }
  .pk-lv-pill { font-size: 8px; padding: 0 4px; }
  .pk-plate { min-width: min(39vw, 210px); width: auto; padding: 4px 6px 4px 18px; margin-left: -12px; }
  .pk-plate-name, .pk-zone-title { font-size: 11px; }
  .pk-zone-wrap { align-items: end; }
  .pk-zone-pill { gap: 4px; padding: 4px 7px; }
  .pk-zone-sub, .pk-sub-strip, .pk-pokeball-pill, .pk-btn { font-size: 10px; }
  .pk-pokeball-pill { padding: 2px 5px; white-space: nowrap; }
  .pk-btn { padding: 4px 7px; white-space: nowrap; }
  .pk-right-col { flex-direction: row; margin-left: auto; gap: 5px; }
  .pk-btn-row, .pk-slots-row { gap: 4px; }
  .pk-slot { width: 27px; height: 27px; }
  .pk-slot .item-ico { width: 20px; height: 20px; }
  .expedition-route { padding-top: 107px; }
}
@media (max-width: 660px) {
  .journal-art { width: 100%; }
  .art-charizard { width: 61%; right: 3%; top: 0; }
  .art-venusaur { width: 41%; right: 37%; bottom: 5%; }
  .art-blastoise { width: 37%; bottom: 2%; }
  .art-pikachu { left: 5%; bottom: 0; }
  .pk-right-col { width: 100%; justify-content: space-between; }
  .pk-pokeball-pill svg { display: none; }
  .pk-mode-badge { display: none; }
  .pk-slots-row .pk-slot.empty { display: none; }
  .stage-area { flex: 1; min-height: 0; max-width: 100%; padding: 95px 5px 0; gap: 4px; }
  .player-unit { max-width: 37%; min-width: 0; }
  .player-stage-pair { min-width: 0; }
  .player-stage-pair .battle-pad { min-width: 64px !important; }
  .enemies-side { gap: 2px; max-width: 63%; min-width: 0; }
  .enemy-unit { min-width: 0; max-width: 100px; }
  .player-plate, .enemy-plate { width: 100%; min-width: 0; padding: 4px; }
  .player-plate-head, .enemy-plate-head { font-size: 10px; }
  .enemy-sprite-2d { max-width: 80px; max-height: 90px; }
  .trainer-on-field { max-width: 72px; max-height: 100px; }
  .hand-dock { display: grid; height: auto; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px 8px 10px; align-items: center; }
  .hand-dock .orb-col { flex-direction: row; justify-content: space-between; min-width: 0; gap: 3px; }
  .hand-dock .orb-col:last-child { justify-content: end; }
  .hand-row { grid-column: 1 / -1; grid-row: 1; width: 100%; height: 188px; padding: 6px 1px 9px; justify-content: flex-start; overflow: auto hidden; gap: 5px; }
  .hand-row .poke-card { flex: 0 0 123px; width: 123px; height: 167px; margin: 0; transform: none !important; padding: 4px; }
  .hand-row .poke-card:hover { transform: none !important; margin: 0; }
  .hand-row .card-art-wrap { min-height: 0; }
  .energy-ring { flex-shrink: 0; width: 41px; height: 41px; border-width: 2px; }
  .energy-num { font-size: 15px; }
  .energy-sub { font-size: 8px; }
  .pile-btn, .end-turn-btn { width: auto; padding: 5px 6px; border-width: 1px; font-size: 10px; white-space: nowrap; }
}

.expedition-event {
  background-image: linear-gradient(#112a28a6,#112a28e6), var(--event-bg);
  background-size: cover;
  background-position: center;
}
.journal-event-card {
  width: min(560px, calc(100vw - 32px)); margin: auto; padding: clamp(16px, 4vw, 34px);
  background: #fff8ea; border: 1px solid #bcad8b; border-radius: 15px; box-shadow: 0 12px 40px #112a2877;
}
.journal-event-card h1 { margin: 7px 0; font-size: clamp(24px, 4vw, 40px); }
.journal-event-card > p:not(.journal-location) { line-height: 1.65; margin: 8px 0 18px; }
.journal-event-choice {
  display: grid; gap: 5px; width: 100%; margin: 7px 0 0; border: 1px solid var(--journal-line);
  text-align: left; font: inherit; color: var(--journal-ink); background: #fffdf5; border-radius: 8px; padding: 10px;
}
.journal-event-choice:not(:disabled) { cursor: pointer; }
.journal-event-choice:not(:disabled):hover { background: #ffe6d2; border-color: var(--journal-action); }
.journal-event-choice span { font-size: 12px; color: var(--journal-muted); }
.journal-event-choice:disabled { opacity: .6; }

.trainer-screen, .starter-screen {
  background: linear-gradient(#122c28da,#122c28f5), url('assets/bg/coast.webp') center / cover;
}
.trainer-screen .hero-banner, .starter-screen .hero-banner {
  background: #f7f0df; border: 1px solid #bdae8d; border-radius: 11px; padding: 13px 19px;
}
.trainer-screen .hero-banner h1, .starter-screen .hero-banner h1 {
  color: var(--journal-ink); text-shadow: none;
}
.trainer-option, .starter-card, .trainer-detail {
  background: #fff9ec; border-color: #a99c7e; color: var(--journal-ink); border-radius: 11px;
}
.trainer-option.selected { border-color: #dc7046; background: #ffe8cf; }
.trainer-screen .title-play-btn, .starter-screen .title-play-btn {
  background: var(--journal-action); border: 1px solid #ef8e65; box-shadow: 0 5px 0 #743422; border-radius: 9px;
}
.hand-row .poke-card:focus-visible, .starter-card:focus-visible, .trainer-option:focus-visible {
  outline: 3px solid #f5c571; outline-offset: 3px; z-index: 66;
}

.journal-dex { width: min(1080px, 100%); background: #fcf5e7; color: var(--journal-ink); border-color: #b6ab91; }
.journal-dex-head { display: flex; justify-content: space-between; align-items: start; gap: 10px; margin-bottom: 10px; }
.journal-dex-head > div { display: flex; align-items: center; gap: 4px; }
.journal-dex h2 { font-size: 28px; margin: 0; }
.journal-dex-search { display: grid; gap: 5px; font-size: 13px; font-weight: 750; }
.journal-dex-search input { width: 100%; max-width: 440px; border: 1px solid var(--journal-line); border-radius: 8px; background: #fffdf7; padding: 9px 11px; font: inherit; color: var(--journal-ink); user-select: auto; }
.journal-dex-filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 11px 0; }
.journal-dex-filters button { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--journal-line); border-radius: 7px; background: #fffbef; color: var(--journal-ink); font: inherit; font-size: 13px; font-weight: 730; cursor: pointer; padding: 5px 9px; }
.journal-dex-filters button[aria-pressed=true] { background: #f4cfb2; border-color: #a85b3b; }
.journal-dex-filters .dex-filter-type-icon { width: 19px; height: 19px; flex: 0 0 auto; object-fit: contain; }
.journal-dex-filters .dex-filter-count { font-size: 11px; }
.journal-dex-page { display: flex; align-items: center; justify-content: space-between; border-block: 1px solid var(--journal-line); padding: 6px 0; margin-bottom: 13px; font-size: 12px; }
.journal-dex-page div { display: flex; align-items: center; gap: 6px; }
.journal-dex-page button:disabled { opacity: .55; cursor: default; }
.journal-dex-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(144px,1fr)); gap: 14px; }
.journal-dex-grid .poke-card { width: 100%; height: 226px; margin: 0; }
.journal-dex-grid .poke-card:hover { transform: translateY(-2px) !important; margin: 0; box-shadow: 0 6px 0 #766c59, 0 10px 14px #2d302a33; }
.journal-empty { padding: 23px 0; color: var(--journal-muted); }
@media(max-width: 520px) {
  .journal-dex-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
  .journal-dex-grid .poke-card { height: 197px; }
  .journal-dex-grid .card-art-wrap { min-height: 0; }
}
.card-missing-art { color: var(--journal-muted); font-size: 11px; margin: auto; }

#app .poke-card .card-desc { white-space: pre-line; }

.dex-wiki-keywords {
  padding: 12px 14px; border-radius: 14px;
  background: #fffcf5; border: 1.5px solid #dfd5bf;
}
.tooltip-box:has(.dex-wiki-keywords) {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  width: min(340px, calc(100vw - 24px));
  max-width: none !important;
}
.tooltip-box .dex-wiki-keywords {
  color: #1c1917;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.2);
}
.tooltip-box .dex-wiki-section-title {
  margin: 0 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid #e6decb;
  color: #1c1917;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.03em;
}
.dex-wiki-kw-list { display: grid; gap: 7px; }
.dex-wiki-kw-item {
  font-size: 12px; line-height: 1.45; color: #36453f;
  padding-bottom: 6px; border-bottom: 1px dashed #e6decb;
}
.dex-wiki-kw-item:last-child { padding-bottom: 0; border-bottom: 0; }
.dex-wiki-kw-item strong {
  display: inline-block; margin-right: 6px; padding: 1px 6px; border-radius: 5px;
  font-size: 11.5px; font-weight: 800;
}

/* Live card value editor */
.dex-tuning-editor {
  border: 1.5px solid #d4c8ae;
  border-radius: 14px;
  padding: 14px;
  background: #fffcf5;
  color: var(--uni-ink, #292524);
}
.dex-tuning-editor h3 { margin: 0 0 6px !important; font-size: 16px !important; }
.dex-tuning-tip {
  margin: 0 0 12px; font-size: 11.5px; line-height: 1.45; color: #5b6963;
}
.dex-tuning-editor fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.dex-tuning-fields { display: grid; gap: 8px; }
.dex-tuning-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 5.8em;
  gap: 8px;
  align-items: center;
  font-size: 13px;
  font-weight: 700;
}
.dex-tuning-field small { display: block; font-weight: 500; color: #64716b; font-size: 11px; }
.dex-tuning-field input {
  min-width: 0;
  width: 100%;
  font: inherit;
  color: inherit;
  background: #fff;
  border: 1.5px solid #cfc4ab;
  border-radius: 8px;
  padding: 6px 8px;
}
.dex-tuning-field input:focus { border-color: var(--dex-accent, #c34a32); outline: none; }
.dex-tuning-field input:invalid { border-color: #b42318; background: #fef2f2; }
.dex-tuning-field input:focus-visible,
.dex-tuning-stage:focus-visible,
.dex-shiny-toggle:focus-visible { outline: 2px solid #2956a6; outline-offset: 2px; }
.dex-tuning-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.dex-tuning-actions :disabled { opacity: .55; cursor: default; }
.dex-tuning-status, .dex-tuning-help { margin: 10px 0 0; font-size: 12px; line-height: 1.45; }
.dex-tuning-status.is-error { color: #b42318; font-weight: 700; }
.dex-tuning-status:empty { display: none; }
