/* =========================================================
   Ghadeer's Stars — frosted glass design system
   One radius scale, one stroke, one shadow, one accent.
   ========================================================= */

:root {
  --gold: #ffd76b;
  --gold-deep: #ffb02e;
  --gold-soft: #fff0c4;
  --ink: #05070f;
  --ink-2: #0a0f24;
  --text: #eef2ff;
  --muted: #8f99c2;

  /* glass */
  --glass: rgba(255, 255, 255, 0.055);
  --glass-2: rgba(255, 255, 255, 0.09);
  --panel: rgba(13, 18, 40, 0.62);
  --panel-solid: rgba(10, 14, 32, 0.94);
  --stroke: rgba(255, 255, 255, 0.10);
  --stroke-gold: rgba(255, 215, 107, 0.26);

  /* geometry */
  --r-xl: 28px;
  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 12px;

  --shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 30px 80px rgba(0, 0, 0, 0.6);
  --blur: blur(18px) saturate(1.25);

  --ok: #46d39a;
  --no: #ff8f8f;
  --dud: #39405e;   /* the wheel's blank slice */

  /* backdrop — themed */
  --bg-hi: #1b2454;
  --bg-mid: var(--ink-2);
  --bg-lo: var(--ink);
  --au-1: rgba(120, 86, 255, 0.16);
  --au-2: rgba(255, 137, 86, 0.12);
  --au-3: rgba(86, 196, 255, 0.10);
  --glow: rgba(255, 183, 67, 0.20);
}

/* ---------------- Themes (Ghadeer's choice) ---------------- */
body[data-theme="rose"] {
  --gold: #ffa7c4; --gold-deep: #ec5f92; --gold-soft: #ffd9e6;
  --ink: #0b0510; --ink-2: #170a1f;
  --bg-hi: #4a1b45; --au-1: rgba(255, 122, 182, 0.18);
  --au-2: rgba(180, 86, 255, 0.14); --au-3: rgba(255, 190, 120, 0.08);
  --glow: rgba(255, 122, 182, 0.22);
  --stroke-gold: rgba(255, 167, 196, 0.26);
}
body[data-theme="ocean"] {
  --gold: #7fdcff; --gold-deep: #29a9dd; --gold-soft: #cdf1ff;
  --ink: #030a12; --ink-2: #06182a;
  --bg-hi: #123a5c; --au-1: rgba(41, 169, 221, 0.20);
  --au-2: rgba(86, 255, 226, 0.10); --au-3: rgba(90, 120, 255, 0.12);
  --glow: rgba(127, 220, 255, 0.20);
  --stroke-gold: rgba(127, 220, 255, 0.26);
}
body[data-theme="forest"] {
  --gold: #8ce8b4; --gold-deep: #35b877; --gold-soft: #d4f7e4;
  --ink: #030d09; --ink-2: #081c15;
  --bg-hi: #14432f; --au-1: rgba(53, 184, 119, 0.18);
  --au-2: rgba(200, 255, 120, 0.08); --au-3: rgba(60, 190, 220, 0.10);
  --glow: rgba(140, 232, 180, 0.20);
  --stroke-gold: rgba(140, 232, 180, 0.26);
}
body[data-theme="sunset"] {
  --gold: #ffb08a; --gold-deep: #f2653a; --gold-soft: #ffe0cd;
  --ink: #100503; --ink-2: #240c09;
  --bg-hi: #5e2018; --au-1: rgba(242, 101, 58, 0.20);
  --au-2: rgba(255, 190, 90, 0.12); --au-3: rgba(180, 60, 120, 0.12);
  --glow: rgba(255, 176, 138, 0.22);
  --stroke-gold: rgba(255, 176, 138, 0.26);
}
body[data-theme="mono"] {
  --gold: #dfe5f5; --gold-deep: #9aa4c0; --gold-soft: #ffffff;
  --ink: #05060a; --ink-2: #0e1119;
  --bg-hi: #262b38; --au-1: rgba(200, 210, 240, 0.10);
  --au-2: rgba(255, 255, 255, 0.06); --au-3: rgba(150, 165, 200, 0.10);
  --glow: rgba(223, 229, 245, 0.16);
  --stroke-gold: rgba(223, 229, 245, 0.22);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}
html { background: var(--ink); }

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background:
    radial-gradient(120% 80% at 50% -20%, var(--bg-hi) 0%, var(--bg-mid) 45%, var(--bg-lo) 100%);
  background-attachment: fixed;
  color: var(--text);
  overflow: hidden;
  overscroll-behavior: none;
  height: 100vh;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  inset: 0;
}

#starfield {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
}

#fx {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 5;
  pointer-events: none;
}

.aurora {
  position: fixed;
  inset: -20%;
  z-index: 1;
  background:
    radial-gradient(38% 28% at 18% 18%, var(--au-1), transparent 62%),
    radial-gradient(42% 32% at 82% 28%, var(--au-2), transparent 62%),
    radial-gradient(48% 38% at 50% 92%, var(--au-3), transparent 62%);
  filter: blur(26px);
  animation: drift 22s ease-in-out infinite alternate;
}
@keyframes drift {
  0% { transform: translate3d(-2%, -1%, 0) scale(1); }
  100% { transform: translate3d(2%, 2%, 0) scale(1.08); }
}

/* ---------------- Stage ---------------- */
.stage {
  position: relative;
  z-index: 10;
  text-align: center;
  width: min(92vw, 460px);
  height: 100dvh;
  padding: 84px 16px 108px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
body.admin .stage { padding-bottom: 146px; }

.kicker {
  letter-spacing: 0.34em;
  text-transform: uppercase;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted);
}

h1 {
  font-size: clamp(26px, 6.2vw, 40px);
  font-weight: 750;
  letter-spacing: -0.02em;
  line-height: 1.05;
  background: linear-gradient(180deg, #ffffff, #b3bdea);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.subtitle {
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.45;
  max-width: 30ch;
}

/* ---------------- Balance card ---------------- */
.balance {
  width: 100%;
  padding: 30px 18px 22px;
  border-radius: var(--r-xl);
  background: linear-gradient(180deg, var(--glass-2), var(--glass));
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  position: relative;
  overflow: hidden;
}
/* soft halo behind the numeral */
.balance::before {
  content: "";
  position: absolute;
  left: 50%; top: -30%;
  width: 70%; height: 90%;
  transform: translateX(-50%);
  background: radial-gradient(circle, var(--glow), transparent 68%);
  filter: blur(14px);
  animation: breathe 5s ease-in-out infinite;
  pointer-events: none;
}
@keyframes breathe {
  0%, 100% { opacity: 0.7; transform: translateX(-50%) scale(1); }
  50% { opacity: 1; transform: translateX(-50%) scale(1.1); }
}

.hero-star {
  position: relative;
  font-size: 40px;
  line-height: 1;
  filter: drop-shadow(0 0 16px rgba(255, 183, 67, 0.6));
  animation: twinkle 4.2s ease-in-out infinite;
}
@keyframes twinkle {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.09) rotate(5deg); }
}

.count {
  position: relative;
  font-size: clamp(56px, 16vw, 88px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.045em;
  margin-top: 6px;
  background: linear-gradient(180deg, #fffaf0 0%, var(--gold) 52%, var(--gold-deep) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  transition: transform 0.25s cubic-bezier(.2, .9, .3, 1.4);
}
.count.neg {
  background: linear-gradient(180deg, #ffd9d9 0%, #ff8f8f 52%, #e2564f 100%);
  -webkit-background-clip: text;
  background-clip: text;
}
.count.bump { transform: scale(1.14); }
.count.shake { animation: shake 0.4s ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px) rotate(-1deg); }
  40% { transform: translateX(6px) rotate(1deg); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}

.label {
  position: relative;
  margin-top: 6px;
  color: var(--muted);
  letter-spacing: 0.26em;
  text-transform: uppercase;
  font-size: 10.5px;
  font-weight: 600;
}

/* the pips — every star, kept tidy */
.cluster {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-content: flex-start;
  gap: 5px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--stroke);
  max-height: 21vh;
  overflow-y: auto;
  scrollbar-width: none;
}
.cluster::-webkit-scrollbar { display: none; }
.pip {
  font-size: clamp(13px, 3.6vw, 17px);
  line-height: 1;
  display: inline-block;
  filter: drop-shadow(0 0 5px rgba(255, 183, 67, 0.45));
  transform-origin: center;
}
.pip.pop { animation: pip-pop 0.5s cubic-bezier(.2, .8, .3, 1.6) both; }
.pip.leaving { animation: pip-leave 0.4s ease forwards; }
@keyframes pip-pop {
  0% { transform: scale(0) rotate(-40deg); opacity: 0; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}
@keyframes pip-leave {
  to { transform: scale(0) translateY(-12px); opacity: 0; }
}

/* ---------------- Top pills ---------------- */
.topbtns {
  position: fixed;
  z-index: 22;
  top: 14px; left: 14px; right: 14px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.histbtn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--stroke);
  background: var(--panel);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  font-weight: 650;
  padding: 8px 13px;
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  transition: background 0.18s ease, transform 0.1s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.histbtn:hover { background: rgba(24, 32, 66, 0.72); }
.histbtn:active { transform: scale(0.96); }
/* Flows inline after the other pills — pushing it right left an odd orphan row. */
.histbtn.ghost {
  text-decoration: none;
  color: var(--gold);
  border-color: var(--stroke-gold);
}
.histbtn .pill {
  display: inline-block;
  min-width: 17px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--ok);
  color: #06210f;
  font-size: 10.5px;
  font-weight: 800;
  line-height: 17px;
  text-align: center;
}

/* ---------------- Bottom dock ---------------- */
.panel {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  width: min(94vw, 420px);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border-radius: var(--r-lg);
  background: var(--panel);
  border: 1px solid var(--stroke);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  box-shadow: var(--shadow);
}
.panel .who {
  font-size: 11.5px;
  color: var(--muted);
  padding: 0 4px;
  white-space: nowrap;
}
.panel .who b { color: var(--gold); font-weight: 700; }

.btn {
  flex: 1;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
  font-size: 14px;
  color: var(--ink);
  border-radius: var(--r-md);
  padding: 13px 14px;
  transition: filter 0.2s ease, transform 0.1s ease;
  background: linear-gradient(180deg, var(--gold-soft), var(--gold-deep));
  box-shadow: 0 8px 20px rgba(255, 176, 46, 0.26);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: scale(0.97); }
.btn.minus {
  color: var(--text);
  background: var(--glass-2);
  border: 1px solid var(--stroke);
  box-shadow: none;
}

/* ---------------- Ghadeer's composer ---------------- */
.composer {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}
.composer .amts { display: flex; gap: 6px; }

.amt {
  flex: 1;
  border: 1px solid var(--stroke);
  background: var(--glass);
  color: var(--text);
  font-family: inherit;
  font-weight: 750;
  font-size: 14px;
  padding: 10px 0;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.2s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.amt:active { transform: scale(0.96); }
.amt.sel {
  color: var(--ink);
  border-color: transparent;
  background: linear-gradient(180deg, var(--gold-soft), var(--gold-deep));
  box-shadow: 0 6px 16px rgba(255, 176, 46, 0.3);
}
.amt.minus.sel {
  color: #2d0c0c;
  background: linear-gradient(180deg, #ffb3b3, #e2564f);
  box-shadow: 0 6px 16px rgba(226, 86, 79, 0.3);
}

.composerow { display: flex; gap: 8px; align-items: center; }
.msgin {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--stroke);
  background: rgba(0, 0, 0, 0.28);
  color: var(--text);
  border-radius: var(--r-md);
  padding: 12px 14px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s ease;
}
.msgin::placeholder { color: var(--muted); }
.msgin:focus { border-color: var(--stroke-gold); }

.sendbtn {
  flex: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: 750;
  font-size: 14px;
  color: var(--ink);
  padding: 13px 20px;
  border-radius: var(--r-md);
  background: linear-gradient(180deg, var(--gold-soft), var(--gold-deep));
  box-shadow: 0 6px 16px rgba(255, 176, 46, 0.26);
  transition: filter 0.2s ease, transform 0.1s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.sendbtn:hover { filter: brightness(1.05); }
.sendbtn:active { transform: scale(0.96); }

/* ---------------- Toast ---------------- */
.toast {
  position: fixed;
  z-index: 55;
  left: 50%; top: 64px;
  transform: translate(-50%, -14px);
  max-width: min(92vw, 420px);
  background: var(--panel-solid);
  border: 1px solid var(--stroke-gold);
  color: var(--text);
  padding: 11px 18px;
  border-radius: 999px;
  font-size: 13.5px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  transition: opacity 0.28s ease, transform 0.28s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- Requests ---------------- */
.requests {
  position: fixed;
  z-index: 21;
  left: 50%;
  bottom: 142px;
  transform: translateX(-50%);
  width: min(94vw, 420px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 46vh;
  overflow-y: auto;
  scrollbar-width: none;
}
.requests::-webkit-scrollbar { display: none; }
.reqcard {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 12px;
  border-radius: var(--r-md);
  background: var(--panel-solid);
  border: 1px solid var(--stroke-gold);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  box-shadow: var(--shadow);
  animation: slide-in 0.3s ease;
}
@keyframes slide-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.reqcard .txt { flex: 1; font-size: 13px; line-height: 1.35; color: var(--text); }
.reqcard .txt b { color: var(--gold); font-weight: 700; }
.reqcard .txt i { display: block; margin-top: 3px; font-size: 12px; color: var(--muted); }
.mini {
  flex: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
  font-size: 12.5px;
  padding: 9px 13px;
  border-radius: var(--r-sm);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.mini.ok { color: #06210f; background: linear-gradient(180deg, #b8f5cf, var(--ok)); }
.mini.no { color: var(--text); background: var(--glass-2); }
.mini:active { transform: scale(0.95); }

.reqstatus {
  position: fixed;
  z-index: 21;
  left: 50%;
  bottom: 88px;
  transform: translate(-50%, 8px);
  max-width: min(94vw, 420px);
  background: var(--panel-solid);
  border: 1px solid var(--stroke-gold);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 12.5px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.reqstatus.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- Side panels ---------------- */
.histpanel {
  position: fixed;
  z-index: 40;
  top: 0; left: 0; bottom: 0;
  width: min(90vw, 400px);
  background: var(--panel-solid);
  border-right: 1px solid var(--stroke);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  box-shadow: 24px 0 70px rgba(0, 0, 0, 0.55);
  transform: translateX(-105%);
  /* Parked off-screen it must stop painting entirely: the shadow is thrown
     24px to the RIGHT and blurred 70px, so it lands back inside the left edge
     of the screen — once per panel, which stacked into a black band. Hiding by
     visibility kills the shadow too, and the delay keeps it through the slide. */
  visibility: hidden;
  transition: transform 0.34s cubic-bezier(.2, .8, .3, 1), visibility 0s linear 0.34s;
  display: flex;
  flex-direction: column;
  padding: 14px 14px calc(16px + env(safe-area-inset-bottom));
}
.histpanel.show {
  transform: translateX(0);
  visibility: visible;
  transition: transform 0.34s cubic-bezier(.2, .8, .3, 1), visibility 0s;
}
.histhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 15px;
  font-weight: 750;
  letter-spacing: 0.01em;
  color: var(--text);
  padding: 4px 4px 14px;
}
.histx {
  flex: none;
  border: 1px solid var(--stroke);
  background: var(--glass);
  color: var(--text);
  width: 30px; height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 13px;
}
.histx:active { transform: scale(0.94); }
.histlist {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 7px;
  scrollbar-width: none;
}
.histlist::-webkit-scrollbar { display: none; }
.histempty { color: var(--muted); font-size: 13px; text-align: center; padding: 28px 0; }

.histrow {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 11px 12px;
  border-radius: var(--r-md);
  background: var(--glass);
  border: 1px solid var(--stroke-gold);
}
.histrow.neg { border-color: var(--stroke); }
.histic { font-size: 17px; line-height: 1.3; flex: none; }
.histmain { flex: 1; min-width: 0; }
.histt { font-size: 13px; color: var(--text); font-weight: 600; line-height: 1.35; }
.histmsg { font-size: 12px; color: var(--muted); margin-top: 3px; font-style: italic; word-break: break-word; }
.histtime { font-size: 10.5px; color: var(--muted); flex: none; white-space: nowrap; padding-top: 3px; }

/* ---------------- Star shop ---------------- */
.shopbal {
  font-size: 12px;
  color: var(--muted);
  padding: 0 4px 12px;
  line-height: 1.45;
}
.shoprow {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 11px 12px;
  border-radius: var(--r-md);
  background: var(--glass);
  border: 1px solid var(--stroke-gold);
  transition: opacity 0.2s ease;
}
.shoprow.off { opacity: 0.4; }
.shopemoji { font-size: 21px; line-height: 1; flex: none; }
.shopmain { flex: 1; min-width: 0; }
.shopname { font-size: 13px; color: var(--text); font-weight: 600; word-break: break-word; }
.shopprice { font-size: 11.5px; color: var(--gold); margin-top: 2px; font-weight: 750; letter-spacing: 0.02em; }
.shopbuy {
  flex: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
  font-size: 12px;
  padding: 9px 13px;
  border-radius: var(--r-sm);
  color: var(--ink);
  background: linear-gradient(180deg, var(--gold-soft), var(--gold-deep));
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.shopbuy:active { transform: scale(0.95); }
.shopbuy[disabled] { background: var(--glass-2); color: var(--muted); cursor: default; }

.shoprow.edit { flex-wrap: wrap; }
.shopin {
  border: 1px solid var(--stroke);
  background: rgba(0, 0, 0, 0.28);
  color: var(--text);
  border-radius: var(--r-sm);
  padding: 9px 10px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  min-width: 0;
}
.shopin:focus { border-color: var(--stroke-gold); }
.shopin.emo { width: 48px; text-align: center; flex: none; }
.shopin.nm { flex: 1; }
.shopin.pr { width: 58px; flex: none; text-align: center; }
.shopdel {
  flex: none;
  border: none;
  background: rgba(255, 120, 120, 0.14);
  color: var(--no);
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 13px;
}
.shopdel:active { transform: scale(0.94); }
.shopadmin { display: flex; gap: 8px; padding-top: 12px; }
.shopadmin .btn { font-size: 13.5px; padding: 12px; }

/* ---------------- Owed ledger ---------------- */
.owedwrap {
  display: none;
  margin-bottom: 12px;
  padding: 12px;
  border-radius: var(--r-md);
  background: rgba(70, 211, 154, 0.07);
  border: 1px solid rgba(70, 211, 154, 0.3);
}
.owedwrap.show { display: block; }
.owedhead {
  font-size: 10.5px;
  font-weight: 750;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #86e6bd;
  margin-bottom: 10px;
}
.owedrow {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}
.owedrow:first-child { border-top: none; padding-top: 0; }
.owedemoji { font-size: 19px; line-height: 1; flex: none; }
.owedmain { flex: 1; min-width: 0; }
.owedname { font-size: 13px; color: var(--text); font-weight: 600; word-break: break-word; }
.owedwhen { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.owedbtn {
  flex: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
  font-size: 12px;
  padding: 9px 13px;
  border-radius: var(--r-sm);
  color: #06210f;
  background: linear-gradient(180deg, #b8f5cf, var(--ok));
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.owedbtn:active { transform: scale(0.95); }

/* ---------------- Badge shelf ---------------- */
.badgerow {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 13px 12px;
  border-radius: var(--r-md);
  background: var(--glass);
  border: 1px solid var(--stroke-gold);
}
.badgerow.locked { opacity: 0.38; border-color: var(--stroke); }
.badgeic { font-size: 25px; line-height: 1; flex: none; filter: drop-shadow(0 0 8px rgba(255, 183, 67, 0.45)); }
.badgerow.locked .badgeic { filter: grayscale(1); }
.badgemain { flex: 1; min-width: 0; }
.badgename { font-size: 13px; font-weight: 700; color: var(--text); }
.badgeat { font-size: 10.5px; color: var(--muted); margin-top: 3px; letter-spacing: 0.08em; text-transform: uppercase; }

/* ---------------- Ghadeer's control panel ---------------- */
.ctlgroup { margin-bottom: 18px; }
.ctltitle {
  font-size: 10.5px;
  font-weight: 750;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 10px;
  padding-left: 2px;
}
.ctlnote {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.45;
  margin: -4px 0 10px;
  padding-left: 2px;
}

/* theme swatches */
.themes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.swatch {
  border: 1px solid var(--stroke);
  background: var(--glass);
  border-radius: var(--r-md);
  padding: 10px 6px 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 650;
  color: var(--muted);
  text-align: center;
  transition: border-color 0.18s ease, transform 0.1s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.swatch:active { transform: scale(0.96); }
.swatch.on { border-color: var(--gold); color: var(--text); }
.swatch .dots {
  display: flex;
  justify-content: center;
  gap: 3px;
  margin-bottom: 7px;
}
.swatch .fxname {
  font-size: 9px;
  font-weight: 500;
  color: var(--muted);
  margin-top: 3px;
  line-height: 1.25;
}
.swatch.on .fxname { color: var(--gold); }
.swatch .dots i {
  width: 13px; height: 13px;
  border-radius: 50%;
  display: block;
}

/* toggle rows */
.togrow {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: var(--glass);
  border: 1px solid var(--stroke);
  margin-bottom: 7px;
}
.toglabel { flex: 1; min-width: 0; font-size: 13px; color: var(--text); font-weight: 600; }
.togsub { font-size: 11px; color: var(--muted); margin-top: 2px; font-weight: 400; }
.tog {
  flex: none;
  position: relative;
  width: 46px; height: 27px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.12);
  transition: background 0.22s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.tog::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 21px; height: 21px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  transition: transform 0.22s cubic-bezier(.2, .8, .3, 1.4);
}
.tog.on { background: linear-gradient(180deg, var(--gold-soft), var(--gold-deep)); }
.tog.on::after { transform: translateX(19px); }

/* accent picker */
.accentrow { display: flex; align-items: center; gap: 10px; }
.accentrow input[type="color"] {
  flex: none;
  width: 52px; height: 40px;
  padding: 0;
  border: 1px solid var(--stroke);
  border-radius: var(--r-sm);
  background: transparent;
  cursor: pointer;
}
.ctlreset {
  border: 1px solid var(--stroke);
  background: var(--glass);
  color: var(--text);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 650;
  padding: 10px 14px;
  border-radius: var(--r-sm);
  cursor: pointer;
}
.ctlreset:active { transform: scale(0.96); }


/* ---------------- Plea modal ---------------- */
.pleawrap {
  position: fixed;
  z-index: 60;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(4, 6, 18, 0.74);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.pleawrap.show { display: flex; animation: fade-in 0.22s ease; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.pleabox {
  width: min(92vw, 370px);
  text-align: center;
  padding: 26px 22px 20px;
  border-radius: var(--r-xl);
  background: linear-gradient(180deg, rgba(30, 38, 78, 0.95), rgba(11, 15, 34, 0.96));
  border: 1px solid var(--stroke-gold);
  box-shadow: var(--shadow-lg);
  animation: pop-in 0.35s cubic-bezier(.2, .8, .3, 1.5);
}
@keyframes pop-in {
  from { opacity: 0; transform: translateY(24px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.pleaface {
  font-size: 56px;
  line-height: 1;
  margin-bottom: 12px;
  animation: wobble 2.2s ease-in-out infinite;
  filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.45));
}
@keyframes wobble {
  0%, 100% { transform: rotate(-6deg) scale(1); }
  50% { transform: rotate(6deg) scale(1.06); }
}
.pleatitle {
  font-size: 18px;
  font-weight: 750;
  color: var(--gold);
  margin-bottom: 8px;
}
.pleamsg {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  margin-bottom: 16px;
}
.pleadots { display: flex; justify-content: center; gap: 6px; margin-bottom: 16px; }
.pleadots span {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  transition: background 0.25s ease, transform 0.25s ease;
}
.pleadots span.on { background: var(--gold); transform: scale(1.3); }
.pleabtns { display: flex; flex-direction: column; gap: 8px; }
.pleayes { width: 100%; }
.pleano {
  border: none;
  background: none;
  color: var(--muted);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 4px;
  cursor: pointer;
  opacity: 0.75;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.pleano:hover { opacity: 1; color: var(--text); }
.pleano:active { transform: scale(0.96); }

.pleabox.t2 { border-color: rgba(255, 145, 145, 0.45); }
.pleabox.t2 .pleaface { animation-duration: 1.4s; font-size: 62px; }
.pleabox.t3 {
  border-color: rgba(255, 96, 96, 0.6);
  box-shadow: var(--shadow-lg), 0 0 40px rgba(255, 96, 96, 0.18);
  animation: pop-in 0.35s cubic-bezier(.2, .8, .3, 1.5), panic 0.9s ease-in-out 0.35s infinite;
}
@keyframes panic {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}
.pleabox.t3 .pleaface { animation-duration: 0.7s; font-size: 68px; }
.pleabox.t3 .pleayes { font-size: 16px; padding: 15px 16px; }
.pleabox.t3 .pleano { font-size: 11.5px; opacity: 0.45; }

/* ---------------- Milestone celebration ---------------- */
.milewrap {
  position: fixed;
  z-index: 70;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(4, 6, 18, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.milewrap.show { display: flex; animation: fade-in 0.3s ease; }
.milebox {
  width: min(92vw, 370px);
  text-align: center;
  padding: 34px 24px 24px;
  border-radius: var(--r-xl);
  background: linear-gradient(180deg, rgba(48, 39, 14, 0.95), rgba(12, 12, 30, 0.96));
  border: 1px solid rgba(255, 215, 107, 0.48);
  box-shadow: var(--shadow-lg), 0 0 60px rgba(255, 176, 46, 0.18);
  animation: pop-in 0.5s cubic-bezier(.2, .8, .3, 1.5);
}
.mileemoji {
  font-size: 70px;
  line-height: 1;
  margin-bottom: 14px;
  filter: drop-shadow(0 0 24px rgba(255, 183, 67, 0.75));
  animation: mile-pop 2.6s ease-in-out infinite;
}
@keyframes mile-pop {
  0%, 100% { transform: scale(1) rotate(-4deg); }
  50% { transform: scale(1.12) rotate(4deg); }
}
.mileat {
  font-size: 11px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 10px;
}
.miletitle {
  font-size: 20px;
  font-weight: 750;
  color: #fff6dd;
  margin-bottom: 20px;
  line-height: 1.25;
}

/* ---------------- Golden star ---------------- */
.goldflash {
  position: fixed;
  z-index: 65;
  left: 50%; top: 38%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
  animation: gold-rise 2s ease-out forwards;
}
.goldflash .gemoji { font-size: 88px; filter: drop-shadow(0 0 30px var(--gold)); }
.goldflash .gtxt {
  margin-top: 6px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: #ffe9a8;
  text-shadow: 0 0 18px rgba(255, 176, 46, 0.9);
}
@keyframes gold-rise {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(0.4) rotate(-25deg); }
  25% { opacity: 1; transform: translate(-50%, -50%) scale(1.15) rotate(6deg); }
  60% { opacity: 1; transform: translate(-50%, -52%) scale(1) rotate(0deg); }
  100% { opacity: 0; transform: translate(-50%, -80%) scale(0.9); }
}

.signout {
  display: block;
  margin-top: 12px;
  padding: 11px;
  text-align: center;
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 650;
  color: var(--muted);
  border: 1px solid var(--stroke);
  border-radius: var(--r-md);
  background: var(--glass);
}
.signout:active { transform: scale(0.98); }

/* ---------------- Sign in ---------------- */
.logwrap {
  position: relative;
  z-index: 10;
  width: min(92vw, 380px);
  padding: 20px;
}
.logcard {
  text-align: center;
  padding: 32px 22px 24px;
  border-radius: var(--r-xl);
  background: linear-gradient(180deg, var(--glass-2), var(--glass));
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}
.logstar {
  font-size: 44px;
  line-height: 1;
  margin-bottom: 14px;
  filter: drop-shadow(0 0 18px rgba(255, 183, 67, 0.6));
  animation: twinkle 4.2s ease-in-out infinite;
}
.logcard h1 { font-size: 26px; margin-bottom: 6px; }
.logcard .subtitle { margin: 0 auto 18px; }
.logfield {
  width: 100%;
  margin-bottom: 10px;
  text-align: center;
}
.logbtn { width: 100%; margin-top: 4px; }
.logerr {
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--no);
  min-height: 16px;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.logerr.show { opacity: 1; }
.logforgot {
  display: block;
  width: 100%;
  margin-top: 10px;
  border: none;
  background: none;
  color: var(--muted);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px;
  cursor: pointer;
}
.logforgot:hover { color: var(--text); }
.logforgot:disabled { opacity: 0.6; cursor: default; }

/* ---------------- Small screens ---------------- */
@media (max-width: 480px) {
  .stage { padding: 78px 12px 100px; gap: 12px; }
  body.admin .stage { padding-bottom: 126px; }
  .histbtn { font-size: 11px; padding: 7px 11px; }
  .panel { width: calc(100vw - 20px); }
  .panel .who { display: none; }
  .cluster { max-height: 18vh; }
  .subtitle { font-size: 12.5px; }
}

@media (max-height: 700px) {
  .balance { padding: 18px 16px 14px; }
  .cluster { max-height: 15vh; margin-top: 12px; padding-top: 10px; }
  .hero-star { font-size: 28px; }
}

/* =========================================================
   The spin wheel — Ghadeer sends it, he spins it, she watches
   ========================================================= */
.spinwrap {
  position: fixed;
  z-index: 72;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(4, 6, 18, 0.84);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.spinwrap.show { display: flex; animation: fade-in 0.3s ease; }
.spinbox {
  width: min(94vw, 380px);
  text-align: center;
  padding: 24px 20px 20px;
  border-radius: var(--r-xl);
  background: linear-gradient(180deg, rgba(30, 26, 12, 0.95), rgba(12, 12, 30, 0.96));
  border: 1px solid var(--stroke-gold);
  box-shadow: var(--shadow-lg), 0 0 60px var(--glow, rgba(255, 176, 46, 0.18));
  animation: pop-in 0.42s cubic-bezier(.2, .8, .3, 1.5);
}
.spintitle {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--gold-soft);
}
.spinsub {
  margin-top: 5px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
  min-height: 18px;
}
.spinsub i { color: var(--gold); font-style: italic; }

.wheelwrap {
  position: relative;
  width: min(70vw, 250px);
  height: min(70vw, 250px);
  margin: 16px auto 10px;
}
.wheelptr {
  position: absolute;
  top: -13px; left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  font-size: 22px;
  line-height: 1;
  color: var(--gold);
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.6));
}
.wheel {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid var(--gold-deep);
  box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.05), var(--shadow);
  /* Generated in app.js from the server's slice list; this is only a fallback
     for the instant before the catalogue arrives. */
  background: conic-gradient(var(--gold-soft), var(--gold-deep));
  will-change: transform;
}
/* Each number rides its own slice, so it turns with the wheel. A full-size
   layer rotated to the slice's midpoint keeps the maths out of pixels. */
.wslot {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  pointer-events: none;
}
.wslot.zero span { color: #c9d1f0; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5); }
.wslot span {
  margin-top: 11%;
  font-size: 19px;
  font-weight: 850;
  color: #221a05;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}
.wheelhub {
  position: absolute;
  top: 50%; left: 50%;
  width: 54px; height: 54px;
  margin: -27px 0 0 -27px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 22px;
  background: var(--panel-solid);
  border: 1px solid var(--stroke-gold);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
  z-index: 2;
}
.wheel.turning { filter: saturate(1.15); }

.spinresult {
  min-height: 26px;
  margin: 6px 0 2px;
  font-size: 17px;
  font-weight: 800;
  color: var(--gold);
}
.spinresult.big { animation: pop-in 0.5s cubic-bezier(.2, .8, .3, 1.5); }
.spinresult.dud { color: var(--muted); }
.spinnote { width: 100%; margin-top: 6px; }
.spinbtns {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}
.spinbtns .btn { width: 100%; }
.spinghost {
  border: 0;
  background: none;
  color: var(--muted);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 650;
  padding: 6px;
  cursor: pointer;
}
.spinghost:hover { color: var(--text); }

/* A waiting spin should be impossible to miss. */
.histbtn.pulse {
  border-color: var(--stroke-gold);
  color: var(--gold);
  animation: spinpulse 1.6s ease-in-out infinite;
}
@keyframes spinpulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 176, 46, 0.36); }
  50%      { box-shadow: 0 0 0 7px rgba(255, 176, 46, 0); }
}

/* ---------------- Sandbox marking ----------------
   /a-test and /g-test must never be mistaken for the real jar. */
.histbtn.sand {
  border-color: rgba(255, 143, 143, 0.5);
  color: #ffc9c9;
  background: rgba(60, 16, 16, 0.6);
}
body.sandboxed::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  border: 2px solid rgba(255, 143, 143, 0.42);
}

/* ---------------- The games menu ---------------- */
.gamerow {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  margin-bottom: 8px;
  border-radius: var(--r-md);
  background: var(--glass);
  border: 1px solid var(--stroke);
}
.gameic {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  font-size: 21px;
  border-radius: 50%;
  background: var(--glass-2);
  border: 1px solid var(--stroke-gold);
}
.gamemain { flex: 1 1 auto; min-width: 0; }
.gamename { font-size: 13.5px; font-weight: 750; color: var(--text); }
.gameblurb { font-size: 11.5px; line-height: 1.35; color: var(--muted); margin-top: 2px; }

/* One stage per game inside the overlay; only the one in play is shown. */
.gstage { display: none; }
.gstage.on { display: block; }

/* His side of the overlay: the games he can ask Ghadeer for. */
.askmenu { margin-top: 10px; text-align: left; }
.askmenu .gamerow:last-child { margin-bottom: 0; }
