:root {
  color-scheme: dark;
  --ink: #f8f5ff;
  --muted: #a9a4c2;
  --faint: #6f6988;
  --night: #070611;
  --surface: rgba(19, 16, 39, 0.82);
  --surface-strong: #141129;
  --line: rgba(255, 255, 255, 0.1);
  --gold: #f7c869;
  --cyan: #66e3dc;
  --violet: #a78bfa;
  --coral: #ff775f;
  --danger: #ff557d;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
  --radius: 20px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--night);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% -20%, rgba(106, 78, 207, 0.28), transparent 46%),
    linear-gradient(155deg, #090716 0%, #060711 50%, #090611 100%);
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
.tile:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

.ambient {
  position: fixed;
  z-index: -1;
  width: 42rem;
  height: 42rem;
  border-radius: 999px;
  opacity: 0.18;
  filter: blur(90px);
  pointer-events: none;
}

.ambient-a {
  top: -18rem;
  left: -10rem;
  background: #4a82e8;
}

.ambient-b {
  right: -15rem;
  bottom: -20rem;
  background: #8a3fd7;
}

.app-shell {
  width: min(1500px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 62px;
  padding: 0 4px 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid rgba(247, 200, 105, 0.42);
  border-radius: 13px;
  color: var(--gold);
  background: linear-gradient(145deg, rgba(247, 200, 105, 0.12), rgba(102, 227, 220, 0.05));
  box-shadow: inset 0 0 22px rgba(247, 200, 105, 0.08);
  font-family: Georgia, serif;
  font-weight: 700;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.02rem;
  letter-spacing: 0.1em;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.top-actions {
  display: flex;
  gap: 8px;
}

.icon-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
  cursor: pointer;
  transition: 160ms ease;
}

.icon-button:hover {
  border-color: rgba(102, 227, 220, 0.36);
  color: var(--ink);
  background: rgba(102, 227, 220, 0.08);
}

.hud {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  max-width: 760px;
  margin: 0 auto 14px;
}

.hud-chip {
  min-width: 0;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(18, 15, 36, 0.68);
  backdrop-filter: blur(14px);
}

.hud-chip span,
.hud-chip strong {
  display: block;
}

.hud-chip span {
  overflow: hidden;
  color: var(--faint);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hud-chip strong {
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
  font-size: 1.1rem;
}

.score-chip strong {
  color: var(--gold);
}

.combo-chip.is-hot {
  border-color: rgba(167, 139, 250, 0.5);
  box-shadow: 0 0 30px rgba(167, 139, 250, 0.14);
}

.combo-chip.is-hot strong {
  color: #c9b9ff;
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(205px, 0.74fr) minmax(520px, 1.55fr) minmax(230px, 0.86fr);
  align-items: start;
  gap: 16px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(150deg, rgba(25, 21, 49, 0.88), rgba(13, 12, 28, 0.86));
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.mission-panel,
.forge-panel {
  margin-top: 24px;
  padding: 22px;
}

.panel-kicker,
.eyebrow {
  color: var(--gold);
  font-size: 0.69rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.mission-panel h1 {
  margin: 10px 0 8px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.4rem, 2vw, 2rem);
  font-weight: 500;
  line-height: 1.08;
}

.mission-panel > p {
  margin: 0 0 25px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.goal-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.78rem;
}

.goal-row strong {
  color: var(--ink);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
}

.progress-track i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), #fff1a6);
  box-shadow: 0 0 14px rgba(247, 200, 105, 0.55);
  transition: width 320ms cubic-bezier(0.22, 1, 0.36, 1);
}

.progress-track.danger i {
  background: linear-gradient(90deg, #ff557d, #ff9671);
  box-shadow: 0 0 14px rgba(255, 85, 125, 0.45);
}

.boss-card {
  margin-top: 20px;
  padding: 14px;
  border: 1px solid rgba(255, 85, 125, 0.2);
  border-radius: 14px;
  background: rgba(255, 85, 125, 0.055);
}

.mode-stamp {
  display: inline-flex;
  margin-top: 24px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--cyan);
  background: rgba(102, 227, 220, 0.07);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.text-button,
.mini-link {
  border: 0;
  color: var(--faint);
  background: none;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 4px;
}

.text-button {
  display: block;
  margin-top: 18px;
  padding: 0;
  font-size: 0.78rem;
}

.text-button:hover,
.mini-link:hover {
  color: var(--muted);
  text-decoration-color: currentColor;
}

.board-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}

.board-frame {
  position: relative;
  width: min(100%, 630px);
  aspect-ratio: 1;
  padding: clamp(9px, 1.5vw, 14px);
  border: 1px solid rgba(247, 200, 105, 0.2);
  border-radius: 28px;
  background:
    linear-gradient(145deg, rgba(247, 200, 105, 0.08), transparent 28%),
    rgba(11, 9, 25, 0.93);
  box-shadow: 0 35px 100px rgba(0, 0, 0, 0.52), inset 0 0 60px rgba(74, 61, 126, 0.08);
  isolation: isolate;
}

.board-frame::before,
.board-frame::after {
  position: absolute;
  z-index: -1;
  width: 58px;
  height: 58px;
  border-color: rgba(247, 200, 105, 0.35);
  content: "";
  pointer-events: none;
}

.board-frame::before {
  top: -4px;
  left: -4px;
  border-top: 2px solid;
  border-left: 2px solid;
  border-radius: 28px 0 0;
}

.board-frame::after {
  right: -4px;
  bottom: -4px;
  border-right: 2px solid;
  border-bottom: 2px solid;
  border-radius: 0 0 28px;
}

.board-glow {
  position: absolute;
  z-index: -1;
  inset: 15%;
  border-radius: 999px;
  background: rgba(94, 75, 190, 0.18);
  filter: blur(55px);
}

.game-board {
  display: grid;
  width: 100%;
  height: 100%;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  gap: clamp(3px, 0.6vw, 7px);
  padding: clamp(3px, 0.6vw, 7px);
  border-radius: 19px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.015), rgba(255, 255, 255, 0.015)),
    rgba(1, 3, 13, 0.7);
  touch-action: none;
  user-select: none;
}

.tile {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 0;
  padding: 0;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: clamp(8px, 1.1vw, 14px);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), inset 0 -10px 20px rgba(0, 0, 0, 0.22), 0 3px 7px rgba(0, 0, 0, 0.26);
  cursor: pointer;
  transform: translateZ(0);
  transition: transform 125ms ease, filter 160ms ease, opacity 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.tile::before {
  position: absolute;
  top: 8%;
  left: 14%;
  width: 47%;
  height: 31%;
  border-radius: 50%;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.62), transparent 75%);
  opacity: 0.42;
  content: "";
  transform: rotate(-19deg);
}

.tile:hover {
  z-index: 2;
  filter: brightness(1.16);
  transform: translateY(-2px) scale(1.025);
}

.tile.is-selected {
  z-index: 3;
  border-color: #fff8cb;
  box-shadow: 0 0 0 2px rgba(247, 200, 105, 0.75), 0 0 25px rgba(247, 200, 105, 0.48), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transform: scale(1.07);
}

.tile.is-hint {
  z-index: 3;
  animation: hintPulse 800ms ease-in-out 2;
}

.tile.is-clearing {
  opacity: 0;
  filter: brightness(1.8);
  transform: scale(0.3) rotate(15deg);
}

.tile.is-invalid {
  animation: nudge 280ms ease;
}

.tile-glyph {
  position: relative;
  z-index: 1;
  color: rgba(255, 255, 255, 0.94);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1rem, 3.4vw, 2rem);
  line-height: 1;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.tile[data-color="ignis"] { background: radial-gradient(circle at 52% 35%, #ffbf74, #df4c41 52%, #651d38); }
.tile[data-color="aqua"] { background: radial-gradient(circle at 52% 35%, #9dfff4, #21a9bb 50%, #17416f); }
.tile[data-color="flora"] { background: radial-gradient(circle at 52% 35%, #d4f08c, #52ad69 50%, #1c4e4a); }
.tile[data-color="aether"] { background: radial-gradient(circle at 52% 35%, #e8c2ff, #9167df 50%, #42306e); }
.tile[data-color="lux"] { background: radial-gradient(circle at 52% 35%, #fff5a7, #e7a636 52%, #77513a); }
.tile[data-color="umbra"] { background: radial-gradient(circle at 52% 35%, #ffb1ee, #a73a9c 48%, #3d245b); }

.tile[data-special]::after {
  position: absolute;
  z-index: 2;
  inset: 7%;
  display: grid;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.82);
  border-radius: 9px;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.62), inset 0 0 14px rgba(255, 255, 255, 0.28);
  color: #fff;
  content: attr(data-special-mark);
  font-size: clamp(0.8rem, 2.5vw, 1.5rem);
  font-weight: 900;
  text-shadow: 0 1px 5px rgba(0, 0, 0, 0.5);
}

.tile[data-special="row"]::after { border-left: 0; border-right: 0; border-radius: 0; }
.tile[data-special="col"]::after { border-top: 0; border-bottom: 0; border-radius: 0; }
.tile[data-special="prism"]::after { border-radius: 50%; animation: slowSpin 5s linear infinite; }
.tile[data-special="nova"]::after { border-radius: 50% 10px; transform: rotate(45deg); }

.board-lock {
  position: absolute;
  inset: 0;
  display: none;
  border-radius: inherit;
  cursor: wait;
}

.board-frame.is-locked .board-lock {
  display: block;
}

.board-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 9px;
  margin-top: 13px;
}

.utility-button,
.secondary-button {
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
  cursor: pointer;
}

.utility-button {
  padding: 10px 14px;
  font-size: 0.78rem;
}

.utility-button:hover,
.secondary-button:hover {
  border-color: rgba(102, 227, 220, 0.32);
  color: var(--ink);
  background: rgba(102, 227, 220, 0.06);
}

.target-creature {
  display: flex;
  align-items: center;
  gap: 13px;
  margin: 14px 0 18px;
}

.formation-stage {
  --formation: 0%;
  position: relative;
  display: grid;
  min-height: 188px;
  margin: 13px 0 6px;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(247, 200, 105, 0.16);
  border-radius: 18px;
  background:
    radial-gradient(circle at 50% 70%, rgba(102, 227, 220, 0.16), transparent 52%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(8, 8, 22, 0.32));
}

.formation-stage img {
  width: 92%;
  height: 176px;
  object-fit: contain;
  filter: saturate(.8) drop-shadow(0 14px 24px rgba(0, 0, 0, .35));
  opacity: .3;
  transform: scale(.84);
  transition: opacity 350ms ease, filter 350ms ease, transform 350ms ease;
}

.formation-stage::after {
  position: absolute;
  inset: auto 0 0;
  height: var(--formation);
  content: "";
  pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(102, 227, 220, .09));
  mix-blend-mode: screen;
  transition: height 350ms ease;
}

.formation-energy {
  position: absolute;
  width: 108px;
  height: 108px;
  border: 1px solid rgba(102, 227, 220, .25);
  border-radius: 50%;
  box-shadow: 0 0 38px rgba(102, 227, 220, .18), inset 0 0 26px rgba(167, 139, 250, .12);
  animation: forge-pulse 2.8s ease-in-out infinite;
}

.formation-stage > span {
  position: absolute;
  right: 10px;
  bottom: 9px;
  z-index: 2;
  padding: 4px 7px;
  border-radius: 6px;
  color: var(--cyan);
  background: rgba(8, 8, 22, .76);
  font-size: .58rem;
  font-weight: 900;
  letter-spacing: .08em;
}

@keyframes forge-pulse {
  50% { opacity: .55; transform: scale(1.09) rotate(8deg); }
}

.creature-seal,
.active-avatar,
.result-seal {
  display: grid;
  place-items: center;
  border: 1px solid rgba(247, 200, 105, 0.28);
  color: var(--gold);
  background:
    radial-gradient(circle, rgba(247, 200, 105, 0.16), transparent 64%),
    rgba(255, 255, 255, 0.035);
  box-shadow: inset 0 0 24px rgba(247, 200, 105, 0.07);
  font-family: Georgia, serif;
}

.creature-seal {
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
  border-radius: 18px 8px 18px 8px;
  font-size: 1.6rem;
  transform: rotate(-3deg);
}

.target-creature h2,
.target-creature small {
  display: block;
  margin: 0;
}

.target-creature h2 {
  margin-top: 3px;
  font-family: Georgia, serif;
  font-size: 1.35rem;
  font-weight: 500;
}

.target-creature small {
  color: var(--faint);
  font-size: 0.63rem;
  font-weight: 800;
  letter-spacing: 0.09em;
}

.recipe-list {
  display: grid;
  gap: 12px;
}

.recipe-item {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 9px;
}

.essence-mark {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 7px;
  color: white;
  font-family: Georgia, serif;
  font-size: 0.8rem;
}

.essence-mark.ignis { background: #d85048; }
.essence-mark.aqua { background: #21a9bb; }
.essence-mark.flora { background: #4ca866; }
.essence-mark.aether { background: #8c65d9; }
.essence-mark.lux { color: #392b1d; background: #e9b84c; }
.essence-mark.umbra { background: #a43d9a; }

.recipe-meta {
  min-width: 0;
}

.recipe-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.72rem;
}

.recipe-item > strong {
  color: var(--muted);
  font-size: 0.74rem;
  font-variant-numeric: tabular-nums;
}

.recipe-item.is-complete > strong,
.recipe-item.is-complete .recipe-label {
  color: var(--cyan);
}

.active-creature {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.active-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--faint);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.09em;
}

.mini-link {
  padding: 4px;
  font-size: 0.72rem;
}

.active-body {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin: 12px 0;
}

.active-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: var(--cyan);
  font-size: 1.25rem;
}

.active-body strong,
.active-body small {
  display: block;
}

.active-body strong {
  overflow: hidden;
  font-family: Georgia, serif;
  font-size: 1rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.active-body small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.7rem;
}

.level-pill {
  padding: 4px 7px;
  border-radius: 7px;
  color: var(--gold);
  background: rgba(247, 200, 105, 0.08);
  font-size: 0.66rem;
  font-weight: 800;
}

.charge-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  margin-bottom: 11px;
}

.progress-track.power i {
  background: linear-gradient(90deg, var(--violet), var(--cyan));
  box-shadow: 0 0 14px rgba(102, 227, 220, 0.45);
}

.charge-row span {
  color: var(--faint);
  font-size: 0.66rem;
  font-variant-numeric: tabular-nums;
}

.power-button,
.primary-button {
  border: 1px solid rgba(102, 227, 220, 0.4);
  border-radius: 14px;
  color: #081516;
  background: linear-gradient(135deg, #7af1e7, #e8d883);
  box-shadow: 0 12px 32px rgba(102, 227, 220, 0.13);
  cursor: pointer;
  transition: 160ms ease;
}

.power-button {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
  padding: 11px 13px;
  text-align: left;
}

.power-button > span:first-child {
  font-size: 1.3rem;
}

.power-button small,
.power-button strong {
  display: block;
}

.power-button small {
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.09em;
}

.power-button strong {
  font-size: 0.88rem;
}

.power-button:disabled {
  border-color: var(--line);
  color: var(--faint);
  background: rgba(255, 255, 255, 0.045);
  box-shadow: none;
  cursor: not-allowed;
}

.power-button:not(:disabled) {
  animation: powerReady 1.4s ease-in-out infinite;
}

.power-button:not(:disabled):hover,
.primary-button:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.toast-stack {
  position: fixed;
  z-index: 100;
  top: max(20px, env(safe-area-inset-top));
  left: 50%;
  display: grid;
  width: min(92vw, 440px);
  gap: 8px;
  pointer-events: none;
  transform: translateX(-50%);
}

.toast {
  padding: 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  color: var(--ink);
  background: rgba(15, 13, 31, 0.94);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.42);
  text-align: center;
  animation: toastIn 260ms ease both;
}

.toast strong {
  color: var(--gold);
}

.game-dialog {
  width: min(96vw, 1000px);
  max-height: min(92vh, 920px);
  padding: 0;
  overflow: visible;
  border: 0;
  color: var(--ink);
  background: transparent;
}

.game-dialog::backdrop {
  background: rgba(3, 2, 10, 0.78);
  backdrop-filter: blur(15px);
}

.dialog-surface {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 26px;
  background:
    radial-gradient(circle at 15% 0%, rgba(102, 227, 220, 0.09), transparent 35%),
    linear-gradient(145deg, rgba(27, 22, 53, 0.99), rgba(9, 8, 23, 0.99));
  box-shadow: 0 45px 120px rgba(0, 0, 0, 0.68);
}

.dialog-close {
  position: absolute;
  z-index: 5;
  top: 14px;
  right: 14px;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  background: rgba(8, 7, 19, 0.72);
  cursor: pointer;
  font-size: 1.25rem;
}

.start-surface {
  display: grid;
  grid-template-columns: minmax(310px, 0.86fr) minmax(440px, 1.14fr);
  min-height: 650px;
}

.start-art {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  min-height: 560px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 70%, rgba(89, 219, 211, 0.22), transparent 35%),
    radial-gradient(circle at 40% 32%, rgba(138, 91, 221, 0.25), transparent 42%),
    linear-gradient(175deg, #15123a, #080818 72%);
}

.start-art::before {
  position: absolute;
  inset: 8%;
  border: 1px solid rgba(247, 200, 105, 0.18);
  border-radius: 50%;
  content: "";
  box-shadow: 0 0 70px rgba(247, 200, 105, 0.08), inset 0 0 90px rgba(102, 227, 220, 0.05);
}

.start-art img {
  position: relative;
  z-index: 1;
  width: 125%;
  max-width: 700px;
  margin: 0 -12% -2%;
  object-fit: contain;
  filter: drop-shadow(0 22px 38px rgba(0, 0, 0, 0.46));
}

.start-copy {
  align-self: center;
  padding: clamp(32px, 5vw, 58px);
}

.start-copy h2,
.compact-surface h2,
.bestiary-heading h2,
.result-surface h2 {
  margin: 10px 0 12px;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  line-height: 1.04;
}

.start-copy h2 {
  font-size: clamp(2rem, 4vw, 3.45rem);
}

.start-copy > p {
  max-width: 48ch;
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 0.96rem;
  line-height: 1.55;
}

.choice-group {
  margin: 17px 0 0;
  padding: 0;
  border: 0;
}

.choice-group legend {
  margin-bottom: 9px;
  color: var(--faint);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mode-options,
.starter-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.choice-card,
.starter-card {
  position: relative;
  min-width: 0;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.025);
  cursor: pointer;
  transition: 150ms ease;
}

.choice-card input,
.starter-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.choice-card strong,
.choice-card span,
.starter-card strong,
.starter-card span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.choice-card strong,
.starter-card strong {
  color: var(--ink);
  font-size: 0.82rem;
}

.choice-card span,
.starter-card span {
  margin-top: 3px;
  font-size: 0.64rem;
}

.choice-card.selected,
.starter-card.selected {
  border-color: rgba(102, 227, 220, 0.52);
  color: #b7ece8;
  background: rgba(102, 227, 220, 0.075);
  box-shadow: inset 0 0 18px rgba(102, 227, 220, 0.04);
}

.starter-card {
  display: grid;
  grid-template-columns: 29px minmax(0, 1fr);
  gap: 7px;
  align-items: center;
}

.starter-card b {
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  border-radius: 9px;
  color: var(--gold);
  background: rgba(247, 200, 105, 0.08);
  font-family: Georgia, serif;
}

.starter-card b img {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: contain;
}

.primary-button,
.secondary-button {
  min-height: 48px;
  padding: 0 20px;
  font-weight: 800;
}

.start-copy > .primary-button {
  width: 100%;
  margin-top: 22px;
}

.save-note {
  display: block;
  margin-top: 10px;
  color: var(--faint);
  font-size: 0.66rem;
  text-align: center;
}

.compact-surface {
  width: min(94vw, 620px);
  margin: 0 auto;
  padding: clamp(28px, 6vw, 52px);
}

.compact-surface h2 {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
}

.rules-list {
  display: grid;
  gap: 14px;
  margin: 28px 0;
  padding: 0;
  list-style: none;
}

.rules-list li {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 14px;
}

.rules-list li > span {
  display: grid;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(247, 200, 105, 0.18);
  border-radius: 12px;
  color: var(--gold);
  background: rgba(247, 200, 105, 0.05);
  font-size: 0.7rem;
  font-weight: 800;
}

.rules-list strong,
.rules-list p {
  display: block;
}

.rules-list p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.special-guide {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.special-guide span {
  padding: 7px 9px;
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.7rem;
}

.special-guide i {
  color: var(--cyan);
  font-style: normal;
  font-weight: 900;
}

.compact-surface .primary-button {
  width: 100%;
}

.bestiary-surface {
  max-height: min(88vh, 820px);
  padding: clamp(24px, 4vw, 42px);
  overflow: auto;
}

.bestiary-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 22px;
}

.bestiary-heading h2 {
  margin-bottom: 0;
  font-size: 2.4rem;
}

.collection-count strong,
.collection-count span {
  display: block;
  text-align: right;
}

.collection-count strong {
  color: var(--gold);
  font-family: Georgia, serif;
  font-size: 1.8rem;
}

.collection-count span {
  color: var(--faint);
  font-size: 0.68rem;
}

.bestiary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 11px;
}

.creature-card {
  position: relative;
  min-height: 170px;
  padding: 15px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    radial-gradient(circle at 75% 8%, var(--card-glow, rgba(102, 227, 220, 0.14)), transparent 36%),
    rgba(255, 255, 255, 0.025);
}

.card-portrait {
  position: relative;
  height: 94px;
  margin: -7px -7px 10px;
  overflow: hidden;
  border-radius: 13px;
  background: radial-gradient(circle, var(--card-glow), transparent 68%);
}

.card-portrait > img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 8px 10px rgba(0, 0, 0, .38));
}

.creature-card.is-locked .card-portrait > img {
  filter: grayscale(1) brightness(.35) blur(2px);
}

.card-portrait .card-seal {
  position: absolute;
  bottom: 4px;
  left: 4px;
  width: 32px;
  height: 32px;
  margin: 0;
  border-radius: 10px 5px;
  background: rgba(8, 8, 22, .78);
  font-size: 1rem;
}

.creature-card.is-locked {
  filter: saturate(0.2);
}

.creature-card.is-locked > * {
  opacity: 0.42;
}

.creature-card.is-active {
  border-color: rgba(247, 200, 105, 0.55);
  box-shadow: inset 0 0 24px rgba(247, 200, 105, 0.06);
}

.card-seal {
  display: grid;
  width: 46px;
  height: 46px;
  margin-bottom: 16px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 15px 7px;
  color: var(--card-color, var(--cyan));
  background: rgba(255, 255, 255, 0.04);
  font-family: Georgia, serif;
  font-size: 1.45rem;
}

.creature-card h3,
.creature-card p {
  margin: 0;
}

.creature-card h3 {
  font-family: Georgia, serif;
  font-size: 1.02rem;
  font-weight: 500;
}

.creature-card p {
  min-height: 35px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.69rem;
  line-height: 1.35;
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 13px;
  color: var(--faint);
  font-size: 0.62rem;
}

.equip-button {
  margin-top: 10px;
  padding: 6px 9px;
  border: 1px solid rgba(102, 227, 220, 0.28);
  border-radius: 8px;
  color: var(--cyan);
  background: rgba(102, 227, 220, 0.06);
  cursor: pointer;
  font-size: 0.65rem;
  font-weight: 800;
}

.lock-label {
  position: absolute;
  top: 13px;
  right: 13px;
  color: var(--faint);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.result-surface {
  width: min(94vw, 560px);
  margin: 0 auto;
  padding: clamp(32px, 6vw, 58px);
  text-align: center;
}

.result-seal {
  width: 86px;
  height: 86px;
  margin: 0 auto 22px;
  border-radius: 27px 10px;
  color: var(--gold);
  font-size: 2.4rem;
  transform: rotate(-3deg);
}

.result-creature {
  position: relative;
  width: 210px;
  height: 170px;
  margin: 0 auto 14px;
}

.result-creature > img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 18px 24px rgba(0, 0, 0, .4));
  animation: creature-awakens 850ms cubic-bezier(.2, .8, .2, 1) both;
}

.result-creature .result-seal {
  position: absolute;
  right: -8px;
  bottom: 0;
  width: 58px;
  height: 58px;
  margin: 0;
  border-radius: 18px 7px;
  font-size: 1.6rem;
}

@keyframes creature-awakens {
  from { opacity: 0; transform: scale(.45) translateY(38px); filter: brightness(3) blur(9px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.audio-surface {
  width: min(92vw, 520px);
}

.audio-intro {
  margin: -5px 0 18px;
  color: var(--muted);
  font-size: .82rem;
}

.audio-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.audio-option span,
.audio-option strong,
.audio-option small { display: block; }
.audio-option strong { font-size: .82rem; }
.audio-option small { margin-top: 3px; color: var(--faint); font-size: .66rem; }
.audio-option input { width: 22px; height: 22px; accent-color: var(--cyan); }

.audio-volume {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 9px;
  margin: 18px 0;
  color: var(--faint);
  font-size: .66rem;
  font-weight: 800;
  letter-spacing: .08em;
}

.audio-volume input { grid-column: 1 / -1; width: 100%; accent-color: var(--cyan); }
.audio-surface .primary-button { width: 100%; }
.audio-status { display: block; margin-top: 10px; color: var(--faint); font-size: .66rem; text-align: center; }
.icon-button.is-active { color: var(--cyan); box-shadow: inset 0 0 14px rgba(102, 227, 220, .11); }

.result-surface h2 {
  font-size: clamp(2rem, 5vw, 3rem);
}

.result-surface > p {
  max-width: 43ch;
  margin: 0 auto;
  color: var(--muted);
  line-height: 1.55;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 27px 0;
}

.result-stats span {
  padding: 12px 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
}

.result-stats small,
.result-stats strong {
  display: block;
}

.result-stats small {
  color: var(--faint);
  font-size: 0.56rem;
  font-weight: 800;
  letter-spacing: 0.07em;
}

.result-stats strong {
  margin-top: 4px;
  color: var(--gold);
  font-size: 1.05rem;
}

.result-actions {
  display: grid;
  grid-template-columns: 1fr 1.45fr;
  gap: 9px;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@keyframes hintPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(102, 227, 220, 0); }
  50% { border-color: #a5fff7; box-shadow: 0 0 0 4px rgba(102, 227, 220, 0.28), 0 0 24px rgba(102, 227, 220, 0.6); transform: scale(1.08); }
}

@keyframes nudge {
  0%, 100% { transform: translateX(0); }
  30% { transform: translateX(-6px); }
  65% { transform: translateX(6px); }
}

@keyframes slowSpin {
  to { transform: rotate(360deg); }
}

@keyframes powerReady {
  0%, 100% { box-shadow: 0 10px 28px rgba(102, 227, 220, 0.12); }
  50% { box-shadow: 0 10px 34px rgba(102, 227, 220, 0.38); }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-8px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 1100px) {
  .game-layout {
    grid-template-columns: minmax(0, 1fr) minmax(520px, 1.8fr);
  }

  .forge-panel {
    grid-column: 1;
    grid-row: 1;
  }

  .mission-panel {
    grid-column: 1;
    grid-row: 1;
    margin-top: 430px;
  }

  .board-stage {
    grid-column: 2;
    grid-row: 1 / span 2;
  }
}

@media (max-width: 820px) {
  .app-shell {
    padding-right: 10px;
    padding-left: 10px;
  }

  .game-layout {
    display: flex;
    flex-direction: column;
  }

  .board-stage {
    order: 1;
    width: 100%;
  }

  .forge-panel {
    order: 2;
    width: 100%;
    margin-top: 0;
  }

  .mission-panel {
    order: 3;
    width: 100%;
    margin-top: 0;
  }

  .board-frame {
    width: min(100%, 620px);
  }

  .start-surface {
    grid-template-columns: 1fr;
    max-height: 92vh;
    overflow: auto;
  }

  .start-art {
    min-height: 250px;
    max-height: 300px;
  }

  .start-art img {
    width: min(88%, 420px);
    margin: 0 0 -8%;
  }

  .start-copy {
    padding: 28px;
  }

  .bestiary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .topbar {
    min-height: 54px;
    padding-bottom: 10px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .brand strong {
    font-size: 0.84rem;
  }

  .brand small {
    font-size: 0.58rem;
  }

  .icon-button {
    width: 37px;
    height: 37px;
  }

  .hud {
    gap: 5px;
    margin-bottom: 9px;
  }

  .hud-chip {
    padding: 8px 7px;
    border-radius: 10px;
    text-align: center;
  }

  .hud-chip span {
    font-size: 0.52rem;
    letter-spacing: 0.04em;
  }

  .hud-chip strong {
    font-size: 0.9rem;
  }

  .board-frame {
    border-radius: 19px;
  }

  .game-board {
    border-radius: 13px;
  }

  .board-actions {
    width: 100%;
  }

  .utility-button {
    flex: 1;
    padding: 9px 8px;
    font-size: 0.7rem;
  }

  .mission-panel,
  .forge-panel {
    padding: 18px;
  }

  .mode-options,
  .starter-options {
    grid-template-columns: 1fr;
  }

  .choice-card,
  .starter-card {
    padding: 9px 11px;
  }

  .bestiary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .creature-card {
    min-height: 164px;
  }

  .result-stats {
    gap: 5px;
  }

  .result-stats span {
    padding: 9px 4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
