@import url("https://fonts.googleapis.com/css2?family=Orbitron:wght@600;800;900&family=Inter:wght@400;500;700&display=swap");

:root {
  --bg: #07060f;
  --panel: rgba(255, 255, 255, 0.04);
  --panel-border: rgba(255, 255, 255, 0.09);
  --text: #eef0ff;
  --muted: #9a9cc4;
  --cyan: #22e4ff;
  --pink: #ff3fb4;
  --violet: #8b5cff;
  --gold: #ffcc33;
  --lime: #7dff5a;
  --radius: 18px;
  --display: "Orbitron", "Segoe UI", system-ui, sans-serif;
  --body: "Inter", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

/* Keep [hidden] working on elements that set their own display (e.g. overlays). */
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(900px 500px at 10% -10%, rgba(139, 92, 255, 0.25), transparent 60%),
    radial-gradient(800px 500px at 100% 0%, rgba(255, 63, 180, 0.18), transparent 60%),
    radial-gradient(900px 600px at 50% 120%, rgba(34, 228, 255, 0.14), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 15px;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, black, transparent 85%);
  z-index: -1;
}

a { color: inherit; text-decoration: none; }

.wrap { max-width: 1280px; margin: 0 auto; padding: 0 20px; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(14px);
  background: rgba(7, 6, 15, 0.7);
  border-bottom: 1px solid var(--panel-border);
}
.topbar .wrap {
  display: flex;
  align-items: center;
  gap: 12px 18px;
  min-height: 68px;
  padding-block: 10px;
  flex-wrap: wrap;
}
.logo {
  font-family: var(--display);
  font-weight: 900;
  font-size: 20px;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo-mark {
  width: 30px; height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--cyan), var(--violet) 55%, var(--pink));
  box-shadow: 0 0 18px rgba(139, 92, 255, 0.7);
  display: grid; place-items: center;
  font-size: 15px;
}
.logo span.grad {
  background: linear-gradient(90deg, var(--cyan), var(--pink));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.nav { display: flex; gap: 4px; margin-left: 12px; }
.nav a {
  padding: 8px 14px;
  border-radius: 10px;
  color: var(--muted);
  font-weight: 500;
  transition: 0.2s;
}
.nav a:hover { color: var(--text); background: var(--panel); }
.nav a.active { color: var(--text); background: rgba(139, 92, 255, 0.18); }

.top-right { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.user-chip {
  display: flex; align-items: center; gap: 8px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  padding: 5px 14px 5px 6px;
  font-weight: 700;
  transition: 0.2s;
}
.user-chip:hover { border-color: rgba(139, 92, 255, 0.6); }
.user-chip .av {
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.08);
  font-size: 16px;
}
.coin-pill {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(255, 204, 51, 0.12);
  border: 1px solid rgba(255, 204, 51, 0.35);
  font-family: var(--display);
  font-weight: 800;
  color: var(--gold);
}
.coin-pill.bump { animation: bump 0.45s ease; }
@keyframes bump { 40% { transform: scale(1.18); box-shadow: 0 0 24px rgba(255, 204, 51, 0.6); } }

.coin {
  width: 18px; height: 18px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff6c4, var(--gold) 45%, #c98a00);
  box-shadow: 0 0 10px rgba(255, 204, 51, 0.6);
  display: inline-block;
  flex: none;
}

/* ---------- Hero ---------- */
.hero { padding: 64px 0 36px; }
.eyebrow {
  display: inline-block;
  font-size: 12px; font-weight: 700; letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--cyan);
  padding: 6px 12px;
  border: 1px solid rgba(34, 228, 255, 0.35);
  border-radius: 999px;
  background: rgba(34, 228, 255, 0.08);
}
.hero h1 {
  font-family: var(--display);
  font-size: clamp(36px, 6vw, 68px);
  line-height: 1.02;
  margin: 18px 0 14px;
  letter-spacing: -1px;
}
.hero h1 .grad {
  background: linear-gradient(90deg, var(--cyan), var(--violet), var(--pink));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p { color: var(--muted); font-size: 17px; max-width: 560px; line-height: 1.6; }

.stats { display: flex; gap: 14px; margin-top: 28px; flex-wrap: wrap; }
.stat {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 14px 20px;
  min-width: 150px;
}
.stat b { display: block; font-family: var(--display); font-size: 24px; }
.stat small { color: var(--muted); }

/* ---------- Sections ---------- */
section { padding: 28px 0; }
.section-title {
  font-family: var(--display);
  font-size: 22px;
  margin: 0 0 18px;
  display: flex; align-items: center; gap: 12px;
}
.section-title::after {
  content: ""; flex: 1; height: 1px;
  background: linear-gradient(90deg, var(--panel-border), transparent);
}

.grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

.card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.25s, border-color 0.25s, box-shadow 0.25s;
}
a.card:hover {
  transform: translateY(-6px);
  border-color: rgba(139, 92, 255, 0.6);
  box-shadow: 0 20px 50px -20px rgba(139, 92, 255, 0.6);
}
.card-art {
  height: 190px;
  position: relative;
  overflow: hidden;
  display: grid; place-items: center;
}
.card-body { padding: 18px 20px 22px; }
.card-body h3 { font-family: var(--display); margin: 0 0 6px; font-size: 20px; }
.card-body p { color: var(--muted); margin: 0 0 16px; line-height: 1.5; }
.card-meta { display: flex; justify-content: space-between; align-items: center; }
.tag {
  font-size: 12px; font-weight: 700;
  padding: 5px 10px; border-radius: 8px;
  background: rgba(255, 255, 255, 0.06); color: var(--muted);
}
.play-btn {
  font-family: var(--display); font-weight: 800; font-size: 13px;
  padding: 9px 16px; border-radius: 10px;
  background: linear-gradient(135deg, var(--violet), var(--pink));
  box-shadow: 0 6px 20px -6px rgba(255, 63, 180, 0.8);
}

/* Card art: Spacebar */
.art-space { background: linear-gradient(160deg, #1a0f3d, #2d0b3a); }
.art-space .key {
  width: 230px; height: 62px; border-radius: 14px;
  background: linear-gradient(#2a2650, #1a1738);
  border: 2px solid rgba(255, 63, 180, 0.6);
  box-shadow: 0 8px 0 #0e0c22, 0 0 30px rgba(255, 63, 180, 0.45);
  display: grid; place-items: center;
  font-family: var(--display); font-weight: 800; letter-spacing: 4px; color: var(--pink);
  animation: press 1s infinite;
}
@keyframes press {
  0%, 60%, 100% { transform: translateY(0); box-shadow: 0 8px 0 #0e0c22, 0 0 30px rgba(255, 63, 180, 0.45); }
  70% { transform: translateY(6px); box-shadow: 0 2px 0 #0e0c22, 0 0 50px rgba(255, 63, 180, 0.8); }
}
.art-space .plus {
  position: absolute; font-family: var(--display); font-weight: 900; color: var(--gold);
  animation: floatUp 1s infinite;
}
@keyframes floatUp { 0%, 65% { opacity: 0; transform: translateY(10px); } 75% { opacity: 1; } 100% { opacity: 0; transform: translateY(-30px); } }

/* Card art: Dash */
.art-dash { background: linear-gradient(160deg, #04203a, #0b0f3d); }
.art-dash .floor { position: absolute; left: 0; right: 0; bottom: 40px; height: 2px; background: var(--cyan); box-shadow: 0 0 14px var(--cyan); }
.art-dash .cube {
  position: absolute; left: 70px; bottom: 42px; width: 30px; height: 30px;
  background: var(--cyan); border-radius: 4px;
  box-shadow: 0 0 18px var(--cyan), inset 0 0 0 6px rgba(0, 0, 0, 0.25);
  animation: hop 1.2s infinite cubic-bezier(.3,.7,.6,1);
}
@keyframes hop { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-60px) rotate(180deg); } }
.art-dash .spike {
  position: absolute; bottom: 42px; width: 0; height: 0;
  border-left: 14px solid transparent; border-right: 14px solid transparent;
  border-bottom: 28px solid var(--pink);
  filter: drop-shadow(0 0 8px var(--pink));
  animation: slide 2.4s linear infinite;
}
@keyframes slide { from { left: 110%; } to { left: -20%; } }

/* Card art: Neon Stack */
.art-stack { background: linear-gradient(160deg, #1a0b3a, #0b1f3d); }
.art-stack .mini-grid { display: grid; grid-template-columns: repeat(6, 22px); gap: 3px; }
.art-stack .mini-grid i { width: 22px; height: 22px; border-radius: 4px; background: rgba(255, 255, 255, 0.05); }
.art-stack .mini-grid i.on { box-shadow: 0 0 10px currentColor; background: currentColor; }
.art-stack .faller { position: absolute; top: 0; display: flex; gap: 3px; animation: fall 2.2s infinite ease-in; color: var(--pink); }
.art-stack .faller i { width: 22px; height: 22px; border-radius: 4px; background: currentColor; box-shadow: 0 0 10px currentColor; }
@keyframes fall { from { transform: translateY(-30px); } to { transform: translateY(70px); opacity: 0.2; } }

/* Card art: Snake */
.art-snake { background: linear-gradient(160deg, #06281a, #0b1f3d); }
.art-snake .seg {
  position: absolute; width: 22px; height: 22px; border-radius: 6px;
  background: var(--lime); box-shadow: 0 0 12px var(--lime);
  animation: slither 2.4s infinite linear;
}
.art-snake .food { position: absolute; width: 16px; height: 16px; border-radius: 50%; background: var(--pink); box-shadow: 0 0 14px var(--pink); left: 72%; top: 46%; }
@keyframes slither { from { left: 8%; top: 46%; } to { left: 68%; top: 46%; } }

/* Card art: Sky Climber */
.art-climber { background: linear-gradient(180deg, #0b1f3d, #3a0b1f); }
.art-climber .plat { position: absolute; height: 8px; background: var(--violet); border-radius: 4px; box-shadow: 0 0 12px var(--violet); }
.art-climber .ladder {
  position: absolute; width: 22px;
  background: repeating-linear-gradient(to bottom, var(--cyan) 0 3px, transparent 3px 12px);
  border-left: 3px solid var(--cyan); border-right: 3px solid var(--cyan);
}
.art-climber .hero-dot {
  position: absolute; width: 18px; height: 22px; border-radius: 4px;
  background: var(--cyan); box-shadow: 0 0 14px var(--cyan);
  left: calc(30% + 2px); animation: climb 2s infinite ease-in-out;
}
@keyframes climb { 0%, 100% { top: 118px; } 50% { top: 62px; } }
.art-climber .lava { position: absolute; left: 0; right: 0; bottom: 0; height: 22px; background: linear-gradient(#ff5a1f, #ff3d3d); box-shadow: 0 0 30px #ff5a1f; animation: lava 2s infinite alternate; }
@keyframes lava { to { height: 30px; } }

/* Generated art (WaveSpeed) layered over the CSS card art */
.card-art .gen-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 0.5s, transform 0.4s; z-index: 1; }
.card-art.has-art .gen-art { opacity: 1; }
a.card:hover .gen-art { transform: scale(1.05); }
.hero { position: relative; }
.hero > :not(.hero-art) { position: relative; z-index: 1; }
.hero-art {
  position: absolute; right: -20px; top: 20px; width: min(56%, 720px); aspect-ratio: 2 / 1; object-fit: cover;
  border-radius: 24px; opacity: 0.9;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, rgba(0, 0, 0, 0.35) 22%, black 48%);
  mask-image: linear-gradient(90deg, transparent 0%, rgba(0, 0, 0, 0.35) 22%, black 48%);
}
.hero h1 { text-shadow: 0 4px 30px rgba(7, 6, 15, 0.8); }
@media (max-width: 900px) { .hero-art { position: static; width: 100%; opacity: 1; -webkit-mask-image: none; mask-image: none; margin-bottom: 10px; } }

/* Featured trio */
.featured { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.featured .card { border-color: rgba(255, 204, 51, 0.45); box-shadow: 0 0 34px -14px var(--gold); }
.featured .card::before {
  content: "⭐ FEATURED"; position: absolute; top: 12px; right: 12px; z-index: 3;
  font-family: var(--display); font-size: 10px; font-weight: 900; letter-spacing: 1px;
  padding: 5px 9px; border-radius: 8px; color: #2a1a00; background: linear-gradient(135deg, var(--gold), #ff9b3d);
}

/* Featured card: Neon Quest */
.card.feature { display: grid; grid-template-columns: 1.2fr 1fr; }
.card.feature .card-art { height: 100%; min-height: 240px; }
.card.feature .card-body { display: flex; flex-direction: column; justify-content: center; padding: 26px; }
.card.feature h3 { font-size: 28px; }
@media (max-width: 760px) { .card.feature { grid-template-columns: 1fr; } }
.art-quest { background: linear-gradient(180deg, #0b1a3a, #14405a); }
.art-quest .q-hill { position: absolute; left: -10%; right: -10%; bottom: 40px; height: 90px; background: radial-gradient(ellipse at 30% 100%, #164a4a 60%, transparent 61%), radial-gradient(ellipse at 80% 100%, #0f2e36 55%, transparent 56%); }
.art-quest .q-ground { position: absolute; left: 0; right: 0; bottom: 0; height: 40px; background: #183f3a; border-top: 6px solid #7dff5a; }
.art-quest .q-crate {
  position: absolute; left: 38%; bottom: 140px; width: 34px; height: 34px; border-radius: 6px;
  background: #ffcc33; box-shadow: 0 0 18px #ffcc33; display: grid; place-items: center; font-size: 18px;
}
.art-quest .q-hero {
  position: absolute; left: calc(38% + 6px); bottom: 40px; width: 24px; height: 34px; border-radius: 7px;
  background: var(--cyan); box-shadow: 0 0 16px var(--cyan); animation: qjump 1.6s infinite cubic-bezier(.3,.7,.6,1);
}
.art-quest .q-hero::after { content: ""; position: absolute; left: 3px; right: 3px; top: 7px; height: 9px; border-radius: 3px; background: #14102a; }
@keyframes qjump { 0%, 100% { transform: translateY(0); } 45% { transform: translateY(-62px); } }
.art-quest .q-blob { position: absolute; bottom: 40px; width: 30px; height: 24px; border-radius: 12px 12px 4px 4px; background: var(--pink); animation: qwalk 4s infinite alternate linear; }
@keyframes qwalk { from { left: 58%; } to { left: 74%; } }
.art-quest .q-portal { position: absolute; right: 7%; bottom: 40px; width: 40px; height: 84px; border-radius: 50%; border: 4px solid var(--violet); box-shadow: 0 0 24px var(--pink), inset 0 0 18px var(--cyan); }

/* Card art: Galaxy Guard */
.art-galaxy { background: radial-gradient(circle at 20% 20%, rgba(139, 92, 255, 0.4), transparent 50%), linear-gradient(180deg, #04020e, #140a2e); }
.art-galaxy .g-alien { position: absolute; width: 30px; height: 20px; border-radius: 15px 15px 4px 4px; background: var(--lime); box-shadow: 0 0 12px var(--lime); animation: gsway 1.6s infinite alternate ease-in-out; }
@keyframes gsway { to { transform: translateX(26px); } }
.art-galaxy .g-ship { position: absolute; left: 48%; bottom: 20px; width: 0; height: 0; border-left: 18px solid transparent; border-right: 18px solid transparent; border-bottom: 30px solid var(--cyan); filter: drop-shadow(0 0 10px var(--cyan)); }
.art-galaxy .g-shot { position: absolute; left: calc(48% + 16px); width: 4px; height: 14px; background: #bff3ff; animation: gshot 0.9s infinite linear; }
@keyframes gshot { from { bottom: 52px; opacity: 1; } to { bottom: 150px; opacity: 0; } }

/* Card art: generic emoji fallback (replaced by WaveSpeed art when generated) */
.art-generic { background: radial-gradient(circle at 30% 30%, rgba(139, 92, 255, 0.35), transparent 60%), linear-gradient(160deg, var(--g1), var(--g2)); }
.art-generic span { font-size: 72px; filter: drop-shadow(0 0 22px rgba(255, 255, 255, 0.35)); animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-8px); } }

/* Card art: Chess */
.art-chess { background: linear-gradient(160deg, #2a1a0b, #1a0b3a); }
.art-chess .mini-board { display: grid; grid-template-columns: repeat(4, 34px); border-radius: 8px; overflow: hidden; box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.8); transform: perspective(400px) rotateX(25deg); }
.art-chess .mini-board i { width: 34px; height: 34px; display: grid; place-items: center; font-style: normal; font-size: 24px; background: #ebd6b3; color: #111; }
.art-chess .mini-board i.d { background: #a8774f; }

/* ---------- Leaderboards ---------- */
.board {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 18px 18px 10px;
}
.board h3 {
  margin: 0 0 12px; font-family: var(--display); font-size: 16px;
  display: flex; justify-content: space-between; align-items: center;
}
.board h3 small { font-family: var(--body); color: var(--muted); font-weight: 500; font-size: 12px; }
.board ol { list-style: none; margin: 0; padding: 0; }
.board li {
  display: grid; grid-template-columns: 34px 1fr auto; align-items: center;
  padding: 10px 10px; border-radius: 10px;
  font-variant-numeric: tabular-nums;
}
.board li:nth-child(odd) { background: rgba(255, 255, 255, 0.025); }
.board li .rank { font-family: var(--display); font-weight: 800; color: var(--muted); }
.board li .who { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 700; }
.board li .who .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board li:nth-child(1) .rank { color: var(--gold); }
.board li:nth-child(2) .rank { color: #d6dcf0; }
.board li:nth-child(3) .rank { color: #e0955a; }
.board li .score { font-family: var(--display); font-weight: 800; }
.board li.me { background: rgba(139, 92, 255, 0.2); outline: 1px solid rgba(139, 92, 255, 0.6); }
.board .empty { color: var(--muted); padding: 16px 10px 20px; text-align: center; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.tab {
  font: inherit; font-weight: 700; cursor: pointer;
  padding: 9px 16px; border-radius: 999px;
  color: var(--muted); background: var(--panel);
  border: 1px solid var(--panel-border);
  transition: 0.2s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); background: rgba(139, 92, 255, 0.25); border-color: rgba(139, 92, 255, 0.7); }

/* ---------- Shop ---------- */
.shop { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.shop-desc { color: var(--muted); margin: -6px 0 18px; }
.skin {
  background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: 14px; padding: 18px 14px; text-align: center;
  display: flex; flex-direction: column; align-items: center;
}
.skin.selected { border-color: var(--cyan); box-shadow: 0 0 0 1px var(--cyan), 0 0 24px -6px var(--cyan); }
.skin .preview { height: 56px; display: grid; place-items: center; margin-bottom: 12px; }
.skin .swatch {
  width: 46px; height: 46px; border-radius: 8px;
  box-shadow: inset 0 0 0 8px rgba(0, 0, 0, 0.25);
}
.skin .rainbow { background: conic-gradient(var(--pink), var(--gold), var(--lime), var(--cyan), var(--violet), var(--pink)); }
.skin .emoji { font-size: 40px; line-height: 1; }
.skin .name-sample { font-family: var(--display); font-weight: 900; font-size: 20px; }
.skin .dots { display: flex; gap: 5px; }
.skin .dots i { width: 12px; height: 12px; border-radius: 50%; }
.skin .snake-prev { display: flex; gap: 2px; }
.skin .snake-prev i { width: 18px; height: 18px; border-radius: 5px; }
.skin .blocks-prev { display: grid; grid-template-columns: repeat(4, 14px); gap: 3px; }
.skin .blocks-prev i { width: 14px; height: 14px; border-radius: 3px; }
.skin .board-prev { display: grid; grid-template-columns: repeat(4, 13px); border-radius: 4px; overflow: hidden; }
.skin .board-prev i { width: 13px; height: 13px; }
.skin b { display: block; margin-bottom: 10px; }
.skin .btn { margin-top: auto; }
/* Site theme preview: a miniature of the real site */
.shop.themes { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.skin .preview.tall { height: auto; width: 100%; }
.theme-prev {
  width: 100%; aspect-ratio: 16 / 10; border-radius: 10px; overflow: hidden; text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background:
    radial-gradient(circle at 5% -10%, color-mix(in srgb, var(--c3) 45%, transparent), transparent 55%),
    radial-gradient(circle at 105% 0%, color-mix(in srgb, var(--c2) 35%, transparent), transparent 55%),
    #07060f;
  font-family: var(--display); color: #eef0ff;
}
.tp-bar { display: flex; align-items: center; gap: 3px; height: 16px; padding: 0 7px; font-size: 6.5px; background: rgba(7, 6, 15, 0.7); border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.tp-logo { width: 9px; height: 9px; border-radius: 3px; margin-right: 2px; background: linear-gradient(135deg, var(--c1), var(--c3) 55%, var(--c2)); box-shadow: 0 0 6px var(--c3); }
.tp-grad { background: linear-gradient(90deg, var(--c1), var(--c2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tp-nav { margin-left: 8px; width: 18px; height: 6px; border-radius: 2px; background: color-mix(in srgb, var(--c3) 35%, transparent); }
.tp-coin { margin-left: auto; width: 16px; height: 7px; border-radius: 9px; border: 1px solid rgba(255, 204, 51, 0.6); background: rgba(255, 204, 51, 0.15); }
.tp-body { padding: 6px 8px; }
.tp-eyebrow { display: inline-block; font-size: 4.5px; letter-spacing: 0.5px; padding: 1.5px 4px; border-radius: 9px; color: var(--c1); border: 1px solid color-mix(in srgb, var(--c1) 50%, transparent); }
.tp-h1 { font-size: 10px; font-weight: 900; line-height: 1.1; margin-top: 2px; }
.tp-grad3 { background: linear-gradient(90deg, var(--c1), var(--c3), var(--c2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tp-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-top: 6px; }
.tp-card { border-radius: 5px; border: 1px solid rgba(255, 255, 255, 0.1); background: rgba(255, 255, 255, 0.04); padding: 3px; display: flex; flex-direction: column; gap: 3px; }
.tp-card i { height: 16px; border-radius: 3px; background: linear-gradient(160deg, color-mix(in srgb, var(--c3) 40%, #07060f), color-mix(in srgb, var(--c2) 30%, #07060f)); }
.tp-play { align-self: flex-end; font-size: 4.5px; font-weight: 800; padding: 2px 4px; border-radius: 3px; background: linear-gradient(135deg, var(--c3), var(--c2)); box-shadow: 0 1px 6px -1px var(--c2); }
.owned-count { color: var(--muted); font-weight: 500; font-size: 14px; font-family: var(--body); }

/* ---------- Forms / login ---------- */
.auth-card {
  max-width: 420px; margin: 60px auto;
  background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: var(--radius); padding: 28px;
}
.auth-card h1 { font-family: var(--display); margin: 0 0 6px; font-size: 26px; }
.auth-card .tabs { margin: 18px 0; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { color: var(--muted); font-size: 13px; font-weight: 500; }
.field input, select.input {
  font: inherit; color: var(--text);
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--panel-border);
  border-radius: 10px; padding: 11px 14px; outline: 0;
}
.field input:focus, select.input:focus { border-color: var(--violet); box-shadow: 0 0 0 3px rgba(139, 92, 255, 0.25); }
.form-error { color: #ff6f8a; min-height: 20px; font-size: 14px; margin-bottom: 8px; }
.note { color: var(--muted); font-size: 13px; line-height: 1.5; }

/* ---------- Profile ---------- */
.profile-head { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; padding: 40px 0 10px; }
.big-avatar {
  width: 96px; height: 96px; border-radius: 26px;
  display: grid; place-items: center; font-size: 54px;
  background: linear-gradient(135deg, rgba(34, 228, 255, 0.2), rgba(255, 63, 180, 0.2));
  border: 1px solid var(--panel-border);
}
.profile-head h1 { font-family: var(--display); margin: 0; font-size: 34px; }
.profile-head p { color: var(--muted); margin: 6px 0 0; }
.profile-actions { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }
.banner {
  background: rgba(255, 204, 51, 0.08); border: 1px solid rgba(255, 204, 51, 0.35);
  border-radius: 14px; padding: 14px 18px; margin-top: 20px;
  display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
}
.banner p { margin: 0; flex: 1; min-width: 220px; }
.game-stats { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.game-stat { background: var(--panel); border: 1px solid var(--panel-border); border-radius: 14px; padding: 16px 18px; }
.game-stat h4 { margin: 0 0 10px; font-family: var(--display); font-size: 14px; }
.game-stat .row { display: flex; justify-content: space-between; color: var(--muted); padding: 3px 0; }
.game-stat .row b { color: var(--text); font-family: var(--display); }
.avatar-pick { display: flex; gap: 8px; flex-wrap: wrap; }
.avatar-pick button {
  font-size: 26px; width: 52px; height: 52px; border-radius: 14px; cursor: pointer;
  background: var(--panel); border: 1px solid var(--panel-border);
}
.avatar-pick button.selected { border-color: var(--cyan); box-shadow: 0 0 0 1px var(--cyan); }

/* ---------- Header extras ---------- */
.icon-btn {
  font-size: 16px; width: 38px; height: 38px; border-radius: 50%; cursor: pointer;
  background: var(--panel); border: 1px solid var(--panel-border); color: var(--text);
}
.icon-btn:hover { border-color: var(--violet); }
.admin-link { border: 1px solid var(--panel-border); }
.gem-pill { color: #7dffea; border-color: rgba(125, 255, 234, 0.45); background: rgba(125, 255, 234, 0.1); text-decoration: none; }
.gem-btn { background: linear-gradient(135deg, #2bd9c5, #4d7dff) !important; }
.music-wrap { position: relative; }
.music-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 50; width: 260px;
  background: rgba(16, 13, 36, 0.98); border: 1px solid var(--panel-border); border-radius: 14px;
  padding: 12px; box-shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.8);
}
.music-menu .mm-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.music-menu .note { margin: 4px 0 10px; }
.mm-track {
  display: block; width: 100%; text-align: left; font: inherit; font-size: 14px; color: var(--text); cursor: pointer;
  background: none; border: 0; border-radius: 8px; padding: 8px 10px;
}
.mm-track:hover { background: rgba(255, 255, 255, 0.06); }
.mm-track.on { background: rgba(139, 92, 255, 0.25); font-weight: 700; }
.site-bg { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: -1; pointer-events: none; }
.user-chip .lv {
  font-family: var(--display); font-size: 11px; font-weight: 800;
  padding: 3px 7px; border-radius: 6px; background: var(--violet); color: #fff;
}
.board li .who .ttl { color: var(--muted); font-size: 11px; font-weight: 600; white-space: nowrap; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); z-index: 100; display: flex; flex-direction: column; gap: 10px; max-width: min(380px, calc(100vw - 36px)); }
.toast {
  display: flex; gap: 12px; align-items: center;
  background: rgba(20, 16, 44, 0.96); border: 1px solid var(--violet);
  box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.8), 0 0 24px -8px var(--violet);
  border-radius: 14px; padding: 12px 16px; font-weight: 600;
  animation: toastIn 0.35s cubic-bezier(.2,1.4,.5,1);
  transition: opacity 0.4s, transform 0.4s;
}
.toast .ti { font-size: 24px; }
.toasts, .toast { pointer-events: none; }
.toast.out { opacity: 0; transform: translateX(40px); }
@keyframes toastIn { from { opacity: 0; transform: translateY(20px) scale(0.9); } }

/* ---------- Home: engagement row ---------- */
.engage { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.engage .panel-card {
  background: var(--panel); border: 1px solid var(--panel-border); border-radius: var(--radius);
  padding: 20px; position: relative; overflow: hidden;
}
.panel-card h3 { margin: 0 0 6px; font-family: var(--display); font-size: 16px; }
.panel-card p { color: var(--muted); margin: 0 0 14px; line-height: 1.5; }
.panel-card .glow { position: absolute; width: 160px; height: 160px; border-radius: 50%; filter: blur(50px); opacity: 0.35; right: -40px; top: -40px; pointer-events: none; }
.streak { display: flex; gap: 6px; margin-bottom: 14px; }
.streak i { flex: 1; height: 30px; border-radius: 8px; background: rgba(255, 255, 255, 0.06); display: grid; place-items: center; font-style: normal; font-size: 11px; font-weight: 700; color: var(--muted); }
.streak i.done { background: linear-gradient(135deg, var(--gold), #ff9b3d); color: #2a1a00; }
.streak i.next { outline: 2px dashed var(--gold); }
.xp-bar { height: 12px; border-radius: 99px; background: rgba(255, 255, 255, 0.08); overflow: hidden; margin: 8px 0 6px; }
.xp-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--cyan), var(--violet), var(--pink)); border-radius: 99px; transition: width 0.6s; }
.big-level { font-family: var(--display); font-size: 42px; font-weight: 900; line-height: 1; }
.gotd-badge {
  position: absolute; top: 12px; left: 12px; z-index: 2;
  font-family: var(--display); font-size: 11px; font-weight: 900; letter-spacing: 1px;
  padding: 6px 10px; border-radius: 8px; color: #2a1a00;
  background: linear-gradient(135deg, var(--gold), #ff9b3d);
  box-shadow: 0 0 20px rgba(255, 204, 51, 0.6);
  animation: pulse 1.6s infinite;
}
@keyframes pulse { 50% { transform: scale(1.06); } }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 10px; align-items: center; padding: 9px 4px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); font-size: 14px; }
.feed li:last-child { border-bottom: 0; }
.feed .av { font-size: 18px; }
.feed .nm { font-weight: 700; }
.feed time { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }

.home-split { display: grid; gap: 22px; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
@media (max-width: 900px) { .home-split { grid-template-columns: 1fr; } }

/* ---------- Power-up bar (game pages) ---------- */
.pw-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 14px; }
.pw-title { font-family: var(--display); font-size: 13px; color: var(--muted); margin-right: 4px; }
.pw-chip {
  font: inherit; font-size: 13px; font-weight: 600; color: var(--text); cursor: pointer;
  padding: 7px 12px; border-radius: 99px; background: var(--panel); border: 1px solid var(--panel-border);
}
.pw-chip b { color: var(--gold); }
.pw-chip.armed { border-color: var(--lime); box-shadow: 0 0 14px -4px var(--lime); background: rgba(125, 255, 90, 0.1); }
.pw-chip:disabled { opacity: 0.45; cursor: not-allowed; }
.pw-chip.shop { color: var(--cyan); text-decoration: none; }

/* ---------- Daily challenges ---------- */
.challenges { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.chal { background: var(--panel); border: 1px solid var(--panel-border); border-radius: 16px; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.chal.done { border-color: rgba(125, 255, 90, 0.55); }
.chal.claimed { opacity: 0.55; }
.chal .ch-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.chal .ch-game { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; }
.chal .ch-text { font-weight: 700; }
.chal .ch-reward { color: var(--gold); font-weight: 800; white-space: nowrap; }
.chal .bar { height: 8px; border-radius: 9px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.chal .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--lime), var(--cyan)); }
.chal .ch-row { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); }

/* ---------- Achievements ---------- */
.ach-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.ach { display: flex; gap: 12px; align-items: center; background: var(--panel); border: 1px solid var(--panel-border); border-radius: 14px; padding: 12px 14px; }
.ach .ai { font-size: 28px; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; background: rgba(255, 255, 255, 0.06); }
.ach b { display: block; font-size: 14px; }
.ach small { color: var(--muted); }
.ach.locked { opacity: 0.45; }
.ach.locked .ai { filter: grayscale(1); }
.ach.done { border-color: rgba(255, 204, 51, 0.5); }
.ach .rw { margin-left: auto; color: var(--gold); font-weight: 800; font-size: 13px; white-space: nowrap; }
.title-pill { display: inline-block; margin-top: 6px; padding: 4px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; background: rgba(139, 92, 255, 0.2); border: 1px solid var(--violet); }

/* ---------- Touch controls ---------- */
.touch-pad { display: none; gap: 10px; justify-content: center; padding: 14px; flex-wrap: wrap; }
.touch-pad button {
  font: inherit; font-weight: 800; font-size: 20px; color: var(--text);
  min-width: 64px; height: 56px; border-radius: 14px;
  background: rgba(255, 255, 255, 0.08); border: 1px solid var(--panel-border);
  touch-action: manipulation; user-select: none;
}
@media (any-pointer: coarse) { .touch-pad { display: flex; } }

.phone-controls, .phone-help, .phone-toolbar, .phone-wordtargets, .phone-sea-aim { display: none; }
.shared-status { padding-block: 8px; color: var(--muted); font-size: 14px; line-height: 1.5; }
@media (any-pointer: coarse) {
  .phone-controls {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px; padding: 12px; padding-bottom: max(12px, env(safe-area-inset-bottom));
    position: sticky; bottom: 0; z-index: 10; background: #100d23;
    border: 1px solid var(--panel-border); border-radius: 16px;
    touch-action: none; overscroll-behavior: contain;
    user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  }
  .phone-movement, .phone-actions { display: flex; flex-wrap: wrap; gap: 8px; align-content: start; }
  .phone-movement { justify-content: flex-start; }
  .phone-actions { justify-content: flex-end; }
  .phone-extras, .phone-letters { grid-column: 1 / -1; }
  .phone-extra-buttons, .phone-letters { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 8px; }
  .phone-extras summary { min-height: 48px; padding: 14px 8px; cursor: pointer; font-size: 16px; touch-action: none; }
  .phone-controls button, .lane-pad button {
    min-width: 48px; min-height: 48px; padding: 10px 12px;
    font: 700 16px var(--body); color: #fff; border-radius: 12px;
    border: 1px solid #6e65a4; background: #292343;
    touch-action: none; user-select: none; -webkit-user-select: none;
    -webkit-touch-callout: none;
  }
  .phone-actions button { background: #493078; border-color: #aa8be5; }
  .phone-controls button.is-held { background: #196579; border-color: var(--cyan); box-shadow: inset 0 0 0 2px var(--cyan); }
  .phone-controls button:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
  .phone-letters button { flex: 1 0 48px; }
  .phone-help { display: block; font-size: 16px; line-height: 1.5; color: var(--text) !important; }
  .game-layout > *, .stage { min-width: 0; }
  .stage canvas { max-width: 100%; object-fit: contain; }
  .stage canvas.game-canvas:not(#next) {
    width: min(100%, var(--canvas-width), calc(var(--phone-stage-height, 62svh) * var(--canvas-ratio))) !important;
    height: auto !important; aspect-ratio: var(--canvas-ratio) !important; margin-inline: auto;
    touch-action: none;
  }
  .phone-toolbar { display: flex; align-items: center; gap: 8px; padding-block: 8px; }
  .phone-toolbar { flex-wrap: wrap; }
  .phone-inventory { flex: 1 1 140px; }
  .phone-inventory summary { min-height: 48px; padding: 14px 8px; font-size: 16px; cursor: pointer; }
  .phone-inventory[open] { flex-basis: 100%; }
  .phone-toolbar .btn { min-height: 48px; }
  .phone-playing .topbar, .phone-playing .shared-status, .phone-playing .game-head,
  .phone-playing .side, .phone-playing .game-layout > div > section { display: none; }
  .phone-playing { --phone-stage-height: max(120px, calc(100dvh - var(--phone-controls-height, 100px) - var(--phone-stage-extra, 0px) - var(--phone-toolbar-height, 64px) - 24px)); }
  .phone-playing .phone-controls { position: static; }
  .chess-settings { width: 100%; }
  .phone-playing .game-layout { padding: 4px 8px 12px; }
  .phone-playing .phone-toolbar { position: sticky; top: 0; z-index: 15; background: var(--bg); }
  .phone-playing .stage > [class$="-wrap"] { padding: 4px; }
  .phone-playing .stage .stack-info { flex-direction: row; flex-wrap: wrap; min-width: 0; }
  .phone-playing .stage .stack-info .keys, .phone-playing .stage .stack-info .info-box:first-child { display: none; }
  .phone-playing .stage .stack-info .info-box { padding: 6px; }
  .phone-playing .stage .stack-wrap { gap: 6px; flex-wrap: nowrap; }
  .phone-playing .stage .stack-info { width: 85px; flex-direction: column; }
  .phone-wordtargets { display: flex; gap: 8px; overflow-x: auto; padding: 8px; touch-action: pan-x; }
  .phone-wordtargets button { flex: 0 0 auto; min-height: 48px; font-size: 16px; }
  .phone-sea-aim { display: block; }
  .phone-sea-aim p { font-size: 16px; line-height: 1.5; }
  .sea-aim-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
  .sea-aim-buttons button { min-width: 48px; min-height: 48px; }
  #enemy .sq.aimed { outline: 3px solid var(--cyan); z-index: 1; background: #305574; }
  body[data-game="rhythm"] .phone-controls { display: block; }
  body[data-game="rhythm"] .phone-movement { display: none; }
  body[data-game="rhythm"] .phone-actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  body[data-game="rhythm"] .phone-actions button { padding-inline: 2px; font-size: 14px; }
  .game-layout .btn, .game-layout select, .game-layout input { min-height: 48px; font-size: 16px; }
  .game-layout .pw-chip, .game-layout .tab { min-height: 48px; min-width: 48px; font-size: 16px; }
  .game-head p { font-size: 16px; line-height: 1.5; }
  .game-layout .stage button, .game-layout #key { touch-action: none; -webkit-touch-callout: none; }
}

@media (max-width: 600px) {
  .topbar .top-right { flex-wrap: wrap; max-width: 100%; justify-content: flex-end; }
  .topbar .wrap > * { min-width: 0; }
  .game-layout { padding-top: 18px; gap: 16px; }
  .game-layout.wrap { padding-inline: 10px; }
  .game-head h1 { font-size: clamp(22px, 7vw, 32px); }
  .hud { flex-wrap: wrap; font-size: 14px; gap: 8px; }
}

.btn {
  font: inherit; font-weight: 700;
  border: 0; cursor: pointer;
  padding: 9px 16px; border-radius: 10px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  display: inline-flex; align-items: center; gap: 6px;
  transition: 0.15s;
}
.btn:hover { background: rgba(255, 255, 255, 0.14); }
.btn.primary { background: linear-gradient(135deg, var(--violet), var(--pink)); }
.btn.primary:hover { filter: brightness(1.12); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.small { padding: 7px 14px; font-size: 14px; }
.btn.wide { width: 100%; justify-content: center; padding: 12px; }

/* ---------- Game pages ---------- */
.game-layout {
  display: grid; gap: 22px;
  grid-template-columns: minmax(0, 1fr) 300px;
  padding-block: 34px 60px;
}
@media (max-width: 1000px) { .game-layout { grid-template-columns: 1fr; } }
.game-head h1 { font-family: var(--display); margin: 0 0 4px; font-size: 32px; }
.game-head p { color: var(--muted); margin: 0 0 18px; }
.stage {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  overflow: hidden;
}
.side { display: flex; flex-direction: column; gap: 18px; }
.side .stats { display: grid; grid-template-columns: 1fr 1fr; margin: 0; }
.side .stat { min-width: 0; }

.overlay {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  place-items: safe center;
  background: rgba(7, 6, 15, 0.78);
  overflow-y: auto;
  text-align: center;
  padding: 20px;
}
.overlay h2 { font-family: var(--display); font-size: clamp(26px, 4vw, 40px); margin: 0 0 8px; }
.overlay p { color: var(--muted); margin: 0 0 18px; }
.overlay .big { font-family: var(--display); font-size: 54px; font-weight: 900; margin: 6px 0; }
.overlay .earned { color: var(--gold); font-weight: 700; display: inline-flex; gap: 8px; align-items: center; margin-bottom: 18px; }
.kbd {
  display: inline-block; padding: 2px 8px; border-radius: 6px;
  border: 1px solid var(--panel-border); background: rgba(255, 255, 255, 0.06);
  font-family: var(--display); font-size: 12px;
}

footer { color: var(--muted); text-align: center; padding: 40px 0 50px; font-size: 13px; }

.overlay-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

@media (max-width: 700px) {
  .nav { display: none; }
  .user-chip .nm, .user-chip .lv { display: none; }
  .user-chip { padding-right: 6px; }
  .logo { font-size: 17px; }
  /* overlays too tall for a short canvas sit below it instead of on top */
  .stage .overlay.flow-mobile { position: static; }
}
