/* V2 READABILITY PASS
   Keep the pixel-art identity in headings and numbers, but do not force
   explanatory Japanese text into tiny display type. */
body {
  background:
    radial-gradient(circle at 50% -20%, rgba(108, 72, 184, .42), transparent 45rem),
    radial-gradient(circle at 100% 40%, rgba(33, 113, 150, .18), transparent 36rem),
    linear-gradient(180deg, #0b0e1a 0%, #070a13 78%, #0d0920 100%);
}

.eyebrow,
.kicker,
.micro-heading,
.status-card > span,
.board-head span,
.enemy-title span,
.intent-card small,
footer {
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.35;
}

.run-stats span {
  color: var(--muted);
  font-size: .75rem;
}

.run-stats strong {
  font-size: 1rem;
}

.primary-button,
.secondary-button,
.danger-button,
.text-button,
.hold-button,
.choice-card,
.shop-card,
.potion-button {
  min-height: 52px;
  font-size: .86rem;
}

.title-copy > p:not(.kicker),
.section-heading > p:not(.kicker),
.result-screen > p:not(.kicker),
.choice-card p,
.shop-card p,
.status-card p,
.log-row,
.potion-button span,
.next-goal,
.dialog-card p {
  font-family: var(--body);
  font-weight: 600;
}

.title-copy > p:not(.kicker),
.section-heading > p:not(.kicker),
.result-screen > p:not(.kicker) {
  color: #e0e4ee;
  font-size: 1.02rem;
}

.start-options label {
  color: var(--muted);
  font-size: .78rem;
}

.record-panel span {
  color: var(--muted);
  font-size: .75rem;
}

.record-panel strong {
  font-size: .94rem;
}

.next-goal {
  color: #eadfff !important;
  font-size: .84rem;
  line-height: 1.65;
}

.choice-screen .scene-banner + .section-heading {
  background: rgba(12, 16, 30, .94);
  border-color: rgba(171, 126, 235, .72);
}

.choice-card,
.shop-card {
  border-color: var(--line);
  background: linear-gradient(145deg, rgba(47, 43, 91, .96), rgba(15, 22, 42, .98));
}

.choice-card small,
.shop-card small {
  color: var(--muted);
  font-size: .75rem;
}

.choice-card p,
.shop-card p {
  color: #e0e4ee;
  font-size: .98rem;
  line-height: 1.72;
}

.enemy-panel {
  border-color: var(--line);
  background: #101629;
}

.enemy-copy {
  background: linear-gradient(90deg, rgba(13, 18, 34, .86), rgba(17, 24, 44, .99));
}

.enemy-title > strong {
  color: #d3a9ff;
  font-size: .75rem;
}

.bar-row b {
  font-size: .82rem;
}

.intent-card {
  border-color: #93425f;
  background: linear-gradient(90deg, rgba(132, 35, 73, .34), rgba(39, 20, 51, .82));
}

.intent-card strong {
  font-size: .86rem;
}

.intent-card > b {
  color: #ff9aae;
  font-size: 1.5rem;
}

.relic-section,
.potion-section,
.status-card,
.combat-log,
.record-panel > div,
.run-stats > div {
  border-color: var(--line);
  background: rgba(17, 24, 45, .96);
}

.relic-button > span:last-child {
  font-size: .75rem;
}

.relic-empty {
  color: var(--muted);
  font-size: .8rem;
}

.popover {
  color: #f0ecf7;
  background: #11172a;
}

.popover strong {
  color: #d2a9ff;
  font-size: .92rem;
}

.board-frame {
  border-color: #8298bd;
  background: linear-gradient(145deg, #141c31, #0d1222);
}

.board-head > div {
  border-color: var(--line);
  background: #11182b;
}

.board-head strong {
  color: #79e5fa;
  font-size: 1.02rem;
}

.board-head p {
  color: #d4d9e5;
  font-size: .86rem;
}

.board {
  border-color: #48658b;
  background: linear-gradient(135deg, rgba(66, 61, 116, .52), rgba(13, 25, 44, .96));
}

.cell {
  border-color: #566079;
  color: #f5f5f0;
  background: linear-gradient(145deg, #343a4d, #202638);
}

.cell.is-empty {
  opacity: .72;
}

.potion-button {
  border-color: #59709a;
  background: linear-gradient(145deg, #27365e, #151f3a);
}

.potion-button strong {
  font-size: .82rem;
}

.potion-button span {
  color: #d2d9e8;
  font-size: .75rem;
  line-height: 1.5;
}

.selection-hint {
  color: #7feaff;
  font-size: .86rem;
}

.status-card > strong {
  color: #d0a0ff;
  font-size: 1rem;
}

.status-card p {
  color: #dbe0eb;
  font-size: .88rem;
  line-height: 1.62;
}

.alignment-meter b {
  background: #11182b;
  font-size: .8rem;
}

.log-row {
  color: #d7dce8;
  font-size: .8rem;
  line-height: 1.55;
}

.shop-groups h3 {
  color: #d5dbea;
  font-size: .92rem;
}

.shop-card b {
  color: #ffd66f;
  font-size: .82rem;
}

.reward-item {
  color: #e3e7ef;
  background: #12192c;
  font-size: .85rem;
}

dialog {
  background: #12192c;
}

.dialog-card p {
  color: #e0e4ee;
  font-size: 1rem;
}

@media (max-width: 720px) {
  .topbar {
    min-height: 82px;
  }

  .run-stats span {
    font-size: .75rem;
  }

  .run-stats strong {
    font-size: 1.02rem;
  }

  .choice-card,
  .shop-card {
    padding: 22px;
  }

  .board-head p {
    font-size: .78rem;
  }

  .potion-button {
    padding: 10px 8px;
  }

  .micro-heading {
    font-size: .75rem;
  }
}

@media (max-width: 390px) {
  .enemy-title h2 {
    font-size: 1.2rem;
  }

  .micro-heading {
    font-size: .75rem;
  }
}

/* Keep short phone screens on one header row. This must stay after the
   legacy max-width rule above, which otherwise restores an 82px header. */
@media (orientation: landscape) and (max-height: 500px) and (max-width: 950px) {
  .topbar {
    height: 42px;
    min-height: 42px;
    max-height: 42px;
    grid-template-rows: 38px;
    align-content: center;
  }

  .board-head {
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    margin-bottom: 2px;
  }

  .board-head > div {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 2px;
  }

  .board-head > p {
    display: none;
  }

  .board-head span,
  .board-head p {
    font-size: .58rem;
    line-height: 1.15;
  }

  .board-head strong {
    display: inline;
    margin-top: 0;
    font-size: .68rem;
    line-height: 1;
    white-space: nowrap;
  }
}

/* V2 MOBILE TACTILE PIXEL PASS
   Make the board feel like a physical pixel device under the thumb without
   changing game rules or adding continuous animation. */
.board {
  position: relative;
  transform: translate3d(var(--swipe-x, 0px), var(--swipe-y, 0px), 0);
  transition: transform .09s steps(2, end), box-shadow .09s steps(2, end);
  will-change: transform;
}

.board::before {
  content: "";
  position: absolute;
  z-index: 6;
  inset: 2px;
  pointer-events: none;
  opacity: 0;
  border: 2px solid rgba(126, 234, 255, .72);
  box-shadow: inset 0 0 0 2px rgba(17, 9, 34, .85), 0 0 18px rgba(105, 208, 255, .22);
}

.board.is-touching {
  transition: none;
  box-shadow: 0 0 0 2px #11152b, 0 0 0 4px #5c78a7, 0 10px 28px rgba(0, 0, 0, .62), inset 0 0 28px rgba(116, 91, 190, .20);
}

.board.is-touching[data-swipe-direction]::before {
  opacity: 1;
}

.board.is-touching[data-swipe-direction="left"]::before { border-right-color: transparent; }
.board.is-touching[data-swipe-direction="right"]::before { border-left-color: transparent; }
.board.is-touching[data-swipe-direction="up"]::before { border-bottom-color: transparent; }
.board.is-touching[data-swipe-direction="down"]::before { border-top-color: transparent; }

.cell:not(.is-empty)::after {
  border-color: rgba(255, 255, 255, .12);
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, .045), inset -2px -2px 0 rgba(0, 0, 0, .22);
}

.cell[data-value="32"],
.cell[data-value="64"],
.cell[data-value="128"],
.cell[data-value="256"],
.cell[data-value="512"],
.cell[data-value="1024"],
.cell[data-value="2048"] {
  text-shadow: 2px 2px 0 rgba(0, 0, 0, .62), 0 0 10px currentColor;
}

.board-frame.swipe-left { animation: swipe-commit-left calc(.18s / var(--speed)) steps(3, end); }
.board-frame.swipe-right { animation: swipe-commit-right calc(.18s / var(--speed)) steps(3, end); }
.board-frame.swipe-up { animation: swipe-commit-up calc(.18s / var(--speed)) steps(3, end); }
.board-frame.swipe-down { animation: swipe-commit-down calc(.18s / var(--speed)) steps(3, end); }

@keyframes swipe-commit-left { 45% { transform: translateX(-4px); filter: brightness(1.12); } }
@keyframes swipe-commit-right { 45% { transform: translateX(4px); filter: brightness(1.12); } }
@keyframes swipe-commit-up { 45% { transform: translateY(-4px); filter: brightness(1.12); } }
@keyframes swipe-commit-down { 45% { transform: translateY(4px); filter: brightness(1.12); } }

@media (max-width: 720px) and (orientation: portrait) {
  .combat-screen { padding-top: 5px; }
  .combat-layout { gap: 6px; }
  .combat-primary { gap: 6px; }

  .enemy-panel {
    min-height: 142px;
    max-height: 142px;
  }

  .board-frame {
    padding: 7px;
    border-width: 2px;
    box-shadow: 0 0 0 2px #0c1020, 0 12px 28px rgba(0, 0, 0, .55), inset 0 0 20px rgba(91, 73, 151, .14);
  }

  .board {
    gap: 6px;
    padding: 7px;
  }

  .cell {
    border-width: 2px;
    font-size: clamp(1.28rem, 7.8vw, 1.8rem);
  }

  .potion-button {
    min-height: 58px;
  }
}

body.reduced-motion .board,
body.reduced-motion .board-frame.swipe-left,
body.reduced-motion .board-frame.swipe-right,
body.reduced-motion .board-frame.swipe-up,
body.reduced-motion .board-frame.swipe-down {
  transition: none !important;
  animation-duration: .001ms !important;
  animation-iteration-count: 1 !important;
}

@media (prefers-reduced-motion: reduce) {
  .board,
  .board-frame.swipe-left,
  .board-frame.swipe-right,
  .board-frame.swipe-up,
  .board-frame.swipe-down {
    transition: none !important;
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
  }
}
/* ABYSS V3 visual polish: presentation only; game contracts stay intact. */
@font-face{font-family:"DotGothic16 Abyss";src:url('./assets/fonts/DotGothic16-ABYSS.woff2') format('woff2');font-display:swap}
@font-face{font-family:"Chakra Petch Abyss";src:url('./assets/fonts/ChakraPetch-SemiBold.ttf') format('truetype');font-weight:600;font-display:swap}
:root{--display-ja:"DotGothic16 Abyss","Yu Gothic UI",sans-serif;--hud:"Chakra Petch Abyss",ui-monospace,monospace;--pixel:var(--display-ja);--abyss-cyan:#69e9ff;--abyss-amber:#ffc35a;--abyss-violet:#9270d8}
body{background:radial-gradient(circle at 50% -18%,rgba(22,119,151,.32),transparent 42rem),radial-gradient(circle at 82% 38%,rgba(34,42,101,.18),transparent 34rem),linear-gradient(180deg,#030711 0%,#06101c 58%,#02050b 100%)}
.brand-block h1,.run-stats,.board-head,.cell,.enemy-title>strong,.bar-row b,.intent-card,.record-panel strong,.potion-count,.combat-toast,.reward-item,button{font-family:var(--hud);font-variant-numeric:tabular-nums}
.title-copy h2,.section-heading h2,.result-screen h2,.enemy-title h2,.shop-groups h3,.dialog-card h2{font-family:var(--display-ja);letter-spacing:-.065em}
.title-copy>p,.section-heading>p,.result-screen>p,.choice-card p,.shop-card p,.dialog-card p,.event-details p{font-family:var(--body);letter-spacing:.015em;line-height:1.72}
.scene-atlas{background-image:linear-gradient(rgba(2,7,15,.08),rgba(2,7,15,.40)),url('./assets/generated/scene-atlas-v3.png')}
.title-art{animation:abyss-title-depth calc(.72s/var(--speed)) cubic-bezier(.18,.8,.2,1) both;transform-origin:50% 60%}
.title-copy h2,.title-copy>p,.mechanic-hook,.title-actions{opacity:0;animation:abyss-copy-rise calc(.38s/var(--speed)) ease-out both}.title-copy h2{animation-delay:calc(.14s/var(--speed))}.title-copy>p{animation-delay:calc(.22s/var(--speed))}.mechanic-hook{animation-delay:calc(.30s/var(--speed))}.title-actions{animation-delay:calc(.38s/var(--speed))}
#new-run::before{animation:cta-sweep calc(.72s/var(--speed)) ease-out calc(.66s/var(--speed)) 1 both}
@keyframes abyss-title-depth{from{opacity:0;transform:perspective(900px) translateZ(-90px) scale(1.08);filter:brightness(.45) saturate(.65)}to{opacity:1;transform:perspective(900px) translateZ(0);filter:none}}@keyframes abyss-copy-rise{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:none}}
.screen{animation:abyss-screen-in calc(.28s/var(--speed)) ease-out both}@keyframes abyss-screen-in{from{opacity:0;transform:translate3d(0,12px,0)}to{opacity:1;transform:none}}
.primary-button,.secondary-button,.choice-card,.shop-card,.potion-button,.icon-button,.cell{transition:transform .11s ease-out,filter .11s ease-out,border-color .11s ease-out}.primary-button:active,.secondary-button:active,.choice-card:active,.shop-card:active,.potion-button:active,.icon-button:active,.cell:active{transform:scale(.965)}
.board.is-touching{transform:translate3d(var(--swipe-x,0px),var(--swipe-y,0px),0) scale(.992)}
.cell{position:relative;overflow:hidden;background-image:url('./assets/generated/tile-material-atlas-v3.png');background-size:400% 400%;background-repeat:no-repeat;image-rendering:pixelated;color:#f7fbff;text-shadow:0 2px 0 rgba(0,0,0,.78),0 0 9px rgba(105,233,255,.18)}
.cell[data-material]{background-image:url('./assets/generated/tile-material-atlas-v3.png');background-size:400% 400%;background-repeat:no-repeat}
.cell[data-material="0"]{background-position:0 0}.cell[data-material="1"]{background-position:33.333% 0}.cell[data-material="2"]{background-position:66.666% 0}.cell[data-material="3"]{background-position:100% 0}.cell[data-material="4"]{background-position:0 33.333%}.cell[data-material="5"]{background-position:33.333% 33.333%}.cell[data-material="6"]{background-position:66.666% 33.333%}.cell[data-material="7"]{background-position:100% 33.333%}.cell[data-material="8"]{background-position:0 66.666%}.cell[data-material="9"]{background-position:33.333% 66.666%}.cell[data-material="10"]{background-position:66.666% 66.666%}.cell[data-material="11"]{background-position:100% 66.666%}.cell[data-material="12"],.cell.is-ward{background-position:0 100%}.cell[data-material="13"],.cell.is-cursed{background-position:33.333% 100%}.cell[data-material="14"],.cell.is-targetable{background-position:66.666% 100%}.cell[data-material="15"],.cell.is-boss{background-position:100% 100%}.cell.is-empty{color:transparent}
.cell.is-merged{animation:abyss-merge-compress calc(.34s/var(--speed)) cubic-bezier(.2,.9,.25,1)}@keyframes abyss-merge-compress{0%{transform:scale(1)}34%{transform:scale(.84);filter:brightness(1.55)}72%{transform:scale(1.08)}100%{transform:scale(1)}}
.board-frame.is-merge-impact{animation:abyss-board-impact calc(.34s/var(--speed)) ease-out}@keyframes abyss-board-impact{35%{transform:scale(.992);box-shadow:0 0 34px rgba(255,195,90,.42),inset 0 0 0 3px rgba(255,195,90,.22)}}
.enemy-panel.is-hit .enemy-art{animation:abyss-hit-depth calc(.24s/var(--speed)) ease-out}@keyframes abyss-hit-depth{30%{transform:perspective(700px) translateZ(-34px) translateX(4px);filter:brightness(1.6)}70%{transform:perspective(700px) translateZ(10px) translateX(-2px)}}
.enemy-panel.is-defeated .enemy-art{animation:abyss-collapse calc(.72s/var(--speed)) cubic-bezier(.4,0,1,1) forwards}@keyframes abyss-collapse{28%{transform:translateY(5px) scaleX(1.05) scaleY(.94);filter:brightness(1.6)}100%{opacity:0;transform:translateY(34px) scaleX(.76) scaleY(.55);filter:grayscale(1) brightness(.15)}}
.choice-card,.shop-card,.reward-item{animation:abyss-option-rise calc(.32s/var(--speed)) ease-out both}.choice-card:nth-child(2),.shop-card:nth-child(2),.reward-item:nth-child(2){animation-delay:calc(.07s/var(--speed))}.choice-card:nth-child(3),.shop-card:nth-child(3),.reward-item:nth-child(3){animation-delay:calc(.14s/var(--speed))}@keyframes abyss-option-rise{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:none}}
.enemy-art{animation:enemy-idle calc(3.4s/var(--speed)) steps(8,end) infinite}
body.reduced-motion .title-art,body.reduced-motion .title-copy h2,body.reduced-motion .title-copy>p,body.reduced-motion .mechanic-hook,body.reduced-motion .title-actions,body.reduced-motion .screen,body.reduced-motion .cell.is-merged,body.reduced-motion .board-frame.is-merge-impact,body.reduced-motion .enemy-panel.is-hit .enemy-art,body.reduced-motion .enemy-panel.is-defeated .enemy-art,body.reduced-motion .choice-card,body.reduced-motion .shop-card,body.reduced-motion .reward-item,body.reduced-motion .enemy-art{animation:abyss-fade .12s linear 1 both!important;transform:none!important;transition:none!important}@keyframes abyss-fade{from{opacity:.65}to{opacity:1}}
@media(prefers-reduced-motion:reduce){.title-art,.title-copy h2,.title-copy>p,.mechanic-hook,.title-actions,.screen,.cell.is-merged,.board-frame.is-merge-impact,.enemy-panel.is-hit .enemy-art,.enemy-panel.is-defeated .enemy-art,.choice-card,.shop-card,.reward-item,.enemy-art{animation:abyss-fade .12s linear 1 both!important;transform:none!important;transition:none!important}}
@media(max-width:390px){.abyss-shell{padding-inline:8px}.topbar{gap:6px;padding-inline:4px}.brand-block h1{font-size:1.2rem;letter-spacing:-.055em}.run-stats>div{min-width:0;padding:5px 6px}.run-stats span{font-size:.6rem}.run-stats strong{font-size:.82rem}.screen{padding-inline:2px}.title-copy h2,.section-heading h2,.result-screen h2{overflow-wrap:anywhere}.choice-card,.shop-card{min-width:0}.board{gap:5px;padding:6px}.cell{min-width:0;font-size:clamp(1.05rem,7vw,1.65rem)}}

/* ABYSS V4 COVER
   The title is now a mobile-first game cover instead of a picture followed by
   a form. The combat framing repeats the same stone, cyan and amber language. */
.start-screen {
  grid-template-columns: minmax(340px, 1fr) minmax(320px, .72fr);
  gap: 0;
  max-width: 1060px;
  padding: clamp(18px, 3vw, 36px);
  border: 1px solid #193848;
  background:
    linear-gradient(135deg, rgba(10, 27, 39, .88), rgba(4, 8, 17, .98) 58%),
    #030711;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .56), inset 0 0 0 3px rgba(4, 10, 18, .8);
}

.title-art {
  min-height: clamp(560px, 72vh, 720px);
  isolation: isolate;
  border: 1px solid #4c7683;
  background-image:
    linear-gradient(180deg, rgba(1, 5, 12, .04) 0%, rgba(1, 7, 15, .02) 45%, rgba(1, 5, 12, .92) 100%),
    url('./assets/generated/web-image2-v1/title-keyart.webp') !important;
  background-position: center 40% !important;
  box-shadow:
    0 24px 54px rgba(0, 0, 0, .56),
    inset 0 0 0 5px rgba(1, 7, 13, .72),
    inset 0 -90px 80px rgba(1, 5, 11, .55);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%);
  animation: abyss-cover-reveal calc(.86s / var(--speed)) cubic-bezier(.16, .84, .22, 1) both;
}

.title-art::before {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(0deg, transparent 0 5px, rgba(103, 225, 243, .025) 5px 6px),
    linear-gradient(90deg, rgba(0, 0, 0, .5), transparent 18%, transparent 82%, rgba(0, 0, 0, .52));
}

.title-art::after {
  content: "";
  position: absolute;
  z-index: 2;
  inset: auto 0 0;
  height: 38%;
  pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(2, 8, 15, .54) 48%, #030711 100%);
}

.title-gate {
  display: block !important;
  z-index: 3;
  inset: 10px;
  border: 1px solid rgba(143, 226, 238, .24);
  box-shadow:
    inset 0 0 0 3px rgba(2, 8, 14, .5),
    inset 0 0 42px rgba(19, 102, 121, .13);
}

.title-water {
  display: block !important;
  z-index: 4;
  left: -12%;
  right: -12%;
  bottom: -5%;
  height: 22%;
  opacity: .48;
  background:
    repeating-linear-gradient(0deg, transparent 0 9px, rgba(93, 223, 242, .12) 9px 11px),
    linear-gradient(180deg, transparent, rgba(33, 154, 178, .18));
  animation: abyss-water-drift calc(6s / var(--speed)) steps(10, end) infinite alternate;
}

.title-copy {
  position: relative;
  z-index: 6;
  margin-left: -46px;
  padding: 34px 30px 28px;
  border: 1px solid #426371;
  background:
    linear-gradient(145deg, rgba(10, 24, 34, .96), rgba(4, 9, 18, .985) 72%),
    #050a12;
  box-shadow:
    12px 14px 0 rgba(0, 0, 0, .28),
    inset 0 0 0 3px rgba(1, 6, 12, .68);
}

.title-copy::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 18px;
  width: 74px;
  height: 3px;
  background: var(--abyss-amber);
  box-shadow: 80px 0 0 rgba(105, 233, 255, .44);
}

.title-copy h2 {
  margin: 0 0 14px;
  font-size: clamp(2.7rem, 5vw, 4.65rem);
  line-height: .96;
  letter-spacing: -.09em;
  text-shadow: 4px 5px 0 #02060b, 0 0 22px rgba(105, 233, 255, .12);
}

.title-copy h2::before {
  content: "ABYSS // 2048";
  display: block;
  margin-bottom: 11px;
  color: var(--abyss-amber);
  font: 600 .68rem/1 var(--hud);
  letter-spacing: .28em;
  text-shadow: none;
}

.title-copy h2 span {
  color: #8cecff;
  text-shadow: 3px 3px 0 #0c3c49;
}

.title-copy > p:not(.kicker) {
  margin: 0;
  color: #d9e4e8;
  font-size: .96rem;
  line-height: 1.62;
}

.mechanic-hook {
  border-color: #4b7786;
  background: linear-gradient(90deg, rgba(9, 28, 39, .98), rgba(8, 18, 29, .98));
}

.hook-tile.is-result {
  border-color: #d6a743;
  color: #fff1a8;
  background: linear-gradient(145deg, #76551d, #34270f);
}

.start-screen #new-run {
  border-color: #ffe197;
  color: #10100c;
  background: linear-gradient(180deg, #ffd97b 0%, #ce8a2f 100%);
  text-shadow: 0 1px 0 rgba(255, 247, 207, .5);
  box-shadow: inset 0 0 0 3px rgba(67, 39, 9, .42), 5px 6px 0 rgba(0, 0, 0, .45);
}

.start-screen #continue-run {
  border-color: #5ea9b8;
  color: #dffaff;
  background: linear-gradient(180deg, #173d49, #0a222d);
}

.enemy-panel {
  isolation: isolate;
  border-color: #4a7080;
  box-shadow:
    0 13px 32px rgba(0, 0, 0, .46),
    inset 0 0 0 3px rgba(3, 9, 18, .74);
}

.enemy-panel::before {
  content: "";
  position: absolute;
  z-index: 9;
  inset: 6px;
  border: 1px solid rgba(117, 226, 241, .18);
  pointer-events: none;
}

.enemy-panel[data-kind="boss"] {
  border-color: #b88a34;
  box-shadow:
    0 0 0 2px rgba(74, 44, 12, .72),
    0 16px 38px rgba(0, 0, 0, .52),
    inset 0 0 36px rgba(255, 176, 62, .1);
}

.enemy-copy {
  position: relative;
  border-left: 1px solid rgba(105, 233, 255, .22);
  background: linear-gradient(102deg, rgba(8, 24, 33, .82), rgba(5, 11, 21, .985) 70%);
}

.intent-card {
  border-color: #b95b64;
  border-left-width: 4px;
  background: linear-gradient(90deg, rgba(115, 30, 45, .48), rgba(29, 13, 24, .9));
  box-shadow: inset 0 0 0 2px rgba(22, 4, 10, .42);
}

.board-frame {
  border-color: #5b8090;
  background: linear-gradient(145deg, #0c202c, #070d18 65%);
  box-shadow:
    0 0 0 3px #030711,
    0 18px 42px rgba(0, 0, 0, .55),
    inset 0 0 30px rgba(86, 211, 230, .08);
}

.board {
  border-color: #315566;
  background:
    linear-gradient(135deg, rgba(21, 76, 91, .22), rgba(4, 10, 18, .92)),
    #050a12;
}

.cell::after {
  border-color: rgba(222, 249, 255, .08);
  background: linear-gradient(145deg, rgba(255, 255, 255, .07), transparent 38%, rgba(0, 0, 0, .12));
}

.cell:not(.is-empty) {
  box-shadow:
    inset 0 0 0 3px rgba(3, 8, 15, .62),
    3px 4px 0 rgba(0, 0, 0, .6),
    0 0 12px rgba(105, 233, 255, .08);
}

@keyframes abyss-cover-reveal {
  from {
    opacity: 0;
    transform: translate3d(0, 18px, 0) scale(1.045);
    filter: brightness(.42) saturate(.62);
    clip-path: polygon(0 13%, 100% 13%, 100% 87%, 0 87%);
  }
  to {
    opacity: 1;
    transform: none;
    filter: none;
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%);
  }
}

@keyframes abyss-water-drift {
  from { transform: translate3d(-3%, 0, 0); opacity: .32; }
  to { transform: translate3d(3%, -5px, 0); opacity: .52; }
}

@media (max-width: 720px) and (orientation: portrait) {
  .start-screen {
    display: flex;
    min-height: calc(100dvh - 86px);
    gap: 0;
    padding: 0 0 16px;
    overflow: hidden;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .start-screen .title-art {
    width: calc(100% + 12px);
    height: min(58dvh, 500px);
    min-height: 418px;
    margin-inline: -6px;
    border-width: 1px;
    background-position: center 38% !important;
  }

  .start-screen .title-copy {
    width: calc(100% - 16px);
    margin: -154px 8px 0;
    padding: 74px 14px 14px;
    text-align: left;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .start-screen .title-copy::before {
    z-index: 2;
    top: 68px;
    left: 14px;
  }

  .start-screen .title-copy::after {
    content: "";
    position: absolute;
    z-index: 0;
    inset: 66px 0 0;
    border: 1px solid #355b69;
    background:
      linear-gradient(180deg, rgba(4, 12, 21, .74), rgba(3, 8, 16, .97) 30%),
      #040912;
    box-shadow: 0 14px 34px rgba(0, 0, 0, .48), inset 0 0 0 3px rgba(1, 5, 11, .62);
    clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%);
  }

  .start-screen .title-copy > * {
    position: relative;
    z-index: 1;
  }

  .start-screen .title-copy h2 {
    margin: 0 0 8px;
    font-size: clamp(2.25rem, 11vw, 3.05rem);
    line-height: .94;
    text-shadow: 3px 4px 0 #02060b, 0 0 18px rgba(105, 233, 255, .16);
  }

  .start-screen .title-copy h2::before {
    margin-bottom: 8px;
    font-size: .62rem;
    letter-spacing: .23em;
  }

  .start-screen .title-copy > p:not(.kicker) {
    margin: 0;
    font-size: .86rem;
    line-height: 1.46;
  }

  .start-screen .mechanic-hook {
    width: 100%;
    justify-content: center;
    gap: 5px;
    margin: 10px 0 0;
    padding: 7px 8px;
  }

  .start-screen .hook-tile {
    width: 34px;
  }

  .start-screen .title-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 10px;
  }

  .start-screen .title-actions .primary-button {
    grid-column: 1 / -1;
    min-width: 0;
    min-height: 56px;
  }

  .start-screen .title-more {
    margin-top: 8px;
  }

  .enemy-panel {
    border-width: 2px;
  }

  .enemy-copy {
    padding: 12px 13px;
  }

  .intent-card {
    min-height: 54px;
  }
}

body.reduced-motion .title-water,
body.reduced-motion .title-gate {
  animation: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .title-water,
  .title-gate {
    animation: none !important;
  }
}

@media (max-width: 720px) and (orientation: portrait) and (max-height: 700px) {
  .start-screen .title-art {
    height: 56dvh;
    min-height: 352px;
  }

  .start-screen .title-copy {
    margin-top: -150px;
    padding-top: 72px;
  }

  .start-screen .title-copy h2 {
    font-size: clamp(2rem, 10vw, 2.5rem);
  }

  .start-screen .title-copy > p:not(.kicker) {
    font-size: .8rem;
  }

  .start-screen .mechanic-hook {
    margin-top: 7px;
    padding-block: 5px;
  }

  .start-screen .title-actions {
    margin-top: 7px;
  }
}

/* ABYSS V4 UNIFIED PORTRAIT LAYOUT
   Desktop deliberately reuses the phone hierarchy instead of maintaining a
   second wide composition. The outer canvas only centers the same play view. */
@media (min-width: 721px) {
  body {
    background:
      radial-gradient(circle at 50% -18%, rgba(22, 119, 151, .2), transparent 34rem),
      linear-gradient(90deg, #02050b, #07111d 28%, #07111d 72%, #02050b);
  }

  .abyss-shell {
    width: min(430px, 100%);
    padding: 0 9px 10px;
    border-inline: 1px solid rgba(89, 155, 174, .2);
    background: linear-gradient(180deg, rgba(5, 12, 22, .98), rgba(2, 6, 12, .99));
    box-shadow: 0 0 70px rgba(0, 0, 0, .62);
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    grid-template-columns: 1fr auto;
    gap: 5px 8px;
    min-height: 0;
    padding: 7px 4px;
    border-bottom-color: #63789e;
    background: rgba(9, 13, 26, .96);
    backdrop-filter: blur(10px);
  }

  .brand-block h1 {
    margin-top: 0;
    font-size: 1.28rem;
    letter-spacing: -.07em;
  }

  .brand-block .eyebrow { font-size: .7rem; }
  .icon-button { width: 42px; height: 42px; }

  .run-stats {
    grid-column: 1 / -1;
    grid-row: 2;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    width: 100%;
    gap: 5px;
  }

  .run-stats > div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 5px;
    min-width: 0;
    min-height: 32px;
    padding: 6px 8px;
  }

  .run-stats span { margin: 0; font-size: .7rem; }
  .run-stats strong { font-size: .9rem; }

  main,
  .screen { min-height: 0; }

  .screen { padding: 12px 0 18px; }

  .start-screen {
    display: flex;
    flex-direction: column;
    align-content: start;
    gap: 0;
    width: 100%;
    max-width: none;
    min-height: calc(100dvh - 86px);
    padding: 0 0 16px;
    overflow: hidden;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .start-screen .title-art {
    width: calc(100% + 12px);
    height: min(58dvh, 500px);
    min-height: 418px;
    margin-inline: -6px;
    border-width: 1px;
    background-position: center 38% !important;
  }

  .start-screen .title-copy {
    width: calc(100% - 16px);
    margin: -154px 8px 0;
    padding: 74px 14px 14px;
    text-align: left;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .start-screen .title-copy::before {
    z-index: 2;
    top: 68px;
    left: 14px;
  }

  .start-screen .title-copy::after {
    content: "";
    position: absolute;
    z-index: 0;
    inset: 66px 0 0;
    border: 1px solid #355b69;
    background:
      linear-gradient(180deg, rgba(4, 12, 21, .74), rgba(3, 8, 16, .97) 30%),
      #040912;
    box-shadow: 0 14px 34px rgba(0, 0, 0, .48), inset 0 0 0 3px rgba(1, 5, 11, .62);
    clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%);
  }

  .start-screen .title-copy > * {
    position: relative;
    z-index: 1;
  }

  .start-screen .title-copy h2 {
    margin: 0 0 8px;
    font-size: clamp(2.25rem, 11vw, 3.05rem);
    line-height: .94;
    text-shadow: 3px 4px 0 #02060b, 0 0 18px rgba(105, 233, 255, .16);
  }

  .start-screen .title-copy h2::before {
    margin-bottom: 8px;
    font-size: .62rem;
    letter-spacing: .23em;
  }

  .start-screen .title-copy > p:not(.kicker) {
    margin: 0;
    font-size: .86rem;
    line-height: 1.46;
  }

  .start-screen .mechanic-hook {
    width: 100%;
    justify-content: center;
    gap: 5px;
    margin: 10px 0 0;
    padding: 7px 8px;
  }

  .start-screen .hook-tile { width: 34px; }

  .start-screen .title-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 10px;
  }

  .start-screen .title-actions > button {
    width: 100%;
    min-width: 0;
    padding-inline: 10px;
  }

  .start-screen .title-actions .primary-button {
    grid-column: 1 / -1;
    min-width: 0;
    min-height: 56px;
  }

  .start-screen .title-more { margin-top: 8px; }

  .start-options {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 12px;
  }

  .record-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    margin-top: 10px;
  }

  .next-goal {
    margin-top: 8px !important;
    font-size: .78rem;
  }

  .choice-screen {
    align-content: start;
    gap: 12px;
  }

  .scene-banner,
  .event-art {
    width: 100%;
    height: 108px;
  }

  .choice-screen .scene-banner + .section-heading {
    margin-top: -42px;
    padding: 14px 16px 12px;
  }

  .section-heading h2 {
    margin: 6px 0 10px;
    font-size: 2.25rem;
  }

  .section-heading > p:not(.kicker) {
    font-size: .94rem;
    line-height: 1.55;
  }

  .mark-grid,
  .event-grid,
  .shop-grid { grid-template-columns: 1fr; }

  .card-grid,
  .shop-groups { gap: 10px; }

  .choice-card,
  .shop-card {
    min-height: 0;
    padding: 15px 16px;
  }

  .choice-card strong,
  .shop-card strong {
    margin: 8px 0;
    font-size: 1.08rem;
  }

  .choice-card p,
  .shop-card p {
    font-size: .91rem;
    line-height: 1.55;
  }

  .combat-screen { padding-top: 5px; }

  .combat-layout {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .combat-primary {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  .enemy-panel { order: 1; }
  .board-frame { order: 2; }
  .potion-section { order: 3; }
  .relic-section { order: 4; }

  .enemy-panel {
    grid-template-columns: minmax(148px, .9fr) minmax(0, 1.1fr);
    min-height: 142px;
    max-height: 142px;
    border-width: 2px;
  }

  .enemy-art {
    background-size: cover;
    background-position: center;
  }

  .enemy-sigil {
    width: 32px;
    height: 32px;
    left: 5px;
    bottom: 5px;
    opacity: .72;
  }

  .enemy-copy {
    gap: 6px;
    padding: 9px 10px;
  }

  .enemy-title {
    display: flex;
    align-items: start;
  }

  .enemy-title h2 {
    margin-top: 2px;
    font-size: 1.18rem;
  }

  .enemy-title > strong {
    flex: 0 0 auto;
    margin-top: 0;
    font-size: .67rem;
  }

  .bar { height: 13px; padding: 2px; }
  .bar-row b { font-size: .75rem; }

  .intent-card {
    grid-template-columns: 30px 1fr auto;
    min-height: 49px;
    gap: 7px;
    padding: 6px 8px;
  }

  .intent-icon { width: 30px; height: 30px; }
  .intent-card small { font-size: .68rem; }
  .intent-card strong { font-size: .78rem; }
  .intent-card > b { font-size: 1.18rem; }

  .board-frame {
    width: 100%;
    margin: 0;
    padding: 7px;
    border-width: 2px;
    box-shadow: 0 0 0 2px #0c1020, 0 12px 28px rgba(0, 0, 0, .55), inset 0 0 20px rgba(91, 73, 151, .14);
  }

  .board-head {
    grid-template-columns: 58px 1fr 58px;
    gap: 6px;
    margin-bottom: 6px;
  }

  .board-head > div { padding: 5px; }
  .board-head span { font-size: .68rem; }
  .board-head strong { font-size: .92rem; }
  .board-head p { font-size: .73rem; line-height: 1.35; }

  .board {
    gap: 6px;
    padding: 7px;
  }

  .cell {
    min-width: 0;
    border-width: 2px;
    font-size: clamp(1.28rem, 7.8vw, 1.8rem);
  }

  .potion-section,
  .relic-section {
    margin-top: 0;
    padding: 8px;
  }

  .micro-heading { margin-bottom: 6px; font-size: .69rem; }
  .potion-row { gap: 5px; }

  .potion-button {
    min-height: 58px;
    padding: 7px 6px;
  }

  .potion-button .atlas-icon {
    width: 27px;
    height: 27px;
    margin-right: 5px;
  }

  .potion-button strong { font-size: .75rem; }
  .potion-button span { font-size: .68rem; line-height: 1.35; }

  .relic-strip {
    flex-wrap: nowrap;
    gap: 6px;
    min-height: 36px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
  }

  .relic-button {
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
  }

  .combat-side {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .status-card,
  .combat-log { padding: 12px; }

  .combat-log {
    grid-column: auto;
    max-height: 92px;
    overflow-y: auto;
  }

  footer {
    min-height: 46px;
    flex-wrap: nowrap;
    padding: 6px 4px;
  }

  footer span:nth-child(2) { display: none; }
}

@media (min-width: 721px) and (max-height: 760px) {
  .start-screen .title-art {
    height: 56dvh;
    min-height: 352px;
  }

  .start-screen .title-copy {
    margin-top: -150px;
    padding-top: 72px;
  }

  .start-screen .title-copy h2 { font-size: 2.5rem; }
  .start-screen .title-copy > p:not(.kicker) { font-size: .8rem; }
  .start-screen .mechanic-hook { margin-top: 7px; padding-block: 5px; }
  .start-screen .title-actions { margin-top: 7px; }
}

/* ABYSS V6 PRESSURE FIELD
   One restrained motion language now connects the cover, choices, combat and
   results: bathymetric rings, a sonar sweep and pressure released on merge. */
:root {
  --abyss-blackwater: #02050b;
  --abyss-trench: #07111d;
  --abyss-glass: #0d2230;
  --abyss-biowake: #69e9ff;
  --abyss-relic: #ffc35a;
  --abyss-wound: #ff5a73;
  --abyss-frost: #effbff;
}

body::before,
body::after {
  content: "";
  position: fixed;
  z-index: 0;
  inset: 0;
  pointer-events: none;
}

body::before {
  inset: -80px 0;
  opacity: .16;
  background:
    repeating-linear-gradient(0deg, transparent 0 7px, rgba(105, 233, 255, .035) 7px 8px),
    linear-gradient(90deg, transparent, rgba(105, 233, 255, .045) 50%, transparent);
  will-change: transform;
  animation: abyss-pressure-drift 18s linear infinite;
}

body::after {
  inset: -18% -28%;
  opacity: .22;
  background:
    repeating-radial-gradient(ellipse at 50% 18%, transparent 0 52px, rgba(105, 233, 255, .07) 53px 54px),
    radial-gradient(ellipse at 50% 18%, rgba(23, 120, 145, .12), transparent 48%);
  will-change: transform, opacity;
  animation: abyss-pressure-breathe 9s steps(18, end) infinite alternate;
}

.abyss-shell {
  position: relative;
  z-index: 1;
  isolation: isolate;
}

.topbar {
  box-shadow: 0 10px 28px rgba(0, 0, 0, .38), inset 0 -1px 0 rgba(105, 233, 255, .1);
}

.run-stats > div {
  --stat-accent: var(--abyss-biowake);
  position: relative;
  overflow: hidden;
}

.run-stats > div:nth-child(2) { --stat-accent: var(--abyss-relic); }
.run-stats > div:nth-child(3) { --stat-accent: #7fe0bd; }

.run-stats > div::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--stat-accent), transparent);
  opacity: .72;
}

.run-stats strong {
  color: var(--abyss-frost);
  text-shadow: 0 0 10px color-mix(in srgb, var(--stat-accent) 38%, transparent);
}

.screen {
  position: relative;
  isolation: isolate;
}

.screen:not(.is-hidden) {
  animation: abyss-screen-descent calc(.42s / var(--speed)) cubic-bezier(.16, .82, .22, 1) both;
}

.title-gate {
  overflow: hidden;
}

.title-gate::before,
.title-gate::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.title-gate::before {
  inset: 9% 7%;
  opacity: .2;
  background: repeating-radial-gradient(ellipse at 50% 38%, transparent 0 34px, rgba(115, 232, 248, .4) 35px 36px);
  animation: abyss-sonar-breathe 5.2s steps(14, end) infinite;
}

.title-gate::after {
  top: -20%;
  bottom: -20%;
  left: -48%;
  width: 42%;
  opacity: .18;
  background: linear-gradient(90deg, transparent, rgba(131, 239, 255, .62), transparent);
  transform: skewX(-16deg);
  animation: abyss-sonar-sweep 7s cubic-bezier(.46, 0, .22, 1) infinite;
}

.title-water {
  box-shadow: 0 -18px 34px rgba(38, 177, 199, .13);
}

.start-screen #new-run::after {
  content: "▼";
  margin-left: .72em;
  font-size: .72em;
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, .35));
}

.scene-banner,
.event-art {
  position: relative;
  overflow: hidden;
  border-color: #3f7181;
  box-shadow: inset 0 0 28px rgba(23, 127, 151, .14), 0 10px 24px rgba(0, 0, 0, .3);
}

.scene-banner::before,
.event-art::before {
  content: "";
  position: absolute;
  z-index: 2;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(0deg, transparent 0 8px, rgba(123, 236, 250, .05) 8px 9px),
    linear-gradient(90deg, rgba(1, 5, 11, .62), transparent 24%, transparent 76%, rgba(1, 5, 11, .62));
}

.scene-banner::after,
.event-art::after {
  content: "";
  position: absolute;
  z-index: 3;
  top: 0;
  bottom: 0;
  left: -35%;
  width: 28%;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(105, 233, 255, .18), transparent);
  transform: skewX(-18deg);
  animation: abyss-banner-scan 6.8s ease-in-out infinite;
}

.section-heading {
  border-left: 3px solid var(--abyss-biowake);
  box-shadow: -8px 0 24px rgba(105, 233, 255, .08);
}

.choice-card,
.shop-card {
  --choice-accent: var(--abyss-biowake);
  position: relative;
  overflow: hidden;
  border-left: 2px solid var(--choice-accent);
  background:
    linear-gradient(108deg, color-mix(in srgb, var(--choice-accent) 10%, transparent), transparent 34%),
    linear-gradient(145deg, rgba(20, 38, 57, .98), rgba(7, 14, 28, .99));
  box-shadow: 0 8px 20px rgba(0, 0, 0, .28), inset 0 0 0 1px rgba(226, 249, 255, .035);
}

.choice-card[data-alignment="blood"] { --choice-accent: var(--abyss-wound); }
.choice-card[data-alignment="knowledge"] { --choice-accent: var(--abyss-biowake); }
.choice-card[data-alignment="void"] { --choice-accent: var(--abyss-relic); }

.choice-card::before,
.shop-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  pointer-events: none;
  background: var(--choice-accent);
  box-shadow: 0 0 16px color-mix(in srgb, var(--choice-accent) 55%, transparent);
}

.choice-card::after,
.shop-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(112deg, transparent 32%, rgba(227, 250, 255, .1) 48%, transparent 64%);
  transform: translateX(-120%);
  transition: transform .42s ease-out;
}

.choice-card:hover,
.choice-card:focus-visible,
.shop-card:hover,
.shop-card:focus-visible {
  border-color: var(--choice-accent);
  filter: brightness(1.08);
  transform: translateY(-2px);
}

.choice-card:hover::after,
.choice-card:focus-visible::after,
.shop-card:hover::after,
.shop-card:focus-visible::after {
  transform: translateX(120%);
}

.choice-card strong,
.shop-card strong {
  color: var(--abyss-frost);
  text-shadow: 0 0 12px color-mix(in srgb, var(--choice-accent) 25%, transparent);
}

.enemy-scene {
  position: relative;
  overflow: hidden;
}

.enemy-scene::before,
.enemy-scene::after {
  content: "";
  position: absolute;
  z-index: 4;
  pointer-events: none;
}

.enemy-scene::before {
  inset: 12%;
  opacity: .16;
  border: 1px solid rgba(105, 233, 255, .44);
  border-radius: 50%;
  box-shadow: 0 0 0 18px rgba(105, 233, 255, .035), 0 0 0 36px rgba(105, 233, 255, .02);
  animation: abyss-enemy-sonar 4.8s steps(12, end) infinite;
}

.enemy-scene::after {
  inset: -25% 0 auto;
  height: 28%;
  opacity: .24;
  background: linear-gradient(180deg, transparent, rgba(121, 234, 249, .4), transparent);
  animation: abyss-enemy-scan 5.4s linear infinite;
}

.intent-card {
  position: relative;
  overflow: hidden;
  box-shadow: inset 3px 0 0 var(--abyss-wound), 0 0 18px rgba(255, 90, 115, .08);
}

.intent-card::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 1px;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--abyss-wound), transparent);
  animation: abyss-intent-charge 2.4s steps(8, end) infinite;
}

.board-frame {
  position: relative;
  isolation: isolate;
}

.board-frame::before,
.board-frame::after {
  content: "";
  position: absolute;
  z-index: 8;
  pointer-events: none;
}

.board-frame::before {
  inset: 3px;
  opacity: .82;
  background:
    linear-gradient(var(--abyss-biowake), var(--abyss-biowake)) left top / 18px 2px no-repeat,
    linear-gradient(var(--abyss-biowake), var(--abyss-biowake)) left top / 2px 18px no-repeat,
    linear-gradient(var(--abyss-biowake), var(--abyss-biowake)) right top / 18px 2px no-repeat,
    linear-gradient(var(--abyss-biowake), var(--abyss-biowake)) right top / 2px 18px no-repeat,
    linear-gradient(var(--abyss-relic), var(--abyss-relic)) left bottom / 18px 2px no-repeat,
    linear-gradient(var(--abyss-relic), var(--abyss-relic)) left bottom / 2px 18px no-repeat,
    linear-gradient(var(--abyss-relic), var(--abyss-relic)) right bottom / 18px 2px no-repeat,
    linear-gradient(var(--abyss-relic), var(--abyss-relic)) right bottom / 2px 18px no-repeat;
}

.board-frame::after {
  inset: 8px;
  opacity: .13;
  background: linear-gradient(180deg, transparent 0 42%, rgba(105, 233, 255, .8) 50%, transparent 58%);
  transform: translateY(-110%);
  animation: abyss-board-depth-scan 7.5s linear infinite;
}

.board-frame.is-merge-impact::after {
  opacity: .72;
  background: repeating-radial-gradient(circle at 50% 50%, transparent 0 24px, rgba(255, 207, 90, .9) 25px 27px, transparent 28px 44px);
  animation: abyss-board-pressure-release calc(.46s / var(--speed)) ease-out both;
}

.board.is-touching {
  filter: brightness(1.06);
  box-shadow: inset 0 0 26px rgba(105, 233, 255, .12);
}

.combat-toast {
  border-radius: 2px;
  backdrop-filter: blur(8px);
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}

.potion-button,
.relic-button,
.mark-chip {
  box-shadow: inset 0 0 0 1px rgba(225, 249, 255, .04), 0 5px 14px rgba(0, 0, 0, .24);
}

.result-screen {
  min-height: calc(100dvh - 142px);
  overflow: hidden;
}

.result-screen::before {
  content: "";
  position: absolute;
  z-index: 0;
  width: min(86vw, 380px);
  aspect-ratio: 1;
  border-radius: 50%;
  opacity: .2;
  background: repeating-radial-gradient(circle, transparent 0 28px, rgba(105, 233, 255, .28) 29px 30px);
  animation: abyss-result-pressure 7s steps(14, end) infinite alternate;
}

.result-scene {
  border-color: #46798a;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .44), inset 0 0 26px rgba(105, 233, 255, .12);
}

.result-sigil {
  position: relative;
  border-color: #78ddef;
  background:
    radial-gradient(circle, rgba(105, 233, 255, .28), transparent 56%),
    rgba(3, 11, 19, .78);
  box-shadow: 0 0 36px rgba(105, 233, 255, .14), inset 0 0 24px rgba(105, 233, 255, .1);
}

.result-sigil::before,
.result-sigil::after {
  content: "";
  position: absolute;
  pointer-events: none;
  border-radius: 50%;
}

.result-sigil::before {
  inset: -13px;
  border: 1px dashed rgba(105, 233, 255, .56);
  animation: abyss-result-orbit 11s linear infinite;
}

.result-sigil::after {
  inset: -25px;
  border: 1px solid rgba(255, 195, 90, .24);
  box-shadow: inset 0 0 0 6px transparent;
  animation: abyss-result-orbit 16s linear infinite reverse;
}

.result-screen h2 {
  color: var(--abyss-frost);
  text-shadow: 3px 4px 0 #02060b, 0 0 22px rgba(105, 233, 255, .14);
}

.reward-item {
  position: relative;
  overflow: hidden;
  border-left: 3px solid var(--abyss-relic);
  background: linear-gradient(100deg, rgba(255, 195, 90, .1), rgba(7, 15, 28, .96) 44%);
  box-shadow: 0 7px 18px rgba(0, 0, 0, .26);
}

:where(button, summary, select, input):focus-visible {
  outline: 2px solid var(--abyss-biowake);
  outline-offset: 3px;
  box-shadow: 0 0 0 5px rgba(105, 233, 255, .14);
}

@media (orientation: portrait), (min-width: 721px) {
  .combat-primary .enemy-panel {
    min-height: 166px;
    max-height: 166px;
  }

  .combat-primary .enemy-copy {
    min-height: 0;
    height: 100%;
    overflow: hidden;
  }

  .combat-primary .intent-card {
    grid-template-columns: 30px minmax(0, 1fr);
    grid-template-areas:
      "icon label"
      "icon value";
    column-gap: 8px;
    row-gap: 2px;
  }

  .combat-primary .intent-icon { grid-area: icon; }

  .combat-primary .intent-card > div {
    grid-area: label;
    min-width: 0;
  }

  .combat-primary .intent-card > b {
    grid-area: value;
    justify-self: start;
    font-size: 1rem;
    line-height: 1;
    white-space: nowrap;
  }
}

@keyframes abyss-pressure-drift {
  to { transform: translateY(80px); }
}

@keyframes abyss-pressure-breathe {
  to { opacity: .3; transform: scale(1.025) translateY(8px); }
}

@keyframes abyss-screen-descent {
  from { opacity: 0; transform: translateY(14px); filter: brightness(.72) saturate(.76); }
  to { opacity: 1; transform: none; filter: none; }
}

@keyframes abyss-sonar-breathe {
  50% { opacity: .33; transform: scale(1.035); }
}

@keyframes abyss-sonar-sweep {
  0%, 18% { transform: translateX(0) skewX(-16deg); opacity: 0; }
  28% { opacity: .2; }
  70%, 100% { transform: translateX(370%) skewX(-16deg); opacity: 0; }
}

@keyframes abyss-banner-scan {
  0%, 24% { transform: translateX(0) skewX(-18deg); opacity: 0; }
  34% { opacity: 1; }
  72%, 100% { transform: translateX(490%) skewX(-18deg); opacity: 0; }
}

@keyframes abyss-enemy-sonar {
  50% { opacity: .28; transform: scale(1.08); }
}

@keyframes abyss-enemy-scan {
  to { transform: translateY(520%); }
}

@keyframes abyss-intent-charge {
  50% { opacity: .35; transform: scaleX(.42); }
}

@keyframes abyss-board-depth-scan {
  0%, 18% { transform: translateY(-110%); opacity: 0; }
  24% { opacity: .15; }
  76%, 100% { transform: translateY(110%); opacity: 0; }
}

@keyframes abyss-board-pressure-release {
  from { opacity: .9; transform: scale(.45); }
  to { opacity: 0; transform: scale(1.18); }
}

@keyframes abyss-result-pressure {
  to { opacity: .32; transform: scale(1.08); }
}

@keyframes abyss-result-orbit {
  to { transform: rotate(1turn); }
}

body.reduced-motion::before,
body.reduced-motion::after,
body.reduced-motion .title-gate::before,
body.reduced-motion .title-gate::after,
body.reduced-motion .scene-banner::after,
body.reduced-motion .event-art::after,
body.reduced-motion .enemy-scene::before,
body.reduced-motion .enemy-scene::after,
body.reduced-motion .intent-card::after,
body.reduced-motion .board-frame::after,
body.reduced-motion .result-screen::before,
body.reduced-motion .result-sigil::before,
body.reduced-motion .result-sigil::after {
  animation: none !important;
}

@media (prefers-reduced-motion: reduce) {
  body::before,
  body::after,
  .title-gate::before,
  .title-gate::after,
  .scene-banner::after,
  .event-art::after,
  .enemy-scene::before,
  .enemy-scene::after,
  .intent-card::after,
  .board-frame::after,
  .result-screen::before,
  .result-sigil::before,
  .result-sigil::after {
    animation: none !important;
  }
}
