.rockpool-dialog {
  width: min(760px, calc(100vw - 24px));
  overflow: auto;
}

.rockpool-dialog .fishing-controls {
  display: flex;
  align-items: end;
  gap: .6rem;
  flex-wrap: wrap;
}

.rockpool-dialog canvas {
  display: block;
  width: 100%;
  max-height: 30dvh;
  object-fit: contain;
  border: 2px solid #395a54;
  background: #376f76;
  image-rendering: pixelated;
}

.rockpool-readout, .rockpool-patches {
  display: grid;
  gap: .25rem;
  margin: .35rem 0;
  padding-inline: .65rem;
}

.rockpool-patches {
  grid-template-columns: repeat(4, minmax(44px, 1fr));
}

.rockpool-patches button[aria-pressed=true] {
  background: #3d645b;
  color: #fff3d0;
}

.rockpool-dialog :is([data-rock-message], [data-rock-notes]) {
  margin: .25rem 0 0;
  font-size: .9rem;
}

.rockpool-dialog .fishing-controls, .rockpool-dialog > [data-rock-message] {
  padding-inline: .65rem;
  padding-block-end: .4rem;
}

.rockpool-dialog [data-rock-message]:empty { display: none; }

@media (max-height: 480px) and (orientation: landscape) {
  .rockpool-dialog canvas { max-height: 23dvh; }
  .rockpool-patches { grid-template-columns: repeat(6, minmax(44px, 1fr)); }
}

.fishing-hud {
  --fish-ink: #213e3a;
  --fish-paper: #f8efd8;
  --fish-line: #bdc4a7;
  --fish-green: #356a55;
  --fish-accent: #d4df9e;
  --fish-gold: #f4cf83;
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.fishing-hud[hidden], .fishing-hud [hidden] { display: none; }

.world-canvas-wrap:has(.fishing-hud:not([hidden])) #room-notices {
  inset: .58rem .62rem auto auto;
  max-width: min(15rem, calc(100% - 21rem));
}

@media (max-width: 680px) {
  .world-canvas-wrap:has(.fishing-hud:not([hidden])) #room-notices {
    z-index: 2;
    inset: auto .62rem 4.15rem auto;
    max-width: min(15rem, calc(100% - 1.24rem));
  }
}

.fishing-panel {
  position: absolute;
  top: .55rem;
  left: .55rem;
  width: min(19.5rem, calc(100% - 1.25rem));
  max-height: calc(100% - 1.25rem);
  padding: .52rem .62rem .6rem;
  overflow: auto;
  border: 2px solid var(--fish-ink);
  background: var(--fish-paper);
  color: var(--fish-ink);
  box-shadow: 4px 4px #203c399e;
  font-size: .82rem;
  line-height: 1.25;
  pointer-events: auto;
}

.fishing-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .6rem;
  margin: -.52rem -.62rem .55rem;
  padding: .44rem .56rem;
  border-bottom: 2px solid var(--fish-line);
  background: #dfe6cb;
}

.fishing-head h2 { margin: 0; font-size: 1.1rem; line-height: 1.22; }
.fishing-head [data-fish-place] { color: #3b5448; font-size: .76rem; }
.fishing-head [data-fish-place]:empty,
.fishing-hud p:empty,
.fishing-tips span:empty { display: none; }

.fishing-button {
  flex: none;
  min-height: 44px;
  padding: .38rem .58rem;
  border: 2px solid var(--fish-ink);
  background: #fff4d8;
  color: var(--fish-ink);
  box-shadow: inset 0 -3px #d7c8a4, 2px 2px var(--fish-ink);
  font: inherit;
  font-weight: 750;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.fishing-button:hover { background: #fff8e7; }
.fishing-button:active,
.fishing-action[aria-pressed='true'] {
  transform: translate(1px, 1px);
  box-shadow: inset 0 -1px #c5b586, 1px 1px var(--fish-ink);
}
.fishing-hud :is(button, select):focus-visible { outline: 2px solid #3478a8; outline-offset: 2px; }

.fishing-signal {
  display: flex;
  align-items: center;
  gap: .38rem;
  margin: 0 0 .48rem;
  font-weight: 780;
}
.fishing-signal::before {
  content: '';
  display: block;
  flex: none;
  width: .52rem;
  height: .52rem;
  background: #51816a;
  box-shadow: inset 0 -.15rem #213e3a70;
}
.fishing-hud:is([data-stage='bite'], [data-cue='ease']) .fishing-signal::before { background: #dfa751; }

.fishing-choices, .fishing-tips {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .34rem .52rem;
}
.fishing-choices label {
  display: grid;
  gap: .22rem;
  font-size: .77rem;
  font-weight: 700;
}
.fishing-choices select {
  min-width: 0;
  min-height: 44px;
  width: 100%;
  padding: .2rem .32rem;
  border: 1px solid #637c69;
  border-radius: 0;
  background: #fff9eb;
  color: var(--fish-ink);
  font: inherit;
}
.fishing-tips { margin-top: .32rem; color: #435649; font-size: .73rem; }
.fishing-odds {
  margin-top: .52rem;
  padding: .32rem .42rem;
  border-inline-start: .22rem solid var(--fish-green);
  background: #e8ead1;
}
.fishing-odds strong {
  float: inline-end;
  font-variant-numeric: tabular-nums;
}

.fishing-fight { display: grid; gap: .32rem; }
.fishing-meter { display: grid; gap: .25rem; font-size: .77rem; font-weight: 720; }
.fishing-meter progress { width: 100%; height: .56rem; accent-color: var(--fish-green); }
.fishing-tension {
  position: relative;
  height: .54rem;
  border: 1px solid var(--fish-ink);
  background: linear-gradient(to right, #9fbdce 0% 18%, #83aa78 18% 76%, #ddb669 76% 92%, #b96150 92%);
}
.fishing-tension::after {
  content: '';
  position: absolute;
  top: -.18rem;
  bottom: -.18rem;
  left: clamp(2px, var(--needle, 2px), calc(100% - 2px));
  width: 4px;
  transform: translateX(-50%);
  background: #fff9ea;
  outline: 1px solid var(--fish-ink);
}
.fishing-fight p, .fishing-message { font-size: .76rem; color: #435649; }
.fishing-message { margin-top: .35rem; }

.fishing-catch {
  display: grid;
  grid-template-columns: minmax(3.6rem, 5.5rem) minmax(0, 1fr);
  gap: .55rem;
  align-items: center;
  padding: .38rem;
  border: 1px solid #a5af93;
  background: #e5e9cd;
}
.fishing-catch canvas {
  max-width: 100%;
  height: auto;
  image-rendering: pixelated;
  background: #d2e2cb;
  border: 1px solid #9fb49f;
}
.fishing-catch strong { font-size: .96rem; }
.fishing-catch [data-fish-details] { margin-top: .16rem; color: #3b5448; }
.fishing-record-tag {
  width: fit-content;
  margin-top: .26rem;
  padding: .14rem .27rem;
  background: #eecd83;
  font-size: .72rem;
  font-weight: 750;
}

.fishing-log-toggle { margin-top: .48rem; }
.fishing-log > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .36rem;
}
.fishing-log [data-fish-log-count] { color: #3d6453; font-variant-numeric: tabular-nums; }
.fishing-log [data-fish-log-empty] { margin-top: .48rem; }
.fishing-log ol { display: grid; gap: .2rem; padding: 0; margin: .5rem 0 0; list-style: none; }
.fishing-log li { display: grid; gap: .14rem; padding: .31rem .38rem; background: #eaeacf; }
.fishing-log li span { color: #435649; font-size: .77rem; }

.fishing-action {
  position: absolute;
  right: .62rem;
  bottom: .62rem;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: .14rem;
  min-width: 7.4rem;
  min-height: 3.12rem;
  padding: .24rem .58rem;
  border-width: 3px;
  background: var(--fish-accent);
  box-shadow: inset 0 -4px #8ea566, 3px 3px var(--fish-ink);
  font-size: .88rem;
  pointer-events: auto;
}
.fishing-action:hover { background: #e0e9b1; }
.fishing-action kbd { font: inherit; font-size: .66rem; }
.fishing-hud:is([data-stage='bite'], [data-cue='ease']) .fishing-action {
  background: var(--fish-gold);
  box-shadow: inset 0 -4px #c29951, 3px 3px var(--fish-ink);
}
.fishing-hud[data-stage='fight'] .fishing-action { touch-action: none; user-select: none; }

@media (any-pointer: coarse) {
  .fishing-action kbd { display: none; }
}

@media (max-width: 480px) and (orientation: portrait) {
  .fishing-panel { max-width: calc(100% - 1.25rem); max-height: calc(100% - 4.4rem); }
  .fishing-choices select { font-size: 1rem; }
}

@media (orientation: landscape) and (max-height: 500px) and (any-pointer: coarse),
       (orientation: landscape) and (max-height: 500px) and (max-width: 740px) {
  #world-foyer:has(#world-controls:not([hidden])):has(.fishing-hud:not([hidden])) {
    grid-template-columns: minmax(0, 1fr);
  }
  #world-foyer:has(.fishing-hud:not([hidden])) > #world-controls { display: none; }
  .fishing-panel { width: min(17.5rem, calc(100% - 1.25rem)); }
  .fishing-choices select { font-size: 1rem; }
  .fishing-hud[data-stage='rig'] [data-fish-body]:not([hidden]) {
    display: grid;
    grid-template-columns: 1fr auto;
    column-gap: .42rem;
    align-items: center;
  }
  .fishing-hud[data-stage='rig'] .fishing-rig:not([hidden]) { display: contents; }
  .fishing-hud[data-stage='rig'] :is(.fishing-signal, .fishing-choices, .fishing-tips, .fishing-message) {
    grid-column: 1 / -1;
  }
}
