/* =========================================================
   STELLAR DRAW · base
   ========================================================= */

@font-face {
  font-family: "Bodoni Moda";
  src: url("../assets/fonts/BodoniModa-Variable.woff2") format("woff2");
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "DM Mono";
  src: url("../assets/fonts/DMMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "DM Mono";
  src: url("../assets/fonts/DMMono-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #050806;
  --bg-deep: #020403;
  --panel: #08100c;
  --panel-raised: #0c1510;
  --ink: #f3f2e8;
  --ink-soft: #d4d6cb;
  --muted: #8b998f;
  --muted-low: #758279;
  --line: rgba(239, 243, 232, 0.12);
  --line-soft: rgba(239, 243, 232, 0.07);
  --line-strong: rgba(239, 243, 232, 0.22);
  --accent: #d7ff7a;
  --accent-rgb: 215, 255, 122;
  --accent-soft: rgba(215, 255, 122, 0.12);
  --accent-dim: rgba(215, 255, 122, 0.38);
  --accent-2: #7ef0c8;
  --danger: #ff9c87;
  --danger-soft: rgba(255, 156, 135, 0.1);
  --font-display: "Bodoni Moda", "Songti SC", "STSong", "Noto Serif CJK SC", "SimSun", serif;
  --font-sans: "Avenir Next", "Avenir", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: "DM Mono", "SFMono-Regular", "Cascadia Mono", "Consolas", monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);
  --orb-size: clamp(280px, min(44vh, 69vw), 430px);
  --drawer-width: min(492px, 100vw);
  color-scheme: dark;
}

body[data-theme="champagne"] {
  --accent: #efd49b;
  --accent-rgb: 239, 212, 155;
  --accent-soft: rgba(239, 212, 155, 0.12);
  --accent-dim: rgba(239, 212, 155, 0.4);
  --accent-2: #ffe7b0;
}

body[data-theme="glacier"] {
  --accent: #a9e8ff;
  --accent-rgb: 169, 232, 255;
  --accent-soft: rgba(169, 232, 255, 0.12);
  --accent-dim: rgba(169, 232, 255, 0.4);
  --accent-2: #7ef0ff;
}

body[data-theme="ember"] {
  --accent: #ffb184;
  --accent-rgb: 255, 177, 132;
  --accent-soft: rgba(255, 177, 132, 0.12);
  --accent-dim: rgba(255, 177, 132, 0.4);
  --accent-2: #ffd3a1;
}

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

html {
  min-width: 320px;
  background: var(--bg-deep);
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.is-drawer-open,
body.is-modal-open {
  overflow: hidden;
}

body.is-drawing {
  cursor: progress;
}

::selection {
  background: rgba(var(--accent-rgb), 0.92);
  color: #071006;
}

[hidden],
.svg-sprite {
  display: none !important;
}

button,
input,
textarea {
  color: inherit;
  font: inherit;
}

button {
  border: 0;
  padding: 0;
  background: none;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

a {
  color: inherit;
}

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

svg {
  display: block;
}

.icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 4px;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: rgba(239, 243, 232, 0.18);
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(var(--accent-rgb), 0.35);
  background-clip: content-box;
}

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

/* ---------- background atmosphere ---------- */

.scene {
  position: fixed;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(ellipse 78% 58% at 50% 48%, rgba(23, 51, 35, 0.24), transparent 64%),
    linear-gradient(150deg, #050a07 0%, #050806 46%, #070b08 100%);
}

.scene::after {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px) 0 0 / 12.5vw 100%,
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px) 0 0 / 100% 16vh;
  mask-image: radial-gradient(ellipse at center, black 0%, transparent 74%);
  content: "";
}

.aurora {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  mix-blend-mode: screen;
  opacity: 0.34;
  transform: translateZ(0);
  will-change: transform;
}

.aurora--one {
  top: -20%;
  left: 7%;
  width: 58vw;
  height: 62vh;
  background: radial-gradient(ellipse at center, rgba(69, 133, 84, 0.38), transparent 68%);
  animation: auroraDriftOne 22s var(--ease-soft) infinite alternate;
}

.aurora--two {
  right: -12%;
  bottom: 2%;
  width: 52vw;
  height: 58vh;
  background: radial-gradient(ellipse at center, rgba(var(--accent-rgb), 0.1), transparent 66%);
  animation: auroraDriftTwo 27s var(--ease-soft) infinite alternate;
}

.aurora--three {
  bottom: -40%;
  left: 28%;
  width: 46vw;
  height: 70vh;
  background: radial-gradient(ellipse at center, rgba(26, 87, 78, 0.26), transparent 68%);
  animation: auroraDriftThree 24s var(--ease-soft) infinite alternate;
}

.horizon-glow {
  position: absolute;
  bottom: -40vh;
  left: 50%;
  width: min(1100px, 100vw);
  height: 80vh;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(var(--accent-rgb), 0.09), transparent 62%);
  filter: blur(40px);
}

.grain {
  position: absolute;
  inset: -50%;
  pointer-events: none;
  opacity: 0.043;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.78' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
  transform: rotate(0.001deg);
}

.star-canvas,
.confetti-canvas {
  position: fixed;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.confetti-canvas {
  z-index: 60;
}

.cursor-light {
  position: fixed;
  z-index: 2;
  top: 0;
  left: 0;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, rgba(var(--accent-rgb), 0.045), transparent 68%);
  transform: translate3d(-50%, -50%, 0);
  transition: opacity 0.4s ease;
  will-change: transform;
}

body.is-drawing .cursor-light,
body.is-winner .cursor-light {
  opacity: 0.7;
}

/* ---------- shared controls ---------- */

.button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 18px;
  background: rgba(9, 16, 12, 0.6);
  color: var(--ink);
  font-size: 12px;
  letter-spacing: 0.04em;
  transition: border-color 0.25s ease, background 0.25s ease, color 0.25s ease, transform 0.25s var(--ease);
}

.button:hover {
  border-color: var(--line-strong);
  background: rgba(16, 26, 20, 0.8);
}

.button:active {
  transform: scale(0.985);
}

.button .icon {
  width: 15px;
  height: 15px;
}

.button--solid {
  border-color: var(--accent);
  background: var(--accent);
  color: #081006;
  font-weight: 650;
}

.button--solid:hover {
  border-color: #f1ffd1;
  background: #e7ff9f;
}

.button--outline {
  background: transparent;
}

.button--text {
  min-height: 34px;
  border-color: transparent;
  padding: 0 4px;
  background: transparent;
  color: var(--muted);
}

.button--text:hover {
  border-color: transparent;
  background: transparent;
  color: var(--ink);
}

.button--wide {
  width: 100%;
  height: 48px;
  border-radius: 10px;
}

.button--small {
  min-height: 36px;
  border-radius: 8px;
  padding: 0 14px;
  font-size: 11px;
}

.button--tiny {
  min-height: 26px;
  font-size: 10px;
}

.icon-button {
  position: relative;
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 50%;
  color: var(--muted);
  transition: color 0.25s ease, border-color 0.25s ease, background 0.25s ease;
}

.icon-button .icon {
  width: 18px;
  height: 18px;
}

.icon-button:hover {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.025);
  color: var(--ink);
}

.has-badge {
  position: relative;
}

.icon-badge {
  position: absolute;
  top: 4px;
  right: 2px;
  display: grid;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  place-items: center;
  border: 1px solid var(--bg);
  border-radius: 999px;
  background: var(--accent);
  color: #071006;
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 500;
  line-height: 1;
}

.equalizer {
  display: flex;
  height: 16px;
  align-items: center;
  gap: 2.5px;
}

.equalizer i {
  display: block;
  width: 1.5px;
  height: 4px;
  border-radius: 999px;
  background: currentColor;
  transform-origin: center;
  transition: height 0.3s ease;
}

.music-quick.is-playing {
  border-color: rgba(var(--accent-rgb), 0.28);
  color: var(--accent);
}

.music-quick.is-playing .equalizer i {
  animation: equalize 0.9s var(--ease-soft) infinite alternate;
}

.music-quick.is-playing .equalizer i:nth-child(2) {
  animation-delay: -0.35s;
}

.music-quick.is-playing .equalizer i:nth-child(3) {
  animation-delay: -0.62s;
}

.music-quick.is-playing .equalizer i:nth-child(4) {
  animation-delay: -0.16s;
}

/* ---------- utility animations ---------- */

@keyframes equalize {
  0% { height: 3px; }
  45% { height: 15px; }
  100% { height: 7px; }
}

@keyframes auroraDriftOne {
  0% { transform: translate3d(-3%, -2%, 0) scale(0.96) rotate(-4deg); }
  100% { transform: translate3d(8%, 7%, 0) scale(1.08) rotate(5deg); }
}

@keyframes auroraDriftTwo {
  0% { transform: translate3d(2%, 3%, 0) scale(1.03); }
  100% { transform: translate3d(-7%, -5%, 0) scale(0.94); }
}

@keyframes auroraDriftThree {
  0% { transform: translate3d(-4%, 1%, 0) scale(0.95); }
  100% { transform: translate3d(5%, -8%, 0) scale(1.07); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

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

@keyframes breathe {
  0%, 100% { opacity: 0.55; transform: scale(0.98); }
  50% { opacity: 0.9; transform: scale(1.03); }
}

@keyframes pulseDot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(var(--accent-rgb), 0.3); }
  50% { box-shadow: 0 0 0 5px rgba(var(--accent-rgb), 0); }
}

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

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

@keyframes slideInDrawer {
  from { opacity: 0; transform: translateX(44px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes slideOutDrawer {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(44px); }
}

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

@keyframes toastIn {
  0% { opacity: 0; transform: translateY(12px) scale(0.97); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastOut {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(8px) scale(0.97); }
}

@keyframes shimmer {
  0% { transform: translateX(-160%) skewX(-18deg); }
  100% { transform: translateX(240%) skewX(-18deg); }
}

@keyframes nameReveal {
  0% { opacity: 0; filter: blur(14px); transform: scale(1.16); letter-spacing: 0.18em; }
  40% { opacity: 1; filter: blur(2px); }
  100% { opacity: 1; filter: blur(0); transform: scale(1); }
}

@keyframes flicker {
  0%, 100% { opacity: 1; }
  45% { opacity: 0.35; }
  55% { opacity: 0.82; }
}

@keyframes winnerPulse {
  0%, 100% { opacity: 0.58; transform: scale(0.97); }
  50% { opacity: 1; transform: scale(1.04); }
}

@keyframes ringRotate {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes ringRotateReverse {
  to { transform: translate(-50%, -50%) rotate(-360deg); }
}

@keyframes rayBloom {
  0% { opacity: 0; transform: rotate(0deg) scale(0.55); }
  24% { opacity: 0.85; }
  100% { opacity: 0; transform: rotate(30deg) scale(1.45); }
}

@keyframes orbShake {
  0%, 100% { transform: translateX(0); }
  26% { transform: translateX(-2px); }
  48% { transform: translateX(2px); }
  70% { transform: translateX(-1px); }
}
