:root {
  --bg: #070b14;
  --bg-elev: #0e1526;
  --bg-card: #121b2e;
  --border: rgba(148, 163, 184, 0.16);
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --accent-2: #818cf8;
  --accent-3: #ec4899;
  --success: #10b981;
  --warn: #f59e0b;
  --danger: #f43f5e;
  --radius: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft JhengHei", "Yu Gothic", sans-serif;
  background: radial-gradient(circle at 15% -10%, rgba(56, 189, 248, 0.14), transparent 45%),
              radial-gradient(circle at 85% 0%, rgba(129, 140, 248, 0.14), transparent 40%),
              var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
}

.container { max-width: 1240px; margin: 0 auto; padding: 0 20px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }

/* Navbar */
.navbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(7, 11, 20, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1240px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; font-weight: 800; font-size: 1.15rem; }
.brand-logo {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2), var(--accent-3));
  display: grid; place-items: center; font-weight: 900; font-size: 0.9rem; color: #fff;
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.35);
}
.brand .accent { color: var(--accent); }
.brand-pill {
  font-size: 0.7rem; font-weight: 600; padding: 3px 9px; border-radius: 999px;
  background: rgba(16, 185, 129, 0.14); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3);
}
.nav-links { display: flex; gap: 4px; flex-wrap: wrap; }
.nav-btn {
  background: transparent; border: 1px solid transparent; color: var(--muted);
  padding: 7px 13px; border-radius: 9px; cursor: pointer; font-weight: 600; font-size: 0.88rem;
  transition: all 0.18s;
}
.nav-btn:hover { color: #fff; background: rgba(255, 255, 255, 0.05); }
.nav-btn.active { color: #fff; background: rgba(56, 189, 248, 0.16); border-color: rgba(56, 189, 248, 0.35); }
.nav-actions { display: flex; align-items: center; gap: 10px; }
.lang-select {
  background: var(--bg-card); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 10px; font-size: 0.85rem; cursor: pointer;
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border-radius: 10px; border: 1px solid transparent;
  font-weight: 600; font-size: 0.9rem; cursor: pointer; transition: all 0.18s; text-decoration: none;
}
.btn-sm { padding: 6px 12px; font-size: 0.82rem; border-radius: 8px; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #050a14; box-shadow: 0 6px 20px rgba(56, 189, 248, 0.25);
}
.btn-primary:hover { transform: translateY(-1px); filter: brightness(1.08); }
.btn-secondary { background: rgba(148, 163, 184, 0.12); color: #fff; border-color: var(--border); }
.btn-secondary:hover { background: rgba(148, 163, 184, 0.22); }
.btn-ghost { background: transparent; color: var(--accent); border-color: rgba(56, 189, 248, 0.35); }
.btn-ghost:hover { background: rgba(56, 189, 248, 0.12); }

/* Hero */
.hero {
  margin: 26px 0 28px; padding: 36px; border-radius: 20px;
  background:
    linear-gradient(95deg, rgba(7, 11, 20, 0.94) 0%, rgba(12, 19, 36, 0.80) 54%, rgba(14, 21, 38, 0.48) 100%),
    url('/images/hero-banner.webp') center/cover no-repeat;
  border: 1px solid rgba(56, 189, 248, 0.28);
  display: grid; grid-template-columns: 1.55fr 1fr; gap: 28px; align-items: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}
.hero-badge {
  display: inline-block; font-size: 0.74rem; font-weight: 700; letter-spacing: 0.08em;
  color: var(--accent); background: rgba(56, 189, 248, 0.12); padding: 4px 12px;
  border-radius: 999px; margin-bottom: 12px; border: 1px solid rgba(56, 189, 248, 0.25);
}
.hero-title { font-size: clamp(1.65rem, 3vw, 2.45rem); line-height: 1.18; font-weight: 850; margin-bottom: 12px; color: #fff; }
.hero-subtitle { color: #cbd5e1; font-size: 0.98rem; margin-bottom: 14px; max-width: 660px; }
.hero-pillars { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.pillar-pill {
  font-size: 0.78rem; font-weight: 700; padding: 5px 11px; border-radius: 999px;
  background: rgba(56, 189, 248, 0.14); color: #e0f2fe;
  border: 1px solid rgba(56, 189, 248, 0.35);
}
.hero-cta { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat-card {
  background: rgba(7, 11, 20, 0.65); border: 1px solid var(--border);
  border-radius: 14px; padding: 16px; text-align: left;
}
.stat-val { font-size: 1.8rem; font-weight: 800; color: var(--success); line-height: 1.1; }
.stat-val.danger { color: var(--danger); }
.stat-val.warn { color: var(--warn); }
.stat-val.accent { color: var(--accent); }
.stat-label { font-size: 0.78rem; color: var(--muted); margin-top: 4px; }

/* Tabs */
.tab-panel { display: none; animation: fadeIn 0.22s ease; }
.tab-panel.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* Showcase Toolbar */
.showcase-toolbar {
  display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-bottom: 18px;
}
.period-tabs { display: flex; gap: 6px; background: var(--bg-elev); padding: 5px; border-radius: 12px; border: 1px solid var(--border); flex-wrap: wrap; }
.period-btn {
  background: transparent; border: none; color: var(--muted); padding: 8px 15px;
  border-radius: 9px; font-weight: 700; font-size: 0.88rem; cursor: pointer; transition: all 0.18s;
}
.period-btn:hover { color: #fff; }
.period-btn.active { background: var(--accent); color: #050a14; }
.period-btn.special.active { background: linear-gradient(135deg, var(--accent-3), var(--accent-2)); color: #fff; }
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; }
.input-search, .select-sm, .input {
  background: var(--bg-card); color: var(--text); border: 1px solid var(--border);
  border-radius: 10px; padding: 9px 13px; font-size: 0.9rem; outline: none;
}
.input-search:focus, .input:focus { border-color: var(--accent); }
.input-search { width: 220px; }

.foryou-banner {
  background: linear-gradient(90deg, rgba(129, 140, 248, 0.16), rgba(236, 72, 153, 0.14));
  border: 1px solid rgba(129, 140, 248, 0.35); border-radius: 12px;
  padding: 12px 18px; margin-bottom: 18px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
}

/* Game Cards */
.games-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 20px; margin-bottom: 40px; }
.game-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; transition: transform 0.2s, border-color 0.2s;
  cursor: pointer;
}
.game-card:hover { transform: translateY(-4px); border-color: rgba(56, 189, 248, 0.45); }
.game-card.demoted { opacity: 0.82; border-color: rgba(245, 158, 11, 0.38); }
.game-cover { position: relative; height: 185px; overflow: hidden; background: #0a0f1e; }
.game-cover svg, .game-cover .cover-img {
  width: 100%; height: 100%; display: block; object-fit: cover;
  transition: transform 0.35s ease;
}
.game-card:hover .cover-img { transform: scale(1.05); }
.game-cover::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(7, 11, 20, 0.25) 0%, transparent 45%, rgba(7, 11, 20, 0.65) 100%);
}
.cover-badges, .cover-os { z-index: 2; }
.cover-badges { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; justify-content: space-between; align-items: flex-start; gap: 6px; }
.badge {
  font-size: 0.72rem; font-weight: 700; padding: 3px 8px; border-radius: 7px;
  backdrop-filter: blur(8px); display: inline-flex; align-items: center; gap: 4px;
}
.badge-score { background: rgba(7, 11, 20, 0.82); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.45); }
.badge-orig { background: rgba(16, 185, 129, 0.85); color: #041f15; }
.badge-demoted { background: rgba(245, 158, 11, 0.9); color: #1f1202; }
.badge-match { background: linear-gradient(135deg, #ec4899, #8b5cf6); color: #fff; }
.cover-os { position: absolute; bottom: 8px; right: 10px; display: flex; gap: 4px; }
.os-pill { font-size: 0.68rem; font-weight: 700; padding: 2px 7px; border-radius: 5px; background: rgba(7, 11, 20, 0.8); color: #cbd5e1; text-transform: uppercase; }

.game-body { padding: 15px; display: flex; flex-direction: column; flex: 1; gap: 8px; }
.game-title-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.game-title { font-size: 1.08rem; font-weight: 800; color: #fff; }
.game-dev { font-size: 0.78rem; color: var(--muted); }
.game-tagline { font-size: 0.86rem; color: #cbd5e1; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tag-row { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 2px; }
.tag { font-size: 0.72rem; padding: 2px 8px; border-radius: 6px; background: rgba(148, 163, 184, 0.12); color: #cbd5e1; }
.tag-ai { background: rgba(129, 140, 248, 0.18); color: #a5b4fc; border: 1px solid rgba(129, 140, 248, 0.3); }

.game-footer {
  margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.game-actions { display: flex; gap: 6px; }
.icon-btn {
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 5px 9px; font-size: 0.78rem; cursor: pointer; transition: all 0.15s;
}
.icon-btn:hover { background: rgba(56, 189, 248, 0.18); border-color: var(--accent); }

/* Cards, Sections, Forms */
.section-header { margin-bottom: 20px; }
.section-header h2 { font-size: 1.55rem; color: #fff; margin-bottom: 6px; }
.section-header p { color: var(--muted); max-width: 780px; }
.sub-heading { font-size: 1.1rem; margin: 22px 0 12px; color: #fff; }
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }

.vm-clusters { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin-bottom: 18px; }
.vm-card {
  background: var(--bg-card); border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 6px;
}
.vm-status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--success); display: inline-block; margin-right: 6px; box-shadow: 0 0 8px var(--success); }

.reviews-list, .registry-list { display: flex; flex-direction: column; gap: 12px; }
.review-item, .registry-item {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 16px;
}
.review-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.log-box {
  background: #050912; border: 1px solid rgba(148, 163, 184, 0.15); border-radius: 10px;
  padding: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.78rem;
  color: #93c5fd; white-space: pre-wrap; margin-top: 8px; max-height: 220px; overflow-y: auto;
}

.form-stack { display: flex; flex-direction: column; gap: 12px; }
.form-stack label { display: flex; flex-direction: column; gap: 5px; font-size: 0.84rem; color: #cbd5e1; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; align-items: center; }
.inline-form { display: flex; gap: 10px; margin-top: 10px; }
.inline-form .input { flex: 1; }
.submit-layout { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; align-items: start; }
.submit-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.form-subsection {
  background: rgba(7, 11, 20, 0.45); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px;
}
.subsection-title { font-size: 0.9rem; color: var(--accent); margin-bottom: 10px; }
.media-upload-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.upload-box {
  background: rgba(14, 21, 38, 0.7); border: 1px dashed rgba(56, 189, 248, 0.35);
  border-radius: 10px; padding: 10px 12px;
}
.file-input { width: 100%; font-size: 0.8rem; color: var(--muted); margin-top: 4px; }
.upload-status { font-size: 0.78rem; margin-top: 6px; }
.thumb-strip { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.thumb-item { position: relative; width: 92px; height: 56px; border-radius: 7px; overflow: hidden; border: 1px solid var(--border); }
.thumb-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-remove {
  position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; border-radius: 50%;
  background: rgba(0, 0, 0, 0.75); color: #fff; border: none; font-size: 12px; cursor: pointer; line-height: 18px;
}
.video-preview-box video, .detail-video {
  width: 100%; max-height: 280px; border-radius: 10px; margin-top: 8px; background: #000;
}
.detail-screenshots { display: grid; grid-template-columns: repeat(auto-fill, minmax(135px, 1fr)); gap: 8px; margin-top: 10px; }
.detail-screenshots a img { width: 100%; height: 84px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); display: block; }
.ai-models-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; margin-top: 10px; }
.ai-model-chip { background: rgba(129, 140, 248, 0.12); border: 1px solid rgba(129, 140, 248, 0.3); border-radius: 8px; padding: 8px 10px; font-size: 0.78rem; }
.ai-model-chip strong { display: block; color: #a5b4fc; font-size: 0.72rem; }
.cli-hint { font-size: 0.74rem; margin-top: 6px; word-break: break-all; }
.cli-hint code { color: #a5f3fc; }
.orig-result { margin-top: 14px; padding: 14px; border-radius: 10px; border: 1px solid var(--border); background: rgba(7, 11, 20, 0.7); }

/* Developers Hub */
.dev-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.skill-links { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.skill-link-card {
  display: flex; flex-direction: column; gap: 4px; padding: 12px; border-radius: 10px;
  background: rgba(7, 11, 20, 0.7); border: 1px solid var(--border); text-decoration: none; color: var(--text);
}
.skill-link-card:hover { border-color: var(--accent); }
.skill-link-card strong { color: var(--accent); font-size: 0.88rem; }
.skill-link-card span { font-size: 0.76rem; color: var(--muted); }
.code-block {
  background: #050912; border: 1px solid var(--border); border-radius: 10px; padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.8rem; color: #a5f3fc;
  overflow-x: auto; max-height: 360px; white-space: pre-wrap; margin-top: 10px;
}
.key-output { margin-top: 12px; padding: 12px; border-radius: 10px; background: rgba(16, 185, 129, 0.14); border: 1px solid rgba(16, 185, 129, 0.4); font-family: monospace; word-break: break-all; }
.keys-list { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.key-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; background: rgba(7, 11, 20, 0.6); border-radius: 8px; font-size: 0.82rem; }
.playground-controls { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.playground-controls .input { flex: 1; }

/* Modals & Chips */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(2, 6, 14, 0.78); backdrop-filter: blur(6px); }
.modal-dialog {
  position: relative; width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto;
  background: var(--bg-elev); border: 1px solid rgba(56, 189, 248, 0.28);
  border-radius: 18px; padding: 24px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.65);
}
.modal-lg { max-width: 820px; }
.modal-close {
  position: absolute; top: 14px; right: 16px; background: transparent; border: none;
  color: var(--muted); font-size: 1.6rem; cursor: pointer;
}
.modal-close:hover { color: #fff; }
.auth-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.auth-tab { flex: 1; padding: 9px; border-radius: 9px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border); color: var(--muted); font-weight: 700; cursor: pointer; }
.auth-tab.active { background: var(--accent); color: #050a14; }
.taste-label { font-size: 0.84rem; font-weight: 700; color: #e2e8f0; margin-top: 8px; display: block; }
.chip-group { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip {
  padding: 5px 11px; border-radius: 999px; font-size: 0.8rem; cursor: pointer;
  background: rgba(148, 163, 184, 0.12); color: #cbd5e1; border: 1px solid var(--border);
}
.chip.selected { background: rgba(56, 189, 248, 0.24); color: #fff; border-color: var(--accent); }
.form-error { color: #fda4af; background: rgba(244, 63, 94, 0.14); padding: 8px 12px; border-radius: 8px; font-size: 0.84rem; }

/* Detail Modal Scores & Downloads */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.score-bar-row { display: flex; align-items: center; gap: 10px; font-size: 0.82rem; margin: 6px 0; }
.score-bar-track { flex: 1; height: 8px; background: rgba(255, 255, 255, 0.08); border-radius: 999px; overflow: hidden; }
.score-bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--success)); }
.download-box { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.download-opt {
  padding: 12px; border-radius: 10px; background: rgba(56, 189, 248, 0.09);
  border: 1px solid rgba(56, 189, 248, 0.3); text-decoration: none; color: #fff; display: flex; flex-direction: column; gap: 4px;
}
.download-opt:hover { background: rgba(56, 189, 248, 0.18); }
.download-opt small { color: var(--muted); font-size: 0.74rem; }

/* Footer & Toast */
.footer { border-top: 1px solid var(--border); padding: 24px 0; margin-top: 40px; color: var(--muted); font-size: 0.84rem; }
.footer-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.footer-links { display: flex; gap: 16px; }
.footer-links a { color: var(--accent); text-decoration: none; }
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 200;
  background: #0f172a; color: #fff; border: 1px solid var(--accent);
  padding: 12px 18px; border-radius: 12px; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  font-size: 0.88rem;
}

@media (max-width: 900px) {
  .hero, .submit-layout, .dev-grid, .detail-grid, .download-box { grid-template-columns: 1fr; }
}
