:root {
  --bg: #0b1320;
  --bg-2: #111c2c;
  --panel: #16243a;
  --panel-2: #1c2e48;
  --line: #27405f;
  --text: #dbe6f3;
  --muted: #8ea3bd;
  --accent: #4cc2ff;
  --accent-2: #2a8fd6;
  --good: #79c35a;
  --good-2: #4f9a35;
  --bad: #e2605a;
  --warn: #e8b64c;
  --radius: 6px;
  --shadow: 0 8px 24px rgba(0, 0, 0, .35);
  --font: "Segoe UI", "Roboto", "Helvetica Neue", Arial, sans-serif;
  --font-head: "Trebuchet MS", "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: radial-gradient(1200px 500px at 50% -120px, #1b3556 0%, transparent 70%), var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: #fff; }
h1, h2, h3 { font-family: var(--font-head); font-weight: 600; letter-spacing: .3px; margin: 0 0 12px; }
h1 { font-size: 28px; }
h2 { font-size: 20px; color: #fff; }
.muted { color: var(--muted); }
.container { max-width: 1160px; margin: 0 auto; padding: 24px 16px 60px; }
.hidden { display: none !important; }

.topbar { background: linear-gradient(180deg, #0f1c2e, #0b1524); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar-inner { max-width: 1160px; margin: 0 auto; padding: 0 16px; height: 62px; display: flex; align-items: center; gap: 28px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font: 700 21px var(--font-head); letter-spacing: 1px; text-transform: uppercase; }
.brand img { width: 30px; height: 30px; }
.nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.nav a { color: var(--muted); padding: 8px 12px; border-radius: var(--radius); font-weight: 600; text-transform: uppercase; font-size: 13px; letter-spacing: .6px; }
.nav a:hover { color: #fff; background: rgba(255,255,255,.05); }
.nav a.active { color: var(--accent); }
.userbox { display: flex; align-items: center; gap: 10px; }
.userbox img { width: 32px; height: 32px; border-radius: 4px; border: 1px solid var(--line); object-fit: cover; }
.userbox .name { color: #fff; font-weight: 600; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11px; font-weight: 700; letter-spacing: .5px; background: var(--panel-2); color: var(--muted); }
.badge.admin { background: #4a2f12; color: var(--warn); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: var(--radius); padding: 9px 16px; font: 600 14px var(--font); cursor: pointer; color: #fff; background: var(--panel-2); transition: filter .15s, transform .05s; }
.btn:hover { filter: brightness(1.2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; filter: none; }
.btn-primary { background: linear-gradient(90deg, var(--accent-2), var(--accent)); }
.btn-good { background: linear-gradient(90deg, var(--good-2), var(--good)); }
.btn-danger { background: #7d2a27; }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.btn-sm { padding: 5px 10px; font-size: 13px; }

input, select, textarea {
  width: 100%; background: #0d1828; color: var(--text); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 9px 11px; font: 14px var(--font); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(76,194,255,.15); }
textarea { resize: vertical; min-height: 90px; }
label { display: block; color: var(--muted); font-size: 13px; margin: 12px 0 5px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }

.panel { background: linear-gradient(180deg, var(--panel), var(--bg-2)); border: 1px solid var(--line); border-radius: 8px; padding: 20px; box-shadow: var(--shadow); }
.alert { padding: 11px 14px; border-radius: var(--radius); margin: 12px 0; border-left: 4px solid; background: rgba(255,255,255,.04); }
.alert.error { border-color: var(--bad); color: #ffb3ae; }
.alert.warn { border-color: var(--warn); color: #f6d58f; }
.alert.ok { border-color: var(--good); color: #c4ecb1; }
.alert.info { border-color: var(--accent); color: #bfe6ff; }
#toast { position: fixed; right: 20px; bottom: 20px; z-index: 50; display: flex; flex-direction: column; gap: 8px; }
#toast .alert { margin: 0; background: #14233a; box-shadow: var(--shadow); min-width: 260px; max-width: 420px; }

.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.hero p { margin: 0; }
.filters { display: flex; gap: 10px; margin-bottom: 20px; }
.filters input { flex: 2; }
.filters select { flex: 1; max-width: 240px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; color: var(--text); display: flex; flex-direction: column; transition: transform .15s, box-shadow .15s, border-color .15s; }
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--accent-2); color: var(--text); }
.cover-blank { display: block; background: #0f1b2c; }
.card .cover-blank { width: 100%; aspect-ratio: 3 / 4; border-bottom: 1px solid var(--line); }
.card .body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card .title { font-weight: 700; color: #fff; }
.card .meta { color: var(--muted); font-size: 13px; }
.card .bottom { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 6px; }
.price { background: #0d1828; color: #b8f08f; font-weight: 700; padding: 3px 9px; border-radius: 4px; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }

.game { display: grid; grid-template-columns: 300px 1fr; gap: 26px; }
.game .cover { width: 100%; aspect-ratio: 3 / 4; border-radius: 8px; border: 1px solid var(--line); box-shadow: var(--shadow); }
.facts { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; margin: 14px 0; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.buybox { display: flex; align-items: center; gap: 14px; background: #0d1828; border: 1px solid var(--line); border-radius: 8px; padding: 14px; margin: 16px 0; flex-wrap: wrap; }
.buybox .price { font-size: 18px; }
.description { white-space: pre-line; color: #c5d4e6; }
.reviews { margin-top: 30px; }
.review { border-top: 1px solid var(--line); padding: 14px 0; }
.review-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.review-head .when { color: var(--muted); font-size: 12px; margin-left: auto; }
.thumb { font-weight: 700; padding: 2px 10px; border-radius: 4px; font-size: 13px; }
.thumb.up { background: rgba(121,195,90,.15); color: var(--good); }
.thumb.down { background: rgba(226,96,90,.15); color: var(--bad); }
.radio-row { display: flex; gap: 10px; margin: 8px 0; }
.radio-row label { margin: 0; display: flex; align-items: center; gap: 6px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; color: var(--text); }
.radio-row input { width: auto; }
.summary { font-weight: 600; }

.lib-item { display: flex; gap: 16px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 10px; }
.lib-item .cover-blank { width: 72px; height: 96px; flex-shrink: 0; border-radius: 4px; border: 1px solid var(--line); }
.lib-item .info { flex: 1; }
.lib-item.unavailable { border-style: dashed; opacity: .85; }

.profile-head { display: flex; gap: 24px; align-items: center; }
.profile-head .avatar { width: 160px; height: 160px; border-radius: 8px; border: 2px solid var(--accent-2); object-fit: cover; background: #0d1828; }
.profile-head h1 { margin: 0 0 4px; }
.about { white-space: pre-line; margin-top: 14px; color: #c5d4e6; }

.auth { max-width: 420px; margin: 40px auto; }
.tabs { display: flex; gap: 4px; margin-bottom: 8px; }
.tabs button { flex: 1; background: transparent; border: 0; border-bottom: 2px solid var(--line); color: var(--muted); padding: 10px; font: 600 15px var(--font); cursor: pointer; }
.tabs button.active { color: #fff; border-color: var(--accent); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: .5px; }
td .cover-blank { width: 36px; height: 48px; border-radius: 3px; border: 1px solid var(--line); }
.actions { display: flex; gap: 6px; }
.admin-layout { display: grid; grid-template-columns: 1fr 380px; gap: 20px; align-items: start; }


@media (max-width: 860px) {
  .game, .admin-layout { grid-template-columns: 1fr; }
  .game .cover { max-width: 140px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .topbar-inner { height: auto; padding: 10px 16px; flex-wrap: wrap; gap: 10px; }
  .profile-head { flex-direction: column; align-items: flex-start; }
  .form-row { grid-template-columns: 1fr; }
}
