:root {
  color-scheme: dark;
  --ink: #061519;
  --ink-2: #0a272c;
  --ink-3: #103b3d;
  --pine: #166f68;
  --mint: #77ddcd;
  --ice: #d9fff5;
  --paper: #f4f8ed;
  --gold: #f2c778;
  --coral: #d97a6f;
  --ruby: #bd4e5a;
  --muted: #9bb8b4;
  --line: rgba(184, 240, 229, 0.2);
  --glass: rgba(7, 31, 35, 0.86);
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--paper);
  background:
    linear-gradient(120deg, transparent 0 48%, rgba(119, 221, 205, 0.04) 48% 49%, transparent 49% 100%),
    repeating-linear-gradient(90deg, #041115 0 1px, #07191d 1px 90px);
  font-family: "Microsoft YaHei UI", "PingFang SC", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

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

.phone-stage {
  position: relative;
  width: min(100vw, 430px);
  height: min(100svh, 900px);
  min-height: 620px;
  overflow: hidden;
  isolation: isolate;
  background: var(--ink);
  box-shadow: var(--shadow);
}

.voice-room {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(2, 10, 13, 0.06) 0 52%, rgba(2, 15, 18, 0.96) 100%),
    linear-gradient(145deg, #111a21 0 28%, #0b3534 50%, #271b28 73%, #091619 100%);
}

.room-stars {
  position: absolute;
  inset: 0;
  opacity: 0.34;
  background-image:
    linear-gradient(45deg, transparent 49.5%, rgba(255, 244, 187, 0.3) 49.5% 50.5%, transparent 50.5%),
    linear-gradient(-45deg, transparent 49.5%, rgba(255, 244, 187, 0.22) 49.5% 50.5%, transparent 50.5%);
  background-size: 91px 91px, 117px 117px;
  background-position: 14px 5px, 39px 28px;
  mask-image: linear-gradient(to bottom, #000, transparent 72%);
}

.system-bar {
  position: relative;
  z-index: 1;
  height: 42px;
  padding: max(12px, env(safe-area-inset-top)) 18px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: rgba(244, 248, 237, 0.82);
  font-size: 13px;
  font-weight: 700;
}

.system-icons {
  display: flex;
  gap: 10px;
  align-items: center;
}

.room-header {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto 30px;
  gap: 10px;
  align-items: center;
  padding: 9px 14px;
}

.host-avatar,
.seat-avatar {
  position: relative;
  display: grid;
  place-items: center;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.12), 0 5px 18px rgba(0, 0, 0, 0.26);
}

.host-avatar {
  width: 44px;
  height: 44px;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 21px;
}

.speaking-ring {
  position: absolute;
  inset: -4px;
  border: 1px solid var(--mint);
  border-radius: inherit;
  opacity: 0.7;
  animation: speaking 1.6s ease-out infinite;
}

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

.room-copy h1,
.room-copy p {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-copy h1 {
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 16px;
  font-weight: 700;
}

.room-copy p {
  margin-top: 4px;
  color: rgba(244, 248, 237, 0.58);
  font-size: 10px;
}

.room-copy p span {
  display: inline-block;
  width: 1px;
  height: 9px;
  margin: 0 7px;
  vertical-align: -1px;
  background: rgba(255, 255, 255, 0.25);
}

.ghost-action,
.icon-action,
.room-metrics button {
  border: 0;
  background: transparent;
  cursor: pointer;
}

.ghost-action {
  padding: 6px 9px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.75);
  font-size: 11px;
}

.icon-action {
  width: 30px;
  height: 30px;
  font-size: 15px;
  writing-mode: vertical-rl;
}

.room-metrics {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 18px 9px;
  color: rgba(244, 248, 237, 0.65);
  font-size: 10px;
}

.room-metrics b {
  color: var(--coral);
}

.room-metrics button {
  color: var(--mint);
  font-size: 10px;
}

.notice-strip {
  position: relative;
  z-index: 1;
  width: calc(100% - 28px);
  min-height: 32px;
  margin: 0 auto;
  padding: 7px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  border-left: 2px solid var(--coral);
  background: rgba(0, 0, 0, 0.3);
}

.notice-strip p {
  margin: 0;
  overflow: hidden;
  color: rgba(244, 248, 237, 0.72);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notice-badge {
  flex: none;
  color: var(--gold);
  font-size: 9px;
}

.seat-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px 8px;
  padding: 28px 18px 0;
}

.seat {
  min-width: 0;
  text-align: center;
}

.seat-avatar {
  width: 58px;
  height: 58px;
  margin: 0 auto 6px;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 24px;
}

.seat.is-speaking .seat-avatar {
  box-shadow: 0 0 0 3px rgba(119, 221, 205, 0.18), 0 0 26px rgba(119, 221, 205, 0.35);
}

.seat.empty .seat-avatar {
  border-style: dashed;
  color: rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.05);
}

.seat p,
.seat small {
  display: block;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seat p {
  font-size: 11px;
}

.seat small {
  margin-top: 2px;
  color: rgba(244, 248, 237, 0.4);
  font-size: 8px;
}

.avatar-tone-1 { background: linear-gradient(145deg, #4a2638, #152f36); }
.avatar-tone-2 { background: linear-gradient(145deg, #294451, #74bfb4); }
.avatar-tone-3 { background: linear-gradient(145deg, #6e556d, #2e253f); }
.avatar-tone-4 { background: linear-gradient(145deg, #aa6c5c, #343049); }
.avatar-tone-5 { background: linear-gradient(145deg, #58816d, #273f45); }
.avatar-tone-6 { background: linear-gradient(145deg, #b69a6f, #4b5f6b); }
.avatar-tone-7 { background: linear-gradient(145deg, #7d5063, #2a4d4f); }

.wish-entry {
  position: absolute;
  z-index: 2;
  left: 18px;
  bottom: 82px;
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 13px 8px 9px;
  border: 1px solid rgba(119, 221, 205, 0.35);
  border-radius: 8px;
  color: var(--paper);
  background: rgba(6, 21, 25, 0.84);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  cursor: pointer;
}

.wish-entry > span:last-child {
  display: grid;
  gap: 2px;
  text-align: left;
}

.wish-entry b {
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 13px;
}

.wish-entry small {
  color: var(--muted);
  font-size: 9px;
}

.wish-entry i {
  color: var(--gold);
  font-style: normal;
}

.entry-moon {
  width: 32px;
  height: 32px;
  border: 5px solid var(--gold);
  border-top-color: transparent;
  border-radius: 50%;
  transform: rotate(-35deg);
  filter: drop-shadow(0 0 8px rgba(242, 199, 120, 0.5));
}

.room-nav {
  position: absolute;
  z-index: 2;
  inset: auto 0 0;
  height: 68px;
  padding: 5px 12px max(8px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(4, 17, 20, 0.88);
  backdrop-filter: blur(14px);
}

.room-nav button {
  display: grid;
  place-items: center;
  gap: 1px;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.room-nav span {
  color: rgba(244, 248, 237, 0.7);
  font-size: 18px;
}

.room-nav small {
  color: rgba(244, 248, 237, 0.45);
  font-size: 9px;
}

.room-nav .nav-wish span,
.room-nav .nav-wish small {
  color: var(--gold);
}

.room-nav .nav-backpack span {
  color: var(--mint);
}

.room-nav .nav-star-tide span,
.room-nav .nav-star-tide small {
  color: #7cd8de;
}

.game-overlay {
  position: absolute;
  z-index: 10;
  inset: 0;
  display: grid;
  grid-template-rows: auto auto auto minmax(270px, 1fr) auto auto;
  overflow: hidden;
  visibility: hidden;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 220ms ease, transform 280ms ease, visibility 280ms;
}

.game-overlay.is-open {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
}

.game-backdrop {
  position: absolute;
  z-index: -1;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(4, 19, 23, 0.88), rgba(7, 33, 35, 0.97)),
    repeating-linear-gradient(135deg, transparent 0 18px, rgba(119, 221, 205, 0.035) 18px 19px);
  backdrop-filter: blur(12px);
}

.game-backdrop::before,
.game-backdrop::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(119, 221, 205, 0.55), transparent);
}

.game-backdrop::before { top: 114px; }
.game-backdrop::after { bottom: 112px; }

.game-topbar {
  min-height: 48px;
  padding: max(9px, env(safe-area-inset-top)) 12px 4px;
  display: grid;
  grid-template-columns: auto 1fr 34px;
  gap: 10px;
  align-items: center;
}

.game-balance {
  height: 30px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.2);
  font-size: 11px;
}

.star-diamond-icon {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  display: block;
  object-fit: contain;
  filter: brightness(1.28) saturate(1.18) drop-shadow(0 0 4px rgba(129, 184, 255, 0.62));
}

.star-diamond-icon-balance {
  width: 20px;
  height: 20px;
}

.balance-add {
  width: 18px;
  height: 18px;
  margin-left: 2px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid rgba(242, 199, 120, 0.58);
  border-radius: 50%;
  color: var(--gold);
  background: rgba(242, 199, 120, 0.08);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

.balance-add:hover {
  color: var(--ink);
  background: var(--gold);
}

.game-settings {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
}

.backpack-shortcut,
.star-tide-shortcut {
  position: relative;
  width: 28px;
  height: 28px;
  flex: none;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid rgba(119, 221, 205, 0.42);
  border-radius: 6px;
  color: var(--mint);
  background: rgba(119, 221, 205, 0.08);
  cursor: pointer;
}

.star-tide-shortcut {
  color: #7cd8de;
  border-color: rgba(124, 216, 222, 0.42);
  background: rgba(124, 216, 222, 0.08);
  font-size: 18px;
  line-height: 1;
  text-decoration: none;
}

.backpack-shortcut > span {
  font-size: 15px;
}

.backpack-shortcut > i {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 18px;
  height: 16px;
  padding: 0 4px;
  display: grid;
  place-items: center;
  border: 1px solid var(--ink-2);
  border-radius: 8px;
  color: var(--ink);
  background: var(--gold);
  font-size: 8px;
  font-style: normal;
  font-weight: 700;
}

.setting-toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 9px;
  cursor: pointer;
}

.setting-toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.setting-toggle i {
  position: relative;
  width: 26px;
  height: 14px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.28);
  transition: 160ms ease;
}

.setting-toggle i::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.68);
  transition: 160ms ease;
}

.setting-toggle input:checked + i {
  border-color: rgba(119, 221, 205, 0.65);
  background: var(--pine);
}

.setting-toggle input:checked + i::after {
  left: 14px;
  background: #fff;
}

.close-game,
.bottom-drawer header button,
.result-shell header button {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.82);
  background: rgba(0, 0, 0, 0.22);
  font-size: 21px;
  line-height: 1;
  cursor: pointer;
}

.game-title {
  position: relative;
  min-height: 75px;
  padding: 4px 20px 5px;
  text-align: center;
}

.title-kicker,
.drawer-shell header span,
.result-shell header span,
.confirm-dialog form > span {
  color: var(--gold);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 8px;
  font-weight: 700;
}

.game-title h2 {
  margin: 1px 0 0;
  color: var(--ice);
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 34px;
  font-weight: 700;
  text-shadow: 0 0 18px rgba(119, 221, 205, 0.35), 0 2px 0 #255b58;
}

.game-title p {
  margin: -1px 0 0;
  color: rgba(217, 255, 245, 0.62);
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 10px;
}

.game-title::before,
.game-title::after {
  content: "";
  position: absolute;
  top: 42px;
  width: 58px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold));
}

.game-title::before { left: 34px; }
.game-title::after { right: 34px; transform: scaleX(-1); }

.game-tabs {
  width: calc(100% - 30px);
  height: 36px;
  margin: 0 auto 5px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.game-tabs button {
  border: 0;
  border-right: 1px solid rgba(184, 240, 229, 0.12);
  color: rgba(217, 255, 245, 0.74);
  background: transparent;
  font-size: 10px;
  cursor: pointer;
}

.game-tabs button:last-child { border-right: 0; }
.game-tabs span { margin-right: 3px; color: var(--gold); }

.moon-stage {
  position: relative;
  width: calc(100% - 20px);
  height: auto;
  align-self: stretch;
  min-height: 0;
  margin: 0 auto;
  padding: 4px 0;
  display: grid;
  grid-template-areas:
    "top top top"
    "left deer right"
    "bottom bottom bottom";
  grid-template-columns: 48px minmax(0, 1fr) 48px;
  grid-template-rows: 48px minmax(0, 1fr) 48px;
  gap: 3px;
}

.seal-row,
.seal-column {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 4px;
}

.seal-row-top { grid-area: top; }
.seal-row-bottom { grid-area: bottom; }
.seal-column-left { grid-area: left; flex-direction: column; }
.seal-column-right { grid-area: right; flex-direction: column; }

.moon-seal {
  position: relative;
  width: 42px;
  height: 42px;
  flex: none;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(202, 255, 243, 0.32);
  border-radius: 8px;
  color: #b9fff0;
  background: rgba(17, 68, 68, 0.72);
  box-shadow: inset 0 0 13px rgba(119, 221, 205, 0.08), 0 3px 12px rgba(0, 0, 0, 0.18);
}

.moon-seal img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  filter: saturate(0.88) contrast(1.05) brightness(0.9);
  transition: filter 180ms ease, transform 180ms ease;
}

.moon-seal::after {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1px solid rgba(255, 244, 187, 0.22);
  border-radius: 5px;
  pointer-events: none;
}

.deer-chamber {
  position: relative;
  grid-area: deer;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(119, 221, 205, 0.44);
  border-radius: 6px;
  background:
    linear-gradient(180deg, rgba(18, 68, 68, 0.72), rgba(5, 28, 33, 0.9)),
    repeating-linear-gradient(0deg, transparent 0 29px, rgba(119, 221, 205, 0.04) 29px 30px);
  box-shadow: inset 0 0 45px rgba(119, 221, 205, 0.08), 0 0 28px rgba(3, 12, 14, 0.48);
}

.deer-chamber::before,
.deer-chamber::after {
  content: "";
  position: absolute;
  z-index: 3;
  width: 28px;
  height: 28px;
  border-color: var(--gold);
  border-style: solid;
  opacity: 0.7;
}

.deer-chamber::before {
  top: 5px;
  left: 5px;
  border-width: 1px 0 0 1px;
}

.deer-chamber::after {
  right: 5px;
  bottom: 5px;
  border-width: 0 1px 1px 0;
}

.deer-chamber img {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
  filter: saturate(0.92) contrast(1.06) brightness(0.9);
  transform-origin: 50% 76%;
  animation: deer-breathe 4.4s ease-in-out infinite;
}

.deer-chamber .premium-deer-art {
  mask-image: linear-gradient(to bottom, #000 0 82%, rgba(0, 0, 0, 0.7) 91%, transparent 100%);
}

.moon-arc {
  position: absolute;
  z-index: 0;
  top: 18px;
  left: 50%;
  width: 128px;
  height: 128px;
  border: 1px solid rgba(255, 244, 187, 0.28);
  border-left-color: transparent;
  border-radius: 50%;
  transform: translateX(-50%) rotate(-28deg);
}

.moon-arc::after {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1px solid rgba(119, 221, 205, 0.14);
  border-right-color: transparent;
  border-radius: inherit;
}

.rare-flare {
  position: absolute;
  z-index: 2;
  inset: 13% 11% 22%;
  opacity: 0;
  background: repeating-conic-gradient(from 20deg, rgba(255, 244, 187, 0) 0 8deg, rgba(255, 244, 187, 0.2) 8deg 9deg);
  transition: opacity 300ms ease;
}

.stage-label {
  position: absolute;
  z-index: 4;
  top: 12px;
  right: 10px;
  display: grid;
  justify-items: end;
}

.stage-label span {
  color: var(--gold);
  font-size: 8px;
}

.stage-label b {
  margin-top: 1px;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 12px;
}

.progress-wrap {
  position: absolute;
  z-index: 5;
  right: 12px;
  bottom: 12px;
  left: 12px;
}

.progress-copy {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
  color: rgba(217, 255, 245, 0.74);
  font-size: 9px;
}

.progress-copy b {
  color: var(--paper);
  font-weight: 500;
}

.progress-copy i {
  color: var(--gold);
  font-style: normal;
}

.progress-track {
  height: 7px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.42);
}

.progress-track i {
  display: block;
  width: 0.472%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--pine), var(--mint), var(--gold));
  box-shadow: 0 0 12px rgba(119, 221, 205, 0.5);
  transition: width 500ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.draw-controls {
  width: calc(100% - 20px);
  min-height: 87px;
  margin: 3px auto 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  align-items: end;
}

.draw-option {
  position: relative;
  min-width: 0;
  min-height: 67px;
  padding: 10px 5px 7px;
  display: grid;
  place-items: center;
  gap: 4px;
  border: 1px solid rgba(119, 221, 205, 0.38);
  border-radius: 8px;
  color: var(--ice);
  background:
    linear-gradient(180deg, rgba(49, 126, 118, 0.62), rgba(11, 55, 58, 0.86));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.16), 0 6px 18px rgba(0, 0, 0, 0.24);
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, filter 140ms ease;
}

.draw-option:hover { border-color: var(--gold); filter: brightness(1.08); }
.draw-option:active { transform: translateY(2px); }
.draw-option:disabled { cursor: wait; filter: grayscale(0.5); opacity: 0.55; }

.draw-option b {
  overflow-wrap: anywhere;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 14px;
}

.draw-option span {
  color: rgba(217, 255, 245, 0.72);
  font-size: 9px;
}

.star-diamond-cost,
.star-diamond-amount {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.star-diamond-cost .star-diamond-icon {
  width: 15px;
  height: 15px;
}

.confirm-dialog .star-diamond-amount {
  color: var(--muted);
  white-space: nowrap;
  vertical-align: -3px;
}

.confirm-dialog .star-diamond-amount .star-diamond-icon {
  width: 16px;
  height: 16px;
}

.game-status {
  min-height: 25px;
  margin: 0;
  padding: 3px 16px max(5px, env(safe-area-inset-bottom));
  color: rgba(217, 255, 245, 0.55);
  font-size: 9px;
  text-align: center;
}

.game-overlay.is-drawing .moon-seal {
  animation: seal-awake 620ms ease-in-out infinite alternate;
}

.game-overlay.is-drawing .moon-seal:nth-child(2n) { animation-delay: 90ms; }
.game-overlay.is-drawing .moon-seal:nth-child(3n) { animation-delay: 180ms; }

.game-overlay.is-drawing .moon-seal img {
  filter: saturate(1.08) contrast(1.08) brightness(1.24);
  transform: scale(1.08);
}

.game-overlay.is-awake .deer-chamber {
  border-color: var(--gold);
  box-shadow: inset 0 0 55px rgba(242, 199, 120, 0.18), 0 0 34px rgba(119, 221, 205, 0.3);
}

.game-overlay.is-awake .rare-flare {
  opacity: 1;
  animation: flare-turn 6s linear infinite;
}

.game-overlay.is-awake .deer-chamber img {
  animation: deer-awake 900ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

dialog {
  padding: 0;
  border: 0;
  color: var(--paper);
  background: transparent;
}

dialog::backdrop {
  background: rgba(1, 8, 10, 0.68);
  backdrop-filter: blur(4px);
}

.bottom-drawer {
  width: min(100%, 430px);
  max-width: none;
  max-height: none;
  margin: auto auto 0;
}

.drawer-shell {
  width: 100%;
  max-height: min(72svh, 620px);
  overflow: hidden;
  border-top: 1px solid rgba(119, 221, 205, 0.48);
  background: rgba(7, 31, 35, 0.98);
  box-shadow: 0 -18px 50px rgba(0, 0, 0, 0.4);
}

.drawer-shell header,
.result-shell header {
  min-height: 66px;
  padding: 13px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.drawer-shell header h3,
.result-shell header h3 {
  margin: 2px 0 0;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 20px;
}

.drawer-content {
  max-height: calc(min(72svh, 620px) - 66px);
  padding: 16px;
  overflow: auto;
}

.backpack-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid rgba(184, 240, 229, 0.14);
  border-bottom: 1px solid rgba(184, 240, 229, 0.14);
}

.backpack-summary > div {
  min-width: 0;
  padding: 10px 5px;
  display: grid;
  gap: 3px;
  text-align: center;
  border-right: 1px solid rgba(184, 240, 229, 0.12);
}

.backpack-summary > div:last-child {
  border-right: 0;
}

.backpack-summary span {
  color: var(--muted);
  font-size: 8px;
}

.backpack-summary b {
  overflow: hidden;
  color: var(--gold);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 15px;
  text-overflow: ellipsis;
}

.backpack-filters {
  height: 34px;
  margin: 12px 0;
  padding: 3px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.18);
}

.backpack-filters button {
  border: 0;
  border-radius: 4px;
  color: var(--muted);
  background: transparent;
  font-size: 10px;
  cursor: pointer;
}

.backpack-filters button.is-active {
  color: var(--ink);
  background: var(--mint);
  font-weight: 700;
}

.backpack-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.backpack-card {
  position: relative;
  min-width: 0;
  min-height: 132px;
  padding: 7px 6px 8px;
  display: grid;
  grid-template-rows: 76px auto auto;
  gap: 3px;
  overflow: hidden;
  border: 1px solid rgba(184, 240, 229, 0.18);
  border-radius: 8px;
  color: var(--paper);
  background: rgba(119, 221, 205, 0.045);
  text-align: left;
  cursor: pointer;
}

.backpack-card:hover,
.backpack-card.is-selected {
  border-color: var(--gold);
  background: rgba(242, 199, 120, 0.08);
}

.backpack-card.rare::after {
  content: "珍";
  position: absolute;
  top: 10px;
  left: 10px;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #2c241c;
  background: var(--gold);
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 9px;
  font-weight: 700;
}

.backpack-card.star-tide {
  border-color: rgba(242, 199, 120, 0.34);
  background: linear-gradient(180deg, rgba(242, 199, 120, 0.1), rgba(119, 221, 205, 0.04));
}

.backpack-card.star-tide::after {
  content: "潮";
  color: #fff9dd;
  background: linear-gradient(145deg, #e56f5e, #b94e58);
}

.backpack-card.currency {
  border-color: rgba(132, 196, 255, 0.5);
  background: linear-gradient(180deg, rgba(93, 156, 221, 0.16), rgba(119, 221, 205, 0.04));
}

.backpack-card.currency::after {
  content: "晶";
  color: #062633;
  background: #9edaff;
}

.backpack-card.currency img,
.backpack-detail.currency-detail > img {
  padding: 6px;
  object-fit: contain;
  background: rgba(7, 35, 57, 0.62);
}

.backpack-card img {
  width: 100%;
  height: 76px;
  display: block;
  border-radius: 5px;
  object-fit: cover;
}

.backpack-card > span {
  overflow: hidden;
  font-size: 10px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.backpack-card > small {
  color: var(--muted);
  font-size: 8px;
}

.backpack-card > em {
  position: absolute;
  right: 10px;
  top: 70px;
  min-width: 28px;
  padding: 2px 5px;
  border-radius: 7px;
  color: var(--ink);
  background: var(--gold);
  font-size: 8px;
  font-style: normal;
  font-weight: 700;
  text-align: center;
}

.backpack-card.is-locked {
  cursor: default;
  opacity: 0.48;
}

.backpack-card.is-locked img {
  filter: grayscale(1) brightness(0.45);
}

.backpack-card.is-locked > em {
  color: var(--muted);
  background: var(--ink-3);
}

.backpack-empty,
.record-empty {
  padding: 28px 12px;
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

.backpack-detail {
  margin-top: 14px;
  padding: 14px 0 0;
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  gap: 11px;
  border-top: 1px solid var(--line);
}

.backpack-detail > img {
  width: 68px;
  height: 68px;
  border: 1px solid rgba(242, 199, 120, 0.36);
  border-radius: 7px;
  object-fit: cover;
}

.backpack-detail-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.backpack-detail-copy span {
  color: var(--gold);
  font-size: 8px;
}

.backpack-detail-copy h4 {
  margin: 4px 0;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 17px;
}

.backpack-detail-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 9px;
}

.gift-send-controls {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 104px 1fr;
  gap: 8px;
}

.quantity-stepper {
  height: 42px;
  display: grid;
  grid-template-columns: 34px 1fr 34px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.quantity-stepper button {
  height: 100%;
  padding: 0;
  border: 0;
  color: var(--mint);
  background: rgba(119, 221, 205, 0.08);
  font-size: 17px;
  cursor: pointer;
}

.quantity-stepper button:disabled {
  color: rgba(155, 184, 180, 0.28);
  cursor: default;
}

.quantity-stepper output {
  text-align: center;
  font-size: 12px;
  font-weight: 700;
}

.send-gift-button {
  min-width: 0;
  height: 42px;
  border: 1px solid var(--gold);
  border-radius: 6px;
  color: #2c241c;
  background: var(--gold);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.send-gift-button:disabled {
  border-color: var(--line);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  cursor: default;
}

.rank-list,
.record-list,
.rules-list {
  display: grid;
  gap: 1px;
}

.record-section-title {
  min-height: 34px;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--gold);
  border-bottom: 1px solid rgba(184, 240, 229, 0.16);
  font-size: 10px;
}

.record-section-title b {
  color: var(--muted);
  font-size: 9px;
}

.record-section-title.sent-title {
  margin-top: 16px;
}

.sent-record > span {
  color: #ffb6ab;
}

.rank-row,
.record-row,
.rule-row {
  min-height: 54px;
  padding: 10px 8px;
  display: grid;
  align-items: center;
  border-bottom: 1px solid rgba(184, 240, 229, 0.1);
}

.rank-row {
  grid-template-columns: 30px 38px 1fr auto;
  gap: 9px;
}

.rank-row > b:first-child {
  color: var(--gold);
  font-family: Georgia, serif;
  font-size: 16px;
  text-align: center;
}

.mini-avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--ice);
  background: linear-gradient(145deg, var(--coral), var(--ink-3));
  font-family: "STKaiti", "KaiTi", serif;
}

.rank-row p,
.record-row p,
.rule-row p {
  margin: 0;
}

.rank-row p b,
.rank-row p small {
  display: block;
}

.rank-row p b { font-size: 12px; }
.rank-row p small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.rank-row > span { color: var(--gold); font-size: 11px; }

.record-row {
  grid-template-columns: 36px 1fr auto;
  gap: 10px;
}

.record-gem {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--mint);
  background: rgba(119, 221, 205, 0.08);
}

.record-row p b,
.record-row p small { display: block; }
.record-row p b { font-size: 11px; }
.record-row p small { margin-top: 2px; color: var(--muted); font-size: 8px; }
.record-row > span { color: rgba(244, 248, 237, 0.56); font-size: 9px; }

.pool-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.pool-item,
.result-item {
  position: relative;
  min-width: 0;
  min-height: 104px;
  padding: 10px 5px 8px;
  display: grid;
  place-items: center;
  gap: 4px;
  overflow: hidden;
  border: 1px solid rgba(184, 240, 229, 0.18);
  border-radius: 8px;
  background: rgba(119, 221, 205, 0.05);
  text-align: center;
}

.pool-item.rare,
.result-item.rare {
  border-color: rgba(242, 199, 120, 0.6);
  background: rgba(242, 199, 120, 0.08);
}

.result-item.secret {
  border-color: rgba(255, 224, 145, 0.9);
  background: linear-gradient(180deg, rgba(242, 199, 120, 0.18), rgba(119, 221, 205, 0.1));
  box-shadow: inset 0 0 18px rgba(255, 226, 154, 0.12), 0 0 18px rgba(119, 221, 205, 0.14);
}

.prize-icon {
  width: 52px;
  height: 52px;
  display: block;
  overflow: hidden;
  border: 1px solid rgba(119, 221, 205, 0.3);
  border-radius: 7px;
  color: var(--mint);
  background: rgba(12, 58, 59, 0.65);
}

.prize-icon img,
.record-gem img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.pool-item b,
.result-item b { max-width: 100%; font-size: 10px; overflow-wrap: anywhere; }
.pool-item small,
.result-item small { color: var(--gold); font-size: 8px; }

.rule-row {
  grid-template-columns: 28px 1fr;
  gap: 10px;
}

.rule-row > b {
  color: var(--gold);
  font-family: Georgia, serif;
}

.rule-row p b { display: block; margin-bottom: 3px; font-size: 11px; }
.rule-row p small { color: var(--muted); font-size: 9px; line-height: 1.65; }

.reset-demo {
  width: 100%;
  height: 40px;
  margin-top: 16px;
  border: 1px solid rgba(217, 122, 111, 0.52);
  border-radius: 6px;
  color: #ffc2b9;
  background: rgba(217, 122, 111, 0.08);
  cursor: pointer;
}

.confirm-dialog {
  width: min(calc(100% - 36px), 360px);
  max-width: none;
  border: 1px solid rgba(242, 199, 120, 0.45);
  border-radius: 8px;
  background: #092329;
  box-shadow: var(--shadow);
}

.confirm-dialog form {
  padding: 24px 20px 18px;
  text-align: center;
}

.confirm-mark {
  width: 52px;
  height: 52px;
  margin: 0 auto 13px;
  display: grid;
  place-items: center;
  border: 1px solid var(--gold);
  transform: rotate(45deg);
  color: var(--gold);
  font-size: 26px;
}

.confirm-mark + span { display: block; margin-top: 20px; }
.confirm-dialog h3 { margin: 5px 0 8px; font-family: "STKaiti", "KaiTi", serif; font-size: 22px; }
.confirm-dialog p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.7; }
.confirm-dialog p b { color: var(--gold); }

.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 20px;
}

.dialog-actions button,
.result-actions button {
  min-height: 42px;
  border-radius: 6px;
  cursor: pointer;
}

.dialog-actions .secondary {
  border: 1px solid var(--line);
  color: var(--muted);
  background: transparent;
}

.dialog-actions .primary,
.repeat-result {
  border: 1px solid var(--gold);
  color: #2e2721;
  background: var(--gold);
  font-weight: 700;
}

.result-dialog {
  width: min(calc(100% - 24px), 406px);
  max-width: none;
  max-height: min(82svh, 720px);
  border: 1px solid rgba(119, 221, 205, 0.42);
  border-radius: 8px;
  background: #082128;
  box-shadow: var(--shadow);
}

.result-shell {
  max-height: min(82svh, 720px);
  overflow: auto;
}

.result-summary {
  min-height: 52px;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 10px;
}

.result-summary b { color: var(--gold); font-size: 18px; }

.result-grid {
  padding: 0 14px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.result-grid.single {
  width: 150px;
  margin: 0 auto;
  grid-template-columns: 1fr;
}

.result-grid.summary-grid {
  grid-template-columns: repeat(3, 1fr);
}

.result-item {
  min-height: 84px;
  padding: 8px 3px 6px;
  opacity: 0;
  transform: translateY(10px);
  animation: result-in 300ms ease forwards;
}

.result-grid.single .result-item { min-height: 150px; }
.result-item .prize-icon { width: 35px; height: 35px; font-size: 16px; }
.result-grid.single .prize-icon { width: 62px; height: 62px; font-size: 27px; }
.result-item em { position: absolute; top: 4px; right: 5px; color: var(--muted); font-size: 8px; font-style: normal; }

.result-item-title {
  max-width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
}

.result-item-title .result-rarity {
  flex: 0 0 auto;
  color: var(--gold);
  font-size: 8px;
  line-height: 1;
}

.result-item-title > b {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 10px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-item-value {
  color: rgba(244, 248, 237, 0.58);
  font-size: 8px;
  line-height: 1.1;
  white-space: nowrap;
}

.result-item-value > b {
  color: var(--gold);
  font-size: 8px;
}

.result-grid.single .result-item-title > b { font-size: 13px; }
.result-grid.single .result-rarity,
.result-grid.single .result-item-value,
.result-grid.single .result-item-value > b { font-size: 10px; }

.result-actions {
  width: calc(100% - 28px);
  margin: 15px 14px 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.collect-result {
  border: 1px solid rgba(119, 221, 205, 0.44);
  color: var(--ice);
  background: rgba(119, 221, 205, 0.08);
  font-weight: 700;
}

.toast {
  position: absolute;
  z-index: 50;
  left: 50%;
  bottom: 118px;
  max-width: calc(100% - 36px);
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--paper);
  background: rgba(3, 17, 20, 0.94);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  font-size: 10px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: 180ms ease;
}

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

.gift-celebration {
  position: absolute;
  z-index: 45;
  inset: 0;
  padding: 74px 24px 88px;
  display: grid;
  grid-template-rows: 1fr auto auto auto 1fr;
  place-items: center;
  overflow: hidden;
  color: var(--paper);
  background: rgba(3, 19, 22, 0.84);
  backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.gift-celebration.is-active {
  visibility: visible;
  opacity: 1;
  animation: gift-backdrop 2.6s ease both;
}

.gift-rays {
  position: absolute;
  z-index: -1;
  width: 430px;
  height: 430px;
  background: repeating-conic-gradient(from 8deg, transparent 0 13deg, rgba(242, 199, 120, 0.13) 13deg 14deg);
  opacity: 0;
}

.gift-celebration.is-active .gift-rays {
  animation: gift-rays 2.6s ease-out both;
}

.gift-celebration img {
  grid-row: 2;
  width: 190px;
  height: 190px;
  border: 1px solid rgba(242, 199, 120, 0.48);
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}

.gift-celebration span {
  grid-row: 3;
  margin-top: 18px;
  color: var(--gold);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 9px;
}

.gift-celebration h3 {
  grid-row: 4;
  margin: 3px 0 0;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 29px;
}

.gift-celebration p {
  grid-row: 5;
  align-self: start;
  margin: 5px 0 0;
  color: var(--ice);
  font-size: 11px;
}

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

.no-motion *,
.no-motion *::before,
.no-motion *::after {
  scroll-behavior: auto !important;
  animation-duration: 1ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 1ms !important;
}

@keyframes speaking {
  0% { transform: scale(0.92); opacity: 0.8; }
  75%, 100% { transform: scale(1.16); opacity: 0; }
}

@keyframes deer-breathe {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-4px) scale(1.01); }
}

@keyframes seal-awake {
  from { color: var(--mint); filter: brightness(0.8); transform: translateY(0); }
  to { color: #fff5b9; filter: brightness(1.5) drop-shadow(0 0 8px rgba(242, 199, 120, 0.7)); transform: translateY(-2px); }
}

@keyframes flare-turn { to { transform: rotate(360deg); } }

@keyframes deer-awake {
  0% { transform: scale(0.88); filter: brightness(2) blur(3px); }
  60% { transform: scale(1.04); filter: brightness(1.4) blur(0); }
  100% { transform: scale(1); filter: brightness(1); }
}

@keyframes result-in { to { opacity: 1; transform: translateY(0); } }

@keyframes gift-backdrop {
  0% { opacity: 0; }
  14%, 78% { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes gift-rays {
  0% { opacity: 0; transform: scale(0.55) rotate(-12deg); }
  24%, 70% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.25) rotate(20deg); }
}

@media (max-height: 720px) {
  .game-title { min-height: 61px; padding-top: 0; }
  .game-title h2 { font-size: 28px; }
  .game-title::before,
  .game-title::after { top: 34px; }
  .moon-stage { grid-template-rows: 43px minmax(0, 1fr) 43px; }
  .moon-seal { width: 38px; height: 38px; }
  .draw-controls { min-height: 75px; }
  .draw-option { min-height: 58px; }
}

@media (max-width: 370px) {
  .game-settings { gap: 5px; }
  .setting-toggle { gap: 3px; }
  .moon-stage { width: calc(100% - 12px); grid-template-columns: 44px minmax(0, 1fr) 44px; }
  .moon-seal { width: 38px; height: 38px; }
  .draw-option b { font-size: 12px; }
  .result-grid { grid-template-columns: repeat(4, 1fr); }
}

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