.route-card {
  height: 210px;
}

.route-card em {
  padding: 8px;
  border-radius: 8px;
  background: #f1cd60;
  color: #10283a;
  font-style: normal;
  font-weight: 900;
  text-align: center;
}

.route-card:disabled em {
  background: #526a77;
  color: #d3e0e5;
}

.ui-icon {
  display: inline-block;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  background-image: url("../../assets/animal-abyss-diver-ui-icons.png");
  background-repeat: no-repeat;
  background-size: 300% 300%;
  vertical-align: middle;
}

.icon-salvage { background-position: 0 0; }
.icon-danger { background-position: 50% 0; }
.icon-oxygen { background-position: 100% 0; }
.icon-power { background-position: 0 50%; }
.icon-sonar { background-position: 50% 50%; }
.icon-shield { background-position: 100% 50%; }
.icon-surface { background-position: 0 100%; }
.icon-beacon { background-position: 50% 100%; }
.icon-pulse { background-position: 100% 100%; }

.pips { display: inline-flex; gap: 2px; }
.pips i { width: 7px; height: 7px; border: 1px solid #a7d9df; border-radius: 50%; background: #123e50; }
.pips i.is-on { background: #f4ca59; border-color: #fff0aa; }

.battle-canvas {
  position: relative;
  grid-template-rows: 58px 50px minmax(0, 1fr) 112px;
  overflow: hidden;
}

.oxygen-meter {
  width: 74px;
  display: grid;
  gap: 3px;
}

.oxygen-meter span {
  font-size: 0.68rem;
}

.oxygen-meter i {
  display: block;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #27465a;
}

.oxygen-meter b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #6de4b2;
  transition: width 0.2s;
}

.oxygen-meter b.is-low {
  background: #ff746d;
}

.objective span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

#objectiveText,
#salvageText,
#salvageText span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

#salvageText { gap: 8px; }
#objectiveText .ui-icon,#salvageText .ui-icon { width: 24px; height: 24px; }
#objectiveText strong { font-size: 0.72rem; }
#salvageText em { font-size: 0.58rem; font-style: normal; }

.dive-field > p {
  max-width: 92%;
}

.field-bg {
  transform: scale(1.04);
  transition: transform 0.42s ease;
}

.depth-track {
  position: absolute;
  z-index: 2;
  top: 10px;
  left: 12%;
  width: 62%;
  height: 7px;
  overflow: hidden;
  border: 1px solid #b7ecf4aa;
  border-radius: 999px;
  background: #062537aa;
}

.depth-track i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: #f2ca5b;
  transition: width 0.35s ease;
}

.lane-gate {
  position: absolute;
  z-index: 2;
  top: 15%;
  width: 31%;
  min-height: 30%;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  justify-items: center;
  gap: 2px;
  padding: 7px;
  border: 2px solid #8ce7f1aa;
  border-radius: 18px;
  background: #052c3faa;
  box-shadow: 0 0 18px #35d8ee44;
  transition: top 0.52s ease, transform 0.52s ease, opacity 0.25s ease;
}

.lane-gate-left { left: 8%; }
.lane-gate-right { right: 8%; }

.lane-gate img {
  width: 72%;
  height: 100%;
  min-height: 54px;
  object-fit: contain;
  filter: saturate(0.7) brightness(1.1);
}

.lane-gate strong,
.lane-gate small {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lane-gate strong { display: inline-flex; align-items: center; gap: 3px; font-size: 1.2rem; line-height: 1; }
.lane-gate strong em { font-size: 0.62rem; font-style: normal; }
.lane-gate small { min-height: 2.4em; display: grid; grid-template-columns: 1fr 1fr; gap: 2px; align-items: center; font-size: 0.66rem; font-weight: 800; white-space: normal; text-align: center; line-height: 1.2; }
.lane-gate .metric { display: grid; grid-template-columns: 22px minmax(0,auto); align-items: center; justify-content: center; gap: 1px; }
.lane-gate .metric em { font-size: 0.56rem; font-style: normal; }
.lane-gate .metric .pips { grid-column: 1 / -1; justify-content: center; }
.lane-gate .metric-oxygen,.lane-gate .exact-result { grid-column: 1 / -1; }
.lane-gate .metric-oxygen { display: inline-flex; }
.lane-gate .ui-icon { width: 22px; height: 22px; }
.lane-gate .exact-result { display: inline-flex; align-items: center; justify-content: center; gap: 2px; }
.lane-gate.is-safe { border-color: #7df0b9; box-shadow: 0 0 22px #55efaa88; }
.lane-gate.is-risk { border-color: #ff8a82; box-shadow: 0 0 22px #ff665f77; }
.lane-gate.is-revealed img { filter: none; }

.diver-art {
  z-index: 3;
  left: 37%;
  bottom: 7%;
  transition: left 0.52s ease, bottom 0.52s ease, transform 0.22s ease;
}

.dive-field.is-swimming[data-lane="left"] .diver-art { left: 10%; bottom: 40%; transform: rotate(-9deg) scale(0.9); }
.dive-field.is-swimming[data-lane="right"] .diver-art { left: 64%; bottom: 40%; transform: rotate(9deg) scale(0.9); }
.dive-field.is-swimming[data-lane="left"] .lane-gate-left,
.dive-field.is-swimming[data-lane="right"] .lane-gate-right { top: 47%; transform: scale(0.82); }
.dive-field.is-swimming[data-lane="left"] .lane-gate-right,
.dive-field.is-swimming[data-lane="right"] .lane-gate-left { opacity: 0.22; transform: scale(0.82); }
.dive-field.is-resolving .diver-art { animation: diver-impact 0.22s ease 2 alternate; }
.dive-field.is-advancing .field-bg { transform: scale(1.12) translateY(-3%); }

.impact-text {
  position: absolute;
  z-index: 5;
  left: 50%;
  top: 47%;
  transform: translate(-50%, -50%);
  padding: 8px 12px;
  border-radius: 999px;
  background: #071d2ee8;
  color: #fff3a3;
  font-weight: 900;
  animation: impact-pop 0.52s ease both;
}

#feedback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 76px;
  min-height: 42px;
  font-size: 1.05rem;
}

#feedback .ui-icon { width: 30px; height: 30px; }
.feedback-arrow { font-size: 2rem; }

.fx-art:not(.hidden) { animation: sonar-pulse 0.7s ease-out infinite alternate; }

.fish-encounter {
  position: absolute;
  z-index: 5;
  inset: 8% 8% auto;
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  gap: 6px 10px;
  align-items: center;
  padding: 12px;
  border: 2px solid #ffd166;
  border-radius: 18px;
  background: #06283eee;
  box-shadow: 0 16px 35px #00131fcc;
}

.fish-sprite {
  grid-row: 1 / span 4;
  position: relative;
  width: 116px;
  height: 52px;
  overflow: hidden;
}

.fish-sprite img {
  position: absolute;
  top: -13px;
  left: -240px;
  width: 594px;
  height: 368px;
  max-width: none;
  transition: transform 0.18s ease;
}

.fish-sprite.attack-left img { transform: scaleX(-1) translateX(-3px) rotate(-5deg); }
.fish-sprite.attack-right img { transform: translateX(3px) rotate(5deg); }
.fish-sprite.attack-glow { filter: drop-shadow(0 0 12px #5ff5ff); animation: fish-glow 0.35s ease infinite alternate; }
.fish-encounter > strong { display: grid; place-items: center; color: #ffe79a; font-size: 0.66rem; }
.fish-encounter > p { position: static; display: grid; place-items: center; transform: none; max-width: none; min-height: 38px; padding: 0; background: none; text-align: center; }
.fish-encounter > strong .ui-icon,.fish-encounter > p .ui-icon { width: 40px; height: 40px; }
.attack-arrow { font-size: 2.2rem; line-height: 1; }
.fish-encounter > p strong { font-size: 0.68rem; }
.fish-guard,.fish-timer { display: grid; gap: 3px; font-size: 0.66rem; font-weight: 900; }
.fish-guard span { display: inline-flex; align-items: center; justify-content: center; gap: 3px; }
.fish-guard .ui-icon { width: 22px; height: 22px; }
.fish-guard i,.fish-timer i { height: 6px; overflow: hidden; border-radius: 999px; background: #173d50; }
.fish-guard i > b,.fish-timer i > b { display: block; width: 0; height: 100%; background: #70e2b4; transition: width 0.25s ease; }
.fish-timer i > b { width: 100%; background: #ffd166; transform-origin: left; }
.fish-actions { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.fish-actions button { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 2px; border: 0; border-radius: 10px; background: #f2ca5b; color: #15243a; font-weight: 900; }
.fish-actions button .ui-icon { width: 32px; height: 32px; }
.fish-actions button span { font-size: 0.65rem; }
.fish-actions button > b { font-size: 1.15rem; }
.fish-encounter.is-dodged { animation: fish-dodged 0.5s ease; }
.fish-encounter.is-hit { animation: fish-hit 0.18s ease 2 alternate; }

@keyframes diver-impact { to { transform: scale(1.08) rotate(-5deg); } }
@keyframes impact-pop { from { opacity: 0; transform: translate(-50%, 20%); } }
@keyframes sonar-pulse { to { opacity: 0.35; transform: scale(1.08); } }
@keyframes fish-dodged { to { transform: translateX(18%); opacity: 0.65; } }
@keyframes fish-hit { to { transform: translateX(-8px); border-color: #ff6f68; } }
@keyframes fish-glow { to { filter: drop-shadow(0 0 22px #8affff); transform: scale(1.04); } }
@keyframes fish-countdown { to { transform: scaleX(0); background: #ff6f68; } }

.help-button {
  position: absolute;
  z-index: 3;
  top: 10px;
  right: 10px;
  width: 42px;
  height: 42px;
  border: 1px solid #b8e9f4;
  border-radius: 50%;
  background: #092b40dd;
  color: #fff;
  font-size: 1.1rem;
  font-weight: 900;
}

.controls {
  display: grid;
  grid-template-rows: 52px 42px;
  align-items: stretch;
  justify-content: stretch;
  gap: 6px;
  padding: 6px 10px;
  background: #0d2b3d;
}

.lane-controls,
.utility-controls {
  display: grid;
  height: 100%;
  align-self: stretch;
  gap: 8px;
}

.lane-controls {
  grid-template-columns: 1fr 1fr;
}

.utility-controls {
  grid-template-columns: repeat(4, 1fr);
}

.controls button {
  width: 100%;
  max-width: none;
  height: 100%;
  min-height: 0;
  font-size: 0.75rem;
  font-weight: 900;
}

.utility-controls button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 2px;
}

.utility-controls button .ui-icon { width: 24px; height: 24px; }
.utility-controls button span { font-size: 0.58rem; }
.utility-controls button b { font-size: 0.7rem; }

.lane-controls button {
  display: grid;
  align-content: center;
  gap: 3px;
  font-size: 0.86rem;
}

.direction-arrow { font-size: 1.65rem; line-height: 1; }

.lane-controls button strong,
.lane-controls button small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lane-controls button small {
  font-size: 0.68rem;
  font-weight: 800;
}

.dive-coach {
  position: absolute;
  z-index: 6;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: #031521d9;
}

.coach-card {
  width: min(100%, 340px);
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 2px solid #62b9cc;
  border-radius: 16px;
  background: #0c3043;
  box-shadow: 0 18px 45px #0008;
}

.coach-card h2 {
  margin: 0;
  text-align: center;
}

.coach-card ol {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 0;
  list-style: none;
}

.coach-card li {
  min-height: 54px;
  display: grid;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 6px;
  border-radius: 10px;
  background: #061f30aa;
}

.coach-card li > div { display: flex; align-items: center; justify-content: center; gap: 7px; }
.coach-card li > small { text-align: center; font-weight: 800; }
.coach-card li .metric,.coach-card li span { display: inline-flex; align-items: center; gap: 2px; }
.coach-card li .metric em { font-size: 0.62rem; font-style: normal; }
.coach-card li .ui-icon { width: 34px; height: 34px; }
.coach-card li .pips i { width: 8px; height: 8px; }
.coach-nori { width: 56px; height: 48px; object-fit: contain; }
.coach-arrow { font-size: 1.65rem; }

/* Direct target selection and slower turn-based fish combat. */
.lane-controls{display:none}
.controls{grid-template-rows:42px}
.lane-gate{grid-template-rows:auto minmax(0,1fr) auto;cursor:pointer}
.lane-gate strong{grid-row:1}
.lane-gate img{grid-row:2;width:92%;min-height:72px}
.lane-gate small{grid-row:3}
.lane-gate[aria-disabled="true"]{pointer-events:none}
.dive-field.is-fish-combat .lane-gate-left{opacity:0;transform:translateX(-140%) scale(.8)}
.dive-field.is-fish-combat .lane-gate-right{opacity:0;transform:translateX(140%) scale(.8)}
.dive-field.is-fish-combat>.diver-art{opacity:0;transform:translateY(25%) scale(.7)}
.fish-encounter{inset:6% 5% auto;grid-template-columns:1fr 1fr;grid-template-rows:auto 122px auto auto auto;gap:7px 12px;padding:12px}
.fish-encounter>strong{grid-column:1/-1;grid-row:1;font-size:.78rem}
.combat-diver{grid-column:1;grid-row:2;display:grid;place-items:center;min-width:0}
.combat-diver img{width:100%;height:118px;object-fit:contain;filter:drop-shadow(0 7px 7px #00121c)}
.fish-sprite{grid-column:2;grid-row:2;width:150px;height:68px;justify-self:center;align-self:center}
.fish-sprite img{top:-16px;left:-290px;width:720px;height:446px}
.fish-encounter>p{grid-column:1/-1;grid-row:3;min-height:26px;display:flex;gap:8px}
.fish-encounter>p small{color:#bcecff}
.fish-timer{grid-column:1;grid-row:4}.fish-guard{grid-column:2;grid-row:4}
.fish-timer span,.fish-guard span{display:inline-flex;justify-content:space-between}
#fishTimerText,#fishGuardText{display:flex!important;justify-content:space-between;gap:4px;white-space:nowrap}
.fish-timer i,.fish-guard i{height:9px}
.fish-timer i>b,.fish-guard i>b{background:#63dfad}
.fish-guard i>b{background:#ff7770}
.fish-actions{grid-column:1/-1;grid-row:5;grid-template-columns:1fr 1fr}
.fish-actions button{min-height:48px;font-size:.86rem}
.fish-encounter.is-countering .combat-diver{animation:fish-hit .24s ease 2 alternate}
.fish-encounter.is-escaping{animation:fish-dodged .7s ease forwards}
.upgrade-panel{position:absolute;z-index:8;inset:8%;display:grid;align-content:center;gap:12px;padding:18px;border:2px solid #ffe083;border-radius:18px;background:#06283ef5;text-align:center;box-shadow:0 18px 40px #00131fdd}
.upgrade-panel h2,.upgrade-panel strong,.upgrade-panel output{margin:0}.upgrade-panel output{display:block;min-height:1.35em;color:#d9f7ff;font-weight:700}.upgrade-panel>div{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}.upgrade-panel button{min-height:52px;border:0;border-radius:10px;background:#e8c45f;color:#142134;font-weight:900}.upgrade-panel button:disabled{opacity:.45}

/* The 30 authored missions keep their name, relic, and rule readable inside
   the fixed Stage card without changing the shared card geometry. */
.route-card strong{overflow:hidden;font-size:1.05rem;line-height:1.2;text-overflow:ellipsis;white-space:nowrap}
.route-card span{font-size:.78rem;color:#d8f4ff}
.route-card small{display:block;line-height:1.25}
.route-card small b{display:-webkit-box;margin-top:4px;overflow:hidden;color:#f4dc88;font-weight:700;-webkit-box-orient:vertical;-webkit-line-clamp:2}
.route-card em{font-size:.78rem;font-style:normal;font-weight:800}
