:root {
  --sky-top: #0E1730;
  --sky-bottom: #1E2B55;
  --cream-bg: #fdf5e4;
  --cream-card: #ffffff;
  --cream-border: #eadcc0;
  --cream-shadow: #dfd0ae;
  --ink-dark: #2c211c;
  --ink-muted: #78695a;
  --red-pill: #d94648;
  --red-pill-shadow: #ac2e31;
  --gold-top: #fae078;
  --gold-bottom: #eab042;
  --gold-shadow: #c2861c;
  --mint-top: #7cd6a8;
  --mint-bottom: #5abb89;
  --mint-shadow: #3f9468;
  --story-grad: linear-gradient(90deg, #f8d470 0%, #e96a7a 54%, #c6377b 100%);
  --story-shadow: #992259;
  --green-correct-bg: #e4f7ec;
  --green-correct-border: #4ea877;
  --red-wrong-bg: #fde9ea;
  --red-wrong-border: #d9534f;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: #0a1224;
  color: var(--ink-dark);
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Rounded', 'Nunito', 'Segoe UI', Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

.visually-hidden {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.is-hidden {
  display: none !important;
}

/* App Shell: mobile full-bleed, desktop framed like Telegram Mini App */
.app-shell {
  display: flex;
  flex-direction: column;
  inline-size: 100%;
  max-inline-size: 440px;
  min-block-size: var(--tg-viewport-stable-height, 100dvh);
  margin-inline: auto;
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-bottom) 58%, var(--cream-bg) 58%);
  position: relative;
  overflow: clip;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
}

/* Sky & Tree Stage */
.sky-stage {
  position: relative;
  flex: 1 1 auto;
  min-block-size: 340px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  background: linear-gradient(180deg, var(--sky-top) 0%, #152244 58%, var(--sky-bottom) 100%);
  overflow: clip;
  padding-block-start: env(safe-area-inset-top, 10px);
}

/* Subtle static cyan-emerald aurora bloom (zero frame cost) */
.sky-stage::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 68% 34% at 24% 22%, rgba(45, 212, 168, 0.14) 0%, rgba(45, 212, 168, 0) 72%),
    radial-gradient(ellipse 58% 30% at 78% 28%, rgba(110, 200, 255, 0.11) 0%, rgba(110, 200, 255, 0) 70%);
  pointer-events: none;
  z-index: 0;
}

.snow-canvas {
  position: absolute;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
  pointer-events: none;
  z-index: 1;
}

.top-controls {
  position: absolute;
  inset-block-start: max(12px, env(safe-area-inset-top, 12px));
  inset-inline: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  z-index: 10;
  pointer-events: none;
}

.top-controls > * {
  pointer-events: auto;
}

.top-left-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.admin-link-btn {
  text-decoration: none;
  background: rgba(217, 70, 72, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.pill-control,
.circle-control {
  touch-action: manipulation;
  border: none;
  background: rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(8px);
  color: #ffffff;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s ease, background-color 0.15s ease;
}

.pill-control {
  gap: 6px;
  padding: 8px 13px;
  border-radius: 999px;
}

.circle-control {
  inline-size: 40px;
  block-size: 40px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pill-control:active,
.circle-control:active {
  transform: scale(0.94);
}

.sound-btn[aria-pressed='true'] .speaker-mute-line {
  display: none;
}

.sound-btn[aria-pressed='false'] .speaker-wave-1,
.sound-btn[aria-pressed='false'] .speaker-wave-2 {
  opacity: 0.25;
}

.tree-owner-banner {
  background: linear-gradient(180deg, #e55153 0%, var(--red-pill) 100%);
  border-block-end: 3px solid var(--red-pill-shadow);
  color: #ffffff;
  font-weight: 800;
  padding: 6px 16px;
  border-radius: 16px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
  max-inline-size: 226px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  line-height: 1.2;
}

.tree-owner-name {
  font-size: 14px;
  font-weight: 800;
  max-inline-size: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tree-owner-count {
  font-size: 11px;
  font-weight: 700;
  color: rgba(255, 245, 224, 0.92);
  margin-block-start: 2px;
  white-space: nowrap;
}

.feedback-bubble {
  position: absolute;
  inset-block-start: 72px;
  inset-inline-start: 50%;
  transform: translateX(-50%);
  z-index: 12;
  background: #ffffff;
  color: var(--ink-dark);
  font-weight: 800;
  font-size: 18px;
  padding: 10px 22px;
  border-radius: 999px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
  animation: popBounce 0.3s cubic-bezier(0.22, 1.3, 0.36, 1);
  pointer-events: none;
}

.feedback-bubble.is-correct {
  color: #267d50;
}

.feedback-bubble.is-wrong {
  color: #c93b3b;
}

/* Tree Viewport & Interactive Zoom */
.tree-viewport {
  position: relative;
  z-index: 3;
  inline-size: 100%;
  max-inline-size: 396px;
  block-size: clamp(325px, 47dvh, 412px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  margin-block-end: 6px;
  touch-action: pan-y;
  user-select: none;
}

.tree-viewport.is-zoomable {
  touch-action: none;
  cursor: grab;
}

.tree-viewport.is-zoomable:active {
  cursor: grabbing;
}

.tree-transform {
  inline-size: 100%;
  block-size: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  transform-origin: center 55%;
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.tree-transform.is-dragging {
  transition: none;
}

.archa-svg {
  display: block;
  inline-size: 100%;
  block-size: 100%;
  max-block-size: 100%;
  overflow: visible;
}

.star-rays {
  @media (prefers-reduced-motion: no-preference) {
    animation: starSpin 24s linear infinite;
  }
}

.star-halo-pulse {
  transform-origin: 0 0;
  @media (prefers-reduced-motion: no-preference) {
    animation: starHaloPulse 2.8s ease-in-out infinite alternate;
  }
}

.star-body-pulse polygon {
  transform-origin: 0 0;
  @media (prefers-reduced-motion: no-preference) {
    animation: starBodyPulse 2.8s ease-in-out infinite alternate;
  }
}

.tree-bulb-wrap.is-lit {
  @media (prefers-reduced-motion: no-preference) {
    animation: bulbTwinkle 2.4s ease-in-out infinite alternate;
  }
}

.ornament-pop {
  @media (prefers-reduced-motion: no-preference) {
    animation: ornamentDrop 0.42s cubic-bezier(0.22, 1.4, 0.36, 1);
  }
}

.bauble-swing {
  transform-origin: 0 -15px;
}

.bauble-swing.is-new-drop {
  @media (prefers-reduced-motion: no-preference) {
    animation: baubleDropIn 0.68s cubic-bezier(0.22, 1.35, 0.36, 1);
  }
}

.friend-ornament,
.overflow-bauble {
  cursor: pointer;
}

.friend-ornament:hover circle,
.friend-ornament:focus-visible circle,
.overflow-bauble:hover circle,
.overflow-bauble:focus-visible circle {
  stroke: #ffe58f;
  stroke-width: 2.3;
}

.live-player-ornament {
  transition: transform 0.5s cubic-bezier(0.22, 1.2, 0.36, 1);
}

.live-pulse {
  @media (prefers-reduced-motion: no-preference) {
    animation: pulseRing 1.6s ease-in-out infinite;
  }
}

.zoom-controls {
  position: absolute;
  inset-inline-end: 12px;
  inset-block-end: 36px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9;
}

.zoom-btn {
  inline-size: 40px;
  block-size: 40px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(14, 23, 48, 0.76);
  backdrop-filter: blur(8px);
  color: #ffffff;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.zoom-btn:active {
  transform: scale(0.92);
}

.zoom-tooltip {
  position: absolute;
  inset-block-start: max(66px, calc(env(safe-area-inset-top, 12px) + 52px));
  inset-inline: 22px;
  background: rgba(14, 23, 48, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #f4f7ff;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
  padding: 7px 14px;
  border-radius: 999px;
  z-index: 8;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
  pointer-events: none;
}

/* Rolling Snow Drift Mound */
.snow-drift {
  position: absolute;
  inset-inline: 0;
  inset-block-end: 10px;
  block-size: 44px;
  z-index: 4;
  pointer-events: none;
}

.snow-drift svg {
  display: block;
  inline-size: 100%;
  block-size: 100%;
}

/* Bottom Warm Cream Sheet rising cleanly out of snow drift */
.bottom-sheet {
  position: relative;
  z-index: 6;
  background: var(--cream-bg);
  border-start-start-radius: 34px;
  border-start-end-radius: 34px;
  margin-block-start: -20px;
  padding: 20px 18px max(22px, env(safe-area-inset-bottom, 22px));
  box-shadow: 0 -10px 28px rgba(10, 18, 36, 0.22);
}

.sheet-scallop {
  position: absolute;
  inset-block-start: 0;
  inset-inline: 0;
  block-size: 16px;
  border-start-start-radius: 34px;
  border-start-end-radius: 34px;
  background: linear-gradient(180deg, rgba(244, 249, 255, 0.95) 0%, rgba(253, 245, 228, 0) 100%);
  pointer-events: none;
}

.sheet-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* Badges & Typography */
.step-pill {
  display: inline-block;
  background: var(--red-pill);
  border-block-end: 3px solid var(--red-pill-shadow);
  color: #ffffff;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 7px 18px;
  border-radius: 12px;
  margin-block-end: 14px;
}

.progress-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-block-end: 14px;
  inline-size: 100%;
  max-inline-size: 280px;
}

.progress-dot {
  flex: 1 1 0;
  block-size: 5px;
  border-radius: 999px;
  background: #e5dbc3;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.progress-dot.is-current {
  background: #e9a13b;
  transform: scaleY(1.2);
}

.progress-dot.is-correct {
  background: #4ca66d;
}

.progress-dot.is-wrong {
  background: #d9534f;
}

.sheet-heading {
  margin: 0 0 10px;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.28;
  color: var(--ink-dark);
}

.sheet-heading .highlight-name {
  color: var(--red-pill);
}

.sheet-subtitle {
  margin: 0 0 16px;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.45;
  color: var(--ink-muted);
}

.sheet-stat-line {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-dark);
}

.hero-emoji {
  font-size: 40px;
  line-height: 1;
  margin-block-end: 8px;
}

/* Inputs */
.cream-input,
.cream-textarea {
  inline-size: 100%;
  border: 2px solid var(--cream-border);
  background: #ffffff;
  color: var(--ink-dark);
  border-radius: 16px;
  font-family: inherit;
  font-size: 17px;
  font-weight: 700;
  padding: 14px 16px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.cream-input {
  text-align: center;
  margin-block-end: 14px;
}

.cream-textarea {
  text-align: start;
  font-size: 15px;
  font-weight: 600;
  min-block-size: 86px;
  resize: vertical;
  margin-block-end: 12px;
}

.cream-input:focus,
.cream-textarea:focus {
  border-color: var(--gold-bottom);
  box-shadow: 0 0 0 3px rgba(234, 176, 66, 0.22);
}

/* 2x2 Option Grid */
.options-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  inline-size: 100%;
  margin-block-start: 6px;
}

.option-card {
  touch-action: manipulation;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-block-size: 96px;
  padding: 12px 10px;
  background: var(--cream-card);
  border: 2px solid var(--cream-border);
  border-block-end: 4px solid var(--cream-shadow);
  border-radius: 18px;
  color: var(--ink-dark);
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.1s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.option-card:active {
  transform: translateY(2px);
  border-block-end-width: 2px;
}

.option-card:disabled {
  cursor: default;
}

.option-emoji {
  font-size: 28px;
  line-height: 1.1;
}

.option-card.is-emoji-only .option-emoji {
  font-size: 40px;
}

.option-label {
  font-size: 14px;
  font-weight: 800;
  line-height: 1.25;
}

.option-card.is-correct {
  background: var(--green-correct-bg);
  border-color: var(--green-correct-border);
  border-block-end-color: #39845a;
}

.option-card.is-wrong {
  background: var(--red-wrong-bg);
  border-color: var(--red-wrong-border);
  border-block-end-color: #b53a37;
  animation: shakeGentle 0.32s ease;
}

/* Tactile CTA Buttons */
.btn-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  inline-size: 100%;
}

.btn {
  touch-action: manipulation;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  inline-size: 100%;
  min-block-size: 52px;
  padding: 13px 18px;
  border: none;
  border-radius: 16px;
  font-family: inherit;
  font-size: 17px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.1s ease, filter 0.15s ease;
}

.btn:active {
  transform: translateY(2px);
}

.btn-gold {
  background: linear-gradient(180deg, var(--gold-top) 0%, var(--gold-bottom) 100%);
  border-block-end: 4px solid var(--gold-shadow);
  color: var(--ink-dark);
}

.btn-story {
  background: var(--story-grad);
  border-block-end: 4px solid var(--story-shadow);
  color: #ffffff;
}

.btn-mint {
  background: linear-gradient(180deg, var(--mint-top) 0%, var(--mint-bottom) 100%);
  border-block-end: 4px solid var(--mint-shadow);
  color: #163b28;
}

.btn-telegram {
  background: linear-gradient(180deg, #3ba7ea 0%, #229ed9 100%);
  border-block-end: 4px solid #1676a8;
  color: #ffffff;
}

.channel-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  margin-block-end: 14px;
  background: #ffffff;
  border: 2px solid var(--cream-border);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 800;
  color: var(--ink-dark);
}

.gate-error {
  margin: 0 0 12px;
  padding: 10px 14px;
  inline-size: 100%;
  background: var(--red-wrong-bg);
  border: 1.5px solid var(--red-wrong-border);
  border-radius: 14px;
  color: #9e2a28;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}

.btn-row {
  display: flex;
  gap: 10px;
  inline-size: 100%;
}

.btn-row .btn {
  flex: 1 1 0;
  min-block-size: 46px;
  font-size: 15px;
}

.link-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-block-start: 14px;
  flex-wrap: wrap;
}

.text-link {
  background: none;
  border: none;
  padding: 4px 6px;
  color: #8a6c40;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.link-dot {
  color: #b7a17d;
  font-weight: 700;
}

.free-note {
  margin: 14px 0 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-muted);
}

.btn-stars {
  background: linear-gradient(180deg, #ffe270 0%, #f5a623 100%);
  border-block-end: 4px solid #b86f09;
  color: #2c1d05;
}

.btn-secondary {
  background: #f5ebd6;
  border: 2px solid var(--cream-border);
  border-block-end: 3px solid var(--cream-shadow);
  color: var(--ink-dark);
}

.btn-compact {
  min-block-size: 38px;
  padding: 7px 12px;
  font-size: 13px;
  border-radius: 12px;
  inline-size: auto;
  flex-shrink: 0;
}

.leaderboard-unlock-bar {
  margin: 10px 0 6px;
}

.all-unlocked-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  background: #e3f7ec;
  border: 1.5px solid #4ea877;
  color: #1f6f46;
  font-size: 13px;
  font-weight: 800;
}

.leaderboard-item.is-locked {
  background: #f8f2e4;
  border-style: dashed;
}

.leaderboard-item.is-clickable {
  cursor: pointer;
}

.lb-name.is-blurred {
  color: var(--ink-muted);
  letter-spacing: 0.01em;
}

.unlock-panel {
  background: #fff7e2;
  border: 1.5px solid #e9cb79;
  border-radius: 16px;
  padding: 12px;
  margin-block-end: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.unlock-panel-text {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: #5b4108;
  line-height: 1.38;
}

.answers-breakdown {
  background: #ffffff;
  border: 2px solid var(--cream-border);
  border-radius: 16px;
  padding: 10px 12px;
  margin-block-end: 14px;
  max-block-size: 240px;
  overflow-y: auto;
  overscroll-behavior: contain;
  text-align: start;
}

.answers-breakdown-title {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.answer-item {
  padding: 7px 0;
  border-block-end: 1px solid #f0e6d2;
  font-size: 13px;
  line-height: 1.35;
}

.answer-item:last-child {
  border-block-end: none;
}

.answer-item-q {
  font-weight: 700;
  color: var(--ink-dark);
}

.answer-item-a {
  font-weight: 700;
  margin-block-start: 2px;
}

.answer-item-a.is-ok {
  color: #24784d;
}

.answer-item-a.is-bad {
  color: #c23b38;
}

.friend-ornament.is-locked circle {
  opacity: 1;
}

.viral-banner {
  inline-size: 100%;
  background: #1a2d50;
  color: #ffffff;
  border-radius: 18px;
  padding: 14px 14px 16px;
  margin-block-start: 12px;
}

.viral-banner p {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
}

/* Native Modal Dialogs (Modern Web Guidance compliant) */
dialog.modal-dialog {
  margin: auto;
  padding: 0;
  border: none;
  background: transparent;
  max-inline-size: min(92vw, 410px);
  inline-size: 100%;
}

dialog:modal {
  overscroll-behavior: contain;
}

dialog::backdrop {
  background: rgba(8, 15, 30, 0.78);
  backdrop-filter: blur(5px);
  overflow: hidden;
  overscroll-behavior: contain;
}

.story-modal-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.story-preview-frame {
  inline-size: 100%;
  max-inline-size: 310px;
  aspect-ratio: 9 / 16;
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.5);
  background: #12213d;
}

.story-preview-frame img {
  display: block;
  inline-size: 100%;
  block-size: 100%;
  object-fit: cover;
}

.story-modal-actions {
  inline-size: 100%;
  background: var(--cream-bg);
  border-radius: 24px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.story-status-note {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  color: #1f6f46;
  text-align: center;
}

.dialog-card {
  background: var(--cream-bg);
  border-radius: 24px;
  padding: 22px 18px;
  text-align: center;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
}

.dialog-heading {
  margin: 0 0 6px;
  font-size: 21px;
  font-weight: 800;
  color: var(--ink-dark);
}

.dialog-meta {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-muted);
}

.friend-avatar-wrap {
  position: relative;
  inline-size: 58px;
  block-size: 58px;
  margin: 0 auto 10px;
}

.friend-avatar-circle {
  inline-size: 100%;
  block-size: 100%;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #ffffff;
  font-size: 20px;
  font-weight: 900;
  border: 3px solid #f7cf52;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.18);
  overflow: hidden;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.friend-avatar-lock {
  position: absolute;
  inset-block-end: -2px;
  inset-inline-end: -2px;
  inline-size: 22px;
  block-size: 22px;
  border-radius: 50%;
  background: #0f172a;
  border: 2px solid #f7cf52;
  display: grid;
  place-items: center;
  font-size: 11px;
  line-height: 1;
}

.admin-view-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  margin-block-end: 10px;
  border-radius: 999px;
  background: #1a2d50;
  color: #ffd96a;
  border: 1.5px solid #f7cf52;
  font-size: 12px;
  font-weight: 800;
}

.tg-account-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  margin-block-end: 12px;
  border-radius: 999px;
  background: #eaf6ff;
  border: 1.5px solid #9fd0f5;
  color: #1565a8;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.lb-avatar {
  position: relative;
  inline-size: 34px;
  block-size: 34px;
  border-radius: 50%;
  color: #ffffff;
  font-weight: 900;
  font-size: 13px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.14);
}

.lb-avatar-lock {
  position: absolute;
  inset-block-end: -3px;
  inset-inline-end: -3px;
  inline-size: 15px;
  block-size: 15px;
  border-radius: 50%;
  background: #0f172a;
  border: 1.5px solid #f7cf52;
  display: grid;
  place-items: center;
  font-size: 8px;
  line-height: 1;
}

.ornament-badge-preview {
  inline-size: 56px;
  block-size: 56px;
  border-radius: 50%;
  margin: 0 auto 12px;
  display: grid;
  place-items: center;
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
  border: 3px solid #f7cf52;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.18);
}

.wish-box {
  background: #ffffff;
  border: 2px solid var(--cream-border);
  border-radius: 16px;
  padding: 12px 14px;
  margin-block-end: 16px;
  text-align: start;
}

.wish-box-label {
  display: block;
  font-size: 12px;
  font-weight: 800;
  color: var(--ink-muted);
  text-transform: uppercase;
  margin-block-end: 4px;
}

.wish-box-text {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--ink-dark);
}

.leaderboard-list {
  list-style: none;
  margin: 12px 0 16px;
  padding: 0;
  max-block-size: 300px;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: start;
}

.leaderboard-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #ffffff;
  border: 1.5px solid var(--cream-border);
  border-radius: 14px;
  padding: 10px 12px;
}

.lb-rank {
  inline-size: 28px;
  block-size: 28px;
  border-radius: 50%;
  color: #ffffff;
  font-weight: 800;
  font-size: 13px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.lb-info {
  flex: 1 1 auto;
  min-inline-size: 0;
}

.lb-name {
  font-size: 15px;
  font-weight: 800;
  color: var(--ink-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lb-wish {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lb-score {
  font-size: 14px;
  font-weight: 800;
  color: var(--red-pill);
  flex-shrink: 0;
}

/* Toast */
.toast {
  position: fixed;
  inset-block-end: 26px;
  inset-inline-start: 50%;
  transform: translate(-50%, 16px);
  background: rgba(17, 30, 56, 0.94);
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  padding: 10px 18px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 40;
}

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

/* Focus visibility */
:focus-visible {
  outline: 3px solid #f7cf52;
  outline-offset: 2px;
}

/* Compact Unlock Bottom Sheet */
dialog.sheet-modal {
  margin-block-start: auto;
  margin-block-end: 0;
  margin-inline: auto;
  max-inline-size: min(100vw, 440px);
  transform: translateY(18px);
  opacity: 0;
  transition:
    opacity 0.22s ease-out,
    transform 0.24s cubic-bezier(0.22, 1, 0.36, 1),
    display 0.24s,
    overlay 0.24s;
  transition-behavior: allow-discrete;
}

dialog.sheet-modal[open] {
  transform: translateY(0);
  opacity: 1;
  @starting-style {
    transform: translateY(24px);
    opacity: 0;
  }
}

.unlock-sheet-card {
  background: var(--cream-bg);
  border-start-start-radius: 28px;
  border-start-end-radius: 28px;
  padding: 12px 18px max(24px, env(safe-area-inset-bottom, 24px));
  text-align: center;
  box-shadow: 0 -14px 40px rgba(0, 0, 0, 0.42);
}

.sheet-drag-handle {
  inline-size: 40px;
  block-size: 4px;
  border-radius: 999px;
  background: #d8ccb1;
  margin: 0 auto 14px;
}

.unlock-sheet-badge {
  inline-size: 52px;
  block-size: 52px;
  border-radius: 50%;
  margin: 0 auto 10px;
  display: grid;
  place-items: center;
  font-size: 24px;
  background: linear-gradient(145deg, #f8fafc 0%, #cbd5e1 65%, #94a3b8 100%);
  border: 2.5px solid #ffffff;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.22);
}

.unlock-sheet-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-block-start: 14px;
}

.unlock-sheet-all-wrap {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.unlock-sheet-all-note {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-muted);
}

.unlock-sheet-close {
  margin-block-start: 2px;
}

.empty-tree-callout {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--ink-dark);
}

/* Animations (transform + opacity only for smooth low-end Android rendering) */
@keyframes starSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes starHaloPulse {
  from { opacity: 0.46; transform: scale(0.92); }
  to { opacity: 0.86; transform: scale(1.12); }
}

@keyframes starBodyPulse {
  from { transform: scale(0.97); }
  to { transform: scale(1.04); }
}

@keyframes bulbTwinkle {
  from { opacity: 0.48; transform: scale(0.88); }
  to { opacity: 1; transform: scale(1.12); }
}

@keyframes ornamentDrop {
  0% { opacity: 0; transform: scale(0.35); }
  70% { opacity: 1; transform: scale(1.12); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes baubleDropIn {
  0% { opacity: 0; transform: translateY(-28px) scale(0.65); }
  65% { opacity: 1; transform: translateY(3px) scale(1.07); }
  85% { opacity: 1; transform: translateY(-1px) scale(0.98); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes popBounce {
  0% { opacity: 0; transform: translate(-50%, 10px) scale(0.85); }
  100% { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

@keyframes shakeGentle {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

@keyframes pulseRing {
  0%, 100% { transform: scale(0.95); opacity: 0.35; }
  50% { transform: scale(1.18); opacity: 0.15; }
}

@media (prefers-reduced-motion: reduce) {
  .feedback-bubble {
    animation: none;
  }
  .tree-transform,
  dialog.sheet-modal {
    transition: none;
  }
}
