/* ===========================================================================
   Reckless (reckgame.com) — UI stylesheet (cosmic landing, auth, HUD, panels)
   ======================================================================== */
:root {
  --ink: #3d3654;
  --ink-soft: #6c6488;
  --pink: #ff7eb6;
  --pink-deep: #ff5fa8;
  --blue: #7ec8e3;
  --lav: #b8a7ff;
  --cream: #fffbf2;
  --card: rgba(255, 255, 255, 0.88);
  --shadow: 0 10px 30px rgba(120, 100, 180, 0.18);
  --radius: 22px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Quicksand', 'Segoe UI', sans-serif;
  color: var(--ink);
}

/* ------------------------------------------------------------- buttons -- */
.btn-primary, .btn-soft {
  display: inline-block;
  border: 0;
  border-radius: 999px;
  padding: 10px 22px;
  font-family: inherit;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: transform .15s, box-shadow .15s, opacity .15s;
}
.btn-primary {
  background: linear-gradient(135deg, var(--pink) 0%, var(--pink-deep) 100%);
  color: #fff;
  box-shadow: 0 6px 18px rgba(255, 95, 168, 0.35);
}
.btn-soft {
  background: rgba(255, 255, 255, 0.85);
  color: var(--ink);
  box-shadow: var(--shadow);
}
.btn-primary:hover, .btn-soft:hover { transform: translateY(-2px) scale(1.02); }
.btn-primary:disabled { opacity: .45; cursor: default; transform: none; }
.btn-big { padding: 14px 30px; font-size: 17px; }
.btn-block { width: 100%; }

/* ------------------------------------------------- floating bubbles bg -- */
.auth-page {
  min-height: 100vh;
  background: linear-gradient(160deg, #ffe3f0 0%, #e8f4ff 45%, #e2ffe9 100%);
  overflow-x: hidden;
}

/* ------------------------------------- cosmic landing (Reckless) bg -- */
.landing-page {
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 50% -10%, #2a1b5e 0%, transparent 55%),
    linear-gradient(170deg, #0b0820 0%, #150f38 45%, #0a1130 75%, #050414 100%);
  background-color: #0b0820;
  color: #efeaff;
  overflow-x: hidden;
}
.cosmos-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.stars {
  position: absolute;
  inset: -20%;
  background-repeat: repeat;
}
.stars-far {
  background-image:
    radial-gradient(1px 1px at 25px 35px, rgba(255,255,255,.7), transparent),
    radial-gradient(1px 1px at 130px 90px, rgba(200,210,255,.55), transparent),
    radial-gradient(1px 1px at 210px 160px, rgba(255,255,255,.45), transparent),
    radial-gradient(1px 1px at 320px 60px, rgba(255,230,200,.5), transparent),
    radial-gradient(1px 1px at 70px 220px, rgba(255,255,255,.5), transparent),
    radial-gradient(1px 1px at 280px 250px, rgba(190,225,255,.45), transparent);
  background-size: 380px 300px;
  animation: starDrift 160s linear infinite;
}
.stars-mid {
  background-image:
    radial-gradient(1.5px 1.5px at 60px 120px, rgba(255,255,255,.85), transparent),
    radial-gradient(1.5px 1.5px at 200px 40px, rgba(180,200,255,.7), transparent),
    radial-gradient(1.5px 1.5px at 330px 200px, rgba(255,255,255,.65), transparent),
    radial-gradient(1.5px 1.5px at 120px 260px, rgba(255,220,235,.6), transparent);
  background-size: 440px 340px;
  animation: starDrift 95s linear infinite, twinkle 7s ease-in-out infinite;
}
.stars-near {
  background-image:
    radial-gradient(2px 2px at 90px 60px, rgba(255,255,255,.95), transparent),
    radial-gradient(2.5px 2.5px at 260px 180px, rgba(170,220,255,.85), transparent),
    radial-gradient(2px 2px at 400px 90px, rgba(255,210,240,.8), transparent),
    radial-gradient(1.5px 1.5px at 180px 300px, rgba(255,255,255,.75), transparent);
  background-size: 520px 380px;
  animation: starDrift 60s linear infinite, expandDrift 24s ease-in-out infinite alternate;
}
@keyframes starDrift {
  from { background-position: 0 0; }
  to   { background-position: 600px 340px; }
}
@keyframes twinkle {
  0%, 100% { opacity: .55; }
  50%      { opacity: 1; }
}
@keyframes expandDrift {
  from { transform: scale(1); }
  to   { transform: scale(1.12); }
}
.nebula {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: .5;
  animation: nebulaFloat 26s ease-in-out infinite alternate;
}
.nebula-1 {
  width: 60vw; height: 60vw;
  max-width: 760px; max-height: 760px;
  top: -18%; left: -14%;
  background: radial-gradient(circle, rgba(138, 92, 255, .55) 0%, rgba(255, 95, 168, .25) 45%, transparent 70%);
}
.nebula-2 {
  width: 55vw; height: 55vw;
  max-width: 700px; max-height: 700px;
  bottom: -22%; right: -12%;
  background: radial-gradient(circle, rgba(74, 215, 255, .4) 0%, rgba(58, 134, 255, .2) 45%, transparent 70%);
  animation-delay: -13s;
}
@keyframes nebulaFloat {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(4vw, 3vh, 0) scale(1.15); }
}

/* ------------------------------- fantasy scenery (Reckless landing) -- */
.moon {
  position: absolute;
  border-radius: 50%;
}
.moon-big {
  width: 130px; height: 130px;
  top: 9%; right: 7%;
  background:
    radial-gradient(circle at 62% 58%, rgba(120,95,190,.55) 0 8%, transparent 9%),
    radial-gradient(circle at 40% 70%, rgba(120,95,190,.5) 0 6%, transparent 7%),
    radial-gradient(circle at 70% 30%, rgba(120,95,190,.45) 0 5%, transparent 6%),
    radial-gradient(circle at 36% 32%, #f3edff 0%, #cdbdf6 45%, #8f7ad6 100%);
  box-shadow: 0 0 50px rgba(205, 189, 246, .5), 0 0 110px rgba(138, 92, 255, .3);
  opacity: .9;
}
.moon-small {
  width: 46px; height: 46px;
  top: 24%; left: 9%;
  background: radial-gradient(circle at 35% 30%, #d8fff6 0%, #6fded0 50%, #2e8f87 100%);
  box-shadow: 0 0 24px rgba(111, 222, 208, .45);
  opacity: .85;
}
.shooting-star {
  position: absolute;
  width: 110px; height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255,255,255,0), #fff);
  opacity: 0;
  animation: shoot 9s linear infinite;
}
.ss-1 { top: 14%; left: 62%; }
.ss-2 { top: 31%; left: 30%; animation-delay: 4.5s; animation-duration: 11s; }
@keyframes shoot {
  0%  { opacity: 0; transform: rotate(-28deg) translateX(0); }
  4%  { opacity: 0; }
  5%  { opacity: 1; }
  13% { opacity: 0; transform: rotate(-28deg) translateX(-280px); }
  100% { opacity: 0; transform: rotate(-28deg) translateX(-280px); }
}
.sparkle {
  position: absolute;
  width: 14px; height: 14px;
  background: #fff;
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
  opacity: 0;
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, .8));
  animation: sparklePulse 4s ease-in-out infinite;
}
.sp-1 { top: 20%; left: 22%; }
.sp-2 { top: 12%; left: 78%; animation-delay: .8s; }
.sp-3 { top: 44%; left: 88%; animation-delay: 1.6s; width: 10px; height: 10px; }
.sp-4 { top: 58%; left: 5%;  animation-delay: 2.4s; width: 10px; height: 10px; }
.sp-5 { top: 70%; left: 72%; animation-delay: 3.2s; }
@keyframes sparklePulse {
  0%, 100% { opacity: 0; transform: scale(.4) rotate(0deg); }
  50%      { opacity: .95; transform: scale(1) rotate(45deg); }
}
.dragon {
  position: absolute;
  width: 300px;
  will-change: transform;
}
.dragon svg { display: block; width: 100%; height: auto; }
.dragon-1 {
  top: 15%;
  left: -340px;
  animation: flyRight 75s linear infinite;
}
.dragon-1 svg { animation: dragonBob 5s ease-in-out infinite alternate; }
.dragon-2 {
  top: 6%;
  left: -240px;
  width: 170px;
  opacity: .55;
  animation: flyLeft 110s linear infinite;
  animation-delay: -45s;
}
.dragon-2 svg { animation: dragonBob 6.5s ease-in-out infinite alternate-reverse; }
@keyframes flyRight {
  from { transform: translateX(0); }
  to   { transform: translateX(calc(100vw + 700px)); }
}
@keyframes flyLeft {
  from { transform: translateX(calc(100vw + 480px)) scaleX(-1); }
  to   { transform: translateX(0) scaleX(-1); }
}
@keyframes dragonBob {
  from { transform: translateY(-12px); }
  to   { transform: translateY(12px); }
}
.island {
  position: absolute;
  animation: islandBob 9s ease-in-out infinite alternate;
}
.island svg { display: block; width: 100%; height: auto; }
.island-1 { top: 33%; left: 5%; width: 150px; }
.island-2 { top: 47%; right: 7%; width: 110px; animation-duration: 11s; animation-delay: -4s; }
@keyframes islandBob {
  from { transform: translateY(-10px) rotate(-1deg); }
  to   { transform: translateY(10px) rotate(1.5deg); }
}
.ridge {
  position: absolute;
  left: 0; right: 0; bottom: 0;
}
.ridge svg { display: block; width: 100%; }
.ridge-back svg  { height: 200px; opacity: .85; }
.ridge-front svg { height: 170px; }
.win { animation: winGlow 3s ease-in-out infinite alternate; }
.win.w2 { animation-delay: .7s; }
.win.w3 { animation-delay: 1.4s; }
.win.w4 { animation-delay: 2.1s; }
@keyframes winGlow {
  from { opacity: .35; }
  to   { opacity: 1; }
}
.landing-page .bg-bubble {
  background: radial-gradient(circle at 32% 28%, rgba(255,255,255,.55), rgba(160,120,255,.14) 55%, rgba(80,200,255,.05));
  border-color: rgba(170, 200, 255, .4);
  box-shadow: 0 0 14px rgba(138, 92, 255, .35), inset 0 0 8px rgba(255, 255, 255, .2);
}
@media (max-width: 640px) {
  .dragon-1 { width: 200px; }
  .dragon-2 { left: -9999px; animation: none; }
  .island-2, .moon-small { display: none; }
  .moon-big { width: 84px; height: 84px; }
  .island-1 { width: 110px; top: 30%; }
  .ridge-back svg  { height: 140px; }
  .ridge-front svg { height: 120px; }
}
@media (prefers-reduced-motion: reduce) {
  .stars, .nebula, .portal-ring, .portal-core, .dragon, .dragon svg,
  .shooting-star, .sparkle, .island, .win, .bg-bubble { animation: none !important; }
  .shooting-star { opacity: 0; }
  .sparkle { opacity: .5; }
}
.bubbles-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.bg-bubble {
  position: absolute;
  bottom: -120px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, rgba(255,255,255,.95), rgba(255,255,255,.25) 55%, rgba(255,255,255,.05));
  border: 1.5px solid rgba(255, 255, 255, 0.7);
  animation: bubbleRise linear infinite;
}
.bg-bubble:nth-child(3n)   { width: 34px; height: 34px; }
.bg-bubble:nth-child(3n+1) { width: 58px; height: 58px; }
.bg-bubble:nth-child(3n+2) { width: 22px; height: 22px; }
.bg-bubble:nth-child(1)  { left: 4%;  animation-duration: 16s; }
.bg-bubble:nth-child(2)  { left: 12%; animation-duration: 21s; animation-delay: 3s; }
.bg-bubble:nth-child(3)  { left: 21%; animation-duration: 14s; animation-delay: 6s; }
.bg-bubble:nth-child(4)  { left: 30%; animation-duration: 24s; animation-delay: 1s; }
.bg-bubble:nth-child(5)  { left: 38%; animation-duration: 17s; animation-delay: 8s; }
.bg-bubble:nth-child(6)  { left: 47%; animation-duration: 20s; animation-delay: 4s; }
.bg-bubble:nth-child(7)  { left: 55%; animation-duration: 15s; animation-delay: 10s; }
.bg-bubble:nth-child(8)  { left: 63%; animation-duration: 23s; animation-delay: 2s; }
.bg-bubble:nth-child(9)  { left: 71%; animation-duration: 18s; animation-delay: 7s; }
.bg-bubble:nth-child(10) { left: 79%; animation-duration: 22s; animation-delay: 5s; }
.bg-bubble:nth-child(11) { left: 86%; animation-duration: 16s; animation-delay: 9s; }
.bg-bubble:nth-child(12) { left: 93%; animation-duration: 19s; animation-delay: 0s; }
.bg-bubble:nth-child(13) { left: 26%; animation-duration: 26s; animation-delay: 12s; }
.bg-bubble:nth-child(14) { left: 60%; animation-duration: 25s; animation-delay: 14s; }
@keyframes bubbleRise {
  0%   { transform: translateY(0) translateX(0); opacity: 0; }
  8%   { opacity: 1; }
  92%  { opacity: 1; }
  100% { transform: translateY(-110vh) translateX(24px); opacity: 0; }
}

/* -------------------------------------------------------------- landing -- */
.landing {
  position: relative;
  z-index: 1;
  max-width: 660px;
  margin: 0 auto;
  padding: 48px 24px 32px;
  text-align: center;
}
.landing-page .landing { padding-bottom: 140px; }
.hero-bubble {
  position: relative;
  width: 130px;
  height: 130px;
  margin: 8px auto 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #ffffff 0%, #ffd1ec 45%, #f7a8d8 100%);
  box-shadow: var(--shadow), inset 0 0 22px rgba(255,255,255,.65);
  animation: heroFloat 4.5s ease-in-out infinite;
}
.hero-eye {
  position: absolute;
  top: 52px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--ink);
}
.hero-eye:nth-child(1) { left: 38px; }
.hero-eye:nth-child(2) { right: 38px; }
.hero-smile {
  position: absolute;
  top: 72px;
  left: 50%;
  width: 26px;
  height: 13px;
  transform: translateX(-50%);
  border: 3px solid var(--ink);
  border-top: 0;
  border-radius: 0 0 26px 26px;
}
@keyframes heroFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}
/* the game's bubble as landing hero — same look as the in-game player */
.landing-page .hero-bubble {
  box-shadow:
    0 0 28px rgba(255, 126, 182, .5),
    0 0 70px rgba(138, 92, 255, .35),
    inset 0 0 22px rgba(255, 255, 255, .65);
  border: 1.5px solid rgba(255, 255, 255, .55);
}

/* portal hero (kept for reuse) */
.hero-portal {
  position: relative;
  width: 150px;
  height: 150px;
  margin: 10px auto 22px;
  animation: heroFloat 5.5s ease-in-out infinite;
}
.portal-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(from 0deg, #ffb347, #ff5fa8, #8a5cff, #4ad7ff, #ffb347);
  -webkit-mask: radial-gradient(circle, transparent 56%, #000 60%);
  mask: radial-gradient(circle, transparent 56%, #000 60%);
  animation: portalSpin 9s linear infinite;
  filter: drop-shadow(0 0 16px rgba(138, 92, 255, .75));
}
.portal-core {
  position: absolute;
  inset: 17%;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, rgba(255,255,255,.9) 0%, rgba(138,92,255,.55) 38%, rgba(16,10,44,.96) 78%);
  box-shadow: inset 0 0 28px rgba(74, 215, 255, .5), 0 0 42px rgba(255, 95, 168, .3);
  animation: portalPulse 4.5s ease-in-out infinite;
}
@keyframes portalSpin { to { transform: rotate(360deg); } }
@keyframes portalPulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.06); }
}
.landing h1 {
  font-size: clamp(34px, 7vw, 52px);
  margin: 0 0 10px;
  background: linear-gradient(135deg, var(--pink-deep), var(--lav) 60%, var(--blue));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.landing-page .landing h1 {
  font-family: 'Cinzel', 'Quicksand', serif;
  font-weight: 900;
  font-size: clamp(44px, 9vw, 72px);
  letter-spacing: .06em;
  text-transform: uppercase;
  margin: 0 0 6px;
  background: linear-gradient(110deg, #ffd98a 0%, #ff7eb6 32%, #b8a7ff 62%, #6fe3ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 22px rgba(184, 167, 255, .45));
}
.landing-sub {
  font-size: clamp(14px, 2.6vw, 18px);
  font-weight: 700;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: #b9aef5;
  margin: 0 0 18px;
}
.landing-tag {
  font-size: 17px;
  color: var(--ink-soft);
  line-height: 1.6;
  margin: 0 auto 26px;
  max-width: 480px;
}
.landing-page .landing-tag {
  color: #cfc8ef;
  max-width: 540px;
  text-shadow: 0 1px 8px rgba(5, 4, 20, .8);
}
.landing-actions { display: flex; flex-direction: column; gap: 12px; align-items: center; margin-bottom: 34px; }
.landing-feats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-bottom: 36px;
}
.feat {
  background: var(--card);
  border-radius: 999px;
  box-shadow: var(--shadow);
  padding: 8px 16px;
  font-weight: 600;
  font-size: 14px;
}
.feat span { margin-right: 6px; }
.landing-page .feat {
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(184, 167, 255, .28);
  color: #efeaff;
  box-shadow: 0 0 18px rgba(138, 92, 255, .18);
  backdrop-filter: blur(4px);
}
.landing-page .btn-soft {
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .22);
  color: #fff;
  box-shadow: 0 0 18px rgba(138, 92, 255, .22);
}
.landing-page .btn-primary {
  background: linear-gradient(135deg, #ff5fa8 0%, #8a5cff 100%);
  box-shadow: 0 6px 24px rgba(138, 92, 255, .45);
}
.landing-note {
  font-size: 13px;
  color: #8f87b8;
  margin: 0 auto 24px;
  max-width: 460px;
}
.landing-foot { color: var(--ink-soft); font-size: 13px; }
.landing-foot a { color: var(--ink-soft); }
.landing-page .landing-note,
.landing-page .landing-foot,
.landing-page .landing-foot a { color: #8f87b8; }

/* ----------------------------------------------------------------- auth -- */
.auth-page { display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 410px;
  background: var(--card);
  backdrop-filter: blur(8px);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 30px 30px 24px;
}
.auth-logo {
  display: block;
  text-align: center;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  margin-bottom: 12px;
}
.auth-card h1 { margin: 0 0 4px; font-size: 26px; text-align: center; }
.auth-sub { margin: 0 0 18px; text-align: center; color: var(--ink-soft); font-size: 14px; }
.auth-card label { display: block; font-weight: 600; font-size: 14px; margin: 12px 0 5px; }
.auth-card input[type="text"], .auth-card input[type="email"], .auth-card input[type="password"] {
  width: 100%;
  border: 2px solid #eee4f4;
  border-radius: 14px;
  padding: 11px 14px;
  font-family: inherit;
  font-size: 15px;
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border-color .15s;
}
.auth-card input:focus { border-color: var(--pink); }
.auth-check { font-weight: 500 !important; font-size: 13px !important; color: var(--ink-soft); margin: 14px 0 16px !important; }
.auth-check input { margin-right: 6px; }
.auth-alt { text-align: center; font-size: 14px; color: var(--ink-soft); margin-top: 16px; }
.auth-alt a, .auth-check a { color: var(--pink-deep); font-weight: 600; }
.auth-error {
  background: #ffe4ec;
  border: 1.5px solid #ffb3cd;
  color: #c2356f;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
  margin-bottom: 6px;
}

/* ============================================================== GAME ==== */
.game-page {
  overflow: hidden;
  position: fixed;
  inset: 0;
  background: #cfe9ff;
  touch-action: none;
}
#game-canvas { position: fixed; inset: 0; display: block; }

#boot-screen {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: linear-gradient(160deg, #ffe3f0, #e8f4ff);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
.boot-bubble {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #fff, #ffd1ec 50%, #f7a8d8);
  animation: heroFloat 1.6s ease-in-out infinite;
  box-shadow: var(--shadow);
}
.boot-text { color: var(--ink-soft); font-weight: 600; }
#boot-error { color: #c2356f; font-weight: 600; max-width: 320px; text-align: center; }
.boot-logout { color: var(--ink-soft); font-size: 13px; }

/* HUD root: overlay that lets the canvas receive touches */
#hud { position: fixed; inset: 0; z-index: 20; pointer-events: none; }
#hud [hidden] { display: none !important; }
#hud > * { pointer-events: auto; }

.hud-top {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  pointer-events: none;
}
.hud-top > * { pointer-events: auto; }

.hud-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border-radius: 999px;
  box-shadow: var(--shadow);
  padding: 6px 16px 6px 6px;
}
#hud-avatar { width: 52px; height: 52px; }
.hud-name { font-weight: 700; font-size: 14px; }
.hud-level {
  background: linear-gradient(135deg, var(--pink), var(--pink-deep));
  color: #fff;
  font-size: 11px;
  border-radius: 999px;
  padding: 2px 8px;
  margin-left: 4px;
}
.hud-xpbar {
  width: 150px;
  height: 8px;
  background: #efe7f7;
  border-radius: 99px;
  overflow: hidden;
  margin: 4px 0 3px;
}
.hud-xpfill {
  height: 100%;
  width: 0%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--blue), var(--lav), var(--pink));
  transition: width .4s ease;
}
.hud-sub { font-size: 11px; color: var(--ink-soft); font-weight: 600; }

.hud-buttons { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.hud-btn {
  position: relative;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: var(--card);
  box-shadow: var(--shadow);
  font-size: 19px;
  cursor: pointer;
  transition: transform .12s;
}
.hud-btn:hover { transform: translateY(-2px) scale(1.06); }
.hud-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--pink-deep);
  border: 2px solid #fff;
  animation: pulseDot 1.4s infinite;
}
@keyframes pulseDot { 50% { transform: scale(1.25); } }

.hud-world {
  position: absolute;
  top: max(64px, calc(env(safe-area-inset-top) + 56px));
  right: 14px;
  font-size: 12px;
  font-weight: 700;
  color: rgba(80, 70, 120, 0.75);
  background: rgba(255,255,255,.55);
  padding: 4px 12px;
  border-radius: 999px;
  pointer-events: none !important;
}

/* quest tracker */
.hud-quests {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  max-width: 230px;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(4px);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 10px 14px;
  font-size: 13px;
}
.hud-quests:empty { display: none; }
.hud-quests-title { font-weight: 700; font-size: 12px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.hud-quest { display: flex; gap: 7px; align-items: baseline; padding: 2px 0; font-weight: 600; }
.hud-quest em { font-style: normal; color: var(--ink-soft); font-size: 11px; }
.hud-quest.done { color: #51b06e; }
.hud-quest-check { font-size: 12px; }

/* interact prompt */
.hud-prompt {
  position: absolute;
  bottom: 96px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--card);
  border-radius: 999px;
  box-shadow: var(--shadow);
  padding: 9px 18px;
  font-weight: 700;
  font-size: 14px;
  pointer-events: none !important;
}
.hud-key {
  display: inline-block;
  background: var(--ink);
  color: #fff;
  border-radius: 7px;
  font-size: 12px;
  padding: 2px 7px;
  font-weight: 700;
}

/* NPC dialog */
.hud-dialog {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  width: min(560px, calc(100vw - 32px));
  background: var(--card);
  backdrop-filter: blur(8px);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 22px 12px;
  cursor: pointer;
}
.hud-dialog-name { font-weight: 700; color: var(--pink-deep); margin-bottom: 4px; }
.hud-dialog-text { font-size: 16px; line-height: 1.55; min-height: 44px; }
.hud-dialog-next { text-align: right; font-size: 11px; color: var(--ink-soft); margin-top: 4px; }

/* panels */
.hud-panel-wrap {
  position: absolute;
  inset: 0;
  background: rgba(80, 60, 120, 0.25);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.hud-panel {
  width: min(620px, 100%);
  max-height: min(82vh, 700px);
  overflow-y: auto;
  background: var(--cream);
  border-radius: var(--radius);
  box-shadow: 0 24px 60px rgba(60, 40, 100, 0.35);
  padding: 22px 26px;
}
.hud-panel h2 { margin: 0 0 8px; display: flex; align-items: center; justify-content: space-between; }
.panel-hint { color: var(--ink-soft); font-size: 14px; margin: 0 0 14px; }
.panel-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* character panel */
.cp-layout { display: flex; gap: 20px; }
.cp-preview {
  flex: 0 0 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: linear-gradient(160deg, #e8f4ff, #ffe9f4);
  border-radius: 18px;
  padding: 10px;
  align-self: flex-start;
}
.cp-name { font-weight: 700; }
.cp-slots { flex: 1; min-width: 0; }
.cp-slot { margin-bottom: 12px; }
.cp-slot-label { font-weight: 700; font-size: 13px; margin-bottom: 6px; }
.cp-choices { display: flex; flex-wrap: wrap; gap: 7px; }
.cp-choice, .cc-choice {
  position: relative;
  border: 2.5px solid transparent;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 3px 10px rgba(120, 100, 180, 0.12);
  padding: 6px 9px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  font-size: 13px;
  color: var(--ink);
  transition: transform .1s;
}
.cp-choice:hover, .cc-choice:hover { transform: scale(1.07); }
.cp-choice.sel, .cc-choice.sel { border-color: var(--pink-deep); }
.cp-choice.locked { opacity: .45; cursor: not-allowed; }
.cp-swatch { display: block; width: 22px; height: 22px; border-radius: 50%; }
.cp-lock { position: absolute; bottom: -7px; right: -7px; font-size: 10px; background: #fff; border-radius: 8px; padding: 1px 4px; box-shadow: 0 2px 6px rgba(0,0,0,.15); }

/* skills panel */
.sp-points {
  font-size: 13px;
  background: linear-gradient(135deg, var(--lav), var(--pink));
  color: #fff;
  padding: 4px 12px;
  border-radius: 999px;
}
.sp-list { display: flex; flex-direction: column; gap: 10px; }
.sp-skill {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 3px 12px rgba(120, 100, 180, 0.1);
  padding: 12px 14px;
}
.sp-icon { font-size: 26px; }
.sp-body { flex: 1; min-width: 0; }
.sp-name { font-weight: 700; }
.sp-desc { font-size: 13px; color: var(--ink-soft); }
.sp-pips { display: flex; gap: 4px; margin-top: 5px; }
.sp-pip { width: 18px; height: 7px; border-radius: 99px; background: #ece4f4; }
.sp-pip.on { background: linear-gradient(90deg, var(--blue), var(--pink)); }
.sp-up { min-width: 52px; }

/* worlds panel */
.wp-list { display: flex; flex-direction: column; gap: 10px; }
.wp-world {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 3px 12px rgba(120, 100, 180, 0.1);
  padding: 12px 14px;
}
.wp-world.soon { opacity: .68; }
.wp-orb { width: 38px; height: 38px; border-radius: 50%; box-shadow: 0 3px 10px rgba(120,100,180,.25); flex: 0 0 38px; }
.wp-body { flex: 1; min-width: 0; }
.wp-name { font-weight: 700; }
.wp-tag { font-size: 13px; color: var(--ink-soft); }
.wp-here, .wp-soon { font-size: 12px; font-weight: 700; color: var(--ink-soft); white-space: nowrap; }
.wp-here { color: #51b06e; }

/* leaderboard panel */
.lb-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.lb-tab {
  border: 0;
  border-radius: 999px;
  background: #f1e9f8;
  font-family: inherit;
  font-weight: 700;
  font-size: 13px;
  padding: 7px 16px;
  cursor: pointer;
  color: var(--ink-soft);
}
.lb-tab.on { background: linear-gradient(135deg, var(--pink), var(--pink-deep)); color: #fff; }
.lb-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  font-size: 14px;
}
.lb-row:nth-child(odd) { background: rgba(255, 255, 255, 0.75); }
.lb-row.me { outline: 2px solid var(--pink); background: #fff0f7; }
.lb-rank { width: 38px; font-weight: 700; }
.lb-dot { display: block; width: 18px; height: 18px; border-radius: 50%; box-shadow: inset -2px -3px 5px rgba(0,0,0,.12); }
.lb-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.lb-lvl { font-size: 12px; color: var(--ink-soft); font-weight: 700; }
.lb-score { font-weight: 700; color: var(--pink-deep); }
.lb-loading { text-align: center; color: var(--ink-soft); padding: 22px 0; font-weight: 600; }
.lb-me {
  margin-top: 12px;
  text-align: center;
  font-weight: 700;
  background: #fff;
  border-radius: 12px;
  padding: 9px;
  box-shadow: 0 3px 12px rgba(120, 100, 180, 0.1);
}

/* help panel */
.help-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 9px 16px;
  margin: 14px 0;
  font-size: 14px;
  align-items: center;
}

/* toasts */
.hud-toasts {
  position: absolute;
  top: max(70px, calc(env(safe-area-inset-top) + 62px));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none !important;
}
.hud-toast {
  background: var(--card);
  border-radius: 999px;
  box-shadow: var(--shadow);
  padding: 9px 20px;
  font-weight: 700;
  font-size: 14px;
  opacity: 0;
  transform: translateY(-8px);
  transition: all .35s ease;
}
.hud-toast.show { opacity: 1; transform: translateY(0); }
.hud-toast.good { background: #eaffef; color: #2f9456; }
.hud-toast.bad { background: #ffe4ec; color: #c2356f; }

/* level up celebration */
.hud-levelup {
  position: absolute;
  top: 30%;
  left: 50%;
  transform: translate(-50%, -50%) scale(.6);
  text-align: center;
  opacity: 0;
  transition: all .45s cubic-bezier(.2, 1.6, .4, 1);
  pointer-events: none !important;
}
.hud-levelup.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.lv-burst { font-size: 64px; animation: spinPop 1.2s ease; }
.lv-title {
  font-size: 42px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--pink-deep), var(--lav), var(--blue));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 4px 24px rgba(255, 255, 255, 0.6);
}
.lv-sub { font-weight: 700; color: var(--ink); background: var(--card); display: inline-block; border-radius: 999px; padding: 6px 16px; box-shadow: var(--shadow); }
@keyframes spinPop { 0% { transform: scale(0) rotate(-180deg); } 70% { transform: scale(1.25) rotate(10deg); } 100% { transform: scale(1); } }

/* world transition fade */
.hud-fade {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, #fff 0%, #e8d8ff 100%);
  opacity: 0;
  transition: opacity .6s ease;
  pointer-events: none !important;
}
.hud-fade.on { opacity: 1; }

/* chat dock */
.hud-chat {
  position: absolute;
  bottom: 16px;
  left: 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  max-width: min(320px, 72vw);
}
.hud-chat-toggle {
  position: relative;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: var(--card);
  box-shadow: var(--shadow);
  font-size: 19px;
  cursor: pointer;
  transition: transform .12s;
}
.hud-chat-toggle:hover { transform: translateY(-2px) scale(1.06); }
.hud-chat-toggle.unread::after {
  content: '';
  position: absolute;
  top: 2px;
  right: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--pink-deep);
  border: 2px solid #fff;
  animation: pulseDot 1.4s infinite;
}
.hud-chat-box {
  width: min(300px, 70vw);
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(5px);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.hud-chat-log {
  max-height: 150px;
  overflow-y: auto;
  padding: 10px 12px 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.hud-chat-log:empty::before {
  content: 'no bubbles talking yet\2026 say hi!';
  color: var(--ink-soft);
  font-size: 12px;
}
.hud-chat-msg { font-size: 12.5px; line-height: 1.35; overflow-wrap: break-word; }
.hud-chat-msg b { color: var(--pink-deep); }
.hud-chat-msg.self b { color: #51a0c8; }
#hud-chat-form { display: flex; border-top: 1.5px solid rgba(120, 100, 180, 0.12); }
#hud-chat-input {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 9px 12px;
  font-family: inherit;
  font-size: 13px;
  color: var(--ink);
  outline: none;
  min-width: 0;
}
#hud-chat-form button {
  border: 0;
  background: transparent;
  font-size: 15px;
  cursor: pointer;
  padding: 0 12px;
  color: var(--pink-deep);
}

/* dialog close button */
.hud-dialog-close {
  position: absolute;
  top: 8px;
  right: 10px;
  border: 0;
  background: rgba(120, 100, 180, 0.1);
  color: var(--ink-soft);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}
.hud-dialog-close:hover { background: rgba(120, 100, 180, 0.22); color: var(--ink); }

/* ------------------------------------------------- character creator -- */
.cc-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: linear-gradient(160deg, #ffe3f0, #e8f4ff);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
}
.cc-card {
  width: min(480px, 100%);
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px 28px;
  text-align: center;
  max-height: 94vh;
  overflow-y: auto;
}
.cc-card h1 { margin: 0 0 2px; font-size: 26px; }
.cc-card p { margin: 0 0 10px; color: var(--ink-soft); font-size: 14px; }
#cc-canvas { margin: 0 auto; display: block; }
#cc-name {
  width: 100%;
  border: 2px solid #eee4f4;
  border-radius: 14px;
  padding: 11px 14px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  color: var(--ink);
  outline: none;
  margin: 8px 0 14px;
}
#cc-name:focus { border-color: var(--pink); }
.cc-rows { text-align: left; }
.cc-row { margin-bottom: 10px; }
.cc-row-label { font-weight: 700; font-size: 13px; display: block; margin-bottom: 5px; }
.cc-choices { display: flex; flex-wrap: wrap; gap: 7px; }
.cc-hint { font-size: 12px !important; }
.cc-go { width: 100%; margin-top: 6px; }
.cc-error { color: #c2356f; font-weight: 600; font-size: 13px; min-height: 18px; margin-top: 8px; }

/* ------------------------------------------------------------- mobile -- */
@media (max-width: 640px) {
  .hud-xpbar { width: 96px; }
  .hud-btn { width: 40px; height: 40px; font-size: 17px; }
  .hud-quests { max-width: 150px; font-size: 11px; padding: 8px 10px; opacity: .92; }
  .cp-layout { flex-direction: column; }
  .cp-preview { align-self: center; }
  .hud-panel { padding: 16px; }
  .hud-prompt { bottom: 120px; }
  .hud-chat-log { max-height: 100px; }
  .hud-chat { bottom: 12px; }
}
