:root {
  color-scheme: light;
  --ink: #171717;
  --muted: #77746d;
  --line: #dedbd2;
  --paper: #f7f5ef;
  --panel: #ffffff;
  --accent: #16463f;
  --accent-2: #b68a35;
  --danger: #9d2f2f;
  --shadow: 0 24px 70px rgba(24, 23, 20, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(22, 70, 63, 0.06) 1px, transparent 1px),
    linear-gradient(rgba(22, 70, 63, 0.05) 1px, transparent 1px), var(--paper);
  background-size: 48px 48px;
}

button,
input,
select {
  font: inherit;
}

button,
select,
input {
  border: 1px solid var(--line);
  border-radius: 8px;
}

button {
  min-height: 44px;
  padding: 0 18px;
  color: var(--ink);
  background: #fbfaf6;
  cursor: pointer;
  transition:
    transform 140ms ease,
    border-color 140ms ease,
    background 140ms ease;
}

button:hover {
  border-color: #b7b1a3;
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  transform: none;
}

.primary {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 18px;
  align-items: center;
  padding: 32px 0;
}

.practice-panel,
.settings,
.ranking {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(222, 219, 210, 0.9);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.practice-panel {
  min-height: 680px;
  padding: 30px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.topbar,
.ranking-head,
.actions,
.sound-control {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 20px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-2);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 5vw, 4.8rem);
  line-height: 0.95;
  font-weight: 760;
  letter-spacing: 0;
}

h2 {
  font-size: 1rem;
  letter-spacing: 0;
}

.sound-control {
  gap: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.switch {
  position: relative;
  width: 48px;
  height: 28px;
}

.switch input {
  position: absolute;
  opacity: 0;
}

.switch span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #d9d5ca;
}

.switch span::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: transform 160ms ease;
}

.switch input:checked + span {
  background: var(--accent);
}

.switch input:checked + span::after {
  transform: translateX(20px);
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.status-grid div {
  padding: 18px 8px;
  display: grid;
  gap: 7px;
  text-align: center;
}

.status-grid div + div {
  border-left: 1px solid var(--line);
}

.status-grid span,
.ranking-head span,
label {
  color: var(--muted);
  font-size: 0.86rem;
}

.status-grid strong {
  font-size: 1.55rem;
}

.word-stage {
  flex: 1;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 14px;
  text-align: center;
}

.difficulty-pill {
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--accent);
  background: #faf9f5;
  font-size: 0.86rem;
}

.meaning {
  font-size: clamp(2.1rem, 8vw, 6.8rem);
  line-height: 1;
  font-weight: 800;
}

.speak-button {
  min-height: 36px;
  padding: 0 16px;
  color: var(--accent);
  border-color: rgba(22, 70, 63, 0.2);
  background: rgba(255, 255, 255, 0.55);
}

.spelling-board {
  width: min(760px, 100%);
  min-height: 94px;
  padding: 12px 4px 6px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(7px, 1.4vw, 16px);
  flex-wrap: wrap;
  border: 0;
  border-radius: 0;
  background: transparent;
  cursor: text;
}

.spelling-board:hover {
  border-color: transparent;
  transform: none;
}

.spelling-board:focus-visible {
  outline: 2px solid rgba(22, 70, 63, 0.22);
  outline-offset: 8px;
}

.letter-cell {
  width: clamp(30px, 5.5vw, 58px);
  height: clamp(54px, 8vw, 78px);
  display: inline-grid;
  place-items: center;
  border-bottom: 4px solid #9f9a8e;
  color: var(--ink);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: clamp(2.25rem, 6vw, 4.8rem);
  font-weight: 900;
  line-height: 1;
  text-transform: none;
  transition:
    border-color 140ms ease,
    color 140ms ease,
    background 140ms ease;
}

.letter-cell.active {
  border-color: var(--accent);
  background: rgba(22, 70, 63, 0.07);
}

.letter-cell.locked {
  color: var(--accent-2);
  border-color: rgba(182, 138, 53, 0.48);
}

.letter-cell.filled:not(.locked) {
  border-color: var(--ink);
}

.typing-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.spelling-board.shake {
  animation: shake 220ms ease;
}

.feedback {
  min-height: 24px;
  color: var(--muted);
}

.feedback.good {
  color: var(--accent);
}

.feedback.bad {
  color: var(--danger);
}

.battle-stage {
  display: grid;
  gap: 12px;
  padding-top: 8px;
}

.battle-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 260px);
  gap: 24px;
  align-items: end;
  padding: 0 4px;
}

.battle-head > div:first-child {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.battle-kicker {
  color: var(--accent-2);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.battle-status {
  min-height: 20px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.garden-progress {
  display: grid;
  gap: 7px;
}

.garden-progress > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.72rem;
}

.garden-progress strong {
  color: var(--ink);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.74rem;
  text-transform: uppercase;
}

.arena {
  position: relative;
  height: 190px;
  overflow: hidden;
  isolation: isolate;
  border: 1px solid #cbc7bd;
  border-radius: 8px;
  background:
    radial-gradient(circle at 78% 20%, rgba(255, 255, 255, 0.96) 0 24px, transparent 25px),
    linear-gradient(180deg, #fdfcf8 0%, #f7f5ef 62%, #eeece5 100%);
  box-shadow:
    inset 0 0 0 5px rgba(255, 255, 255, 0.72),
    inset 0 -24px 40px rgba(23, 23, 23, 0.035);
}

.arena::before {
  content: "";
  position: absolute;
  inset: auto 0 0;
  z-index: 0;
  height: 46px;
  background:
    radial-gradient(ellipse at 12% 100%, transparent 0 38px, rgba(23, 23, 23, 0.08) 39px 40px, transparent 41px),
    radial-gradient(ellipse at 48% 110%, transparent 0 64px, rgba(23, 23, 23, 0.07) 65px 66px, transparent 67px),
    radial-gradient(ellipse at 88% 100%, transparent 0 48px, rgba(23, 23, 23, 0.08) 49px 50px, transparent 51px);
}

.boss-card {
  position: absolute;
  top: 42px;
  right: 26px;
  z-index: 5;
  width: min(230px, 42%);
  padding: 12px;
  border: 2px solid #171717;
  border-radius: 8px;
  background: rgba(255, 254, 250, 0.9);
  box-shadow: 7px 7px 0 rgba(23, 23, 23, 0.08);
}

.boss-title {
  margin-bottom: 9px;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: lowercase;
}

.boss-health {
  height: 7px;
  overflow: hidden;
  border: 1px solid #aaa59a;
  border-radius: 999px;
  background: #e8e5dd;
}

.boss-health span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: #171717;
  transition: width 260ms ease;
}

.rhythm-lanes {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 46px;
  z-index: 2;
  display: grid;
  gap: 14px;
}

.rhythm-lanes span {
  height: 1px;
  background: linear-gradient(90deg, #171717 0 8px, transparent 8px 16px);
  opacity: 0.42;
}

.runner {
  position: absolute;
  left: 52px;
  bottom: 48px;
  z-index: 4;
  width: 76px;
  height: 62px;
}

.runner-core {
  position: absolute;
  left: 26px;
  top: 14px;
  width: 30px;
  height: 30px;
  border: 3px solid #171717;
  border-radius: 50%;
  background: #fffefa;
  box-shadow:
    -12px -6px 0 -8px #171717,
    12px -6px 0 -8px #171717,
    -18px 20px 0 -12px #171717,
    20px 18px 0 -12px #171717;
}

.runner-core::before,
.runner-core::after {
  content: "";
  position: absolute;
  left: 12px;
  top: 24px;
  width: 4px;
  height: 30px;
  background: #171717;
  transform-origin: top;
}

.runner-core::before {
  transform: rotate(35deg);
}

.runner-core::after {
  transform: rotate(-35deg);
}

.runner-trail {
  position: absolute;
  left: 0;
  top: 29px;
  width: 34px;
  height: 3px;
  background: #171717;
  opacity: 0.55;
  box-shadow:
    -12px -10px 0 rgba(23, 23, 23, 0.22),
    -20px 12px 0 rgba(23, 23, 23, 0.16);
}

.enemy-sigil {
  position: absolute;
  right: 84px;
  bottom: 56px;
  z-index: 4;
  width: 78px;
  height: 78px;
  display: grid;
  place-items: center;
  border: 2px solid #171717;
  border-radius: 50%;
  background: #fffefa;
  box-shadow: 0 0 0 8px rgba(23, 23, 23, 0.035);
}

.enemy-sigil::before {
  content: "★";
  position: relative;
  z-index: 2;
  color: #171717;
  font-size: 2.2rem;
  line-height: 1;
}

.enemy-sigil span {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 58px;
  height: 58px;
  border: 1px solid #171717;
  border-radius: 50%;
  background: transparent;
  transform-origin: center;
}

.enemy-sigil span:nth-child(1) {
  transform: translate(-50%, -50%) rotate(0deg) scaleX(1);
}

.enemy-sigil span:nth-child(2) {
  transform: translate(-50%, -50%) rotate(60deg) scaleX(0.7);
}

.enemy-sigil span:nth-child(3) {
  transform: translate(-50%, -50%) rotate(120deg) scaleX(0.7);
}

.rift {
  position: absolute;
  left: 54%;
  bottom: 58px;
  z-index: 6;
  width: 120px;
  height: 38px;
  opacity: 0;
  transform: translateX(-50%);
  border-top: 3px solid #171717;
  border-bottom: 1px solid rgba(23, 23, 23, 0.5);
  border-radius: 50%;
  background: transparent;
}

.rift::before,
.rift::after {
  content: "✦";
  position: absolute;
  top: -20px;
  color: #171717;
  font-size: 1.4rem;
}

.rift::before {
  left: 18px;
}

.rift::after {
  right: 12px;
}

.answer-reveal {
  position: absolute;
  left: 50%;
  bottom: 18px;
  z-index: 10;
  min-width: min(420px, calc(100% - 32px));
  padding: 12px 18px;
  border: 2px solid #171717;
  border-radius: 8px;
  color: #171717;
  background: #fffefa;
  box-shadow: 8px 8px 0 rgba(23, 23, 23, 0.12);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: clamp(2rem, 5vw, 4.2rem);
  font-weight: 900;
  line-height: 1;
  text-align: center;
  text-transform: none;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(16px) scale(0.94);
}

.arena.reveal-answer .answer-reveal {
  animation: answerReveal 2200ms ease both;
}

.arena.combo-1 .runner,
.arena.combo-2 .runner,
.arena.combo-3 .runner {
  animation: runnerDash 760ms cubic-bezier(0.2, 0.9, 0.2, 1);
}

.arena.combo-1 .rift {
  animation: riftSlash 760ms ease;
}

.arena.combo-2 .rift {
  animation: riftCross 820ms ease;
}

.arena.combo-3 .rift {
  animation: riftBurst 880ms ease;
}

.arena.combo-1 .enemy-sigil,
.arena.combo-2 .enemy-sigil,
.arena.combo-3 .enemy-sigil {
  animation: sigilHit 880ms ease;
}

.arena.combo-1 .arena-hud,
.arena.combo-2 .arena-hud,
.arena.combo-3 .arena-hud {
  animation: hudPulse 520ms ease;
}

.arena.miss {
  animation: arenaGlitch 560ms steps(2, end);
}

.arena.miss .runner {
  animation: runnerStagger 720ms ease;
}

.arena.miss .enemy-sigil {
  animation: sigilCounter 720ms ease;
}

.garden-sky {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.garden-sky span {
  position: absolute;
  width: 5px;
  height: 5px;
  border: 1px solid rgba(23, 23, 23, 0.62);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.58);
}

.garden-sky span:nth-child(1) {
  left: 12%;
  top: 22%;
}

.garden-sky span:nth-child(2) {
  left: 32%;
  top: 15%;
}

.garden-sky span:nth-child(3) {
  left: 58%;
  top: 24%;
}

.garden-sky span:nth-child(4) {
  left: 79%;
  top: 18%;
}

.garden-sky span:nth-child(5) {
  left: 88%;
  top: 46%;
}

.garden-path {
  position: absolute;
  inset: auto 28px 26px;
  z-index: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(23, 23, 23, 0.18) 12%, rgba(23, 23, 23, 0.18) 88%, transparent);
}

.garden-path span {
  display: none;
}

.keeper {
  position: absolute;
  left: 12%;
  bottom: 28px;
  z-index: 5;
  width: 70px;
  height: 82px;
  transform-origin: 50% 100%;
}

.keeper span {
  position: absolute;
  display: block;
}

.keeper-head {
  left: 24px;
  top: 4px;
  width: 24px;
  height: 24px;
  border: 2px solid #171717;
  border-radius: 50%;
  background: #fffefa;
}

.keeper-hair {
  left: 21px;
  top: 1px;
  width: 30px;
  height: 18px;
  border: 2px solid #171717;
  border-bottom: 0;
  border-radius: 18px 18px 0 0;
  background: #171717;
}

.keeper-dress {
  left: 18px;
  top: 30px;
  width: 38px;
  height: 42px;
  border: 2px solid #171717;
  border-radius: 20px 20px 6px 6px;
  background:
    linear-gradient(135deg, transparent 0 44%, rgba(23, 23, 23, 0.12) 44% 50%, transparent 50%),
    #fffefa;
}

.keeper-arm {
  top: 35px;
  width: 2px;
  height: 26px;
  background: #171717;
  transform-origin: top;
}

.keeper .arm-left {
  left: 22px;
  transform: rotate(42deg);
}

.keeper .arm-right {
  right: 18px;
  transform: rotate(-42deg);
}

.glow-trail {
  position: absolute;
  left: 30%;
  bottom: 82px;
  z-index: 4;
  width: 180px;
  height: 44px;
  opacity: 0;
  border-top: 2px solid #171717;
  border-radius: 50%;
  transform: rotate(-10deg);
}

.glow-trail::before,
.glow-trail::after {
  content: "✦";
  position: absolute;
  top: -23px;
  color: #171717;
  font-size: 1.2rem;
}

.glow-trail::before {
  left: 44px;
}

.glow-trail::after {
  right: 28px;
}

.bloom {
  position: absolute;
  right: 15%;
  bottom: 30px;
  z-index: 5;
  width: 82px;
  height: 92px;
}

.bloom::before {
  content: "";
  position: absolute;
  left: 39px;
  bottom: 0;
  width: 2px;
  height: 48px;
  background: #171717;
}

.bloom::after {
  content: "";
  position: absolute;
  left: 24px;
  bottom: -5px;
  width: 34px;
  height: 12px;
  border: 2px solid #171717;
  border-radius: 50%;
  background: #fffefa;
}

.bloom span {
  position: absolute;
  left: 31px;
  top: 14px;
  width: 22px;
  height: 30px;
  border: 2px solid #171717;
  border-radius: 50% 50% 44% 44%;
  background:
    linear-gradient(180deg, rgba(255, 247, 250, 0.9), rgba(238, 246, 242, 0.9)),
    #fffefa;
  transform-origin: 50% 100%;
}

.bloom span:nth-child(1) {
  transform: rotate(0deg) translateY(-14px) scale(0.88);
}

.bloom span:nth-child(2) {
  transform: rotate(72deg) translateY(-14px) scale(0.88);
}

.bloom span:nth-child(3) {
  transform: rotate(144deg) translateY(-14px) scale(0.88);
}

.bloom span:nth-child(4) {
  transform: rotate(216deg) translateY(-14px) scale(0.88);
}

.bloom span:nth-child(5) {
  transform: rotate(288deg) translateY(-14px) scale(0.88);
}

.keepsakes {
  position: absolute;
  left: 28%;
  right: 30%;
  bottom: 25px;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  opacity: 0.72;
}

.keepsakes span {
  width: 12px;
  height: 12px;
  border: 1px solid rgba(23, 23, 23, 0.55);
  border-radius: 6px 6px 10px 10px;
  background: rgba(255, 255, 255, 0.75);
  transform: rotate(45deg);
}

.arena.combo-1 .keeper,
.arena.combo-2 .keeper,
.arena.combo-3 .keeper {
  animation: keeperFloat 880ms cubic-bezier(0.2, 0.9, 0.2, 1);
}

.arena.combo-1 .glow-trail {
  animation: glowArc 860ms ease;
}

.arena.combo-2 .glow-trail {
  animation: glowLoop 920ms ease;
}

.arena.combo-3 .glow-trail {
  animation: glowBloom 980ms ease;
}

.arena.combo-1 .bloom,
.arena.combo-2 .bloom,
.arena.combo-3 .bloom {
  animation: bloomGrow 980ms ease;
}

.arena.combo-1 .garden-sky span,
.arena.combo-2 .garden-sky span,
.arena.combo-3 .garden-sky span {
  animation: skyTwinkle 900ms ease;
}

.arena.miss {
  animation: softWobble 560ms ease;
}

.arena.miss .keeper {
  animation: keeperPause 680ms ease;
}

.arena.miss .glow-trail {
  animation: dewFade 780ms ease;
}

.arena.miss .bloom {
  animation: bloomRest 760ms ease;
}


.actions {
  gap: 10px;
  flex-wrap: wrap;
}

.side-panel {
  display: grid;
  gap: 18px;
}

.settings,
.ranking {
  padding: 20px;
}

.settings {
  display: grid;
  gap: 16px;
}

.settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.settings-head span {
  color: var(--accent);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.75rem;
  font-weight: 700;
}

label {
  display: grid;
  gap: 8px;
}

select,
.dialog-card input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  color: var(--ink);
  background: #fbfaf6;
}

.ranking-head {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

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

li {
  min-height: 44px;
  padding: 10px 12px;
  display: grid;
  grid-template-columns: 30px 1fr auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf6;
}

li strong {
  justify-self: end;
}

dialog {
  width: min(420px, calc(100vw - 32px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  color: var(--ink);
  background: transparent;
}

dialog::backdrop {
  background: rgba(23, 23, 23, 0.34);
  backdrop-filter: blur(6px);
}

.dialog-card {
  padding: 24px;
  display: grid;
  gap: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

@keyframes shake {
  30% {
    transform: translateX(-7px);
  }
  65% {
    transform: translateX(7px);
  }
}

@keyframes runnerDash {
  0% {
    transform: translateX(0) translateY(0) rotate(0);
  }
  34% {
    transform: translateX(160px) translateY(-24px) rotate(-8deg);
  }
  52% {
    transform: translateX(198px) translateY(-4px) rotate(7deg);
  }
  100% {
    transform: translateX(0) translateY(0) rotate(0);
  }
}

@keyframes riftSlash {
  0% {
    opacity: 0;
    transform: translateX(-50%) scaleX(0.35) translateY(10px);
  }
  34% {
    opacity: 1;
    transform: translateX(-50%) scaleX(1.05) translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) scaleX(1.28) translateY(-16px);
  }
}

@keyframes riftCross {
  0% {
    opacity: 0;
    transform: translateX(-50%) rotate(0deg) scale(0.65);
  }
  30% {
    opacity: 1;
    transform: translateX(-50%) rotate(8deg) scale(1.08);
  }
  58% {
    opacity: 1;
    transform: translateX(-50%) rotate(-8deg) scale(1.16);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) rotate(0deg) scale(1.38) translateY(-18px);
  }
}

@keyframes riftBurst {
  0% {
    opacity: 0;
    transform: translateX(-50%) scale(0.4);
  }
  28% {
    opacity: 1;
    transform: translateX(-50%) scale(1.25);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) scale(1.72) translateY(-18px);
  }
}

@keyframes sigilHit {
  0%,
  34% {
    transform: translateX(0) rotate(0deg) scale(1);
    filter: none;
  }
  52% {
    transform: translateX(0) rotate(18deg) scale(1.2);
    filter: none;
  }
  100% {
    transform: translateX(0) rotate(0deg) scale(1);
    filter: none;
  }
}

@keyframes hudPulse {
  0%,
  100% {
    transform: scale(1);
  }
  42% {
    transform: scale(1.025);
  }
}

@keyframes arenaGlitch {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-3px);
  }
  50% {
    transform: translateX(3px);
  }
  75% {
    transform: translateX(-2px);
  }
}

@keyframes runnerStagger {
  0%,
  100% {
    transform: translateX(0) rotate(0);
  }
  45% {
    transform: translateX(-12px) rotate(-5deg);
  }
}

@keyframes sigilCounter {
  0%,
  100% {
    transform: translateX(0) scale(1);
  }
  44% {
    transform: translateX(0) scale(0.9) rotate(-10deg);
  }
}

@keyframes answerReveal {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(16px) scale(0.94);
  }
  14%,
  78% {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(-10px) scale(0.98);
  }
}

@keyframes keeperFloat {
  0%,
  100% {
    transform: translateX(0) translateY(0) rotate(0deg);
  }
  36% {
    transform: translateX(108px) translateY(-22px) rotate(-5deg);
  }
  62% {
    transform: translateX(138px) translateY(-6px) rotate(4deg);
  }
}

@keyframes glowArc {
  0% {
    opacity: 0;
    transform: rotate(-10deg) scaleX(0.3) translateY(10px);
  }
  38% {
    opacity: 1;
    transform: rotate(-10deg) scaleX(1) translateY(0);
  }
  100% {
    opacity: 0;
    transform: rotate(-10deg) scaleX(1.12) translateY(-16px);
  }
}

@keyframes glowLoop {
  0% {
    opacity: 0;
    transform: rotate(-10deg) scale(0.55);
  }
  42% {
    opacity: 1;
    transform: rotate(8deg) scale(1.08);
  }
  100% {
    opacity: 0;
    transform: rotate(-2deg) scale(1.25) translateY(-16px);
  }
}

@keyframes glowBloom {
  0% {
    opacity: 0;
    transform: rotate(-10deg) scale(0.45);
  }
  32% {
    opacity: 1;
    transform: rotate(0deg) scale(1.18);
  }
  100% {
    opacity: 0;
    transform: rotate(0deg) scale(1.45) translateY(-20px);
  }
}

@keyframes bloomGrow {
  0%,
  100% {
    transform: scale(1);
  }
  42% {
    transform: scale(1.12) translateY(-5px);
  }
}

@keyframes skyTwinkle {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  45% {
    transform: scale(1.7);
    opacity: 0.55;
  }
}

@keyframes softWobble {
  0%,
  100% {
    transform: translateX(0);
  }
  35% {
    transform: translateX(-2px);
  }
  70% {
    transform: translateX(2px);
  }
}

@keyframes keeperPause {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }
  48% {
    transform: translateY(4px) rotate(-3deg);
  }
}

@keyframes dewFade {
  0% {
    opacity: 0;
    transform: rotate(-10deg) scaleX(0.25);
  }
  35% {
    opacity: 0.65;
    transform: rotate(-10deg) scaleX(0.7);
  }
  100% {
    opacity: 0;
    transform: rotate(-10deg) scaleX(0.92) translateY(12px);
  }
}

@keyframes bloomRest {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(0.97);
  }
}

@media (max-width: 860px) {
  .shell {
    grid-template-columns: 1fr;
    align-items: start;
    padding: 18px 0;
  }

  .practice-panel {
    min-height: 720px;
    padding: 22px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .side-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 540px) {
  .shell {
    width: min(100vw - 20px, 1180px);
  }

  .practice-panel {
    min-height: 680px;
  }

  .arena {
    height: 162px;
  }

  .boss-card {
    right: 14px;
    width: 46%;
  }

  .garden-card {
    right: 14px;
    width: 48%;
  }

  .runner {
    left: 26px;
  }

  .keeper {
    left: 24px;
  }

  .enemy-sigil {
    right: 34px;
    width: 64px;
    height: 64px;
  }

  .bloom {
    right: 34px;
    width: 68px;
    height: 82px;
  }

  .keepsakes {
    left: 108px;
    right: 112px;
  }

  .arena.combo-1 .runner,
  .arena.combo-2 .runner,
  .arena.combo-3 .runner {
    animation-name: runnerDashMobile;
  }

  .arena.combo-1 .keeper,
  .arena.combo-2 .keeper,
  .arena.combo-3 .keeper {
    animation-name: keeperFloatMobile;
  }

  .status-grid strong {
    font-size: 1.25rem;
  }

  .actions button {
    flex: 1 1 130px;
  }
}

@keyframes runnerDashMobile {
  0% {
    transform: translateX(0) translateY(0) rotate(0);
  }
  38% {
    transform: translateX(94px) translateY(-20px) rotate(-8deg);
  }
  58% {
    transform: translateX(108px) translateY(-3px) rotate(7deg);
  }
  100% {
    transform: translateX(0) translateY(0) rotate(0);
  }
}

@keyframes keeperFloatMobile {
  0%,
  100% {
    transform: translateX(0) translateY(0) rotate(0deg);
  }
  38% {
    transform: translateX(72px) translateY(-18px) rotate(-5deg);
  }
  62% {
    transform: translateX(88px) translateY(-4px) rotate(4deg);
  }
}

@media (max-width: 540px) {
  .battle-head {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .garden-progress {
    width: 100%;
  }

  .arena {
    height: 166px;
  }
}

/* Botanical specimen game */
.arena {
  height: 224px;
  background:
    linear-gradient(90deg, transparent 49.9%, rgba(23, 23, 23, 0.035) 50%, transparent 50.1%),
    linear-gradient(180deg, #fdfcf9 0%, #f6f4ee 100%);
}

.arena::before {
  inset: 14px;
  height: auto;
  border: 1px solid rgba(23, 23, 23, 0.08);
  background: none;
}

.specimen-meta {
  position: absolute;
  inset: 25px 28px auto;
  z-index: 4;
  display: flex;
  justify-content: space-between;
  color: rgba(23, 23, 23, 0.48);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.63rem;
  font-weight: 700;
}

.growth-rings {
  position: absolute;
  left: 50%;
  bottom: 31px;
  width: 230px;
  height: 64px;
  transform: translateX(-50%);
}

.growth-rings span {
  position: absolute;
  left: 50%;
  bottom: 0;
  border: 1px solid rgba(23, 23, 23, 0.1);
  border-radius: 50%;
  transform: translateX(-50%);
}

.growth-rings span:nth-child(1) {
  width: 82px;
  height: 18px;
}

.growth-rings span:nth-child(2) {
  width: 154px;
  height: 38px;
}

.growth-rings span:nth-child(3) {
  width: 224px;
  height: 62px;
}

.botanical {
  position: absolute;
  left: 50%;
  bottom: 26px;
  z-index: 5;
  width: 190px;
  height: 165px;
  transform: translateX(-50%);
}

.botanical span {
  position: absolute;
  display: block;
}

.soil {
  left: 50%;
  bottom: 0;
  width: 88px;
  height: 17px;
  border: 1.5px solid #171717;
  border-radius: 50%;
  background: #f1efe8;
  transform: translateX(-50%);
}

.root {
  left: 50%;
  bottom: 8px;
  width: 1.5px;
  height: 29px;
  background: #171717;
  opacity: 0;
  transform-origin: top;
  transition: opacity 400ms ease, transform 700ms ease;
}

.root-left {
  transform: rotate(34deg) scaleY(0);
}

.root-right {
  transform: rotate(-38deg) scaleY(0);
}

.stem {
  left: calc(50% - 1px);
  bottom: 12px;
  width: 2px;
  height: 91px;
  background: #171717;
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform 900ms cubic-bezier(0.2, 0.78, 0.2, 1);
}

.leaf {
  bottom: 57px;
  width: 35px;
  height: 16px;
  border: 1.5px solid #171717;
  background: #f9f8f3;
  opacity: 0;
  transition: opacity 500ms ease, transform 750ms cubic-bezier(0.2, 0.78, 0.2, 1);
}

.leaf-left {
  right: 50%;
  border-radius: 100% 0 100% 0;
  transform: rotate(20deg) scale(0);
  transform-origin: right bottom;
}

.leaf-right {
  left: 50%;
  bottom: 73px;
  border-radius: 0 100% 0 100%;
  transform: rotate(-18deg) scale(0);
  transform-origin: left bottom;
}

.bud {
  left: 50%;
  bottom: 98px;
  width: 25px;
  height: 35px;
  border: 1.5px solid #171717;
  border-radius: 50% 50% 45% 45%;
  background: #f7f5ef;
  opacity: 0;
  transform: translateX(-50%) scale(0.2);
  transform-origin: 50% 100%;
  transition: opacity 420ms ease, transform 780ms cubic-bezier(0.2, 0.86, 0.2, 1);
}

.petal {
  left: 50%;
  bottom: 105px;
  width: 29px;
  height: 46px;
  border: 1.5px solid #171717;
  border-radius: 55% 55% 42% 42%;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(231, 228, 219, 0.82));
  opacity: 0;
  transform-origin: 50% 100%;
  transition: opacity 480ms ease, transform 900ms cubic-bezier(0.16, 0.88, 0.22, 1);
}

.petal-1 { transform: translateX(-50%) rotate(0deg) translateY(10px) scale(0.12); }
.petal-2 { transform: translateX(-50%) rotate(72deg) translateY(10px) scale(0.12); }
.petal-3 { transform: translateX(-50%) rotate(144deg) translateY(10px) scale(0.12); }
.petal-4 { transform: translateX(-50%) rotate(216deg) translateY(10px) scale(0.12); }
.petal-5 { transform: translateX(-50%) rotate(288deg) translateY(10px) scale(0.12); }

.flower-core {
  left: 50%;
  bottom: 116px;
  z-index: 2;
  width: 22px;
  height: 22px;
  border: 1.5px solid #171717;
  border-radius: 50%;
  background:
    radial-gradient(circle, #171717 0 1px, transparent 1.5px) 0 0 / 5px 5px,
    #f7f5ef;
  opacity: 0;
  transform: translateX(-50%) scale(0);
  transition: opacity 450ms ease, transform 700ms ease;
}

.growth-pulse {
  position: absolute;
  left: 50%;
  bottom: 39px;
  z-index: 3;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(23, 23, 23, 0.34);
  border-radius: 50%;
  opacity: 0;
  transform: translateX(-50%);
}

.arena.stage-1 .root {
  opacity: 0.65;
}

.arena.stage-1 .root-left {
  transform: rotate(34deg) scaleY(1);
}

.arena.stage-1 .root-right {
  transform: rotate(-38deg) scaleY(1);
}

.arena.stage-2 .root,
.arena.stage-3 .root,
.arena.stage-4 .root,
.arena.stage-5 .root {
  opacity: 0.65;
}

.arena.stage-2 .root-left,
.arena.stage-3 .root-left,
.arena.stage-4 .root-left,
.arena.stage-5 .root-left {
  transform: rotate(34deg) scaleY(1);
}

.arena.stage-2 .root-right,
.arena.stage-3 .root-right,
.arena.stage-4 .root-right,
.arena.stage-5 .root-right {
  transform: rotate(-38deg) scaleY(1);
}

.arena.stage-2 .stem,
.arena.stage-3 .stem,
.arena.stage-4 .stem,
.arena.stage-5 .stem {
  transform: scaleY(1);
}

.arena.stage-3 .leaf,
.arena.stage-4 .leaf,
.arena.stage-5 .leaf {
  opacity: 1;
}

.arena.stage-3 .leaf-left,
.arena.stage-4 .leaf-left,
.arena.stage-5 .leaf-left {
  transform: rotate(20deg) scale(1);
}

.arena.stage-3 .leaf-right,
.arena.stage-4 .leaf-right,
.arena.stage-5 .leaf-right {
  transform: rotate(-18deg) scale(1);
}

.arena.stage-4 .bud {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

.arena.stage-5 .bud {
  opacity: 0;
  transform: translateX(-50%) scale(0.5);
}

.arena.stage-5 .petal,
.arena.stage-5 .flower-core {
  opacity: 1;
}

.arena.stage-5 .petal-1 { transform: translateX(-50%) rotate(0deg) translateY(-18px) scale(1); }
.arena.stage-5 .petal-2 { transform: translateX(-50%) rotate(72deg) translateY(-18px) scale(1); }
.arena.stage-5 .petal-3 { transform: translateX(-50%) rotate(144deg) translateY(-18px) scale(1); }
.arena.stage-5 .petal-4 { transform: translateX(-50%) rotate(216deg) translateY(-18px) scale(1); }
.arena.stage-5 .petal-5 { transform: translateX(-50%) rotate(288deg) translateY(-18px) scale(1); }
.arena.stage-5 .flower-core { transform: translateX(-50%) scale(1); }

.arena.combo-1 .growth-pulse,
.arena.combo-2 .growth-pulse,
.arena.combo-3 .growth-pulse {
  animation: specimenPulse 900ms ease-out;
}

.arena.combo-1 .botanical,
.arena.combo-2 .botanical,
.arena.combo-3 .botanical {
  animation: specimenBreathe 980ms ease;
}

.arena.miss .botanical {
  animation: specimenStill 580ms ease;
}

@keyframes specimenPulse {
  0% {
    opacity: 0.5;
    transform: translateX(-50%) scale(0.5);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) scale(4.6);
  }
}

@keyframes specimenBreathe {
  0%,
  100% {
    filter: contrast(1);
  }
  45% {
    filter: contrast(1.22);
  }
}

@keyframes specimenStill {
  0%,
  100% {
    transform: translateX(-50%);
  }
  45% {
    transform: translateX(-50%) translateY(2px);
  }
}

@media (max-width: 540px) {
  .arena {
    height: 204px;
  }

  .botanical {
    transform: translateX(-50%) scale(0.88);
    transform-origin: 50% 100%;
  }
}

/* Chromatic conservatory */
.battle-kicker {
  color: #9b5c45;
}

.garden-progress strong {
  color: #285a4a;
}

.boss-health {
  border-color: rgba(35, 74, 62, 0.24);
  background: rgba(40, 90, 74, 0.09);
  box-shadow: inset 0 1px 2px rgba(35, 74, 62, 0.08);
}

.boss-health span {
  background: linear-gradient(90deg, #285a4a, #62a66e 58%, #d9ad55);
  box-shadow: 0 0 12px rgba(98, 166, 110, 0.28);
}

.arena {
  border-color: rgba(49, 72, 62, 0.2);
  background:
    radial-gradient(circle at 82% 16%, rgba(255, 220, 153, 0.5), transparent 24%),
    radial-gradient(circle at 18% 88%, rgba(87, 151, 126, 0.18), transparent 35%),
    linear-gradient(145deg, #f8fbf7 0%, #eef4ec 50%, #f8eee7 100%);
  box-shadow:
    inset 0 0 0 5px rgba(255, 255, 255, 0.6),
    inset 0 -28px 52px rgba(66, 105, 83, 0.08),
    0 14px 30px rgba(50, 62, 53, 0.08);
}

.arena::before {
  border-color: rgba(40, 90, 74, 0.1);
  background:
    linear-gradient(90deg, transparent 49.8%, rgba(40, 90, 74, 0.06) 50%, transparent 50.2%),
    linear-gradient(transparent 49.8%, rgba(40, 90, 74, 0.045) 50%, transparent 50.2%);
  background-size: 72px 72px;
}

.specimen-meta {
  color: rgba(40, 90, 74, 0.55);
}

.growth-rings span {
  border-color: rgba(40, 90, 74, 0.14);
}

.soil {
  border-color: #5c574c;
  background:
    radial-gradient(circle at 30% 40%, #816f58 0 2px, transparent 2.5px),
    radial-gradient(circle at 66% 58%, #6b5b48 0 1.5px, transparent 2px),
    linear-gradient(180deg, #a78c6c, #695744);
  box-shadow:
    inset 0 2px 4px rgba(255, 255, 255, 0.22),
    0 7px 15px rgba(73, 60, 45, 0.14);
}

.root {
  background: #9b7652;
}

.stem {
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, #245a42, #6da36b 58%, #244f3d);
  box-shadow: 1px 0 3px rgba(34, 79, 61, 0.2);
}

.leaf {
  border-color: #285a4a;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.38), transparent 42%),
    linear-gradient(135deg, #8fc078, #3d7b58 58%, #23513f);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.16),
    0 4px 8px rgba(35, 81, 63, 0.12);
}

.bud {
  border-color: #805341;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.45), transparent 40%),
    linear-gradient(180deg, #e9a998, #bd6e68 56%, #7c4f48);
  box-shadow: 0 5px 12px rgba(132, 75, 68, 0.18);
}

.petal {
  border-color: rgba(128, 74, 70, 0.62);
  background:
    radial-gradient(circle at 38% 25%, rgba(255, 255, 255, 0.9), transparent 24%),
    linear-gradient(160deg, #ffe1d3 0%, #e79b91 48%, #bb6b78 100%);
  box-shadow:
    inset -3px -5px 8px rgba(126, 66, 76, 0.13),
    0 8px 14px rgba(131, 70, 77, 0.14);
}

.flower-core {
  border-color: #8a682d;
  background:
    radial-gradient(circle, #815d22 0 1px, transparent 1.6px) 0 0 / 5px 5px,
    radial-gradient(circle at 35% 30%, #ffe5a1, #d6a640 68%, #996f27);
  box-shadow: 0 3px 9px rgba(139, 99, 34, 0.22);
}

.growth-pulse {
  border-color: rgba(89, 160, 108, 0.5);
  box-shadow: 0 0 24px rgba(89, 160, 108, 0.24);
}

.arena.stage-5 .botanical {
  filter: saturate(1.08);
}

.arena.stage-5 .petal {
  animation: petalDrift 4.8s ease-in-out infinite alternate;
}

.arena.stage-5 .petal:nth-of-type(even) {
  animation-delay: -2.1s;
}

.arena.stage-3 .leaf,
.arena.stage-4 .leaf,
.arena.stage-5 .leaf {
  animation: leafBreath 4.2s ease-in-out infinite alternate;
}

@keyframes petalDrift {
  from {
    filter: brightness(0.98);
  }
  to {
    filter: brightness(1.08);
  }
}

@keyframes leafBreath {
  from {
    filter: saturate(0.94);
  }
  to {
    filter: saturate(1.14) brightness(1.04);
  }
}
