:root {
  --violet-950: #2b1838;
  --violet-900: #3b214c;
  --violet-800: #56326f;
  --violet-700: #704394;
  --violet-500: #a74be7;
  --lilac: #d9b9ff;
  --pink: #f55fc8;
  --cream: #fff3dd;
  --ink: #2c1d34;
  --muted: #bba8c4;
  font-family: "Avenir Next", "PingFang SC", "Hiragino Sans GB", sans-serif;
  color: #fff;
  background: var(--violet-900);
}

* { box-sizing: border-box; }

html, body { width: 100%; min-width: 320px; min-height: 100%; }

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 50% -10%, rgba(221,111,255,.42), transparent 33rem),
    linear-gradient(180deg, #6c3a84 0%, #3b214c 100%);
}

button { color: inherit; font: inherit; -webkit-tap-highlight-color: transparent; }
button:focus-visible { outline: 3px solid #ffe46b; outline-offset: 3px; }

.game-shell {
  width: 100vw;
  max-width: 520px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px) 0 0 / 34px 34px,
    linear-gradient(180deg, #6e4088 0 53%, #4a285e 100%);
  box-shadow: 0 0 90px rgba(16,5,30,.48);
}

.game-shell::before,
.game-shell::after {
  content: "";
  width: 160px;
  height: 160px;
  position: absolute;
  z-index: 0;
  pointer-events: none;
  border: 1px solid rgba(255,255,255,.08);
  transform: rotate(45deg);
}

.game-shell::before { top: 120px; left: -120px; }
.game-shell::after { right: -120px; bottom: 140px; }

.topbar {
  min-height: 72px;
  padding: max(12px, env(safe-area-inset-top)) 15px 10px;
  position: relative;
  z-index: 5;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
}

.top-actions { display: flex; gap: 7px; }
.top-spacer { width: 38px; height: 38px; }

.top-actions button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: #faeaff;
  border: 2px solid #b68ee4;
  border-radius: 50%;
  background: #3158bd;
  box-shadow: inset 0 3px 0 rgba(255,255,255,.25), 0 4px 0 #243d91, 0 7px 12px rgba(29,9,47,.24);
  cursor: pointer;
  font-size: 18px;
  font-weight: 900;
  transition: transform .16s ease, filter .16s ease;
}

.top-actions button:active { transform: translateY(3px); }
.top-actions button:hover { transform: rotate(18deg) scale(1.05); }

.level-pill,
.progress-pill {
  min-height: 38px;
  padding: 5px 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 2px solid rgba(255,255,255,.2);
  border-radius: 18px;
  box-shadow: inset 0 3px 0 rgba(255,255,255,.18), 0 4px 0 rgba(43,17,72,.45);
}

.level-pill {
  justify-content: center;
  justify-self: center;
  background: linear-gradient(180deg, #ca43ef, #9a2bd3);
}

.progress-pill {
  justify-self: end;
  color: #6f2541;
  background: linear-gradient(180deg, #ffd5e7, #f6b8d2);
  border-color: rgba(255,231,244,.7);
}

.level-pill span,
.progress-pill span {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .12em;
  opacity: .78;
}

.level-pill strong,
.progress-pill strong {
  font: 1000 18px/1 "Avenir Next Condensed", "Arial Rounded MT Bold", sans-serif;
  letter-spacing: -.03em;
  text-shadow: 0 2px 0 rgba(49,14,62,.32);
}

.progress-pill strong { text-shadow: 0 1px 0 rgba(255,255,255,.5); }

.mosaic-bay {
  width: calc(100% - 20px);
  max-width: calc(100vw - 20px);
  margin: 0 10px;
  padding: 14px 10px 10px;
  position: relative;
  z-index: 2;
  background:
    repeating-linear-gradient(90deg, transparent 0 62px, rgba(255,255,255,.06) 62px 65px),
    linear-gradient(180deg, #755193, #4a2d61);
  border: 3px solid #c9a8f2;
  border-radius: 42px 42px 12px 12px;
  box-shadow:
    inset 0 0 0 4px rgba(64,31,82,.35),
    inset 0 10px 18px rgba(255,255,255,.09),
    0 7px 0 #3a214c,
    0 15px 28px rgba(26,7,39,.28);
}

.bay-rivets {
  position: absolute;
  inset: 7px 18px auto;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}

.bay-rivets i {
  width: 5px;
  height: 5px;
  background: #e7d2ff;
  border-radius: 50%;
  box-shadow: 0 1px 0 #5d3b75;
  opacity: .72;
}

.stage {
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 4;
  position: relative;
  overflow: hidden;
  background: #6f4c7f;
  border: 5px solid #dec8ff;
  border-radius: 29px 29px 8px 8px;
  box-shadow:
    inset 0 0 0 5px #53376b,
    inset 0 0 36px rgba(24,10,35,.42),
    0 5px 0 #342041;
}

#gameCanvas {
  width: 100%;
  height: 100%;
  display: block;
  filter: saturate(1.16) contrast(1.03);
  touch-action: none;
}

.demand-panel {
  position: absolute;
  z-index: 5;
  top: 14px;
  left: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
  text-shadow: 0 2px 3px rgba(35,14,48,.8);
}

.demand-panel > span {
  color: #eadbfa;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: .12em;
}

#demandChips { display: flex; gap: 6px; }

.demand-chip {
  display: flex;
  align-items: center;
  gap: 3px;
  color: #fff;
  font: 900 9px/1 "Avenir Next", sans-serif;
}

.demand-chip i {
  width: 8px;
  height: 8px;
  background: var(--dot);
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(21,8,30,.48);
}

.stage-tip {
  min-height: 34px;
  padding: 8px 5px 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: #eadbfa;
  font-size: 10px;
  font-weight: 800;
  text-align: center;
}

.stage-tip i {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  color: #56326f;
  background: #ffe45d;
  border-radius: 50%;
  font: 1000 10px/1 Georgia, serif;
}

.stage-tip.is-alert { color: #ffd4e9; }
.stage-tip.is-alert i { color: #fff; background: #ff4d85; }

.control-deck {
  width: 100%;
  max-width: 100vw;
  padding: 14px 16px max(22px, env(safe-area-inset-bottom));
  position: relative;
  z-index: 3;
  background:
    radial-gradient(circle at 50% 0, rgba(187,103,220,.22), transparent 17rem),
    #4a285e;
}

.control-deck::before {
  content: "";
  height: 2px;
  position: absolute;
  inset: 0 0 auto;
  background: linear-gradient(90deg, transparent, #b07ed0 18%, #b07ed0 82%, transparent);
}

.slots-head,
.boxes-head {
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.boxes-head.is-ready { min-height: 70px; }

.slots-head span,
.boxes-head span {
  display: block;
  color: #ab91b8;
  font-size: 7px;
  font-weight: 900;
  letter-spacing: .15em;
}

.slots-head strong,
.boxes-head strong {
  display: block;
  margin-top: 2px;
  color: #fff4ff;
  font-size: 12px;
  letter-spacing: .04em;
}

.queue-next-button {
  width: 100%;
  min-height: 62px;
  padding: 9px 11px 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #fff;
  border: 3px solid #f6c9ff;
  border-radius: 20px;
  background:
    radial-gradient(circle at 18% 10%, rgba(255,255,255,.34), transparent 24%),
    linear-gradient(180deg, #dc50f4, #9d2fc9);
  box-shadow:
    inset 0 3px 0 rgba(255,255,255,.28),
    inset 0 -5px 0 rgba(79,22,105,.2),
    0 6px 0 #62227d,
    0 11px 19px rgba(29,8,42,.3);
  cursor: pointer;
  animation: queueReadyIn .34s cubic-bezier(.2,.9,.25,1.2) both;
}

.queue-next-button[hidden] { display: none; }

.queue-next-button .queue-next-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  color: inherit;
  letter-spacing: normal;
}

.queue-next-button small {
  color: #ffe96e;
  font: 900 7px/1 "Avenir Next", sans-serif;
  letter-spacing: .16em;
}

.queue-next-button .queue-next-copy strong {
  margin: 0;
  color: #fff;
  font: 1000 16px/1.1 "Avenir Next Condensed", "Arial Rounded MT Bold", sans-serif;
  letter-spacing: .03em;
  text-shadow: 0 2px 0 #75208e;
}

.queue-next-button > b {
  width: 35px;
  height: 35px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #8d2ab3;
  background: #fff2bb;
  border: 2px solid #fff9df;
  border-radius: 50%;
  box-shadow: 0 3px 0 #d8943e;
  font: 1000 31px/28px Arial, sans-serif;
}

.queue-next-button:hover { filter: saturate(1.08) brightness(1.04); transform: translateY(-2px); }
.queue-next-button:active { transform: translateY(4px); box-shadow: inset 0 3px 0 rgba(255,255,255,.2), 0 2px 0 #62227d; }

.slot-counter {
  color: #c8b5d2;
  font-size: 9px;
  font-weight: 800;
}

.slot-counter b { color: #ffe25c; font-size: 20px; }

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

.slot {
  min-width: 0;
  aspect-ratio: 1 / .72;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: #aa8ab7;
  background: rgba(38,17,50,.26);
  border: 2px solid #765287;
  border-radius: 18px;
  box-shadow: inset 0 5px 10px rgba(22,8,30,.34), 0 2px 0 rgba(255,255,255,.07);
}

.slot::before {
  content: "";
  width: 34%;
  height: 5px;
  position: absolute;
  left: 50%;
  top: -4px;
  background: #24132e;
  border: 2px solid #815b92;
  border-bottom: 0;
  border-radius: 9px 9px 0 0;
  transform: translateX(-50%);
}

.nest-bedding {
  width: 32px;
  height: 13px;
  border: 3px solid #856194;
  border-top: 0;
  border-radius: 0 0 50% 50%;
  opacity: .48;
}

.slot.has-batch {
  border-color: #d7a7f5;
  background: rgba(115,63,135,.42);
  box-shadow: inset 0 5px 13px rgba(27,9,35,.38), 0 0 14px rgba(212,111,255,.22);
}

.slot.is-locked {
  flex-direction: column;
  gap: 3px;
  color: #76647d;
  border-style: dashed;
  border-color: #5d4767;
  background: rgba(24,13,30,.34);
  box-shadow: inset 0 5px 12px rgba(14,6,19,.42);
}

.slot.is-locked::before { border-color: #55405f; background: #29172f; }
.slot.is-locked small { font-size: 7px; font-weight: 900; letter-spacing: .04em; }

.slot-lock {
  width: 20px;
  height: 16px;
  position: relative;
  display: block;
  border: 3px solid #705b78;
  border-radius: 5px;
}

.slot-lock::before {
  content: "";
  width: 10px;
  height: 9px;
  position: absolute;
  left: 2px;
  top: -11px;
  border: 3px solid #705b78;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
}

.slot.is-working { animation: slotWork .32s ease-in-out infinite alternate; }

.slot.is-waiting::after {
  content: "等";
  width: 18px;
  height: 18px;
  position: absolute;
  right: -5px;
  top: -7px;
  display: grid;
  place-items: center;
  color: #642540;
  background: #ffb4d1;
  border: 2px solid #fff0f7;
  border-radius: 50%;
  font-size: 8px;
  font-weight: 1000;
}

.slot-creature {
  width: 42px;
  height: 38px;
  position: relative;
  display: grid;
  place-items: center;
  color: var(--hamster-text, #392238);
  background: var(--hamster, #d9ae82);
  border: 2px solid color-mix(in srgb, var(--hamster, #d9ae82), white 52%);
  border-radius: 48% 48% 42% 42%;
  box-shadow: 0 3px 0 var(--hamster-dark, #7b4f4c);
}

.slot-creature::before,
.slot-creature::after {
  content: "";
  width: 12px;
  height: 11px;
  position: absolute;
  top: -4px;
  z-index: -1;
  background: var(--hamster, #d9ae82);
  border: 2px solid color-mix(in srgb, var(--hamster, #d9ae82), white 52%);
  border-radius: 50%;
}

.slot-creature::before { left: -4px; }
.slot-creature::after { right: -4px; }
.slot-creature .slot-number {
  color: var(--hamster-text, #392238);
  font: 1000 19px/1 "Avenir Next Condensed", "Arial Rounded MT Bold", sans-serif;
  letter-spacing: -.05em;
  text-shadow: 0 2px 0 rgba(33,10,39,.28);
}

.boxes {
  min-height: 92px;
  margin-top: 13px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 9px;
  align-items: end;
}

.boxes[hidden] { display: none; }

.batch-card {
  min-width: 0;
  height: 82px;
  padding: 12px 3px 5px;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--card-text, #fff);
  border: 0;
  background: transparent;
  cursor: pointer;
  transition: transform .16s ease, filter .16s ease, opacity .16s ease;
}

.batch-card::before,
.batch-card::after {
  content: "";
  width: 22px;
  height: 22px;
  position: absolute;
  z-index: 0;
  top: -8px;
  background: var(--card);
  border: 3px solid rgba(255,255,255,.36);
  border-radius: 64% 36% 58% 42%;
  box-shadow: inset 0 4px 0 rgba(255,255,255,.2), 0 3px 0 var(--card-dark);
}

.batch-card::before { left: -2px; transform: rotate(-18deg); }
.batch-card::after { right: -2px; transform: scaleX(-1) rotate(-18deg); }

.batch-body {
  position: absolute;
  z-index: 1;
  inset: 0;
  pointer-events: none;
  border: 3px solid rgba(255,255,255,.36);
  border-radius: 49% 49% 39% 39%;
  background:
    radial-gradient(circle at 30% 22%, rgba(255,255,255,.32) 0 6%, transparent 7%),
    linear-gradient(160deg, rgba(255,255,255,.2), transparent 45%),
    var(--card);
  box-shadow:
    inset 0 4px 0 rgba(255,255,255,.22),
    inset 0 -7px 0 rgba(32,12,44,.12),
    0 6px 0 var(--card-dark), 0 9px 13px rgba(20,7,28,.25);
}

.batch-card:hover:not(:disabled) { transform: translateY(-5px) rotate(-1deg); filter: saturate(1.12); }
.batch-card:active:not(:disabled) { transform: translateY(3px) scale(.97); }
.batch-card:disabled { cursor: default; opacity: .38; filter: saturate(.6); }
.batch-card.is-guided:not(:disabled),
.slot.is-guided {
  z-index: 7;
  animation: tutorialTarget .72s ease-in-out infinite alternate;
  filter: saturate(1.14) brightness(1.06);
}
.batch-card.is-deployed:disabled { opacity: 1; filter: none; }
.batch-card.is-deployed { box-shadow: inset 0 4px 0 rgba(255,255,255,.22), inset 0 -7px 0 rgba(32,12,44,.12), 0 4px 0 var(--card-dark), 0 0 0 3px #ffe767, 0 8px 16px rgba(20,7,28,.25); }
.batch-card.is-working { animation: hamsterWorking .32s ease-in-out infinite alternate; }
.batch-card.is-waiting { filter: saturate(.55) brightness(.78); animation: hamsterBlocked .42s ease-in-out 2; }
.batch-card.is-waiting small { color: #ffe45d; }

.batch-face {
  width: 43px;
  height: 25px;
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-around;
  transform: translateY(-7px);
}

.batch-face::before,
.batch-face::after {
  content: "";
  width: 21px;
  height: 15px;
  position: absolute;
  z-index: -1;
  bottom: -4px;
  background: rgba(255,239,221,.9);
  border-radius: 50%;
}

.batch-face::before { left: 2px; transform: rotate(8deg); }
.batch-face::after { right: 2px; transform: rotate(-8deg); }

.batch-face i {
  width: 9px;
  height: 11px;
  position: relative;
  z-index: 2;
  background: #fff6f0;
  border-radius: 50%;
  box-shadow: inset 0 -2px 0 rgba(73,32,70,.18);
}

.batch-face i::after {
  content: "";
  width: 4px;
  height: 5px;
  position: absolute;
  left: 2px;
  bottom: 1px;
  background: #4a294d;
  border-radius: 50%;
}

.batch-face b {
  width: 7px;
  height: 5px;
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: 2px;
  background: #6d3654;
  border-radius: 50% 50% 60% 60%;
  box-shadow: 0 3px 0 -2px #6d3654;
  transform: translateX(-50%);
}

.batch-card strong {
  position: relative;
  z-index: 2;
  margin-top: -2px;
  color: #fff;
  font: 1000 21px/1 "Avenir Next Condensed", "Arial Rounded MT Bold", sans-serif;
  letter-spacing: -.04em;
  text-shadow: 0 2px 0 rgba(44,13,48,.65), 1px 0 0 rgba(44,13,48,.35), -1px 0 0 rgba(44,13,48,.35);
}

.box-empty {
  height: 74px;
  display: grid;
  place-items: center;
  color: #80698b;
  border: 2px dashed #674576;
  border-radius: 17px;
  font-size: 8px;
  font-weight: 800;
}

.toast {
  max-width: min(410px, calc(100% - 36px));
  padding: 10px 15px;
  position: fixed;
  z-index: 80;
  left: 50%;
  bottom: 26px;
  color: #3c2146;
  background: #fff0b8;
  border: 2px solid #fff8dc;
  border-radius: 18px;
  box-shadow: 0 5px 0 #d7a544, 0 12px 28px rgba(20,7,27,.34);
  font-size: 11px;
  font-weight: 900;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px) scale(.96);
  transition: opacity .2s, transform .2s;
}

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

.tutorial-guide {
  width: 0;
  height: 0;
  position: absolute;
  z-index: 70;
  pointer-events: none;
}

.tutorial-guide[hidden] { display: none; }

.tutorial-hand {
  position: absolute;
  left: 0;
  top: -8px;
  color: #fff8df;
  font-size: 36px;
  font-style: normal;
  line-height: 1;
  filter: drop-shadow(0 4px 0 #9c5d55) drop-shadow(0 7px 8px rgba(28,8,33,.32));
  transform: translate(-50%, 0) rotate(-10deg);
  animation: tutorialHand .68s ease-in-out infinite alternate;
}

.settings-dialog {
  width: min(460px, calc(100% - 24px));
  margin: auto auto 12px;
  padding: 12px 16px max(20px, env(safe-area-inset-bottom));
  color: #fff;
  background:
    radial-gradient(circle at 82% 0, rgba(232,125,255,.28), transparent 16rem),
    #4a285e;
  border: 3px solid #d0a8ef;
  border-radius: 28px;
  box-shadow: inset 0 4px 0 rgba(255,255,255,.1), 0 18px 70px rgba(18,4,27,.58);
}

.settings-dialog::backdrop { background: rgba(24,7,33,.72); backdrop-filter: blur(6px); }
.settings-dialog[open] { animation: dialogIn .28s cubic-bezier(.2,.9,.25,1.05); }

.settings-handle {
  width: 44px;
  height: 5px;
  margin: 0 auto 12px;
  background: #956dab;
  border-radius: 5px;
}

.settings-head {
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.settings-head span {
  color: #b59ac2;
  font-size: 7px;
  font-weight: 900;
  letter-spacing: .16em;
}

.settings-head h2 { margin: 2px 0 0; font-size: 23px; }

.settings-close {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: #efdafa;
  border: 2px solid #866397;
  border-radius: 50%;
  background: #392048;
  cursor: pointer;
  font-size: 20px;
}

.settings-list { display: grid; gap: 9px; }

.setting-toggle,
.setting-action {
  width: 100%;
  min-height: 54px;
  padding: 8px 11px;
  display: grid;
  grid-template-columns: 38px 1fr auto;
  align-items: center;
  gap: 10px;
  color: #fff;
  border: 2px solid #765087;
  border-radius: 17px;
  background: rgba(44,22,56,.56);
  box-shadow: inset 0 3px 0 rgba(255,255,255,.04), 0 3px 0 rgba(31,12,42,.5);
  cursor: pointer;
  text-align: left;
}

.setting-toggle i,
.setting-action i {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: #5a2a59;
  background: #ffcaef;
  border-radius: 50%;
  font-size: 17px;
  font-style: normal;
  font-weight: 1000;
}

.setting-toggle span,
.setting-action span { font-size: 13px; font-weight: 900; }

.setting-toggle b,
.setting-action b {
  min-width: 36px;
  padding: 5px 8px;
  color: #4d5e27;
  background: #b8e85a;
  border-radius: 12px;
  font-size: 9px;
  text-align: center;
}

.setting-toggle.is-off { color: #a58cae; }
.setting-toggle.is-off i { filter: grayscale(1); opacity: .55; }
.setting-toggle.is-off b { color: #8e738f; background: #5e4669; }
.setting-action b { color: #795020; background: #ffd36b; }

.home-screen {
  position: fixed;
  z-index: 120;
  inset: 0;
  padding: max(68px, env(safe-area-inset-top)) 28px max(30px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  background:
    radial-gradient(circle at 50% 34%, rgba(223,102,255,.44), transparent 19rem),
    linear-gradient(180deg, #704394, #352044);
  text-align: center;
}

.home-screen[hidden] { display: none; }
.home-stars { margin-bottom: 20px; color: #ffe45d; letter-spacing: .35em; }

.home-hamster {
  width: 126px;
  height: 112px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-around;
  background: #d9a66f;
  border: 7px solid #ffe2ba;
  border-radius: 50% 50% 42% 42%;
  box-shadow: 0 10px 0 #81505e, 0 20px 40px rgba(21,5,30,.32);
}

.home-hamster::before,
.home-hamster::after {
  content: "";
  width: 43px;
  height: 38px;
  position: absolute;
  z-index: -1;
  top: -15px;
  background: #d9a66f;
  border: 7px solid #ffe2ba;
  border-radius: 65% 35% 60% 40%;
}

.home-hamster::before { left: -10px; transform: rotate(-18deg); }
.home-hamster::after { right: -10px; transform: scaleX(-1) rotate(-18deg); }

.home-hamster i {
  width: 16px;
  height: 22px;
  background: #fff7e9;
  border-radius: 50%;
  box-shadow: inset 0 -7px 0 #4a294d;
}

.home-hamster b {
  width: 16px;
  height: 10px;
  position: absolute;
  left: 50%;
  bottom: 28px;
  background: #d86e83;
  border-radius: 50%;
  transform: translateX(-50%);
}

.home-screen p { margin: 34px 0 5px; color: #e7a8ff; font-size: 9px; font-weight: 1000; letter-spacing: .18em; }
.home-screen h1 { margin: 0; font-family: "Kaiti SC", "STKaiti", serif; font-size: 45px; }
.home-screen > span { margin-top: 10px; color: #cdb9d6; font-size: 12px; }
.home-actions { width: min(330px, 100%); margin-top: 34px; display: grid; gap: 11px; }

.home-actions button {
  min-height: 50px;
  color: #fff;
  border: 2px solid #ffc8ee;
  border-radius: 18px;
  background: linear-gradient(180deg, #ed62cc, #b835a0);
  box-shadow: inset 0 3px 0 rgba(255,255,255,.22), 0 5px 0 #72275f;
  cursor: pointer;
  font-weight: 1000;
}

.home-actions button + button {
  color: #d9c5e1;
  border-color: #765087;
  background: #462555;
  box-shadow: 0 4px 0 #291732;
}

.result-dialog {
  width: min(520px, 100%);
  margin: auto auto 0;
  padding: 52px 28px max(28px, env(safe-area-inset-bottom));
  overflow: visible;
  color: #fff;
  background:
    radial-gradient(circle at 50% 0, rgba(231,111,255,.34), transparent 18rem),
    #4a285e;
  border: 0;
  border-top: 4px solid #d9b9ff;
  border-radius: 36px 36px 0 0;
  box-shadow: 0 -18px 70px rgba(21,5,30,.58), inset 0 5px 0 rgba(255,255,255,.09);
  text-align: center;
}

.result-dialog::backdrop { background: rgba(24,7,33,.74); backdrop-filter: blur(5px); }
.result-dialog[open] { animation: dialogIn .34s cubic-bezier(.2,.9,.25,1.06); }

.dialog-mascot {
  width: 94px;
  height: 68px;
  margin: -92px auto 15px;
  display: grid;
  place-items: center;
  color: #422638;
  background: #d9ad7d;
  border: 5px solid #ffe6c4;
  border-radius: 48% 48% 38% 38%;
  box-shadow: 0 7px 0 #7f4d53, 0 11px 20px rgba(26,8,33,.36);
  font: 1000 19px/1 ui-monospace, monospace;
}

.result-dialog p {
  margin: 0 0 8px;
  color: #ff9ddd;
  font-size: 9px;
  font-weight: 1000;
  letter-spacing: .14em;
}

.result-dialog h2 {
  margin: 0;
  font-family: "Kaiti SC", "STKaiti", serif;
  font-size: 29px;
  line-height: 1.24;
}

.result-dialog > span {
  display: block;
  margin: 13px 0 20px;
  color: #cbb8d5;
  font-size: 11px;
  line-height: 1.7;
}

.result-dialog button {
  width: 100%;
  padding: 13px;
  color: #fff;
  border: 2px solid #ffadf0;
  border-radius: 17px;
  background: linear-gradient(180deg, #f05cc9, #bd37a1);
  box-shadow: inset 0 3px 0 rgba(255,255,255,.25), 0 5px 0 #762763;
  cursor: pointer;
  font-weight: 1000;
}

.reward {
  width: max-content;
  margin: -3px auto 19px;
  padding: 6px 12px;
  color: #ffe45d;
  border: 2px solid #ffe45d;
  border-radius: 18px;
  font-weight: 1000;
  transform: rotate(-3deg);
}

@keyframes slotWork {
  from { transform: rotate(-1deg) translateY(0); }
  to { transform: rotate(1deg) translateY(-3px); }
}

@keyframes hamsterWorking {
  from { transform: translateY(0) rotate(-1deg); }
  to { transform: translateY(-4px) rotate(1deg); }
}

@keyframes hamsterBlocked {
  0%, 100% { transform: translateX(0); }
  35% { transform: translateX(-3px) rotate(-1deg); }
  70% { transform: translateX(3px) rotate(1deg); }
}

@keyframes tutorialTarget {
  from { box-shadow: 0 0 0 3px rgba(255,232,92,.2); }
  to { box-shadow: 0 0 0 7px rgba(255,232,92,.62), 0 0 24px rgba(255,220,72,.48); }
}

@keyframes tutorialHand {
  from { transform: translate(-50%, 0) rotate(-10deg); }
  to { transform: translate(-50%, 13px) rotate(-2deg); }
}

@keyframes dialogIn {
  from { opacity: 0; transform: translateY(80px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes queueReadyIn {
  from { opacity: 0; transform: translateY(9px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 550px) {
  .game-shell { width: 100%; box-shadow: none; }
  .stage { height: auto; }
}

@media (max-width: 380px) {
  .topbar { padding-inline: 10px; gap: 6px; }
  .top-actions { gap: 5px; }
  .top-actions button { width: 34px; height: 34px; }
  .level-pill, .progress-pill { padding-inline: 9px; }
  .mosaic-bay { margin-inline: 7px; padding-inline: 7px; }
  .stage { height: auto; }
  .control-deck { padding-inline: 11px; }
  .slots { gap: 7px; }
  .boxes { gap: 6px; }
  .batch-card { height: 72px; }
  .batch-card strong { font-size: 20px; }
}

@media (max-height: 760px) and (max-width: 550px) {
  .topbar { min-height: 59px; padding-top: 8px; }
  .mosaic-bay { padding-top: 10px; }
  .stage { height: auto; }
  .control-deck { padding-top: 13px; }
  .slots { margin-bottom: 14px; }
  .batch-card { height: 69px; }
}

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