:root {
  --ink: #163042;
  --muted: #5d7180;
  --paper: #fbfeff;
  --line: #c9dde4;
  --ice: #dffbff;
  --aqua: #63cad8;
  --teal: #2f9caa;
  --rose: #ff8fa8;
  --peach: #ffd0a6;
  --gold: #f3c65d;
  --green: #77c7a4;
  --danger: #c35369;
  --shadow: 0 20px 50px rgba(31, 89, 117, 0.18);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  width: 100%;
  overflow-x: hidden;
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 208, 166, 0.45), transparent 22rem),
    radial-gradient(circle at 88% 10%, rgba(119, 199, 164, 0.32), transparent 20rem),
    linear-gradient(135deg, #f5fdff 0%, #d9f3f7 54%, #fff4e8 100%);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.app-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.topbar,
.section-heading,
.modal-header,
.stage-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar {
  width: 100%;
  min-width: 0;
  min-height: 82px;
  padding: 10px 0 18px;
}

.topbar > div:first-child,
.section-heading > div:first-child {
  min-width: 0;
  max-width: 100%;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  max-width: 100%;
  overflow-wrap: break-word;
  font-size: 2.65rem;
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  font-size: 1.25rem;
  line-height: 1.2;
  letter-spacing: 0;
}

h3 {
  font-size: 1rem;
  line-height: 1.2;
  letter-spacing: 0;
}

.eyebrow,
.mini-label {
  color: var(--teal);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  min-width: 0;
}

.score-pill,
.stage-status,
.routine-panel,
.shop-panel,
.modal-panel {
  border: 1px solid rgba(201, 221, 228, 0.85);
  background: rgba(251, 254, 255, 0.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.score-pill {
  display: inline-flex;
  min-width: 0;
  min-height: 56px;
  align-items: center;
  gap: 7px;
  padding: 0 18px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 1.08rem;
}

.score-icon {
  color: var(--gold);
  font-size: 1.75rem;
  filter: drop-shadow(0 0 8px rgba(243, 198, 93, 0.75));
  animation: scoreTwinkle 1800ms ease-in-out infinite;
}

.snowflake-bank {
  display: flex;
  max-width: 128px;
  flex-wrap: wrap;
  gap: 2px;
  align-items: center;
  margin-left: 3px;
}

.snowflake-bank i,
.snowflake-bank em {
  display: grid;
  min-width: 16px;
  height: 16px;
  place-items: center;
  border-radius: 999px;
  color: #a1700d;
  background: #fff2a9;
  font-size: 0.72rem;
  font-style: normal;
  line-height: 1;
  box-shadow: 0 3px 8px rgba(243, 198, 93, 0.28);
}

.snowflake-bank em {
  padding: 0 5px;
  font-weight: 900;
}

.icon-button {
  display: inline-grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 8px 20px rgba(30, 75, 95, 0.1);
}

.icon-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.floating-parent-button {
  display: none;
}

.game-grid {
  display: grid;
  grid-template-columns: minmax(360px, 1.14fr) minmax(360px, 0.86fr);
  grid-template-areas:
    "stage routines"
    "shop routines";
  gap: 16px;
  align-items: start;
}

.kingdom-stage {
  position: relative;
  grid-area: stage;
  min-height: 550px;
  overflow: hidden;
  border: 1px solid #b8dce6;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.12)),
    linear-gradient(150deg, #dffbff 0%, #b8edf4 47%, #ffe3c5 100%);
  box-shadow: var(--shadow);
}

.stage-sky {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.snowflake-mascot-img {
  position: absolute;
  left: 18px;
  top: 92px;
  z-index: 1;
  width: clamp(78px, 12vw, 128px);
  aspect-ratio: 1;
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 999px;
  object-fit: cover;
  object-position: center;
  box-shadow: 0 16px 34px rgba(35, 113, 142, 0.2);
  animation: mascotBob 2800ms ease-in-out infinite;
}

.snow-dot {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow:
    38px 88px 0 rgba(255, 255, 255, 0.6),
    116px 28px 0 rgba(255, 255, 255, 0.78),
    178px 144px 0 rgba(255, 255, 255, 0.52);
  animation: snowDrift 9s ease-in-out infinite alternate;
}

.dot-a {
  left: 5%;
  top: 10%;
}

.dot-b {
  left: 42%;
  top: 6%;
  transform: scale(0.8);
  animation-duration: 11s;
}

.dot-c {
  left: 70%;
  top: 18%;
  transform: scale(0.6);
  animation-duration: 13s;
}

.dot-d {
  left: 28%;
  top: 34%;
  transform: scale(0.7);
  animation-duration: 10s;
}

@keyframes snowDrift {
  from {
    translate: 0 0;
  }
  to {
    translate: 16px 22px;
  }
}

.castle-svg {
  position: absolute;
  right: -8px;
  bottom: 0;
  width: min(96%, 680px);
  height: auto;
  animation: castleGlow 3600ms ease-in-out infinite;
}

.snow-ground {
  fill: rgba(255, 255, 255, 0.9);
}

.avatar-wrap {
  position: absolute;
  left: clamp(10px, 4vw, 58px);
  bottom: 18px;
  width: min(42%, 280px);
  min-width: 170px;
  animation: avatarFloat 3200ms ease-in-out infinite;
}

.avatar-svg {
  display: block;
  width: 100%;
  filter: drop-shadow(0 16px 22px rgba(25, 76, 94, 0.22));
}

.queen-state-img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: contain;
  mix-blend-mode: multiply;
  filter: drop-shadow(0 16px 22px rgba(25, 76, 94, 0.22));
}

.queen-state-img + .avatar-fallback {
  display: none;
}

.avatar-shadow {
  fill: rgba(40, 82, 102, 0.18);
}

.hair-back,
.hair-front,
.hair-sweep {
  fill: url(#braidGold);
}

.side-braid {
  animation: braidSway 2600ms ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}

.side-braid-rope {
  fill: none;
  stroke: url(#braidGold);
  stroke-linecap: round;
  stroke-width: 13;
}

.side-braid-lines {
  fill: none;
  stroke: #fff5c6;
  stroke-linecap: round;
  stroke-width: 3;
}

.side-braid-tip {
  fill: #fff0a7;
  stroke: #d6a93f;
  stroke-linejoin: round;
  stroke-width: 2;
}

.hair-sweep {
  stroke: rgba(255, 248, 207, 0.9);
  stroke-width: 2;
}

.face {
  fill: #ffd5c3;
}

.dress-main {
  fill: url("#iceDress");
}

.bodice {
  fill: #4bb8cc;
  stroke: #eaffff;
  stroke-width: 3;
}

.ice-panel {
  fill: rgba(244, 254, 255, 0.64);
}

.arm-left,
.arm-right {
  fill: none;
  stroke: #ffd5c3;
  stroke-linecap: round;
  stroke-width: 12;
}

.snowflake-mark {
  animation: dressFlakePulse 1700ms ease-in-out infinite;
}

.castle-base,
.castle-piece.is-visible {
  animation: iceShimmer 4200ms ease-in-out infinite;
}

.avatar-piece,
.castle-piece {
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
  scale: 0.92;
  transition:
    opacity 220ms ease,
    scale 220ms ease;
}

.avatar-piece.is-visible,
.castle-piece.is-visible {
  opacity: 1;
  scale: 1;
}

.cloud-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.cloud {
  position: absolute;
  width: 96px;
  height: 42px;
  border-radius: 999px;
  background: #8e9ba5;
  opacity: 0.78;
  box-shadow:
    24px -18px 0 #a1adb6,
    48px -6px 0 #7d8b96,
    8px 12px 18px rgba(68, 87, 101, 0.22);
}

.cloud:nth-child(1) {
  top: 86px;
  left: 8%;
}

.cloud:nth-child(2) {
  top: 42px;
  right: 18%;
  transform: scale(0.82);
}

.cloud:nth-child(3) {
  top: 142px;
  right: 6%;
  transform: scale(0.7);
}

.cloud:nth-child(4) {
  top: 196px;
  left: 42%;
  transform: scale(0.66);
}

.stage-status {
  position: absolute;
  z-index: 3;
  right: 16px;
  top: 16px;
  min-width: 210px;
  padding: 11px 13px;
  border-radius: 8px;
}

.stage-status > div {
  display: grid;
  gap: 2px;
}

.routine-panel {
  grid-area: routines;
  padding: 16px;
  border-radius: 8px;
}

.shop-panel {
  grid-area: shop;
  padding: 16px;
  border-radius: 8px;
}

.routine-list,
.shop-list,
.parent-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.routine-card,
.shop-item,
.parent-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  min-height: 84px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.routine-card.is-complete {
  background: #f2fbf2;
  border-color: rgba(119, 199, 164, 0.7);
}

.routine-icon {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 8px;
  background: #e8fbff;
  color: var(--teal);
}

.routine-icon svg {
  width: 31px;
  height: 31px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.routine-icon img {
  width: 46px;
  height: 46px;
  object-fit: contain;
  border-radius: 7px;
}

.routine-copy {
  min-width: 0;
}

.routine-title {
  display: block;
  overflow-wrap: anywhere;
  font-size: 1.02rem;
  font-weight: 900;
}

.routine-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.9rem;
}

.progress-pips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.pip {
  width: 12px;
  height: 12px;
  border: 2px solid #9fc8d4;
  border-radius: 999px;
  background: #fff;
}

.pip.is-done {
  border-color: var(--green);
  background: var(--green);
}

.routine-action,
.shop-action,
.routine-form button,
.inline-form button,
.small-button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 900;
  white-space: normal;
  box-shadow: 0 10px 18px rgba(22, 48, 66, 0.16);
}

.routine-action,
.shop-action {
  min-width: 105px;
  padding: 0 12px;
}

.small-button {
  min-width: 116px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: none;
}

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

.shop-item {
  grid-template-columns: 1fr;
  align-content: start;
  min-height: 222px;
  gap: 10px;
}

.shop-preview {
  display: grid;
  min-height: 82px;
  place-items: center;
  border: 1px solid #b9dfe8;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.25)),
    #dffbff;
}

.shop-preview svg {
  width: 88px;
  height: 66px;
  fill: #78cfdd;
  stroke: #276f83;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
}

.shop-preview img {
  width: 100%;
  height: 100%;
  max-height: 116px;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.shop-preview.is-avatar svg {
  fill: #ff9ab0;
  stroke: #25536a;
}

.shop-title {
  font-weight: 900;
  overflow-wrap: anywhere;
}

.shop-text {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
}

.shop-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
}

.shop-cost {
  display: grid;
  gap: 1px;
  color: var(--teal);
  font-weight: 900;
  line-height: 1.05;
}

.shop-cost strong {
  color: var(--ink);
  font-size: 1.2rem;
}

.shop-cost small {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
}

.segmented {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(110px, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.segment {
  min-height: 42px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
}

.segment.is-active {
  background: var(--aqua);
  color: #10313b;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 20;
  max-width: min(92vw, 520px);
  padding: 13px 16px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 900;
  text-align: center;
  transform: translate(-50%, calc(100% + 28px));
  opacity: 0;
  transition:
    transform 220ms ease,
    opacity 220ms ease;
}

.toast.is-visible {
  transform: translate(-50%, 0);
  opacity: 1;
}

.flake-gain {
  position: fixed;
  top: 18px;
  right: 98px;
  z-index: 45;
  display: grid;
  min-width: 124px;
  min-height: 86px;
  place-items: center;
  pointer-events: none;
  color: var(--gold);
  animation: flakeGain 1100ms ease forwards;
}

.flake-gain strong {
  padding: 8px 14px;
  border: 1px solid rgba(243, 198, 93, 0.55);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  box-shadow: var(--shadow);
}

.flake-gain span {
  position: absolute;
  font-size: 1.55rem;
  filter: drop-shadow(0 0 8px rgba(243, 198, 93, 0.95));
}

.flake-gain span:nth-child(2) {
  left: 0;
  top: 22px;
  animation: flakeFloatA 980ms ease forwards;
}

.flake-gain span:nth-child(3) {
  right: 4px;
  top: 10px;
  animation: flakeFloatB 980ms ease forwards;
}

.flake-gain span:nth-child(4) {
  left: 44px;
  bottom: 0;
  animation: flakeFloatC 980ms ease forwards;
}

.score-pulse {
  animation: scorePulse 600ms ease;
}

.purchase-celebration {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  pointer-events: none;
  background: rgba(218, 250, 255, 0.78);
  animation: celebrationIn 260ms ease forwards;
  backdrop-filter: blur(5px);
}

.purchase-celebration.is-leaving {
  animation: celebrationOut 300ms ease forwards;
}

.celebration-card {
  position: relative;
  display: grid;
  width: min(520px, 92vw);
  min-height: 260px;
  place-items: center;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.95);
  border-radius: 8px;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 1), rgba(199, 251, 255, 0.92)),
    linear-gradient(145deg, #dbfbff, #ffd7e1);
  box-shadow: 0 28px 80px rgba(22, 48, 66, 0.34);
  text-align: center;
}

.celebration-card p {
  color: var(--teal);
  font-size: 0.85rem;
  font-weight: 900;
  text-transform: uppercase;
}

.celebration-card strong {
  max-width: 88%;
  color: var(--ink);
  font-size: 2.1rem;
  line-height: 1.05;
}

.celebration-snow span {
  position: absolute;
  color: var(--gold);
  font-size: 2.4rem;
  filter: drop-shadow(0 0 10px rgba(243, 198, 93, 0.85));
  animation: celebrationSnow 1250ms ease-in-out infinite alternate;
}

.celebration-snow span:nth-child(1) {
  left: 14%;
  top: 18%;
}

.celebration-snow span:nth-child(2) {
  left: 25%;
  bottom: 18%;
  animation-delay: 160ms;
}

.celebration-snow span:nth-child(3) {
  right: 16%;
  top: 16%;
  animation-delay: 280ms;
}

.celebration-snow span:nth-child(4) {
  right: 24%;
  bottom: 18%;
  animation-delay: 420ms;
}

.celebration-snow span:nth-child(5) {
  left: 47%;
  top: 8%;
  animation-delay: 560ms;
}

.celebration-snow span:nth-child(6) {
  right: 45%;
  bottom: 8%;
  animation-delay: 680ms;
}

@keyframes scoreTwinkle {
  0%,
  100% {
    scale: 1;
    opacity: 0.92;
  }
  50% {
    scale: 1.18;
    opacity: 1;
  }
}

@keyframes castleGlow {
  0%,
  100% {
    filter: drop-shadow(0 10px 20px rgba(82, 177, 194, 0.12));
  }
  50% {
    filter: drop-shadow(0 8px 28px rgba(255, 255, 255, 0.7));
  }
}

@keyframes avatarFloat {
  0%,
  100% {
    translate: 0 0;
  }
  50% {
    translate: 0 -7px;
  }
}

@keyframes mascotBob {
  0%,
  100% {
    translate: 0 0;
    rotate: -3deg;
  }
  50% {
    translate: 0 -8px;
    rotate: 3deg;
  }
}

@keyframes braidSway {
  0%,
  100% {
    translate: 0 0;
  }
  50% {
    translate: 2px 1px;
  }
}

@keyframes dressFlakePulse {
  0%,
  100% {
    opacity: 0.68;
  }
  50% {
    opacity: 1;
  }
}

@keyframes iceShimmer {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.86;
  }
}

@keyframes scorePulse {
  0%,
  100% {
    scale: 1;
  }
  45% {
    scale: 1.08;
  }
}

@keyframes flakeGain {
  0% {
    opacity: 0;
    translate: 0 18px;
  }
  15% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    translate: 0 -34px;
  }
}

@keyframes flakeFloatA {
  to {
    translate: -22px -42px;
    rotate: -18deg;
  }
}

@keyframes flakeFloatB {
  to {
    translate: 24px -50px;
    rotate: 22deg;
  }
}

@keyframes flakeFloatC {
  to {
    translate: 8px -46px;
    rotate: 14deg;
  }
}

@keyframes celebrationIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes celebrationOut {
  to {
    opacity: 0;
  }
}

@keyframes celebrationSnow {
  from {
    translate: 0 -8px;
    scale: 0.9;
  }
  to {
    translate: 0 10px;
    scale: 1.18;
  }
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  place-items: center;
  padding: 18px;
  background: rgba(22, 48, 66, 0.45);
}

.modal.is-open {
  display: grid;
}

.modal-panel {
  width: min(760px, 100%);
  max-height: min(88vh, 880px);
  overflow: auto;
  padding: 18px;
  border-radius: 8px;
}

.pin-gate {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.pin-gate label,
.routine-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
}

.helper {
  color: var(--muted);
  font-size: 0.9rem;
}

.parent-content {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.parent-block {
  display: grid;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.routine-form {
  display: grid;
  grid-template-columns: 1.35fr 1fr 0.78fr 0.72fr;
  gap: 10px;
  align-items: end;
}

.routine-form .check-label {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
}

.check-label input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--teal);
}

.routine-form button {
  grid-column: 1 / -1;
}

.inline-form {
  display: flex;
  gap: 10px;
}

.inline-form input {
  flex: 1 1 180px;
}

.inline-form button {
  flex: 0 0 auto;
  padding: 0 14px;
}

.parent-row {
  grid-template-columns: 1fr auto auto;
  min-height: 68px;
}

.parent-row small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.row-button {
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 900;
}

.row-button.danger,
.danger-row .small-button {
  color: var(--danger);
}

.danger-row {
  display: flex;
  justify-content: flex-end;
}

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

.variant-prep-item {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.variant-prep-item.is-preselected {
  border-color: rgba(47, 156, 170, 0.72);
  box-shadow: 0 0 0 3px rgba(99, 202, 216, 0.18);
}

.variant-prep-item .shop-preview {
  min-height: 78px;
}

.variant-prep-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.variant-prep-copy strong {
  overflow-wrap: anywhere;
}

.variant-prep-copy small {
  color: var(--muted);
  font-weight: 800;
}

.variant-grid {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.variant-card {
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 1px solid #c6e2e8;
  border-radius: 8px;
  background: #f8feff;
}

.variant-card.is-selected {
  border-color: var(--green);
  background: #f0fbf4;
}

.variant-card.is-missing {
  display: none;
}

.variant-card img {
  width: 100%;
  aspect-ratio: 3 / 4;
  border: 1px solid #d9edf1;
  border-radius: 8px;
  background: #fff;
  object-fit: contain;
}

.sparkle-burst {
  animation: burst 540ms ease;
}

@keyframes burst {
  0% {
    filter: drop-shadow(0 0 0 rgba(243, 198, 93, 0));
  }
  45% {
    filter: drop-shadow(0 0 28px rgba(243, 198, 93, 0.95));
  }
  100% {
    filter: drop-shadow(0 0 0 rgba(243, 198, 93, 0));
  }
}

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

@media (max-width: 980px) {
  .game-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "stage"
      "routines"
      "shop";
  }

  .kingdom-stage {
    min-height: 480px;
  }
}

@media (max-width: 680px) {
  .app-shell {
    padding: 12px;
  }

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

  .topbar {
    display: grid;
    width: calc(100vw - 24px);
    max-width: 100%;
    grid-template-columns: minmax(0, 1fr) 48px;
    grid-template-areas:
      "title settings"
      "score score";
    gap: 8px 10px;
  }

  .topbar > div:first-child {
    grid-area: title;
  }

  .top-actions,
  .section-heading .small-button,
  .segmented {
    width: 100%;
  }

  h1 {
    font-size: 1.48rem;
    line-height: 1.05;
  }

  .top-actions {
    display: contents;
  }

  .score-pill {
    grid-area: score;
    width: 100%;
    flex: 1 1 auto;
    justify-content: center;
  }

  .top-actions .icon-button {
    display: none;
  }

  .floating-parent-button {
    position: fixed;
    left: 14px;
    bottom: 14px;
    z-index: 25;
    display: inline-grid;
    width: 52px;
    height: 52px;
  }

  .kingdom-stage {
    min-height: 430px;
  }

  .stage-status {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    left: 12px;
    right: 12px;
    top: 12px;
    min-width: 0;
  }

  .avatar-wrap {
    width: 52%;
    min-width: 150px;
  }

  .snowflake-mascot-img {
    left: 22px;
    right: auto;
    top: 252px;
    width: 74px;
  }

  .castle-svg {
    width: 112%;
    right: -82px;
  }

  .routine-card {
    grid-template-columns: auto 1fr;
  }

  .routine-action {
    grid-column: 1 / -1;
    width: 100%;
  }

  .shop-list {
    grid-template-columns: 1fr;
  }

  .routine-form {
    grid-template-columns: 1fr;
  }

  .inline-form {
    flex-direction: column;
  }

  .parent-row {
    grid-template-columns: 1fr;
  }

  .variant-prep-item {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .variant-prep-item > .row-button {
    grid-column: 1 / -1;
  }

  .variant-grid {
    grid-template-columns: 1fr;
  }
}
