/* Landscape stations share the same game state and touch/mouse controls. */
:root { --nav-height: 68px; --rail-width: clamp(190px, 22vw, 280px); }
body { min-height: 100dvh; display: grid; place-items: center; background: radial-gradient(ellipse at center, #173e44, #071b23 75%); }
#app { width: min(100vw, 1920px); height: 100dvh; grid-template-rows: minmax(0, 1fr) var(--nav-height); }
#app:fullscreen { width: 100vw; height: 100dvh; max-height: none; border: 0; }
#rotateNotice { display: none; }
main, .page { min-width: 0; }
nav { height: var(--nav-height); padding: 0 max(12px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(12px, env(safe-area-inset-left)); z-index: 2; }
nav button { font-size: 25px; min-width: 56px; }
nav button small { font-size: 12px; }
nav .navUtility { max-width: 110px; font-size: 23px; border-left: 1px solid #c6a26125; }
nav .navUtility small { font-size: 10px; }
button { min-height: 42px; }
.tag { font-size: 11px; }
.eyebrow { font-size: 10px; line-height: 1.5; }
.secondary { font-size: 12px; }
#fishPage.active { display: grid; grid-template-columns: minmax(0, 1fr) var(--rail-width); grid-template-rows: 48px minmax(0, 1fr); overflow: hidden; }
.waterbar { grid-column: 1 / -1; padding: 5px max(16px, env(safe-area-inset-right)) 5px max(16px, env(safe-area-inset-left)); border-bottom: 1px solid #c2a16a38; }
.waterbar button { min-height: 36px; font-size: 12px; padding: 6px 14px; }
.canvasbox { grid-column: 1; grid-row: 2; min-width: 0; }
.fishBottom { grid-column: 2; grid-row: 2; min-height: 0; overflow: auto; padding: 24px 18px; display: flex; flex-direction: column; border-left: 1px solid #b28e5150; background: linear-gradient(140deg, #294440, #112c35); }
.baitLabel { margin-bottom: 14px; }
.lures { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.lures button { padding: 16px 5px; min-height: 72px; font-size: 14px; background: #ffffff05; }
.lures button small { display: block; font-size: 9px; margin-top: 6px; color: #aac7bb; }
.lures button.selected { background: #edcc7c16; box-shadow: inset 0 0 0 1px #e7bb7030; }
.targetline { flex-direction: column; align-items: flex-start; gap: 9px; margin: 25px 0 14px; font-size: 18px; }
.targetline span:last-child { font-size: 14px; }
.linebar { flex: 0 0 5px; width: 100%; margin-bottom: 10px; }
.fishBottom #fishTip { font-size: 12px; line-height: 1.65; text-align: left; margin-top: 0; min-height: 38px; }
.routeNote { border-top: 1px solid #e0be8130; margin-top: auto; padding-top: 20px; }
.routeNote p { font-family: Georgia, serif; font-size: 16px; line-height: 1.55; color: #e5d6b3; margin: 9px 0 0; }
.widePad { height: 100%; padding: clamp(16px, 2.2vw, 32px); }
.widePad > .toprow { grid-column: 1 / -1; }
.widePad h2 { font-family: Georgia, serif; font-size: 32px; letter-spacing: -.5px; margin: 0; }
.forgeSetup, .crewSetup, .holdSetup { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); grid-template-rows: 48px minmax(0, 1fr); gap: 18px 28px; overflow: hidden; }
.forgePreview, .forgeMaterials, .crewMain, .crewSide, .holdContents, .holdNotes { min-width: 0; min-height: 0; }
.forgePreview { display: flex; flex-direction: column; gap: 12px; }
.forgePreview .preview { flex: 1; min-height: 120px; height: auto; background: radial-gradient(ellipse at 50% 70%, #88593660, #15343cd9 75%); }
.forgePreview .preview .weaponSprite > div { width: min(70%, 320px); }
.forgePreview .primary { margin-bottom: 4px; }
.forgePreview .error { margin: 0; font-size: 12px; }
.forgeMaterials { overflow: auto; padding: 0 4px 4px 0; }
.forgeMaterials .label { font-size: 11px; margin: 14px 0 9px; }
.forgeMaterials .label:first-child { margin-top: 3px; }
.forgeMaterials .chips { gap: 8px; flex-wrap: wrap; overflow: visible; }
.chip { min-width: 92px; padding: 12px; }
.chip strong { font-size: 13px; }
.chip small { font-size: 11px; }
.chip .icon { font-size: 28px; }
.work { padding: 18px; grid-template-columns: minmax(0, 1fr) var(--rail-width); grid-template-rows: 30px minmax(0, 1fr); gap: 12px 18px; }
.worktop { grid-column: 1 / -1; align-items: center; padding: 0 4px; font-size: 12px; }
#workCanvas { grid-column: 1; grid-row: 2; border-radius: 18px; }
.workControls { grid-column: 2; grid-row: 2; min-height: 0; display: flex; flex-direction: column; justify-content: center; gap: 18px; padding: 20px 16px; background: linear-gradient(150deg, #30443d, #19353b); border: 1px solid #b48b504d; border-radius: 18px; }
.workCall { font-family: Georgia, serif; font-size: 26px; line-height: 1.2; }
.workControls .primary { font-size: 15px; min-height: 56px; padding: 12px 6px; }
.workControls > small { text-align: center; font-size: 12px; line-height: 1.6; }
.reactionHelp { min-height: 56px; font-size: 13px; }
.workStageDots { display: flex; justify-content: center; gap: 8px; margin-bottom: 12px; }
.workStageDots span { width: 7px; height: 7px; border-radius: 50%; background: #758f8260; }
.workStageDots .done { background: #a3c89b; }
.workStageDots .current { background: var(--gold); box-shadow: 0 0 0 3px #f5c46d20; }
.crewMain { display: flex; flex-direction: column; gap: 12px; }
.crewSlots { flex: 1; min-height: 0; margin: 0; gap: 12px; }
.slot { min-height: 145px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 18px 8px; background: linear-gradient(#315352dd, #13353cf0); }
.slot .weapon { width: 100%; height: clamp(80px, 20vh, 220px); flex: 1; min-height: 70px; }
.slot strong { font-size: 15px; }
.slot small { font-size: 11px; margin-top: 5px; }
.slot .number { font-size: 12px; }
.crewVeterans { margin: 0; }
.crewVeterans span { font-size: 11px; padding: 10px 4px; }
.crewSide { display: flex; flex-direction: column; gap: 10px; }
.crewLoadout { min-height: 0; overflow: auto; flex: 1; }
.crewSide .scout { margin: 0 0 12px; padding: 16px; }
.scout strong { font-size: 16px; }
.scout .routeBrief { font-size: 13px; line-height: 1.6; margin: 7px 0 10px; color: #c6d2bb; }
.scout small { font-size: 12px; }
.rowcard strong { font-size: 14px; }
.rowcard small { font-size: 12px; }
.deployFoot .error { margin: 0 0 6px; font-size: 12px; }
.deployFoot .primary { margin-bottom: 4px; }
.crewHint { display: block; text-align: center; font-size: 10px; padding-top: 7px; }
.autopage { grid-template-columns: minmax(0, 1fr) var(--rail-width); grid-template-rows: 42px minmax(0, 1fr); padding: 16px; gap: 12px 18px; }
.autoTop { grid-column: 1 / -1; font-size: 14px; }
.autoTop button { min-width: 44px; font-size: 14px; }
#battleCanvas { grid-column: 1; grid-row: 2; min-width: 0; min-height: 0; }
.autoBottom { grid-column: 2; grid-row: 2; display: flex; flex-direction: column; justify-content: center; gap: 16px; padding: 18px; border: 1px solid #c1a06845; background: linear-gradient(140deg, #2f4944, #142f37); border-radius: 18px; overflow: auto; }
.partyHp { flex-direction: column; gap: 16px; margin: 0; }
.partyHp small { font-size: 13px; }
.partyHp .bar { height: 8px; }
.autoBottom p { font-size: 12px; line-height: 1.6; }
.holdSetup { grid-template-columns: minmax(0, 1.5fr) minmax(220px, .7fr); }
.holdContents { overflow: auto; padding-right: 5px; }
.holdContents .tabs { margin-top: 0; position: sticky; top: 0; z-index: 1; }
.tabs button { font-size: 12px; }
.grid3 { grid-template-columns: repeat(auto-fill, minmax(135px, 1fr)); gap: 12px; }
.catchcard { padding: 12px; }
.catchcard canvas { height: 90px; }
.catchcard strong { font-size: 13px; }
.catchcard small { font-size: 11px; }
.holdNotes { overflow: auto; padding: 20px; background: #173b42c9; border: 1px solid #c9a26338; border-radius: 18px; }
.holdNotes .label { margin-top: 0; font-size: 11px; }
.holdNotes .tags { gap: 8px; }
.holdNotes .routeNote { margin-top: 22px; }
#overlay { inset: 0; padding: max(16px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left)); justify-content: center; background: #061d29c9; }
.panel { width: min(100%, 620px); padding: 24px; background: radial-gradient(ellipse at top left, #345550, #142f37 85%); border: 1px solid #b5955e99; border-radius: 22px; box-shadow: 0 20px 80px #0007; }
.panel h2 { font-family: Georgia, serif; font-size: 32px; }
.panel p { font-size: 13px; }
.panel .primary, .panel > .secondary { min-height: 44px; }
.panel.modalSplit { width: min(100%, 960px); height: min(620px, calc(100dvh - 40px)); display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); gap: 24px; overflow: hidden; }
.modalArt { min-width: 0; min-height: 0; display: grid; place-items: center; background: radial-gradient(ellipse, #52716a6b, #112b3500 75%); }
.modalArt .reveal, .modalArt .gradeArt { width: 100%; height: clamp(170px, 38dvh, 360px); max-height: 100%; margin: 0; }
.modalText { min-height: 0; display: flex; flex-direction: column; overflow: hidden; padding-right: 4px; }
.modalCopy { min-height: 0; flex: 1; overflow: auto; }
.modalActions { flex-shrink: 0; padding-top: 8px; }
.modalActions .primary { margin-top: 0; }
.forgeMaterials, .crewLoadout, .holdContents, .holdNotes, .modalCopy { scrollbar-width: thin; scrollbar-color: #927b53 #15343c; }
.modalText .secondary { width: 100%; margin-top: 10px; }
.modalText .eyebrow { margin-top: 7px; }
.modalText .forgeGrade { margin: 18px 0; }
.gradeRows > div { font-size: 13px; }
.resultrow { font-size: 13px; }
.resultrow small { font-size: 11px; }
.shopPanel { width: min(100%, 1000px); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.shopPanel > .toprow, .shopPanel > .offerHint, .shopPanel > #shopFish { grid-column: 1 / -1; }
.shopPanel .offerHint { margin: 0; }
.shopPanel .upgradeOffer { flex-direction: column; text-align: center; align-items: center; margin: 0; padding: 20px 12px; gap: 10px; }
.shopPanel .upgradeOffer > div { flex: 1; }
.shopPanel .upgradeOffer p { font-size: 12px; }
.shopPanel .upgradeOffer b { font-size: 16px; }
.shopPanel #shopFish { margin-top: 0; }
.logPanel { width: min(100%, 950px); text-align: left; }
.logHeader { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.logHeader h2 { margin: 5px 0; }
.logHeader .secondary { min-width: 44px; font-size: 19px; }
.logTabs { margin: 15px 0 20px; }
.logTabs button { font-size: 13px; }
.logLead { font: 24px/1.4 Georgia, serif; color: #f0d39b; max-width: 650px; margin-bottom: 20px; }
.logOpening { display: grid; grid-template-columns: 1.2fr 1fr; gap: 26px; }
.logOpening p { font-size: 14px; line-height: 1.8; margin: 0 0 14px; }
.loreRule { border-left: 2px solid #c99e555c; padding-left: 16px; margin-bottom: 18px; }
.loreRule strong { color: #e9d0a0; font-size: 14px; }
.loreRule p { font-size: 12px; margin: 4px 0 0; }
.logRoutes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.routeCard { border: 1px solid #91a99630; border-radius: 14px; padding: 18px; background: #0d2d354d; }
.routeCard.current { border-color: #d6b675; background: #d6b6750b; }
.routeCard h3 { margin: 8px 0; font: 21px Georgia, serif; color: #eddbaf; }
.routeCard p { margin: 0 0 9px; line-height: 1.65; }
.routeCard strong { display: block; font-size: 12px; color: #e9d39d; line-height: 1.5; }
.controlTable { width: 100%; border-collapse: collapse; font-size: 13px; }
.controlTable th, .controlTable td { padding: 11px 10px; text-align: left; border-bottom: 1px solid #ffffff13; line-height: 1.5; }
.controlTable th { color: var(--gold); font-size: 11px; letter-spacing: 1px; }
.controlTable td:first-child { color: #f4e2ba; font-weight: 900; }
.controlNote { font-size: 12px; color: #b4ccbb; line-height: 1.7; margin-bottom: 0; }
#toast { max-width: 90%; white-space: normal; text-align: center; font-size: 14px; }
@media (min-width: 1000px) and (min-height: 720px) {
  #app { height: min(100dvh, max(700px, 56.25vw)); max-height: 1080px; border: 1px solid #8b774d4d; }
}
@media (orientation: landscape) and (max-height: 600px) {
  :root { --nav-height: 52px; --rail-width: clamp(170px, 25vw, 220px); }
  nav button { font-size: 20px; min-height: 42px; }
  nav button small, nav .navUtility small { font-size: 9px; margin-top: 0; }
  nav .navUtility { max-width: 84px; font-size: 19px; }
  #fishPage.active { grid-template-rows: 40px minmax(0, 1fr); }
  .waterbar { padding-top: 2px; padding-bottom: 2px; }
  .waterbar button { min-height: 34px; font-size: 11px; }
  .fishBottom { padding: 12px; }
  .baitLabel { margin-bottom: 7px; font-size: 9px; }
  .lures { gap: 6px; }
  .lures button { min-height: 45px; padding: 7px 3px; font-size: 12px; }
  .lures button small { margin-top: 2px; font-size: 8px; }
  .targetline { margin: 12px 0 8px; font-size: 14px; flex-direction: row; align-items: center; gap: 5px; }
  .targetline span:last-child { font-size: 11px; }
  .fishBottom #fishTip { font-size: 10px; min-height: 0; line-height: 1.4; }
  .routeNote { padding-top: 10px; margin-top: 12px; }
  .fishBottom .routeNote { display: none; }
  .widePad { padding: 12px 16px; }
  .forgeSetup, .crewSetup, .holdSetup { grid-template-rows: 32px minmax(0, 1fr); gap: 10px 18px; }
  .widePad h2 { font-size: 25px; }
  .forgePreview { gap: 4px; }
  .forgePreview .preview { min-height: 80px; }
  .forgePreview .primary { padding: 10px; min-height: 43px; }
  .forgeMaterials .label { font-size: 9px; margin: 6px 0 5px; }
  .forgeMaterials .chips { gap: 6px; flex-wrap: nowrap; overflow: auto; padding: 0 0 4px; }
  .chip { min-width: 82px; padding: 6px 8px; }
  .chip strong { font-size: 10px; }
  .chip small { font-size: 9px; margin-top: 1px; }
  .chip .icon { font-size: 18px; height: 20px; }
  .work { padding: 9px 12px; grid-template-rows: 24px minmax(0, 1fr); gap: 7px 12px; }
  .worktop { font-size: 10px; }
  .workControls { padding: 12px; gap: 13px; }
  .workCall { font-size: 21px; }
  .workControls .primary { min-height: 46px; font-size: 12px; }
  .workControls > small { font-size: 10px; }
  .workStageDots { margin-bottom: 2px; }
  .slot { min-height: 100px; padding: 8px 5px; }
  .slot .weapon { min-height: 48px; height: 90px; }
  .slot strong { font-size: 12px; }
  .slot small { font-size: 9px; }
  .crewSlots { gap: 8px; }
  .crewVeterans span { padding: 5px 3px; font-size: 9px; }
  .crewMain { gap: 7px; }
  .crewSide { gap: 3px; }
  .crewSide .scout { padding: 10px; margin-bottom: 8px; }
  .scout strong { font-size: 13px; }
  .scout .routeBrief { font-size: 11px; margin: 4px 0 7px; }
  .crewLoadout .rowcard { padding: 7px; gap: 8px; }
  .rowcard strong { font-size: 12px; }
  .crewSide .tag { font-size: 9px; }
  .deployFoot .primary { padding: 10px; min-height: 42px; }
  .crewHint { display: none; }
  .autopage { padding: 8px 12px; grid-template-rows: 35px minmax(0, 1fr); gap: 6px 12px; }
  .autoTop { font-size: 12px; }
  .autoTop button { min-height: 34px; }
  .autoBottom { padding: 12px; gap: 10px; }
  .partyHp { gap: 9px; }
  .partyHp small { font-size: 11px; }
  .autoBottom p { font-size: 10px; margin: 0; }
  .holdSetup { grid-template-columns: minmax(0, 1.5fr) minmax(180px, .7fr); }
  .holdNotes { padding: 12px; }
  .holdNotes .tag { font-size: 9px; }
  .holdNotes .routeNote { display: none; }
  .grid3 { grid-template-columns: repeat(auto-fill, minmax(105px, 1fr)); gap: 8px; }
  .catchcard { padding: 7px; }
  .catchcard canvas { height: 65px; }
  .catchcard strong { font-size: 11px; }
  .catchcard small { font-size: 9px; }
  #overlay { padding: 10px max(14px, env(safe-area-inset-right)) 10px max(14px, env(safe-area-inset-left)); }
  .panel { padding: 16px; border-radius: 16px; }
  .panel h2 { font-size: 25px; margin: 6px 0 10px; }
  .panel.modalSplit { gap: 15px; max-height: 100%; }
  .modalArt .reveal, .modalArt .gradeArt { height: min(68dvh, 270px); }
  .modalText .forgeGrade { gap: 16px; margin: 10px 0; }
  .forgeGrade b { font-size: 29px; }
  .shopPanel { gap: 8px; }
  .shopPanel .upgradeOffer { padding: 10px; gap: 5px; }
  .shopPanel .upgradeIcon { font-size: 23px; }
  .shopPanel .upgradeOffer strong { font-size: 13px; }
  .shopPanel .upgradeOffer p { font-size: 10px; }
  .shopPanel .upgradeOffer b { font-size: 13px; }
  .shopPanel #shopFish { min-height: 42px; padding: 10px; }
  .logTabs { margin: 8px 0 12px; }
  .logTabs button { min-height: 36px; font-size: 11px; }
  .logLead { font-size: 20px; }
  .logOpening { gap: 18px; }
  .logOpening p { font-size: 12px; line-height: 1.65; }
  .loreRule strong { font-size: 12px; }
  .loreRule p { font-size: 11px; }
  .controlTable { font-size: 11px; }
  .controlTable th, .controlTable td { padding: 8px; }
}
@media (orientation: portrait) {
  :root { --nav-height: 62px; }
  #app { width: 100vw; height: 100dvh; grid-template-rows: 30px minmax(0, 1fr) var(--nav-height); }
  #rotateNotice { display: flex; align-items: center; justify-content: center; background: #e7c17a; color: #163b42; font-size: 11px; font-weight: 900; padding: 4px; }
  #fishPage.active { grid-template-columns: minmax(0, 1fr); grid-template-rows: 44px minmax(0, 1fr) 118px; }
  .canvasbox { grid-column: 1; grid-row: 2; }
  .fishBottom { grid-column: 1; grid-row: 3; padding: 9px 14px; display: block; border-left: 0; border-top: 1px solid #b28e5150; overflow: hidden; }
  .baitLabel, .fishBottom .routeNote, .lures button small { display: none; }
  .lures { display: flex; gap: 6px; }
  .lures button { min-height: 38px; padding: 6px 3px; font-size: 10px; }
  .targetline { flex-direction: row; margin: 8px 0 5px; font-size: 12px; }
  .targetline span:last-child { font-size: 11px; }
  .linebar { margin-bottom: 6px; }
  .fishBottom #fishTip { font-size: 10px; text-align: center; line-height: 1.4; min-height: 0; }
  nav { padding-left: 0; padding-right: 0; }
  nav button, nav .navUtility { min-width: 0; max-width: none; font-size: 21px; }
  nav button small, nav .navUtility small { font-size: 8px; }
  .widePad { padding: 18px; height: auto; }
  .forgeSetup, .crewSetup, .holdSetup { display: flex; flex-direction: column; overflow: visible; gap: 16px; }
  .forgePreview .preview { height: 180px; min-height: 180px; }
  .forgeMaterials { overflow: visible; }
  .forgeMaterials .chips { flex-wrap: nowrap; overflow: auto; }
  .work { padding: 12px; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: 24px minmax(0, 1fr) 132px; gap: 8px; }
  #workCanvas { grid-column: 1; grid-row: 2; }
  .workControls { grid-column: 1; grid-row: 3; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto auto; gap: 5px 12px; padding: 12px; align-items: center; }
  .workStageDots { display: none; }
  .workCall { font-size: 20px; }
  .workControls > small { grid-column: 1 / -1; font-size: 10px; }
  .workControls .primary { min-height: 48px; font-size: 12px; }
  .crewSlots { min-height: 180px; }
  .crewSide { overflow: visible; }
  .crewLoadout { overflow: visible; }
  .autopage { grid-template-columns: minmax(0, 1fr); grid-template-rows: 40px minmax(0, 1fr) 100px; padding: 12px; }
  #battleCanvas { grid-column: 1; grid-row: 2; }
  .autoBottom { grid-column: 1; grid-row: 3; padding: 9px; gap: 5px; }
  .partyHp { flex-direction: row; gap: 8px; }
  .partyHp small { font-size: 10px; }
  .autoBottom p { font-size: 9px; margin: 0; }
  .holdContents { overflow: visible; }
  .grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .catchcard { padding: 8px 4px; }
  .catchcard canvas { height: 65px; }
  .catchcard strong { font-size: 11px; }
  .catchcard small { font-size: 9px; }
  #overlay { padding: 14px; }
  .panel { padding: 20px; }
  .panel.modalSplit { display: block; height: auto; overflow: auto; }
  .modalArt .reveal, .modalArt .gradeArt { height: 170px; }
  .modalText { display: block; overflow: visible; padding: 0; }
  .modalCopy { overflow: visible; }
  .shopPanel { display: block; }
  .shopPanel .upgradeOffer { flex-direction: row; text-align: left; padding: 13px; margin: 10px 0; }
  .shopPanel .upgradeOffer p { font-size: 11px; }
  .logOpening, .logRoutes { grid-template-columns: 1fr; }
  .logLead { font-size: 22px; }
  .logHeader h2 { font-size: 25px; }
  .controlTable { font-size: 11px; }
  .controlTable th, .controlTable td { padding: 8px 5px; }
}
@media (prefers-reduced-motion: reduce) {
  .upgradeOffer { animation: none; }
  #toast { transition: none; }
}
