:root {
  --bg: #0b0e1a;
  --panel: #141a2e;
  --panel2: #1a2140;
  --line: #2a3358;
  --text: #eef1ff;
  --dim: #9aa5cc;
  --red: #e3350d;
  --red-dark: #b32a0a;
  --radius: 16px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: radial-gradient(1200px 600px at 80% -10%, #1c2a52 0%, var(--bg) 55%);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
}
a { color: #7db4ff; }

/* ---------- header ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 20px clamp(16px, 4vw, 40px) 8px;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand h1 { margin: 0; font-size: 30px; letter-spacing: .5px; }
.brand p { margin: 2px 0 0; color: var(--dim); font-size: 14px; }
.ball {
  width: 46px; height: 46px; border-radius: 50%; flex: none;
  background: linear-gradient(to bottom, var(--red) 0 46%, #11131f 46% 54%, #f4f6ff 54% 100%);
  border: 3px solid #f4f6ff; position: relative;
}
.ball::after {
  content: ""; position: absolute; inset: 0; margin: auto;
  width: 12px; height: 12px; border-radius: 50%;
  background: #f4f6ff; border: 3px solid #11131f;
}

.notice {
  margin: 12px clamp(16px, 4vw, 40px) 0;
  background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--red);
  border-radius: 12px; padding: 12px 16px; font-size: 14px; line-height: 1.5; color: #cfd7f5;
}
.notice code { background: #0d1122; padding: 1px 5px; border-radius: 5px; }

/* ---------- controls ---------- */
.controls {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
  padding: 16px clamp(16px, 4vw, 40px) 4px;
}
#search {
  flex: 1 1 240px; padding: 12px 14px; border-radius: 12px; font-size: 16px;
  background: var(--panel); color: var(--text); border: 1px solid var(--line); outline: none;
}
#search:focus { border-color: var(--red); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 9px 14px; border-radius: 999px; cursor: pointer; font-size: 14px;
  background: var(--panel); color: var(--dim); border: 1px solid var(--line);
}
.chip.active { background: var(--red); border-color: var(--red); color: #fff; }

/* ---------- grid & cards ---------- */
.grid {
  display: grid; gap: 16px; padding: 16px clamp(16px, 4vw, 40px) 8px;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}
.section-title { padding: 10px clamp(16px, 4vw, 40px) 0; margin: 8px 0 0; font-size: 20px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column;
}
.cover {
  height: 132px; position: relative; display: grid; place-items: center; overflow: hidden;
  background:
    radial-gradient(circle at 85% 15%, hsla(var(--hue), 90%, 75%, .35) 0 34px, transparent 35px),
    radial-gradient(circle at 12% 88%, hsla(var(--hue), 90%, 70%, .22) 0 46px, transparent 47px),
    linear-gradient(150deg,
      hsl(var(--hue) 72% 42%) 0%, hsl(calc(var(--hue) + 35) 68% 24%) 100%);
}
.cover-shine {
  position: absolute; inset: 0;
  background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,.16) 45%, transparent 60%);
}
.cover-initials {
  font-size: 46px; font-weight: 900; letter-spacing: 1px;
  text-shadow: 0 3px 0 rgba(0,0,0,.28), 0 10px 22px rgba(0,0,0,.45);
  border: 3px solid rgba(255,255,255,.85); border-radius: 14px; padding: 2px 14px;
  background: rgba(0,0,0,.18);
}
.cover-ball {
  position: absolute; right: 12px; top: 12px; width: 26px; height: 26px; border-radius: 50%; opacity: .85;
  background: linear-gradient(to bottom, #fff 0 46%, #11131f 46% 54%, #fff 54% 100%);
  border: 2px solid #11131f;
}
.cover-initials { font-size: 40px; font-weight: 800; letter-spacing: 1px; text-shadow: 0 3px 10px rgba(0,0,0,.45); }
.cover-gen {
  position: absolute; left: 12px; bottom: 10px; font-size: 11px; font-weight: 700; letter-spacing: 1.5px;
  background: rgba(0,0,0,.45); padding: 3px 8px; border-radius: 999px;
}
.card-body { padding: 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card-body h3 { margin: 0; font-size: 17px; }
.meta { margin: 0; color: var(--dim); font-size: 13px; }
.file { margin: 0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file.dim { color: var(--dim); }
.card-actions { margin-top: auto; padding-top: 8px; display: flex; gap: 8px; }
.empty { color: var(--dim); padding: 12px 0; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 18px; border-radius: 12px; font-size: 15px; font-weight: 600;
  cursor: pointer; border: 1px solid transparent; text-decoration: none;
}
.btn-red { background: var(--red); color: #fff; }
.btn-red:hover { background: var(--red-dark); }
.btn-ghost { background: transparent; color: var(--dim); border-color: var(--line); }
.btn-ghost:hover { color: var(--text); }

.foot { padding: 18px clamp(16px, 4vw, 40px) 34px; color: var(--dim); font-size: 13px; line-height: 1.55; }
.foot p { margin: 4px 0; }

.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  background: #232c52; color: var(--text); border: 1px solid var(--line);
  padding: 12px 18px; border-radius: 12px; font-size: 14px; max-width: min(92vw, 560px);
  box-shadow: 0 10px 30px rgba(0,0,0,.5); z-index: 50; text-align: center;
}

/* ---------- player page ---------- */
.play-body { display: flex; flex-direction: column; }
.playbar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 12px clamp(12px, 3vw, 28px); border-bottom: 1px solid var(--line); background: rgba(10,12,24,.6);
}
.play-title h1 { margin: 0; font-size: 20px; }
.play-title p { margin: 2px 0 0; color: var(--dim); font-size: 13px; }
.play-tip { margin-left: auto; color: var(--dim); font-size: 13px; }
.stage { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 14px; width: 100%; }
#game { width: min(100%, 980px); aspect-ratio: 4 / 3; background: #000; border-radius: 12px; overflow: hidden; }
#game:fullscreen { width: 100%; height: 100%; aspect-ratio: auto; }
.status { margin-top: 14px; color: var(--dim); font-size: 15px; text-align: center; }

@media (max-width: 560px) {
  .brand h1 { font-size: 24px; }
  #game { aspect-ratio: 3 / 3.4; }
  .play-tip { display: none; }
}
