@import url("./tokens.css");
:root {
  color-scheme: dark;
  --bg: #100d23;
  --mint: #99f0ce;
  --gold: #f5d995;
  --violet: #a98cef;
  --text: #eeeaf8;
  --muted: #9c97b2;
  --line: #c8b9f126;
  --enemy: #86e9ce;
  --progress: 0;
  --attack-duration: 700ms;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background:
    radial-gradient(ellipse at 18% 25%, #28334a 0, transparent 45%),
    radial-gradient(ellipse at 86% 80%, #372039, transparent 50%), var(--bg);
  color: var(--text);
  font:
    14px Inter,
    -apple-system,
    BlinkMacSystemFont,
    "PingFang SC",
    sans-serif;
}
button,
a {
  -webkit-tap-highlight-color: transparent;
}
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  border: 1px solid var(--line);
  background: #ffffff05;
  border-radius: 8px;
  padding: 9px 13px;
  transition:
    background 0.2s,
    border-color 0.2s,
    transform 0.2s;
}
button:hover {
  background: #ffffff12;
  border-color: #bda5e777;
}
button:disabled {
  opacity: 0.42;
  cursor: default;
}
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}
a {
  color: inherit;
  text-decoration: none;
}
.topbar {
  height: 68px;
  max-width: 1360px;
  margin: auto;
  padding: 0 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
}
.topbar > span {
  letter-spacing: 4px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 600;
}
.topbar i {
  font-style: normal;
  letter-spacing: 2px;
  color: #b7abc8;
  margin-left: 18px;
  font-size: 10px;
}
.topbar button {
  font-size: 10px;
}
.expedition {
  width: min(1210px, calc(100% - 64px));
  margin: 28px auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(370px, 492px);
  gap: clamp(26px, 4vw, 62px);
  align-items: stretch;
}
.arena {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid #b5add031;
  min-height: 760px;
  isolation: isolate;
  background: #1c2441;
  box-shadow: 0 25px 60px #0004;
}
.ruins-art {
  position: absolute;
  inset: 0;
  background: url("./art/rift-citadel-v1.png") center/cover;
  opacity: 0.8;
  filter: saturate(0.95);
}
.arena:after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(
    #17192deb,
    transparent 43%,
    #151a3188 62%,
    #131428 90%
  );
}
.ruins-art,
.rift-glow,
.starfield {
  z-index: -2;
}
.rift-glow {
  position: absolute;
  inset: 15% 5% 32%;
  border-radius: 50%;
  background: radial-gradient(ellipse, #80f0d740, transparent 68%);
  animation: rift-breathe 5s ease-in-out infinite alternate;
}
.starfield {
  position: absolute;
  inset: -20%;
  background-image:
    radial-gradient(2px 2px at 13% 22%, #e6ceac 45%, transparent 60%),
    radial-gradient(2px 2px at 78% 52%, #97f8d2 45%, transparent 60%),
    radial-gradient(1px 1px at 48% 82%, #fff 45%, transparent 60%);
  background-size:
    150px 190px,
    230px 170px,
    210px 150px;
  animation: float-stars 30s linear infinite;
  opacity: 0.6;
}
.arena-heading {
  padding: 29px 29px 0;
  position: relative;
  z-index: 2;
}
.eyebrow {
  font:
    9px ui-monospace,
    monospace;
  letter-spacing: 2px;
  color: var(--gold);
  display: inline-block;
  margin: 0;
}
.arena-heading button {
  float: right;
  font-size: 10px;
  border: 0;
  padding: 0;
  color: #c3b7d7;
}
h1 {
  font:
    500 40px "Iowan Old Style",
    "Songti SC",
    serif;
  letter-spacing: 3px;
  margin: 18px 0 9px;
}
#chapter-subtitle {
  font-size: 12px;
  line-height: 1.8;
  color: #b3b6c7;
  margin: 0;
}
.enemy {
  position: relative;
  margin: 16px auto 0;
  width: 83%;
  height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 14px 15px #0a071f);
  will-change: translate;
}
.guardian {
  height: 100%;
  width: 100%;
  overflow: visible;
  animation: guardian-float 3.8s ease-in-out infinite;
  filter: drop-shadow(0 0 20px #80ddc021);
}
.guardian path {
  fill: url("#armor-paint");
  stroke: #90d7c36e;
  stroke-width: 1.1;
  stroke-linejoin: round;
}
.guardian .armor-trim {
  fill: none;
  stroke: #decb91;
  stroke-width: 3;
}
.guardian .guardian-mask {
  fill: url("#mask-paint");
  stroke: #92d8c5;
}
.guardian .guardian-crown {
  fill: url("#gold-paint");
  stroke: #f1dcae;
  stroke-width: 2;
}
.guardian .eye,
.guardian .guardian-core {
  fill: var(--enemy);
  stroke: #e1fff4;
  stroke-width: 0.5;
  filter: drop-shadow(0 0 7px var(--enemy));
}
.guardian-core {
  animation: core-beat 1.9s infinite alternate;
  transform-box: fill-box;
  transform-origin: center;
}
.guardian .plate-light {
  fill: url("#armor-light");
  stroke: #d3dfc36e;
  stroke-width: 0.65;
}
.guardian .plate-shadow,
.guardian .plate-panel,
.guardian .mask-facet {
  fill: url("#armor-dark");
  stroke: #89a5a66e;
  stroke-width: 0.75;
}
.guardian .plate-panel {
  stroke: #b0b9a8b3;
  stroke-width: 1.2;
}
.guardian .mask-facet {
  opacity: 0.75;
}
.guardian .nose-plate,
.guardian .scale-plate {
  fill: url("#armor-light");
  stroke: #b3c8b49e;
  stroke-width: 0.7;
}
.guardian .edge-line,
.guardian .eye-glint {
  fill: none;
  stroke: #edebcb;
  stroke-width: 0.8;
  stroke-linecap: round;
  opacity: 0.65;
}
.guardian .engraving,
.guardian .guardian-runes path {
  fill: none;
  stroke: #d5c38e;
  stroke-width: 0.85;
  stroke-linecap: square;
  opacity: 0.7;
}
.guardian .guardian-runes path {
  stroke: #eff4c4;
  stroke-width: 1.05;
  opacity: 0.78;
}
.guardian .guardian-crack {
  fill: none;
  stroke: var(--enemy);
  stroke-width: 0.8;
  opacity: 0.8;
}
.guardian .joint-rim {
  fill: url("#gold-paint");
  stroke: #c7ba8e;
  stroke-width: 0.7;
}
.guardian .joint-inset {
  fill: #1b293f;
  stroke: #8f9a98;
  stroke-width: 0.55;
}
.guardian .joint-score {
  fill: none;
  stroke: #a7b7a48c;
  stroke-width: 0.6;
}
.guardian .rivet {
  fill: #e8dba2;
  stroke: #1b293f;
  stroke-width: 0.4;
}
.guardian .eye-socket {
  fill: #0b1528;
  stroke: #bdd5b975;
  stroke-width: 0.7;
}
.guardian .core-socket {
  fill: url("#gold-paint");
  stroke: #d8cf9e;
  stroke-width: 0.8;
}
.guardian .socket-edge {
  fill: #162f42;
  stroke: #526d76;
  stroke-width: 1.6;
}
.guardian .core-facet {
  fill: #245e7a;
  stroke: none;
  opacity: 0.5;
}
.guardian .core-light {
  fill: url("#core-paint");
  stroke: none;
  opacity: 0.82;
}
.guardian .core-ray,
.guardian .crown-inlay {
  fill: none;
  stroke: #fff3cf;
  stroke-width: 0.8;
  opacity: 0.8;
}
.guardian .core-glint {
  fill: #fffce6;
}
.guardian .weapon-blade {
  fill: url("#armor-dark");
  stroke: #cee3d5;
  stroke-width: 0.8;
}
.guardian .blade-facet,
.guardian .shield-face {
  fill: url("#armor-light");
  stroke: #cee3d580;
  stroke-width: 0.7;
}
.guardian .weapon-guard,
.guardian .shield-inlay {
  fill: url("#gold-paint");
  stroke: #ebd9a9;
  stroke-width: 0.8;
}
.guardian .wing-membrane {
  fill: #354357;
  stroke: #91aaa389;
  stroke-width: 0.6;
}
.guardian .wing-rib {
  fill: none;
  stroke: #a5b9a7;
  stroke-width: 2.1;
}
.guardian .arcane-link,
.guardian .link-detail {
  fill: none;
  stroke: var(--enemy);
  stroke-width: 1.2;
  stroke-dasharray: 2 6;
  opacity: 0.8;
}
.guardian .link-detail {
  stroke: #dccb9b;
  stroke-width: 0.65;
  stroke-dasharray: none;
  opacity: 0.55;
}
.guardian .floating-rune,
.guardian .crown-gem {
  fill: var(--enemy);
  stroke: #fbebbd;
  stroke-width: 0.65;
}
.guardian .guardian-halo circle,
.guardian .guardian-halo path {
  fill: none;
  stroke: #e0bd7d;
  stroke-width: 0.75;
  opacity: 0.6;
}
.guardian .guardian-halo .halo-inner {
  stroke-dasharray: 1 7;
  stroke-width: 1.7;
  opacity: 0.7;
}
.arena[data-phase="2"] .guardian .guardian-crack {
  stroke: #ffbb97;
  stroke-width: 1.3;
  opacity: 1;
}
.enemy.match-hit-enemy .guardian .plate-light {
  fill: #ebf5d6;
}
.enemy.match-hit-enemy .guardian .guardian-crack {
  stroke: #fff3d4;
  stroke-width: 1.7;
}
.guardian-wing {
  transform-origin: 150px 120px;
}
.wing-left {
  animation: wing-left 3.8s ease-in-out infinite;
}
.wing-right {
  animation: wing-right 3.8s ease-in-out infinite;
}
.enemy-aura {
  position: absolute;
  width: 78%;
  height: 70%;
  border: 1px solid #c6a4f52e;
  border-radius: 50%;
  box-shadow: 0 0 70px #7ce2d521;
  transform: rotateX(45deg);
  animation: rift-breathe 3s infinite alternate;
}
.arena[data-phase="2"] .guardian {
  filter: drop-shadow(0 0 18px #ff826850);
  animation-duration: 2s;
}
.arena[data-phase="2"] .guardian-mask {
  fill: #55304b;
}
.arena[data-phase="2"] .guardian-core {
  fill: #ffc595;
  animation-duration: 0.6s;
}
.arena[data-phase="2"] .rift-glow {
  background: radial-gradient(ellipse, #f07e8e36, transparent 68%);
}
.arena[data-ending="release"] .starfield {
  opacity: 1;
  animation-duration: 7s;
}
.arena[data-ending="carry"] .enemy-aura {
  box-shadow:
    0 0 0 14px #91c1ff17,
    0 0 70px #a8d9fa66;
  border-color: #badcff;
}
.enemy.defeated .guardian {
  animation: guardian-fall 0.9s forwards;
}
.enemy-status {
  margin: 10px 32px 0;
}
.enemy-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
#enemy-name {
  font-size: 16px;
  letter-spacing: 1px;
}
#enemy-phase {
  font:
    9px ui-monospace,
    monospace;
  color: #cab6d7;
  letter-spacing: 1px;
}
.armor-track {
  height: 9px;
  border: 1px solid #d8cbeb36;
  padding: 2px;
  border-radius: 8px;
  background: #0d0b23;
  margin-top: 11px;
}
.armor-track i {
  display: block;
  height: 100%;
  border-radius: 5px;
  background: linear-gradient(90deg, #85cdbb, #cdf7c9);
  box-shadow: 0 0 9px #94e6c475;
  transition: width 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
  width: 100%;
}
#armor-label {
  margin: 8px 0 0;
  font:
    10px ui-monospace,
    monospace;
  color: #9da9b8;
  letter-spacing: 1px;
}
.intent {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(110deg, #833b5d30, #30274655);
  border: 1px solid #ce839453;
  border-radius: 10px;
  margin: 20px 28px 0;
  padding: 13px 14px;
}
.intent-icon {
  font-size: 24px;
  color: #ffab9a;
}
.intent b {
  font-size: 12px;
  color: #f4c3b9;
  font-weight: 500;
}
.intent p {
  margin: 6px 0 0;
  font-size: 10px;
  color: #c0afbf;
  line-height: 1.65;
}
.intent > strong {
  margin-left: auto;
  font:
    29px Georgia,
    serif;
  color: #ffb5a2;
}
.intent.imminent {
  border-color: #f99480;
  background: #a6404633;
  animation: threat-pulse 1s infinite alternate;
}
.intent.interrupted {
  border-color: #9be8cd;
  background: #355e5033;
}
.intent.interrupted b,
.intent.interrupted > strong {
  color: #a2efd0;
}
.companion {
  margin: 22px 28px 25px;
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 83px;
  padding-top: 15px;
  border-top: 1px solid #adadcf28;
}
.companion-portrait {
  background: linear-gradient(140deg, #635076, #292440);
  width: 48px;
  height: 54px;
  border: 1px solid #b6abd757;
  border-radius: 12px;
  flex-shrink: 0;
  padding: 4px;
}
.companion-portrait svg {
  width: 100%;
  height: 100%;
}
.companion > div:nth-child(2) {
  flex: 1;
}
.companion span {
  font-size: 10px;
  letter-spacing: 1px;
  color: #c9b3f0;
}
.companion p {
  font-size: 12px;
  line-height: 1.8;
  margin: 5px 0 0;
  color: #e0d9e8;
}
.companion button {
  padding: 4px 10px;
  font-size: 23px;
  color: var(--gold);
  border: 0;
}
.spell-desk {
  padding: 4px 0;
}
.battle-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--line);
}
.player-vitals {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.mini-label {
  font-size: 10px;
  color: #a69bb8;
}
.player-vitals #health {
  letter-spacing: 3px;
  font-size: 16px;
  color: #eda0a7;
}
.player-vitals #shield {
  font-size: 11px;
  color: #a2d3f2;
}
.move-counter {
  display: flex;
  align-items: baseline;
  gap: 7px;
}
.move-counter strong {
  font:
    28px Georgia,
    serif;
  color: var(--gold);
}
.move-counter > span {
  font-size: 10px;
  color: #afa1bd;
}
.move-counter.low strong {
  color: #ff9d86;
}
.targets {
  display: flex;
  gap: 22px;
  padding: 17px 0 6px;
}
.target {
  display: grid;
  grid-template-columns: 25px auto;
  gap: 2px 7px;
  align-items: center;
}
.target svg {
  width: 23px;
  height: 23px;
  grid-row: span 2;
  color: #b1cfc6;
}
.target b {
  font:
    18px Georgia,
    serif;
}
.target span {
  font-size: 9px;
  color: #a99bb5;
}
.target.done {
  color: var(--mint);
}
.target.done svg {
  color: var(--mint);
}
.goal-hint {
  font-size: 10px;
  line-height: 1.6;
  color: #a99bb5;
  min-height: 30px;
  margin: 7px 0 10px;
}
.board-wrap {
  position: relative;
  padding: 8px;
  border: 1px solid #b6aad452;
  border-radius: 15px;
  background: linear-gradient(140deg, #9484b52e, #272439 60%);
  box-shadow:
    inset 0 0 0 3px #171326,
    0 20px 50px #08061466;
}
.board {
  position: relative;
  aspect-ratio: 1;
  background: #0b1021;
  border-radius: 9px;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  isolation: isolate;
}
.board-floor,
.pieces,
.threat-layer {
  position: absolute;
  inset: 0;
}
.board-floor {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
}
.well {
  margin: 2px;
  border-radius: 7px;
  background: #232a4133;
  border: 1px solid #b5bfd408;
}
.well.noise {
  background: #597e8159;
  border: 1px solid #acd1c877;
  box-shadow: inset 0 0 10px #9edfbb1c;
}
.well.double {
  border: 2px solid #b5d6bd80;
}
.piece {
  position: absolute;
  left: 0;
  top: 0;
  width: 12.5%;
  height: 12.5%;
  padding: 4px;
  border: 0;
  border-radius: 0;
  background: none !important;
  z-index: 2;
  transition:
    transform 0.2s cubic-bezier(0.2, 0.9, 0.35, 1.25),
    opacity 0.18s;
  will-change: transform;
}
.tile-face {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(
    145deg,
    color-mix(in srgb, var(--color) 45%, #24344e),
    color-mix(in srgb, var(--color) 16%, #102037) 75%
  );
  color: var(--color);
  border: 1px solid color-mix(in srgb, var(--color) 62%, transparent);
  box-shadow:
    inset 0 1px 0 #ffffff59,
    inset 0 -3px 6px #06071e60,
    0 3px 0 #090616;
  overflow: hidden;
  transition:
    filter 0.12s,
    transform 0.16s;
}
.tile-face:before {
  content: "";
  position: absolute;
  inset: 2px 2px 50%;
  border-radius: 8px 8px 50% 10%;
  background: linear-gradient(140deg, #fff2, transparent);
}
.tile-face svg {
  width: 74%;
  height: 74%;
  filter: drop-shadow(0 2px 1px #0006)
    drop-shadow(0 0 4px color-mix(in srgb, var(--color) 30%, transparent));
}
.piece:hover .tile-face {
  filter: brightness(1.16);
}
.piece.selected .tile-face,
.piece.hinted .tile-face {
  box-shadow:
    0 0 0 2px #ffe9aa,
    0 0 16px #f6daa367;
  transform: scale(0.9);
}
.piece.hinted .tile-face {
  animation: hint 1s infinite;
}
.piece.letter .tile-face {
  background: radial-gradient(#fff8d9, #bba1e48f 48%, #756da340);
  border: 1px solid #f2d8ff;
  box-shadow:
    inset 0 0 12px #c8acfd66,
    0 0 8px #d1b5f855;
  border-radius: 50%;
  color: #f6e6ff;
  animation: relic-glow 2s infinite alternate;
}
.piece.letter .tile-face svg {
  width: 82%;
  height: 82%;
}
.piece.blocked .tile-face {
  border-radius: 5px;
  background: linear-gradient(140deg, #646473, #292c3f);
  border: 1px solid #a3a2b14d;
  color: #c3bda9;
  box-shadow: inset 0 0 0 2px #16182b66;
}
.layer-mark {
  position: absolute;
  bottom: 1px;
  right: 4px;
  font: 10px Georgia;
  color: var(--gold);
}
.piece.has-noise:after {
  content: "◇";
  position: absolute;
  bottom: 4px;
  left: 5px;
  color: #e2f4c6;
  background: #15372dea;
  line-height: 13px;
  font-size: 13px;
  border-radius: 3px;
  padding: 0 2px;
  z-index: 3;
}
.piece.noise-2:after {
  content: "◇Ⅱ";
  font-size: 11px;
}
.special-row .tile-face:after,
.special-col .tile-face:after {
  content: "";
  position: absolute;
  background: #fff4ce;
  box-shadow: 0 0 8px 3px #fcdd9688;
}
.special-row .tile-face:after {
  left: 0;
  right: 0;
  height: 2px;
  top: 48%;
}
.special-col .tile-face:after {
  top: 0;
  bottom: 0;
  width: 2px;
  left: 48%;
}
.special-bomb .tile-face {
  border-radius: 50%;
  border: 2px solid #f8dba5;
  box-shadow:
    inset 0 0 13px #f5cd874f,
    0 0 6px #f7d39677;
}
.special-wild .tile-face {
  background: conic-gradient(#8dc2fa, #c599e2, #f4c586, #9ce6d2, #8dc2fa);
  color: #ffefd7;
}
.special-wild svg {
  animation: spin 9s infinite linear;
}
.piece.clearing .tile-face {
  animation: tile-burst 0.22s forwards;
}
.piece.invalid .tile-face {
  animation: shake 0.25s;
}
.threat-layer {
  pointer-events: none;
  z-index: 3;
}
.threat-mark {
  position: absolute;
  width: 12.5%;
  height: 12.5%;
  padding: 2px;
  display: grid;
  place-items: center;
}
.threat-mark:before {
  content: "";
  position: absolute;
  inset: 2px;
  border: 1.5px solid #ff8f91;
  border-radius: 8px;
  box-shadow:
    inset 0 0 12px #ed5c7930,
    0 0 5px #ff6c8133;
  animation: threat-pulse 1.4s infinite alternate;
}
.threat-mark:after {
  content: "⌖";
  position: absolute;
  top: 1px;
  right: 4px;
  font-size: 16px;
  line-height: 18px;
  color: #ffb4aa;
  text-shadow: 0 1px 3px #250a19;
}
.combo {
  position: absolute;
  left: 0;
  right: 0;
  top: 40%;
  pointer-events: none;
  z-index: 5;
  text-align: center;
  opacity: 0;
  font:
    600 27px Georgia,
    "Songti SC",
    serif;
  color: #fff0b7;
  text-shadow: 0 2px 16px #2b1354;
  letter-spacing: 3px;
}
.combo.show {
  animation: combo 0.8s both;
}
.relic-slot {
  display: flex;
  gap: 9px;
  align-items: center;
  justify-content: center;
  color: #a496bb;
  font-size: 9px;
  margin: 9px 0 13px;
}
.relic-slot p {
  margin: 0;
}
.relic-slot > span {
  color: #ba99e7;
}
.spell-toolbar {
  display: flex;
  align-items: center;
  gap: 9px;
}
.energy {
  flex: 1;
  min-width: 70px;
}
.energy > div:first-child {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: #baabd1;
  gap: 8px;
}
.energy b {
  color: #d4c2f5;
  font:
    11px ui-monospace,
    monospace;
}
.energy-track {
  background: #242238;
  height: 7px;
  border-radius: 8px;
  margin-top: 9px;
  overflow: hidden;
}
.energy-track i {
  display: block;
  height: 100%;
  width: 0;
  transition: width 0.5s;
  background: linear-gradient(90deg, #7981ef, #d3a3fa);
  box-shadow: 0 0 9px #b891f8;
}
.spell-button {
  display: grid;
  grid-template-columns: 22px auto;
  gap: 3px 4px;
  align-items: center;
  min-width: 99px;
  min-height: 51px;
  padding: 8px 10px;
  background: linear-gradient(#63547733, #26223c);
  border-color: #b4a0dd55;
}
.spell-button > span {
  grid-row: span 2;
  font-size: 26px;
  color: var(--gold);
}
.spell-button b {
  font-size: 11px;
  letter-spacing: 1px;
  font-weight: 500;
}
.spell-button small {
  font-size: 9px;
  color: #ad9fbb;
}
.spell-button.ready {
  border-color: #d9beeb;
  box-shadow: 0 0 16px #a580da24;
}
.spell-button.armed {
  background: #8665b344;
  border-color: #f8daa5;
  box-shadow: 0 0 0 1px #f8daa5;
}
.feedback {
  font-size: 11px;
  color: #b6a7c8;
  line-height: 1.8;
  min-height: 36px;
  margin: 13px 0 9px;
}
.feedback.important {
  color: #ffdfa1;
}
.controls {
  display: flex;
  gap: 6px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  align-items: center;
}
.controls button {
  font-size: 10px;
  padding: 7px 9px;
  min-height: 34px;
  color: #b7a7c5;
}
.controls > span {
  margin-left: auto;
  white-space: nowrap;
  font-size: 9px;
  color: #766f8e;
}
.damage-float {
  position: absolute;
  top: 35%;
  font:
    600 32px Georgia,
    serif;
  color: var(--gold);
  opacity: 0;
  pointer-events: none;
  text-shadow: 0 2px 5px #251837;
}
.damage-float.show {
  animation: combo 0.85s both;
}
.footer {
  max-width: 1210px;
  margin: 0 auto 25px;
  color: #827791;
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  padding: 0 4px;
}
.arena[data-ending="release"] .guardian-core {
  fill: #fff;
  filter: drop-shadow(0 0 25px #bffff0);
}
dialog {
  width: min(540px, calc(100% - 28px));
  max-height: 87dvh;
  padding: 30px;
  border-radius: 18px;
  border: 1px solid #b4a0c976;
  color: var(--text);
  background: radial-gradient(ellipse at top, #3c3555, #1b1a30 65%);
  box-shadow: 0 30px 120px #000b;
}
dialog::backdrop {
  background: #080819b8;
  backdrop-filter: blur(8px);
}
dialog .eyebrow {
  font-size: 9px;
  color: #d5b7ed;
}
dialog h2 {
  font:
    500 29px "Songti SC",
    serif;
  letter-spacing: 1px;
  margin: 17px 0;
}
dialog p {
  font-size: 13px;
  line-height: 1.9;
  color: #c1b5ce;
}
.modal-close {
  position: absolute;
  right: 17px;
  top: 14px;
  border: 0;
  font-size: 16px;
}
.modal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 23px;
}
.modal-actions button {
  flex: 1;
  min-width: 120px;
  min-height: 44px;
  font-size: 12px;
}
.primary {
  background: linear-gradient(120deg, #e6d2ac, #bdb2e9) !important;
  border-color: #e3cbf5 !important;
  color: #242137 !important;
}
.choice-grid {
  display: grid;
  gap: 12px;
  margin-top: 22px;
}
.choice-card {
  text-align: left;
  padding: 16px 18px;
  border: 1px solid #c7add56e;
  border-radius: 11px;
  background: #5c436825;
  display: block;
  width: 100%;
}
.choice-card strong {
  display: block;
  font-size: 15px;
  color: #f3e1c1;
  font-weight: 500;
}
.choice-card span {
  display: block;
  font-size: 12px;
  line-height: 1.7;
  color: #c9bdd0;
  margin-top: 8px;
}
.choice-card small {
  display: block;
  color: #b7e4d2;
  font-size: 11px;
  margin-top: 10px;
}
.choice-card:hover {
  background: #7b5d8544;
  transform: translateY(-2px);
}
.dialogue-line {
  border-left: 2px solid #b2a3d757;
  padding-left: 15px;
  margin: 14px 0;
}
.dialogue-line span {
  font-size: 10px;
  color: var(--gold);
  letter-spacing: 1px;
}
.dialogue-line p {
  margin: 5px 0;
}
.dialog-note {
  font-size: 10px !important;
  color: #8d819f !important;
}
.map-list {
  display: grid;
  gap: 8px;
}
.map-list button {
  display: flex;
  align-items: center;
  gap: 13px;
  text-align: left;
  padding: 13px;
}
.map-list b {
  font: 14px Georgia;
  color: var(--gold);
}
.map-list small {
  margin-left: auto;
  font-size: 10px;
  color: #afa2c2;
}
.journal-entry {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.journal-entry h3 {
  font-size: 13px;
  color: var(--gold);
  font-weight: 500;
}
.journal-entry p {
  font-size: 12px;
}
.reward-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.reward-chips span {
  font-size: 11px;
  padding: 6px 9px;
  background: #5c476632;
  border: 1px solid #c2a1dc44;
  border-radius: 5px;
}
.ending-seal {
  font-size: 38px;
  color: var(--mint);
  margin-top: 18px;
}
.manual-row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 12px 0;
}
.manual-row svg {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  color: var(--gold);
}
.manual-row p {
  font-size: 12px;
  margin: 0;
}
@keyframes rift-breathe {
  to {
    opacity: 0.5;
    transform: scale(1.08);
  }
}
@keyframes float-stars {
  to {
    transform: translateY(-90px) rotate(4deg);
  }
}
@keyframes guardian-float {
  50% {
    transform: translateY(-9px) rotate(0.8deg);
  }
}
@keyframes wing-left {
  50% {
    transform: rotate(-4deg);
  }
}
@keyframes wing-right {
  50% {
    transform: rotate(4deg);
  }
}
@keyframes core-beat {
  to {
    filter: drop-shadow(0 0 16px var(--enemy));
    transform: scale(1.06);
  }
}
@keyframes guardian-fall {
  to {
    opacity: 0.1;
    transform: translateY(45px) scale(0.75);
    filter: blur(7px);
  }
}
@keyframes hint {
  50% {
    transform: scale(0.94);
    filter: brightness(1.45);
  }
}
@keyframes relic-glow {
  to {
    box-shadow:
      inset 0 0 14px #e3c6ff99,
      0 0 12px #d0b9fc88;
  }
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes tile-burst {
  30% {
    transform: scale(1.16);
    filter: brightness(1.7);
  }
  to {
    transform: scale(0.5);
    opacity: 0;
  }
}
@keyframes threat-pulse {
  to {
    opacity: 0.6;
  }
}
@keyframes shake {
  25%,
  75% {
    transform: translateX(-4px);
  }
  50% {
    transform: translateX(4px);
  }
}
@keyframes combo {
  0% {
    opacity: 0;
    transform: translateY(15px) scale(0.8);
  }
  25%,
  65% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-25px);
  }
}
@media (max-width: 1000px) {
  .expedition {
    width: calc(100% - 36px);
    gap: 24px;
    grid-template-columns: minmax(0, 1fr) minmax(350px, 450px);
  }
  .arena-heading {
    padding: 24px 22px 0;
  }
  h1 {
    font-size: 32px;
  }
  .enemy {
    height: 270px;
  }
  .enemy-status {
    margin-left: 22px;
    margin-right: 22px;
  }
  .intent,
  .companion {
    margin-left: 19px;
    margin-right: 19px;
  }
  .intent {
    padding: 11px;
    gap: 8px;
  }
  .companion {
    gap: 9px;
  }
  .companion p {
    font-size: 11px;
  }
  .controls > span {
    display: none;
  }
  .footer {
    margin-left: 18px;
    margin-right: 18px;
  }
}
@media (max-width: 760px) {
  .topbar {
    height: 45px;
    padding: 0 15px;
    font-size: 10px;
  }
  .topbar > span {
    font-size: 10px;
    letter-spacing: 2px;
  }
  .topbar i {
    display: none;
  }
  .topbar button {
    font-size: 9px;
    padding: 6px 9px;
  }
  .expedition {
    display: block;
    width: min(480px, calc(100% - 22px));
    margin: 11px auto 18px;
  }
  .arena {
    min-height: 0;
    height: 225px;
    border-radius: 12px;
    margin-bottom: 13px;
  }
  .arena-heading {
    padding: 14px 16px 0;
    width: 62%;
  }
  .arena-heading .eyebrow {
    font-size: 8px;
    letter-spacing: 1px;
  }
  .arena-heading button {
    position: absolute;
    right: -56%;
    top: 13px;
    font-size: 9px;
  }
  .arena-heading h1 {
    font-size: 25px;
    margin: 10px 0 5px;
    letter-spacing: 1px;
  }
  #chapter-subtitle {
    font-size: 10px;
    line-height: 1.6;
    max-width: 92%;
  }
  .enemy {
    position: absolute;
    right: -2%;
    top: 29px;
    width: 47%;
    height: 133px;
    margin: 0;
  }
  .enemy-status {
    position: absolute;
    top: 106px;
    left: 16px;
    width: 47%;
    margin: 0;
  }
  .enemy-title {
    gap: 5px;
  }
  #enemy-name {
    font-size: 10px;
    letter-spacing: 0;
  }
  #enemy-phase {
    font-size: 7px;
    letter-spacing: 0;
  }
  .armor-track {
    height: 7px;
    margin-top: 5px;
    padding: 1px;
  }
  #armor-label {
    font-size: 8px;
    letter-spacing: 0;
    margin-top: 4px;
  }
  .intent {
    position: absolute;
    top: 146px;
    left: 12px;
    right: 12px;
    margin: 0;
    padding: 6px 9px;
    gap: 7px;
    border-radius: 7px;
  }
  .intent-icon {
    font-size: 17px;
  }
  .intent b {
    font-size: 10px;
  }
  .intent p {
    display: none;
  }
  .intent > strong {
    font-size: 20px;
  }
  .companion {
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 5px;
    margin: 0;
    min-height: 31px;
    padding: 0;
    border: 0;
    gap: 7px;
  }
  .companion-portrait {
    width: 25px;
    height: 28px;
    padding: 2px;
    border-radius: 7px;
  }
  .companion > div:nth-child(2) {
    display: flex;
    gap: 7px;
    align-items: baseline;
    min-width: 0;
  }
  .companion span {
    font-size: 9px;
    white-space: nowrap;
  }
  .companion p {
    font-size: 10px;
    line-height: 1.5;
    margin: 0;
    max-height: 30px;
    overflow: hidden;
  }
  .companion button {
    font-size: 21px;
    padding: 0 4px;
  }
  .battle-bar {
    padding-bottom: 8px;
  }
  .player-vitals {
    gap: 7px;
  }
  .mini-label {
    font-size: 9px;
  }
  #health {
    font-size: 13px !important;
    letter-spacing: 2px !important;
  }
  .player-vitals #shield {
    font-size: 10px;
  }
  .move-counter strong {
    font-size: 24px;
  }
  .targets {
    padding: 10px 0 3px;
    gap: 21px;
  }
  .target {
    grid-template-columns: 19px auto;
    gap: 1px 6px;
  }
  .target svg {
    width: 18px;
    height: 18px;
  }
  .target b {
    font-size: 16px;
  }
  .target span {
    font-size: 8px;
  }
  .goal-hint {
    min-height: 0;
    font-size: 9px;
    line-height: 1.55;
    margin: 5px 0 8px;
  }
  .board-wrap {
    padding: 5px;
    border-radius: 11px;
  }
  .piece {
    padding: 3px;
  }
  .tile-face {
    border-radius: 8px;
  }
  .well {
    margin: 1px;
  }
  .spell-toolbar {
    gap: 7px;
  }
  .spell-button {
    min-width: 91px;
    padding: 6px 7px;
    min-height: 45px;
    grid-template-columns: 20px auto;
  }
  .spell-button > span {
    font-size: 23px;
  }
  .spell-button b {
    font-size: 10px;
  }
  .spell-button small {
    font-size: 8px;
  }
  .energy > div:first-child {
    font-size: 9px;
  }
  .energy b {
    font-size: 9px;
  }
  .energy-track {
    margin-top: 7px;
  }
  .relic-slot {
    font-size: 8px;
    margin: 8px 0 10px;
  }
  .feedback {
    font-size: 10px;
    min-height: 32px;
    margin: 9px 0 7px;
  }
  .controls {
    padding-top: 9px;
    gap: 5px;
  }
  .controls button {
    font-size: 9px;
    padding: 7px 9px;
  }
  .footer {
    width: min(480px, calc(100% - 26px));
    margin: 0 auto 20px;
    font-size: 9px;
  }
  .damage-float {
    font-size: 25px;
  }
  dialog {
    padding: 24px;
  }
  dialog h2 {
    font-size: 25px;
  }
  .choice-card {
    padding: 13px 14px;
  }
  .choice-card strong {
    font-size: 14px;
  }
  .choice-card span {
    font-size: 11px;
  }
  .arena:after {
    background:
      linear-gradient(100deg, #17172ceb, transparent 95%),
      linear-gradient(transparent 30%, #141429 91%);
  }
  .arena[data-ending="release"] .rift-glow {
    opacity: 1;
  }
}
@media (max-width: 400px) and (max-height: 740px) {
  .arena {
    height: 170px;
    margin-bottom: 9px;
  }
  .arena-heading {
    padding: 10px 12px 0;
  }
  .arena-heading h1 {
    font-size: 21px;
    margin: 7px 0 4px;
  }
  #chapter-subtitle {
    display: none;
  }
  .enemy {
    height: 100px;
    top: 15px;
  }
  .enemy-status {
    top: 66px;
    left: 12px;
    width: 48%;
  }
  .intent {
    top: 103px;
  }
  .companion {
    bottom: 3px;
    left: 11px;
    right: 11px;
    min-height: 27px;
  }
  .companion-portrait {
    height: 24px;
    width: 23px;
  }
  .companion p {
    font-size: 9px;
  }
  .targets {
    padding-top: 7px;
  }
  .goal-hint {
    margin: 4px 0 6px;
    font-size: 9px;
  }
  .topbar {
    height: 39px;
  }
  .expedition {
    margin-top: 8px;
  }
  .battle-bar {
    padding-bottom: 5px;
  }
  .move-counter strong {
    font-size: 21px;
  }
  .target b {
    font-size: 14px;
  }
  .spell-button {
    min-width: 88px;
  }
  .relic-slot {
    margin: 7px 0;
  }
  .companion button {
    font-size: 18px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    animation: none !important;
    transition: none !important;
  }
  .enemy.defeated {
    opacity: 0.3;
  }
  .piece.clearing {
    opacity: 0;
  }
  .combo.show {
    opacity: 1;
  }
}
#dialogue {
  cursor: pointer;
}
#dialogue:hover {
  color: #fff0cb;
}
.path-emblem {
  position: absolute;
  top: 156px;
  left: 29px;
  z-index: 5;
  color: #d4f2d5;
  background: #24213bcf;
  border: 1px solid #bcafe777;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 10px;
}
.ending-vision {
  height: 165px;
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  background:
    radial-gradient(ellipse at 50% 45%, #337b7255, transparent 70%),
    linear-gradient(#121833, #2e2444);
  border: 1px solid #a3b3d033;
  margin: 18px 0;
}
.ending-vision svg {
  width: 100%;
  height: 100%;
}
.ending-vision .horizon {
  fill: #131a2c;
}
.shell-fragments path {
  fill: #9c8dc875;
  stroke: #c7b4eb;
  stroke-width: 1.5;
}
.shell-fragments path:first-child {
  animation: fragment-left 4s infinite alternate;
}
.shell-fragments path:nth-child(2) {
  animation: fragment-right 4s infinite alternate;
}
.free-spirits {
  fill: #caffdc;
  filter: drop-shadow(0 0 6px #a0ffe4);
  animation: spirit-flight 3s infinite alternate;
}
.whole-core {
  fill: #a4c9e5;
  stroke: #ebf4ff;
  stroke-width: 1.5;
  filter: drop-shadow(0 0 15px #b7a2ff);
}
.core-lines {
  fill: none;
  stroke: #686a9d;
  stroke-width: 1;
}
.protect-ring {
  fill: #9fcafa10;
  stroke: #a3d5ef;
  stroke-width: 1.5;
  stroke-dasharray: 5 7;
  transform-origin: 210px 80px;
  animation: spin 20s infinite linear;
}
.tracker {
  fill: none;
  stroke: #ffad9c;
  stroke-width: 2;
  filter: drop-shadow(0 0 5px #fb886e);
  animation: threat-pulse 1s infinite alternate;
}
.ending-vision > span {
  position: absolute;
  bottom: 9px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 10px;
  color: #dcdfd4;
  letter-spacing: 2px;
}
.collected-ending {
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
}
.collected-ending summary {
  cursor: pointer;
  color: var(--gold);
  font-size: 13px;
}
.collected-ending p {
  font-size: 12px;
}
@keyframes fragment-left {
  to {
    transform: translate(-10px, 9px) rotate(-3deg);
  }
}
@keyframes fragment-right {
  to {
    transform: translate(10px, 9px) rotate(3deg);
  }
}
@keyframes spirit-flight {
  to {
    transform: translateY(-17px);
    opacity: 0.6;
  }
}
@media (max-width: 760px) {
  .path-emblem {
    top: 87px;
    left: 14px;
    padding: 3px 5px;
    font-size: 8px;
    max-width: 52%;
  }
  .ending-vision {
    height: 145px;
  }
}
@media (max-width: 400px) and (max-height: 740px) {
  .path-emblem {
    top: 48px;
    left: 12px;
    font-size: 7px;
  }
}

.companion-portrait[data-role="speaker"] svg { display: none; }
.companion-portrait[data-role="speaker"]::after { content: attr(data-glyph); font-size: clamp(14px, 2.5vw, 28px); color: #dfc493; }
