/* Compact, readable touch telemetry. Only the backing is translucent. */
#stage[data-input="touch"] {
  --status-width: 156px;
  --hand-width: 120px;
  --finish-stack: 188px;
  --hand-bottom: calc(106px + env(safe-area-inset-bottom));
  --hud-ceiling: calc(204px + env(safe-area-inset-top));
}
#stage[data-input="touch"] .casting-panel,
#stage[data-input="touch"]:not([data-phase="finish"]) .fishing-hud {
  left: max(8px, env(safe-area-inset-left)); right: auto; top: auto;
  bottom: var(--hand-bottom); width: var(--status-width); padding: 8px;
  border: 1px solid transparent; border-radius: 10px;
  /* Percentages refer to this card, not the viewport. Clamp at the header. */
  transform: translateY(max(-50%, calc(100% + var(--hand-bottom) + var(--hud-ceiling) - 100svh)));
}
#stage[data-input="touch"] .casting-heading { font-size: 10px; gap: 4px; color: #f1fbff; }
#stage[data-input="touch"] .casting-heading strong { font-size: 10px; color: #ffe3a0; }
#stage[data-input="touch"] .landing-readout { gap: 3px 6px; margin-top: 5px; flex-wrap: wrap; }
#stage[data-input="touch"] .landing-readout strong { font-size: 12px; letter-spacing: 0; }
#stage[data-input="touch"] .landing-readout output { font-size: 12px; color: #ffe3a0; }
#stage[data-input="touch"] .cast-odds { font-size: 10px; line-height: 1.4; margin-top: 4px; color: #f1fbff; overflow-wrap: anywhere; }
#stage[data-input="touch"] .casting-panel .charge-box { margin-top: 8px; color: #f1fbff; }
#stage[data-input="touch"] .casting-panel .charge-box > span { font-size: 11px; }
#stage[data-input="touch"] .casting-panel .charge-track { height: 10px; margin-top: 5px; }
#stage[data-input="touch"] #cast-instruction,
#stage[data-input="touch"] .casting-rule,
#stage[data-input="touch"] .action-shortcut,
#stage[data-input="touch"] #phase-description,
#stage[data-input="touch"] .meter-tip,
#stage[data-input="touch"] .fishing-hud h2,
#stage[data-input="touch"] .phase-label .live-dot,
#stage[data-input="touch"] .stage-bottomline,
#stage[data-input="touch"] #cast-button > [data-icon],
#stage[data-input="touch"] .action-button > [data-icon] { display: none; }
#stage[data-input="touch"] .aim-readout { gap: 3px; flex-wrap: wrap; margin-top: 5px; color: #f1fbff; font-size: 10px; line-height: 1.35; }
#stage[data-input="touch"] .aim-readout output { margin-left: auto; color: #ffe3a0; font-size: 11px; }
#stage[data-input="touch"] #cast-button,
#stage[data-input="touch"] .action-button {
  min-width: 44px; min-height: 44px; margin-top: 8px;
  padding: 6px 3px; font-size: 12px; line-height: 1.35; gap: 4px;
  touch-action: none; word-break: keep-all; text-shadow: none;
}
#stage[data-input="touch"] .phase-label { font-size: 11px; line-height: 1.4; flex-wrap: wrap; gap: 3px 6px; letter-spacing: 0; color: #f1fbff; }
#stage[data-input="touch"] .timer { font-size: 12px; color: #ffe3a0; white-space: nowrap; }
#stage[data-input="touch"] .fight-meters { margin-top: 7px; }
#stage[data-input="touch"] .meter-caption { font-size: 11px; line-height: 1.35; margin-bottom: 4px; gap: 3px; flex-wrap: wrap; color: #f1fbff; }
#stage[data-input="touch"] .meter-caption strong { font-size: 11px; font-variant-numeric: tabular-nums; }
#stage[data-input="touch"] .tension-caption { margin-top: 7px; }
#stage[data-input="touch"] .meter { height: 9px; }
#stage[data-input="touch"] .fight-status { margin-top: 8px; gap: 5px; font-size: 11px; }
#stage[data-input="touch"] .fight-status > div { display: block; }
#stage[data-input="touch"] .fight-status dt { display: inline; margin-right: 4px; }
#stage[data-input="touch"] .fight-status dd { display: inline; color: #f1fbff; }
#stage[data-input="touch"] .fight-status .equipment-readout dd { margin-top: 0; }
#stage[data-input="touch"] .danger-text { color: #ffe1a1 !important; }
/* Pause stays in the topline, never under the moving left-hand card. */
#stage[data-input="touch"] .pause-button { position: static; min-width: 44px; min-height: 44px; margin-left: auto; }

@media (orientation: portrait) {
  #stage[data-input="touch"] {
    --hand-width: 120px;
    --hand-bottom: calc(clamp(112px, 20svh, 220px) + env(safe-area-inset-bottom));
  }
  #stage[data-input="touch"] .casting-panel,
  #stage[data-input="touch"]:not([data-phase="finish"]) .fishing-hud {
    left: env(safe-area-inset-left, 0px); border-left: 0; border-radius: 0 12px 12px 0;
  }
  #stage[data-input="touch"] .finish-board {
    left: env(safe-area-inset-left, 0px); right: auto; top: auto;
    bottom: var(--hand-bottom); width: var(--hand-width); height: 180px;
  }
  #stage[data-input="touch"][data-phase="finish"] .fishing-hud {
    left: env(safe-area-inset-left, 0px); right: auto; top: auto;
    bottom: calc(var(--hand-bottom) + 188px); width: var(--hand-width);
    padding: 7px 6px; border: 1px solid transparent; border-left: 0; border-radius: 0 10px 10px 0;
  }
}
@media (max-width: 600px) and (orientation: portrait) {
  #stage[data-input="touch"] {
    --hand-width: 76px;
    --status-width: 136px;
    --hand-bottom: calc(clamp(112px, 16svh, 150px) + env(safe-area-inset-bottom));
  }
}
@media (orientation: landscape) {
  #stage[data-input="touch"] {
    --hand-width: 112px;
    --finish-stack: 164px;
    --hand-bottom: calc(106px + env(safe-area-inset-bottom));
  }
  #stage[data-input="touch"] .finish-board {
    left: max(8px, env(safe-area-inset-left)); right: auto; top: auto;
    bottom: var(--hand-bottom); width: var(--hand-width); height: 156px;
  }
  #stage[data-input="touch"][data-phase="finish"] .fishing-hud {
    left: max(8px, env(safe-area-inset-left)); right: auto; top: auto;
    bottom: calc(var(--hand-bottom) + 164px); width: var(--hand-width); padding: 6px;
  }
}
/* A two-column readout fits short landscape screens without tiny type. */
@media (max-height: 500px) and (orientation: landscape) {
  #stage[data-input="touch"] {
    --status-width: 260px;
    --hand-bottom: calc(106px + env(safe-area-inset-bottom));
    --hud-ceiling: calc(86px + env(safe-area-inset-top));
  }
  #stage[data-input="touch"] .location,
  #stage[data-input="touch"] .weather { display: none; }
  #stage[data-input="touch"] .stage-topline { top: calc(86px + env(safe-area-inset-top)); }
  #stage[data-input="touch"] .casting-panel,
  #stage[data-input="touch"]:not([data-phase="finish"]) .fishing-hud { padding: 4px; }
  #stage[data-input="touch"] .casting-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; }
  #stage[data-input="touch"] .casting-heading { grid-column: 1 / -1; }
  #stage[data-input="touch"] .landing-readout { margin: 0; }
  #stage[data-input="touch"] .cast-odds { margin: 0; }
  #stage[data-input="touch"] .casting-panel .charge-box { grid-column: 1; grid-row: 3; margin: 0; }
  #stage[data-input="touch"] #cast-button { grid-column: 2; grid-row: 3 / 5; margin: 0; }
  #stage[data-input="touch"] .aim-readout { grid-column: 1; margin: 0; }
  #stage[data-input="touch"] .fight-meters { display: grid; grid-template-columns: 1fr 1fr; column-gap: 10px; margin-top: 2px; }
  #stage[data-input="touch"] .meter-caption { grid-column: 1; margin-bottom: 3px; font-size: 10px; }
  #stage[data-input="touch"] .meter { grid-column: 1; height: 8px; }
  #stage[data-input="touch"] .tension-caption { margin-top: 5px; }
  #stage[data-input="touch"] .fight-status { grid-column: 2; grid-row: 1 / 5; gap: 1px; margin: 0; font-size: 10px; line-height: 1.2; }
  #stage[data-input="touch"] .fight-status dt { font-size: 10px; }
  #stage[data-input="touch"] .fight-status .equipment-readout { display: block; }
  #stage[data-input="touch"] .fight-status .equipment-readout dd { margin: 0; }
  #stage[data-input="touch"] .phase-label { font-size: 10px; line-height: 1.2; }
  #stage[data-input="touch"] .timer { font-size: 11px; }
  #stage[data-input="touch"] .action-button { margin-top: 2px; }
  #stage[data-input="touch"][data-phase="finish"] { --hand-bottom: max(24px, env(safe-area-inset-bottom)); }
}
#stage[data-input="touch"][data-phase="finish"] .fishing-hud {
  /* Lift only the readout; the ordered 44–64px recovery targets stay put. */
  transform: translateY(max(-50%, calc(100% + var(--hand-bottom) + var(--finish-stack) + var(--hud-ceiling) - 100svh)));
}
#stage[data-input="touch"][data-phase="finish"] #phase-caption {
  font-size: 12px; font-weight: 800; letter-spacing: 0; white-space: nowrap;
}
#stage[data-input="touch"][data-phase="finish"] .timer { width: 100%; margin-left: 0; }
#stage[data-input="touch"][data-phase="finish"] .finish-countdown { margin-top: 5px; }
#stage[data-input="touch"] .casting-panel,
#stage[data-input="touch"][data-phase] .fishing-hud {
  background: rgb(10 34 48 / 10%);
  border-color: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  color: #f1fbff;
  text-shadow: 0 1px 2px #071c30, 0 0 4px #071c30cc;
}
.audio-settings { display: grid; gap: 20px; padding: 12px 0; }
.audio-settings label { display: grid; gap: 8px; font-weight: 700; }
.audio-settings input { width: 100%; min-height: 44px; accent-color: #287c89; }
.audio-settings output { font-variant-numeric: tabular-nums; }
.audio-settings p { font-size: 12px; line-height: 1.8; color: #526d78; }
