/* WebGL play-space overlays. The water, landscape, rod and fish live in 3D. */
.game-shell, .ocean-stage { min-height: 100svh; }
.game-shell:has(#stage[data-phase="title"]) .topbar,
.game-shell:has(#stage[data-phase="title"]) .dock-bar,
.ocean-stage[data-phase="title"] .stage-topline,
.ocean-stage[data-phase="title"] .stage-bottomline { visibility: hidden; pointer-events: none; }

.casting-panel {
  position: absolute; z-index: 4; left: 28px; bottom: 134px; width: 306px;
  padding: 18px; color: #e9f7ef; background: #102d43ed;
  border: 2px solid #b4c7b6; border-radius: 12px; box-shadow: 0 5px 0 #091e30b3;
}
.casting-heading { display: flex; justify-content: space-between; align-items: center; font-size: 10px; color: #9bb9c6; }
.casting-heading strong { font-size: 11px; letter-spacing: .06em; color: #a6c9d4; }
.casting-heading strong[data-grade="GOOD"] { color: #60e4bc; }
.casting-heading strong[data-grade="PERFECT"] { color: #ffda72; }
.landing-readout { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; margin-top: 10px; }
.landing-readout strong { font-size: 20px; letter-spacing: -.8px; }
.landing-readout output { font-size: 17px; color: #ffdf87; font-weight: 800; font-variant-numeric: tabular-nums; }
.cast-odds { font-size: 10px; margin-top: 5px; color: #c1d6dc; font-variant-numeric: tabular-nums; }
.casting-panel .charge-box { max-width: none; padding: 0; border: 0; box-shadow: none; background: none; margin: 17px 0 0; color: #dae9e5; }
.casting-panel .charge-box > span { font-size: 10px; }
.casting-panel .charge-box small { font-size: 9px; color: #bacbd1; min-height: 15px; }
.casting-panel .charge-track { height: 15px; background: #061e31; border: 1px solid #668ca0; border-radius: 4px; overflow: visible; }
.casting-panel .charge-track > i { position: relative; background: #a4d5ed55; border-radius: 3px; z-index: 1; }
.casting-panel .charge-track > i:after { content: ''; position: absolute; right: 0; width: 3px; top: -4px; bottom: -4px; background: #fff9d2; border-radius: 2px; box-shadow: 0 0 0 1px #1a3850; }
#cast-sweet-spots { position: absolute; inset: 0; display: block; pointer-events: none; }
#cast-sweet-spots i { position: absolute; height: 100%; background: var(--spot-color); opacity: .8; border-inline: 1px solid #f3ffea; }
.aim-readout { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-top: 9px; font-size: 10px; color: #b8cdd4; line-height: 1.5; }
.aim-readout kbd { font-size: 9px; padding: 1px 5px; }
.aim-readout output { color: #f7e8b4; font-size: 11px; white-space: nowrap; }
#cast-button { width: 100%; min-height: 51px; margin-top: 12px; padding: 11px; border-color: #071e30; font-size: 14px; }
.casting-panel.charging #cast-button { background: #ffe3a0; }
.casting-rule { margin-top: 10px; font-size: 9px; color: #91b1c0; line-height: 1.6; }
/* Bright full-size casting card; compact touch controls keep their own alpha. */
#stage:not([data-input="touch"]) .casting-panel {
  background: rgb(231 246 252 / 90%); color: #173d53;
  border-color: #c6e5ef; box-shadow: 0 4px 12px #173d5326;
}
#stage:not([data-input="touch"]) .casting-panel .casting-heading,
#stage:not([data-input="touch"]) .casting-panel .cast-odds,
#stage:not([data-input="touch"]) .casting-panel .charge-box,
#stage:not([data-input="touch"]) .casting-panel .charge-box small,
#stage:not([data-input="touch"]) .casting-panel .aim-readout,
#stage:not([data-input="touch"]) .casting-panel .casting-rule { color: #385d70; }
#stage:not([data-input="touch"]) .casting-panel .casting-heading strong,
#stage:not([data-input="touch"]) .casting-panel .landing-readout output,
#stage:not([data-input="touch"]) .casting-panel .aim-readout output { color: #225d78; }
#stage:not([data-input="touch"]) .casting-panel .casting-heading strong[data-grade="GOOD"] { color: #087451; }
#stage:not([data-input="touch"]) .casting-panel .casting-heading strong[data-grade="PERFECT"] { color: #915900; }
.world-labels { position: absolute; inset: 0; z-index: 2; pointer-events: none; overflow: hidden; }
.world-label { position: absolute; transform: translate(-50%, calc(-100% - 10px)); padding: 6px 9px; background: #122e43e8; border: 1px solid var(--spot-color); border-radius: 5px; color: #fffbea; font-size: 11px; white-space: nowrap; text-align: center; box-shadow: 0 3px 8px #10283a55; }
.world-label:after { content: ''; position: absolute; width: 1px; height: 9px; bottom: -10px; left: 50%; background: var(--spot-color); }
.world-label small { display: block; color: var(--spot-color); font-size: 8px; margin-top: 3px; }
.landing-banner { position: absolute; left: 50%; top: 21%; transform: translateX(-50%); z-index: 4; max-width: calc(100% - 30px); border: 2px solid #7bb6c3; border-radius: 8px; padding: 10px 16px; background: #123248ed; color: #e4f7ec; font-size: 12px; font-weight: 800; text-align: center; pointer-events: none; }
.landing-banner[data-grade="PERFECT"] { border-color: #f6cc69; color: #ffe69d; }
.landing-banner[data-grade="GOOD"] { border-color: #5cdfb6; }
.fishing-hud { left: 28px; top: auto; bottom: 134px; width: 310px; padding: 19px; }
.fishing-hud h2 { font-size: 24px; margin-top: 10px; }
.fishing-hud > p { font-size: 10px; }
.fishing-hud .fight-meters { margin-top: 16px; }
.fishing-hud .action-button { margin-top: 17px; }
.fishing-hud .meter-tip { font-size: 9px; }
.fight-status { display: grid; gap: 5px; margin: 12px 0 0; font-size: 11px; line-height: 1.4; font-variant-numeric: tabular-nums; }
.fight-status > div { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 2px 8px; min-width: 0; }
.fight-status dt { font-weight: 600; }
.fight-status dd { margin: 0; font-weight: 800; overflow-wrap: anywhere; }
.fight-status .equipment-readout { display: block; }
.fight-status .equipment-readout dd { margin-top: 2px; font-weight: 600; }
.fish-card-art > img { width: 100%; height: 108px; object-fit: contain; }
.record-row > img { width: 65px; height: 48px; object-fit: contain; }
.result-art > canvas { display: block; position: absolute; inset: 0; width: 100% !important; height: 100% !important; pointer-events: none; }
.result-art .record-badge { z-index: 2; }
.result-card { max-height: calc(100svh - 140px); overflow-y: auto; overscroll-behavior: contain; }
.portrait-unavailable { font-size: 10px; color: #607e85; }
.webgl-error { position: absolute; z-index: 25; inset: 0; padding: 30px; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 18px; background: #f6f3e9f7; text-align: center; }
.webgl-error h2 { font-size: 23px; }
.webgl-error p { max-width: 440px; font-size: 13px; line-height: 1.9; color: #526d78; }
.webgl-error button { margin-top: 10px; }
@media (max-width: 760px) {
  .casting-panel { left: 14px; right: 14px; bottom: 116px; width: auto; padding: 14px 15px; }
  .casting-heading { font-size: 9px; }
  .landing-readout { margin-top: 5px; }
  .landing-readout strong { font-size: 17px; }
  .landing-readout output { font-size: 15px; }
  .casting-panel .charge-box { margin-top: 11px; }
  .aim-readout { margin-top: 7px; }
  .casting-rule { margin-top: 7px; font-size: 8px; }
  .world-label { font-size: 9px; padding: 5px; }
  .world-label small { font-size: 7px; }
  .landing-banner { font-size: 10px; top: 19%; padding: 8px 12px; }
  .fishing-hud { left: 14px; bottom: 116px; top: auto; width: calc(100% - 28px); padding: 16px; }
  .fishing-hud h2 { font-size: 22px; }
  .fishing-hud > #phase-description { font-size: 9px; margin-top: 5px; }
  .fishing-hud .fight-meters { margin-top: 12px; }
  .fishing-hud .action-button { min-height: 50px; margin-top: 12px; }
  .fishing-hud .action-shortcut { margin-top: 7px; }
  .record-row > img { width: 55px; }
  .stage-bottomline { bottom: 100px; }
}
@media (max-height: 700px) {
  .casting-panel { bottom: 110px; padding: 11px 15px; }
  .casting-rule { display: none; }
  .casting-panel .charge-box { margin-top: 9px; }
  .aim-readout { margin-top: 7px; }
  .fishing-hud { bottom: 110px; padding: 14px; }
  .fishing-hud > #phase-description { display: none; }
  .fishing-hud h2 { font-size: 21px; }
  .fishing-hud .fight-meters { margin-top: 10px; }
  .fishing-hud .action-button { margin-top: 12px; min-height: 46px; padding-block: 10px; }
  .fishing-hud .action-shortcut { display: none; }
}

/* Mobile finishing is a full play-space tap sequence, not a tiny keyboard. */
.finish-board {
  position: absolute; z-index: 5; left: max(14px, env(safe-area-inset-left));
  right: max(14px, env(safe-area-inset-right));
  top: calc(152px + env(safe-area-inset-top)); bottom: max(24px, env(safe-area-inset-bottom));
  pointer-events: none;
}
.finish-target {
  position: absolute; transform: translate(-50%, -50%); width: 64px; height: 64px;
  display: grid; place-items: center; padding: 0; border: 3px solid #f4e6bb;
  border-radius: 50%; background: #153e55; color: #fff7dd;
  font-size: 27px; font-weight: 800; font-variant-numeric: tabular-nums;
  box-shadow: 0 4px 0 #061d2a, 0 0 0 4px #102b4480;
  pointer-events: auto; touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.finish-target.current { background: #ffcf65; border-color: #fff6c2; color: #193745; box-shadow: 0 4px 0 #7b5024, 0 0 0 5px #fff5bb80; }
.finish-target.complete { background: #2c7766; border-color: #8de2bf; color: #b5e7cf; opacity: .65; box-shadow: none; }
.finish-target.complete:after { content: '✓'; position: absolute; top: -9px; right: -5px; width: 24px; height: 24px; border-radius: 50%; background: #b8f1ce; color: #144c3b; font-size: 16px; line-height: 24px; }
.finish-target:not(:disabled):active { transform: translate(-50%, -50%) scale(.94); }
.finish-board.wrong .finish-target.current { animation: finish-tap-error .3s ease-out; }
@keyframes finish-tap-error { 0%, 50% { background: #ef725f; } }
#stage[data-input="touch"][data-phase="finish"] .fishing-hud {
  top: calc(78px + env(safe-area-inset-top)); bottom: auto; left: 14px; right: 90px;
  width: auto; padding: 12px 14px; z-index: 6;
}
#stage[data-input="touch"][data-phase="finish"] .fishing-hud h2,
#stage[data-input="touch"][data-phase="finish"] #phase-description,
#stage[data-input="touch"][data-phase="finish"] #finish-help,
#stage[data-input="touch"][data-phase="finish"] .stage-bottomline,
#stage[data-input="touch"][data-phase="finish"] .location { display: none; }
#stage[data-input="touch"][data-phase="finish"] .finish-area { margin-top: 0; }
#stage[data-input="touch"][data-phase="finish"] .stage-topline { justify-content: flex-end; }
#stage[data-input="touch"][data-phase="finish"] .finish-countdown { margin-top: 9px; }
.game-shell:has(#stage[data-input="touch"][data-phase="finish"]) .dock-bar { visibility: hidden; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .finish-board.wrong .finish-target.current { animation: none; } }

/* A result must expose its actions without an off-screen landscape scroll. */
@media (max-height: 500px) and (orientation: landscape) {
  .game-shell:has(#stage:is([data-phase="success"], [data-phase="miss"])) .dock-bar,
  .game-shell:has(#stage:is([data-phase="success"], [data-phase="miss"])) .brand {
    visibility: hidden; pointer-events: none;
  }
  #stage:is([data-phase="success"], [data-phase="miss"]) .stage-bottomline { display: none; }
  #stage:is([data-phase="success"], [data-phase="miss"]) .legend-slots {
    top: max(8px, env(safe-area-inset-top)); left: max(12px, env(safe-area-inset-left)); right: auto;
  }
  .result-card:not([hidden]) {
    display: grid; grid-template-columns: minmax(140px, .9fr) minmax(220px, 1.1fr); gap: 3px 12px;
    width: min(740px, calc(100% - 24px)); max-width: none; padding: 10px 12px;
    top: calc(78px + env(safe-area-inset-top)); transform: translateX(-50%); z-index: 7;
    max-height: calc(100svh - 90px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  }
  .result-card > * { grid-column: 2; }
  .result-card .result-eyebrow { grid-column: 1 / -1; }
  .result-card .result-art, .result-card .miss-art {
    grid-column: 1; grid-row: 2 / 7; height: 100%; min-height: 120px; max-height: 210px; margin: 0;
  }
  .result-card .rarity-pill { justify-self: start; }
  .result-card h2 { font-size: 20px; margin: 0; }
  .result-card .result-stats { margin: 2px 0; padding: 6px; }
  .result-card .result-stats strong { font-size: 18px; }
  .result-card .result-actions { gap: 8px; }
  .result-card .result-actions button { min-height: 44px; padding: 8px; }
  .result-card .result-link { min-height: 44px; margin: 0; }
  .result-card .result-note { margin: 3px 0; }
  #stage[data-phase="success"] .result-note { display: none; }
}
@media (max-width: 760px) and (min-height: 501px) {
  #stage:is([data-phase="success"], [data-phase="miss"]) .stage-topline { visibility: hidden; }
  #stage:is([data-phase="success"], [data-phase="miss"]) .legend-slots {
    top: calc(78px + env(safe-area-inset-top));
  }
  #stage:is([data-phase="success"], [data-phase="miss"]) .result-card {
    top: calc(146px + env(safe-area-inset-top)); transform: translateX(-50%); padding: 16px;
    max-height: calc(100svh - 236px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  }
  .result-card .result-art { height: 100px; }
  .result-card .result-link { min-height: 44px; }
}


