:root {
  --bg: #0f1216;
  --panel: #171b21;
  --panel-2: #1e232b;
  --line: #2a313b;
  --text: #e6e9ee;
  --muted: #8b95a3;
  --accent: #6ee7a8;
  --accent-ink: #0d2a1c;
  --pos: #5bc27a;
  --neg: #e5605a;
  --warn: #e6b450;
  --steam: #66c0f4;
  --youtube: #ff4e45;
  --twitch: #a970ff;
  --reddit: #ff6a2b;
  --bluesky: #3d9bff;
  --radius: 10px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--neg); min-height: 1.5em; margin: 0; }

.btn {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 12px; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: #3a4350; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.small { padding: 3px 9px; font-size: 12.5px; }
.btn:disabled { opacity: .55; cursor: default; }

input, select {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; outline: none;
}
input:focus, select:focus { border-color: var(--accent); }
.check { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); user-select: none; }
.check input { accent-color: var(--accent); }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .2px; }
.brand.big { font-size: 22px; justify-content: center; margin-bottom: 8px; }
.brand-mark {
  width: 22px; height: 22px; border-radius: 6px; background: var(--panel-2) url('favicon.svg') center/cover;
}

.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card {
  width: min(360px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 28px; display: flex; flex-direction: column; gap: 14px;
}
.login-card label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 13px; }
.login-card input { padding: 9px 12px; color: var(--text); }

.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 24px;
  padding: 10px 24px; background: rgba(15,18,22,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.tabs { display: flex; gap: 4px; }
.tabs button { background: none; border: 0; padding: 7px 14px; border-radius: 8px; cursor: pointer; color: var(--muted); }
.tabs button.active { background: var(--panel-2); color: var(--text); }
.tabs button:hover { color: var(--text); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.user { color: var(--muted); }

.games { display: flex; gap: 12px; padding: 18px 24px 4px; overflow-x: auto; }
.game-card {
  flex: 0 0 auto; min-width: 210px; text-align: left; cursor: pointer; padding: 0; overflow: hidden;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column;
}
.game-card.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.game-card .art { height: 64px; background: var(--panel-2) center/cover no-repeat; position: relative; }
.game-card .art.all { display: grid; place-items: center; font-weight: 700; font-size: 15px; background: linear-gradient(135deg, #1d2b26, #1b2230); }
.game-card .info { padding: 8px 12px 10px; display: flex; flex-direction: column; gap: 2px; }
.game-card .name { font-weight: 600; }
.game-card .score { font-size: 12.5px; color: var(--muted); }
.game-card .score b { font-weight: 600; }
.badge-new {
  position: absolute; top: 6px; right: 6px; background: var(--accent); color: var(--accent-ink);
  border-radius: 999px; font-size: 11.5px; font-weight: 700; padding: 1px 8px;
}

main { padding: 12px 24px 60px; max-width: 1200px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 6px 0 10px; }
#f-search { flex: 1 1 260px; }
.result-info { color: var(--muted); font-size: 12.5px; margin-bottom: 10px; }

.feed { display: flex; flex-direction: column; gap: 10px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px;
  display: grid; grid-template-columns: 1fr auto; gap: 14px; border-left: 3px solid var(--line);
}
.card.is-new { border-left-color: var(--accent); }
.card.pos { border-left-color: var(--pos); }
.card.neg { border-left-color: var(--neg); }
.card.is-new.pos, .card.is-new.neg { box-shadow: inset 0 0 0 1px rgba(110,231,168,.25); }
.card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.src { font-weight: 700; font-size: 11px; letter-spacing: .4px; text-transform: uppercase; padding: 2px 7px; border-radius: 5px; background: var(--panel-2); }
.src.steam { color: var(--steam); }
.src.youtube { color: var(--youtube); }
.src.twitch { color: var(--twitch); }
.src.reddit { color: var(--reddit); }
.src.bluesky { color: var(--bluesky); }
.pill { padding: 1px 8px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); font-size: 12px; }
.pill.new { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
.pill.pos { color: var(--pos); border-color: rgba(91,194,122,.4); }
.pill.neg { color: var(--neg); border-color: rgba(229,96,90,.4); }
.pill.live { color: #fff; background: #e91916; border-color: #e91916; font-weight: 700; }
.card-title { font-size: 15.5px; font-weight: 600; margin: 6px 0 4px; }
.card-title a { text-decoration: none; }
.card-title a:hover { text-decoration: underline; }
.card-body { white-space: pre-wrap; word-break: break-word; color: #cfd5dd; }
.card-body.clamp { display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.card-body.translated { border-left: 2px solid var(--accent); padding-left: 10px; }
.translate-note { font-size: 12px; color: var(--accent); margin-top: 6px; }
.card-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.card-actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.card-thumb { width: 168px; height: 94px; border-radius: 8px; object-fit: cover; background: var(--panel-2); cursor: pointer; }
.dev-response { margin-top: 8px; padding: 8px 10px; background: var(--panel-2); border-radius: 8px; font-size: 13px; }

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; cursor: pointer; position: relative; }
.tile img { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; background: var(--panel-2); }
.tile .tile-info { padding: 8px 10px; font-size: 12.5px; }
.tile .tile-title { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .tile-sub { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .pill { position: absolute; top: 8px; left: 8px; }
.tile .play { position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,.65); border-radius: 6px; padding: 1px 7px; font-size: 12px; }

.more { display: block; margin: 16px auto; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.panel h2 { font-size: 16px; margin: 0; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; }
td.err { color: var(--neg); max-width: 380px; word-break: break-word; }
.ok { color: var(--pos); }
.off { color: var(--muted); }

.hook-row { display: grid; grid-template-columns: 200px 1fr auto auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.hook-row:last-child { border-bottom: 0; }
.hook-row input[type=url] { width: 100%; }
.matrix th, .matrix td { text-align: center; }
.matrix th:first-child, .matrix td:first-child { text-align: left; }
.matrix input { accent-color: var(--accent); width: 16px; height: 16px; cursor: pointer; }
.matrix .row-toggle { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 12px; text-decoration: underline; }
.save-bar { position: sticky; bottom: 0; display: flex; justify-content: flex-end; align-items: center; gap: 12px; padding: 12px 0; background: linear-gradient(transparent, var(--bg) 40%); }

.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.7); }
.modal-body { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; width: min(980px, 100%); max-height: 92vh; overflow: auto; padding: 18px; }
.modal-close { position: absolute; top: 6px; right: 10px; background: none; border: 0; font-size: 26px; cursor: pointer; color: var(--muted); z-index: 2; }
.modal-media { width: 100%; max-height: 70vh; object-fit: contain; border-radius: 8px; background: #000; display: block; }
.modal-frame { width: 100%; aspect-ratio: 16/9; border: 0; border-radius: 8px; background: #000; display: block; }
.modal .card { border: 0; padding: 12px 0 0; grid-template-columns: 1fr; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--panel-2); border: 1px solid var(--line); padding: 9px 16px; border-radius: 10px; z-index: 60; }
.empty { padding: 40px; text-align: center; color: var(--muted); background: var(--panel); border: 1px dashed var(--line); border-radius: var(--radius); }

@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; gap: 10px; padding: 10px 14px; }
  .topbar-right { margin-left: 0; }
  .games, main { padding-left: 14px; padding-right: 14px; }
  .card { grid-template-columns: 1fr; }
  .card-thumb { width: 100%; height: auto; aspect-ratio: 16/9; }
  .hook-row { grid-template-columns: 1fr; }
}
