:root {
  --bg: #0b0e17;
  --panel: #151a28;
  --panel-2: #1d2436;
  --line: #2a3350;
  --text: #e8ecf5;
  --muted: #8d97b3;
  --accent: #7c5cff;
  --accent-2: #00d4a6;
  --gold: #fdcb6e;
  --danger: #ff5c7a;
  --radius: 14px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, "Segoe UI", sans-serif; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.2; }
.muted { color: var(--muted); }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 20px; padding: 12px 24px;
  background: rgba(11,14,23,.85); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.logo { font-weight: 900; letter-spacing: .12em; font-size: 18px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
nav { display: flex; gap: 4px; }
nav a { padding: 6px 12px; border-radius: 8px; color: var(--muted); font-weight: 600; }
nav a:hover { color: var(--text); background: var(--panel); }
nav a.active { color: var(--text); background: var(--panel-2); }
.search { flex: 1; min-width: 160px; }
.search input { width: 100%; max-width: 360px; }
.account { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.coins { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px;
  background: #fdcb6e1f; color: var(--gold); font-weight: 700; border: 1px solid #fdcb6e44; }

/* controls */
input, select, textarea { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { width: 100%; resize: vertical; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 18px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel-2); font-weight: 700; cursor: pointer; transition: transform .08s, filter .15s; }
.btn:hover { filter: brightness(1.2); }
.btn:active { transform: scale(.97); }
.btn.primary { background: linear-gradient(90deg, var(--accent), #9b7bff); border: 0; color: #fff; }
.btn.green { background: linear-gradient(90deg, #00b894, var(--accent-2)); border: 0; color: #04241d; }
.btn.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn.big { padding: 13px 28px; font-size: 17px; }
.btn:disabled { opacity: .5; cursor: default; }

/* layout */
main { max-width: 1200px; margin: 0 auto; padding: 28px 24px 80px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.stack > * + * { margin-top: 14px; }
.cols { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; }
@media (max-width: 860px) { .cols { grid-template-columns: 1fr; } }
.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 32px 0 14px; }

/* hero */
.hero { position: relative; border-radius: 20px; padding: 44px; overflow: hidden; display: flex; gap: 32px; align-items: center; min-height: 340px; }
.hero .big-emoji { font-size: 120px; filter: drop-shadow(0 10px 30px #0008); }
.hero h1 { font-size: 40px; }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, #0b0e17cc, transparent); pointer-events: none; }
.hero > * { position: relative; z-index: 1; }
.tag { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: #ffffff1a; }

/* chips */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { padding: 6px 14px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); cursor: pointer; font-weight: 600; color: var(--muted); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* game cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; transition: transform .15s, border-color .15s; display: block; }
.card:hover { transform: translateY(-4px); border-color: var(--accent); }
.cover { aspect-ratio: 16/10; display: grid; place-items: center; font-size: 64px; }
.card-body { padding: 12px 14px 14px; }
.card-title { font-weight: 800; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; margin-top: 6px; }
.price { color: var(--gold); font-weight: 800; }
.price.free { color: var(--accent-2); }

/* avatars */
.avatar { display: inline-grid; place-items: center; border-radius: 50%; width: 36px; height: 36px; font-size: 20px; flex-shrink: 0; }
.avatar.lg { width: 110px; height: 110px; font-size: 62px; }
.user-row { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 10px; }
.user-row:hover { background: var(--panel-2); }

/* game page */
.banner { border-radius: 20px; height: 380px; display: grid; place-items: center; font-size: 140px; margin-bottom: 24px; }
.review { border-top: 1px solid var(--line); padding: 14px 0; }
.thumb { font-size: 20px; }

/* player */
.player { position: fixed; inset: 0; z-index: 50; background: #000; display: flex; flex-direction: column; }
.player-bar { display: flex; align-items: center; gap: 12px; padding: 8px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.player iframe { flex: 1; border: 0; width: 100%; background: #000; }

/* studio */
.code { font-family: Consolas, "Cascadia Code", monospace; font-size: 13px; min-height: 420px; tab-size: 2; white-space: pre; }
.preview { width: 100%; height: 420px; border: 1px solid var(--line); border-radius: 10px; background: #000; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
label { display: block; font-size: 13px; color: var(--muted); font-weight: 600; }
label > input, label > select, label > textarea { display: block; width: 100%; margin-top: 6px; color: var(--text); }
.stat { text-align: center; }
.stat b { display: block; font-size: 26px; }
table { width: 100%; border-collapse: collapse; }
td, th { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: 13px; }
.plus { color: var(--accent-2); font-weight: 700; }
.minus { color: var(--danger); font-weight: 700; }

.thumb-box { width: 224px; aspect-ratio: 16/10; border-radius: 10px; border: 1px dashed var(--line); background: var(--panel-2) center/cover;
  display: grid; place-items: center; color: var(--muted); font-size: 13px; flex-shrink: 0; }
.docs summary { cursor: pointer; }
.docs-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; margin-top: 14px; }
.docs h4 { margin: 0 0 6px; color: var(--accent-2); }
.docs pre { margin: 0; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px; font: 12.5px/1.5 Consolas, monospace; overflow-x: auto; }
.docs p { font-size: 13px; margin: 8px 0 0; }

/* auth */
.auth { max-width: 400px; margin: 40px auto; }
.auth input { width: 100%; }

.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty .e { font-size: 54px; }

#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(100px); background: var(--panel-2);
  border: 1px solid var(--line); padding: 12px 20px; border-radius: 12px; transition: transform .25s; z-index: 100; font-weight: 600; }
#toast.show { transform: translateX(-50%) translateY(0); }
#toast.error { border-color: var(--danger); color: var(--danger); }
