:root {
  --bg: #0b0d12;
  --bg-2: #10131a;
  --surface: #151923;
  --surface-2: #1b2030;
  --border: #262c3b;
  --text: #e7eaf1;
  --muted: #8b93a7;
  --accent: #8b6cff;
  --accent-2: #b09bff;
  --approve: #37d69b;
  --danger: #ff5d7d;
  --pending: #ffb648;
  --radius: 14px;
  --head: 'Chakra Petch', system-ui, sans-serif;
  --body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(139, 108, 255, .14), transparent 60%),
    radial-gradient(900px 400px at -10% 10%, rgba(55, 214, 155, .06), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 15px/1.55 var(--body);
  min-height: 100vh;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--head); letter-spacing: .01em; line-height: 1.15; margin: 0 0 .4em; }
h1 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
h2 { font-size: 1.25rem; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; background: var(--bg-2); padding: .15em .4em; border-radius: 6px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

.wrap { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 28px; padding-bottom: 64px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: rgba(11, 13, 18, .82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner { display: flex; align-items: center; gap: 20px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; font: 700 1.15rem var(--head); color: var(--text); white-space: nowrap; text-transform: uppercase; letter-spacing: .06em; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 14px; height: 14px; background: linear-gradient(135deg, var(--accent), var(--approve)); transform: rotate(45deg); border-radius: 3px; box-shadow: 0 0 14px rgba(139, 108, 255, .6); }
.nav { display: flex; align-items: center; gap: 4px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a, .nav .linkish {
  color: var(--muted); padding: 8px 12px; border-radius: 10px; white-space: nowrap; font-weight: 500; font-size: .92rem;
  display: inline-flex; align-items: center; gap: 6px;
}
.nav a:hover, .nav .linkish:hover { color: var(--text); background: var(--surface); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); }
.nav-logout { margin: 0; }
.linkish { background: none; border: 0; font: inherit; cursor: pointer; }
.badge { background: var(--pending); color: #1a1200; font-size: .72rem; font-weight: 700; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; display: inline-grid; place-items: center; }

@media (max-width: 760px) {
  .topbar-inner { flex-wrap: wrap; gap: 0; padding-top: 10px; }
  .nav { width: 100%; margin: 0 -8px; padding: 6px 0 8px; }
  .nav a, .nav .linkish { padding: 7px 9px; font-size: .88rem; }
}

/* ---------- buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 16px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font: 600 .92rem var(--body); cursor: pointer;
  transition: transform .08s ease, background .15s ease, border-color .15s ease;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; border-color: #36405a; background: #20263a; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-primary { background: linear-gradient(135deg, var(--accent), #6a4fe6); border-color: transparent; box-shadow: 0 6px 20px -8px rgba(139, 108, 255, .8); }
.btn-primary:hover { background: linear-gradient(135deg, #9a7fff, var(--accent)); border-color: transparent; }
.btn-approve { background: rgba(55, 214, 155, .14); border-color: rgba(55, 214, 155, .45); color: var(--approve); }
.btn-approve:hover { background: rgba(55, 214, 155, .24); border-color: var(--approve); }
.btn-danger { background: rgba(255, 93, 125, .1); border-color: rgba(255, 93, 125, .4); color: var(--danger); }
.btn-danger:hover { background: rgba(255, 93, 125, .2); border-color: var(--danger); }
.btn-small { padding: 6px 10px; font-size: .82rem; border-radius: 8px; }

input, textarea, select {
  width: 100%; padding: 11px 13px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg-2); color: var(--text); font: 400 .95rem var(--body);
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(139, 108, 255, .22); }
textarea { resize: vertical; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 500; font-size: .9rem; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row input { flex: 1; min-width: 180px; width: auto; }
form { margin: 0; }

.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 20px; border: 1px solid; font-weight: 500; }
.flash-success { background: rgba(55, 214, 155, .1); border-color: rgba(55, 214, 155, .35); color: #8ff0c8; }
.flash-error { background: rgba(255, 93, 125, .1); border-color: rgba(255, 93, 125, .35); color: #ffabbc; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.page-head h1 { margin: 0; }

/* ---------- auth ---------- */
.auth { max-width: 440px; margin: 6vh auto 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 32px; }
.auth h2 { margin-top: 28px; }
@media (max-width: 480px) { .auth { padding: 22px; margin-top: 2vh; } }

/* ---------- chips ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 18px; scrollbar-width: thin; }
.chip { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: .85rem; white-space: nowrap; }
.chip span { opacity: .6; margin-left: 2px; }
.chip:hover { color: var(--text); text-decoration: none; border-color: #36405a; }
.chip-on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip-on span { opacity: .8; }

/* ---------- gallery grid ---------- */
.grid { columns: 4 260px; column-gap: 16px; }
.card {
  display: block; break-inside: avoid; margin-bottom: 16px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.card:hover { text-decoration: none; transform: translateY(-3px); border-color: #3a3363; box-shadow: 0 14px 30px -14px rgba(139, 108, 255, .55); }
.card-media { position: relative; background: #07080b; }
.card-media img, .card-media video { display: block; width: 100%; height: auto; }
.card-media video { aspect-ratio: 16 / 9; object-fit: cover; }
.play-chip { position: absolute; top: 10px; right: 10px; background: rgba(0, 0, 0, .65); color: #fff; font-size: .7rem; padding: 4px 8px; border-radius: 6px; pointer-events: none; }
.card-body { padding: 12px 14px 14px; }
.card-title { font: 600 1rem var(--head); margin-bottom: 4px; overflow-wrap: anywhere; }
.card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); font-size: .82rem; }
.tag { background: rgba(139, 108, 255, .14); color: var(--accent-2); padding: 2px 8px; border-radius: 6px; font-weight: 600; font-size: .78rem; }

.pager { display: flex; justify-content: space-between; margin-top: 20px; }
.empty { text-align: center; padding: 64px 16px; border: 1px dashed var(--border); border-radius: var(--radius); background: rgba(21, 25, 35, .5); }
.empty .btn { margin-top: 10px; }

/* ---------- single post ---------- */
.post { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; align-items: start; }
.post-media { background: #07080b; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
.post-media img, .post-media video { display: block; width: 100%; max-height: 80vh; object-fit: contain; }
.post-info h1 { margin-top: 6px; overflow-wrap: anywhere; }
.caption { white-space: pre-wrap; overflow-wrap: anywhere; margin: 16px 0; }
.post-info .row { margin-top: 20px; }
@media (max-width: 900px) { .post { grid-template-columns: 1fr; gap: 18px; } }
.gone { display: grid; place-items: center; min-height: 120px; color: var(--muted); font-size: .85rem; }

/* ---------- pills ---------- */
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .75rem; font-weight: 600; margin-bottom: 6px; }
.pill-pending { background: rgba(255, 182, 72, .14); color: var(--pending); }
.pill-approved { background: rgba(55, 214, 155, .14); color: var(--approve); }
.pill-denied { background: rgba(255, 93, 125, .14); color: var(--danger); }

/* ---------- my uploads ---------- */
.list { display: flex; flex-direction: column; gap: 12px; }
.list-item { display: grid; grid-template-columns: 120px minmax(0, 1fr) auto; gap: 16px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.list-thumb { display: block; position: relative; border-radius: 10px; overflow: hidden; background: #07080b; aspect-ratio: 4 / 3; }
.list-thumb img, .list-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.list-thumb .gone { min-height: 0; height: 100%; }
.deny-reason { margin: 6px 0 0; color: #ffabbc; font-size: .88rem; }
@media (max-width: 560px) {
  .list-item { grid-template-columns: 88px minmax(0, 1fr); }
  .list-item form { grid-column: 1 / -1; }
  .list-item form .btn { width: 100%; }
}

/* ---------- review ---------- */
.review { display: flex; flex-direction: column; gap: 18px; }
.review-item { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--pending); border-radius: var(--radius); padding: 16px; }
.review-media { background: #07080b; border-radius: 10px; overflow: hidden; }
.review-media img, .review-media video { display: block; width: 100%; max-height: 60vh; object-fit: contain; }
.review-body { display: flex; flex-direction: column; gap: 6px; }
.review-actions { margin-top: auto; padding-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.review-actions .btn-approve { width: 100%; padding: 12px; }
.deny-form { display: flex; gap: 8px; }
.deny-form input { flex: 1; min-width: 0; }
@media (max-width: 820px) { .review-item { grid-template-columns: 1fr; } }

/* ---------- upload ---------- */
.upload { max-width: 640px; }
.drop {
  position: relative; display: block; border: 2px dashed #34405c; border-radius: var(--radius);
  background: rgba(21, 25, 35, .6); cursor: pointer; transition: border-color .15s, background .15s; overflow: hidden;
}
.drop:hover, .drop.drag { border-color: var(--accent); background: rgba(139, 108, 255, .08); }
.drop input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.drop-inner { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 44px 16px; font-weight: 400; }
.drop-inner strong { font: 600 1.1rem var(--head); }
.drop-preview { padding: 12px; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.drop-preview img, .drop-preview video { max-width: 100%; max-height: 320px; border-radius: 10px; display: block; }
.drop-preview .muted { font-size: .85rem; font-weight: 400; }
.progress { position: relative; height: 32px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.progress-bar { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(90deg, var(--accent), var(--approve)); transition: width .2s ease; }
.progress span { position: relative; display: grid; place-items: center; height: 100%; font-size: .85rem; font-weight: 600; }

/* ---------- admin ---------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; margin-bottom: 18px; }
.panel .row { margin-top: 12px; }
.invite { display: flex; gap: 10px; align-items: center; margin: 12px 0; flex-wrap: wrap; }
.invite code { flex: 1; min-width: 0; overflow-wrap: anywhere; padding: 10px 12px; font-size: .88rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--muted); font-weight: 500; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
tr:last-child td { border-bottom: 0; }
td.actions { display: flex; gap: 6px; justify-content: flex-end; }

select {
  appearance: none; cursor: pointer; padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%238b93a7' stroke-width='2'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
select:invalid { color: var(--muted); }
option { color: var(--text); background: var(--bg-2); }

/* ---------- admin: games ---------- */
.game-list { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-direction: column; }
.game-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); }
.game-rename { display: flex; gap: 8px; flex: 1; min-width: 0; }
.game-rename input { flex: 1; min-width: 0; padding: 7px 10px; background: transparent; border-color: transparent; }
.game-rename input:hover { border-color: var(--border); }
.game-rename input:focus { background: var(--bg-2); }
.game-rename .btn { opacity: 0; transition: opacity .15s; }
.game-rename:focus-within .btn, .game-list li:hover .game-rename .btn { opacity: 1; }
.game-count { white-space: nowrap; min-width: 56px; text-align: right; }
@media (hover: none) { .game-rename .btn { opacity: 1; } }
@media (max-width: 560px) {
  .game-list li { flex-wrap: wrap; }
  .game-rename { flex-basis: 100%; }
  .game-count { text-align: left; margin-right: auto; }
}

/* ---------- comments ---------- */
.comment-count { margin-left: auto; }
.comments { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border); }
.comments h2 { font-size: 1.1rem; }
.comment-list { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.comment { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; }
.comment:target { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(139, 108, 255, .18); }
.comment-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: .9rem; }
.comment-head .op { font-size: .7rem; font-weight: 600; color: var(--accent-2); background: rgba(139, 108, 255, .14); padding: 1px 6px; border-radius: 5px; }
.comment-del { margin-left: auto; }
.comment-del .linkish { color: var(--muted); padding: 0; }
.comment-del .linkish:hover { color: var(--danger); }
.comment p { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-form { display: flex; flex-direction: column; gap: 8px; }
.comment-form .btn { align-self: flex-end; }

/* ---------- account ---------- */
.account { max-width: 560px; margin: 0 auto; }
.account .panel h1 { margin-bottom: 4px; }
.account .panel > p.muted { margin-top: 0; }
h3.sub { font: 600 1rem var(--head); margin: 26px 0 8px; }
.my-requests { list-style: none; margin: 0; padding: 0; }
.my-requests li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.my-request-info { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.my-request-info .pill { margin: 0; }
.my-request-info strong { overflow-wrap: anywhere; }
.my-request-info .deny-reason { flex-basis: 100%; margin: 0; }

/* ---------- review: requests ---------- */
.request-list { list-style: none; margin: 12px 0 0; padding: 0 18px; background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--radius); }
.request:first-child { border-top: 0; }
.request { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 16px; padding: 14px 0; border-top: 1px solid var(--border); align-items: start; }
.request-info strong { overflow-wrap: anywhere; }
.request-info .pill { margin: 0 0 0 6px; }
.request-note { margin: 6px 0 0; color: var(--text); font-size: .9rem; overflow-wrap: anywhere; }
.request-actions { display: flex; flex-direction: column; gap: 8px; }
.request-approve { display: flex; gap: 8px; }
.request-approve input { flex: 1; min-width: 0; }
@media (max-width: 760px) { .request { grid-template-columns: 1fr; gap: 10px; } }

/* ---------- review tabs ---------- */
.tabs { display: flex; gap: 4px; padding: 4px; margin-bottom: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; width: fit-content; max-width: 100%; }
.tab { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 9px; color: var(--muted); font-weight: 600; font-size: .92rem; white-space: nowrap; }
.tab:hover { color: var(--text); text-decoration: none; background: var(--surface-2); }
.tab-on, .tab-on:hover { color: #fff; background: var(--accent); }
.tab-count { font-size: .75rem; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; display: inline-grid; place-items: center; background: rgba(255, 255, 255, .08); color: var(--muted); }
.tab-count-hot { background: var(--pending); color: #1a1200; }
@media (max-width: 480px) { .tabs { width: 100%; } .tab { flex: 1; justify-content: center; padding: 8px 8px; } }
.tab-on .tab-count { background: rgba(255, 255, 255, .22); color: #fff; }
.tab-on .tab-count-hot { background: var(--pending); color: #1a1200; }

/* ---------- avatars ---------- */
.avatar { display: inline-block; flex: none; border-radius: 50%; object-fit: cover; vertical-align: middle; background: var(--surface-2); }
.avatar-sm { width: 22px; height: 22px; }
.avatar-lg { width: 88px; height: 88px; }
.avatar-letter {
  display: inline-grid; place-items: center; color: #fff; font: 700 .7rem var(--head); line-height: 1;
  --h: 260;
  background: linear-gradient(135deg, hsl(var(--h) 65% 52%), hsl(calc(var(--h) + 40) 60% 38%));
}
.hue-0 { --h: 0; }
.hue-1 { --h: 30; }
.hue-2 { --h: 60; }
.hue-3 { --h: 90; }
.hue-4 { --h: 120; }
.hue-5 { --h: 150; }
.hue-6 { --h: 180; }
.hue-7 { --h: 210; }
.hue-8 { --h: 240; }
.hue-9 { --h: 270; }
.hue-10 { --h: 300; }
.hue-11 { --h: 330; }
.avatar-lg.avatar-letter { font-size: 2.2rem; }
.who { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.who-line { display: inline-flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.nav a .avatar-sm { width: 24px; height: 24px; margin: -2px 0; }
.comment-head .avatar { align-self: center; }

.profile-head { display: flex; align-items: center; gap: 18px; }
.profile-head h1 { margin: 0 0 2px; overflow-wrap: anywhere; }
.profile-head p { margin: 0; }
.profile-pic .avatar-lg { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px rgba(139, 108, 255, .55); }
.avatar-form { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.avatar-remove { margin-top: 10px; }
.avatar-remove .linkish { color: var(--muted); padding: 0; }
.avatar-remove .linkish:hover { color: var(--danger); }
#avatar-error { margin: 12px 0 0; }
@media (max-width: 480px) { .avatar-lg { width: 72px; height: 72px; } }

/* ---------- profiles ---------- */
a.who-link { color: inherit; }
a.who-link:hover { color: var(--accent-2); text-decoration: none; }
.bio-form { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }
.bio-row { margin: 0; }
.view-profile { margin-left: auto; }
.profile-hero {
  display: flex; gap: 26px; align-items: flex-start; padding: 26px; margin-bottom: 26px;
  background: linear-gradient(135deg, rgba(139, 108, 255, .12), rgba(55, 214, 155, .05)), var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.profile-hero .avatar-lg { width: 120px; height: 120px; }
.profile-hero .avatar-lg.avatar-letter { font-size: 3rem; }
.profile-main { flex: 1; min-width: 0; }
.profile-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.profile-title h1 { margin: 0; overflow-wrap: anywhere; }
.profile-title .pill { margin: 0; }
.profile-main > p.small { margin: 4px 0 0; }
.bio { white-space: pre-wrap; overflow-wrap: anywhere; margin: 14px 0 0; max-width: 60ch; }
.stats { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0 16px; }
.stat { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 10px 14px; min-width: 96px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; }
.stat strong { font: 700 1.3rem var(--head); line-height: 1; }
.stat span { color: var(--muted); font-size: .78rem; }
.profile-posts-title { margin: 0 0 14px; }
@media (max-width: 560px) {
  .profile-hero { flex-direction: column; align-items: center; text-align: center; padding: 22px 16px; gap: 14px; }
  .profile-hero .avatar-lg { width: 96px; height: 96px; }
  .profile-title, .stats { justify-content: center; }
  .bio { margin-left: auto; margin-right: auto; }
  .stat { align-items: center; }
}

/* ---------- admin badge ---------- */
.admin-badge {
  display: inline-block; margin-left: 5px; padding: 1px 6px; border-radius: 5px; vertical-align: 1px;
  font: 700 .66rem/1.4 var(--body); letter-spacing: .04em; text-transform: uppercase;
  color: var(--approve); background: rgba(55, 214, 155, .14); border: 1px solid rgba(55, 214, 155, .3);
}
.who .admin-badge { margin-left: 0; }
.comment { position: relative; }
.comment-head { padding-right: 56px; row-gap: 2px; }
.comment-del { position: absolute; top: 10px; right: 12px; margin: 0; }

/* ---------- Four in a Row ---------- */
.c4 { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.c4-play { display: flex; flex-direction: column; align-items: center; }
.c4-status { font: 600 1.15rem var(--head); min-height: 1.6em; margin-bottom: 12px; text-align: center; }
.c4-status-thinking { color: var(--muted); }
.c4-status-win { color: var(--approve); }
.c4-status-loss { color: var(--danger); }
.c4-frame {
  width: 100%; max-width: 620px; padding: 12px; border-radius: 20px;
  background: linear-gradient(160deg, #2a2160, #1a1640); border: 1px solid #3b3370;
  box-shadow: 0 24px 50px -24px rgba(139, 108, 255, .6), inset 0 1px 0 rgba(255, 255, 255, .06);
}
.c4-board { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0; }
.c4-col {
  display: grid; grid-template-rows: repeat(6, 1fr); gap: 0; padding: 0; margin: 0; border: 0; border-radius: 12px;
  background: transparent; cursor: pointer; transition: background .15s; touch-action: manipulation;
}
.c4-col:hover:not(:disabled), .c4-col:focus-visible { background: rgba(255, 255, 255, .06); outline: none; }
.c4-col:disabled { cursor: default; }
.c4-busy .c4-col { cursor: progress; }
.c4-slot {
  position: relative; display: block; aspect-ratio: 1; margin: 7%; border-radius: 50%;
  background: #0b0d12; box-shadow: inset 0 3px 6px rgba(0, 0, 0, .7);
}
.c4-p1, .c4-p2 { box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .25), inset 0 3px 0 rgba(255, 255, 255, .25); }
.c4-slot.c4-p1, .c4-dot.c4-p1 { background: radial-gradient(circle at 35% 30%, #ffd27a, #ffb648 55%, #e08f12); }
.c4-slot.c4-p2, .c4-dot.c4-p2 { background: radial-gradient(circle at 35% 30%, #ff9db1, #ff5d7d 55%, #d32f55); }
.c4-drop { animation: c4-fall calc(.12s + var(--fall, 1) * .05s) cubic-bezier(.45, 0, .9, .55); }
@keyframes c4-fall {
  from { transform: translateY(calc(var(--fall, 1) * -116%)); }
  to { transform: translateY(0); }
}
.c4-last::after { content: ''; position: absolute; inset: 36%; border-radius: 50%; background: rgba(255, 255, 255, .35); }
.c4-win { animation: c4-pulse .9s ease-in-out infinite alternate; z-index: 1; }
.c4-win::before { content: ''; position: absolute; inset: -8%; border-radius: 50%; border: 3px solid #fff; }
@keyframes c4-pulse { to { transform: scale(.88); } }
.c4-col:hover:not(:disabled) .c4-slot:not(.c4-p1):not(.c4-p2) { background: #11141c; }
.c4-help { text-align: center; margin-top: 14px; max-width: 46ch; }

.c4-side .panel { padding: 18px; }
.c4-side h2 { font-size: 1rem; margin: 0 0 8px; }
.c4-side h2:not(:first-child) { margin-top: 18px; }
.seg { display: flex; padding: 3px; gap: 3px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; }
.seg-btn { flex: 1; padding: 8px 6px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font: 600 .85rem var(--body); cursor: pointer; white-space: nowrap; }
.seg-btn:hover { color: var(--text); }
.seg-btn[aria-pressed="true"] { background: var(--accent); color: #fff; }
.c4-new { width: 100%; margin-top: 20px; }
.c4-score { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.c4-score div { display: flex; flex-direction: column; align-items: center; padding: 10px 4px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; }
.c4-score strong { font: 700 1.4rem var(--head); line-height: 1.1; }
.c4-score span { color: var(--muted); font-size: .75rem; }
.c4-legend { display: flex; gap: 16px; margin-top: 14px; font-size: .85rem; color: var(--muted); }
.c4-legend span { display: inline-flex; align-items: center; gap: 6px; }
.c4-dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; }
.c4-reset { margin-top: 10px; color: var(--muted); padding: 0; }
.c4-reset:hover { color: var(--danger); }
@media (max-width: 900px) { .c4 { grid-template-columns: 1fr; } .c4-side { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; } .c4-side .panel { margin: 0; } }
@media (max-width: 600px) { .c4-side { grid-template-columns: 1fr; } .c4-frame { padding: 6px; border-radius: 14px; } }
@media (prefers-reduced-motion: reduce) { .c4-drop, .c4-win { animation: none; } }

/* =================== games =================== */
.badge-play { background: var(--approve); color: #062016; }

/* hub */
.game-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-bottom: 18px; }
.game-card { display: flex; flex-direction: column; padding: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); transition: border-color .15s, transform .15s; }
.game-card:hover { border-color: #3a3363; transform: translateY(-2px); }
.game-card-art { display: grid; place-items: center; height: 120px; margin: -4px -4px 14px; border-radius: 10px; background: radial-gradient(circle at 50% 40%, rgba(139, 108, 255, .18), transparent 70%), var(--bg-2); }
.game-card-art svg { height: 84px; width: auto; }
.game-card h2 { margin: 0 0 4px; font-size: 1.15rem; }
.game-card h2 a { color: var(--text); }
.game-card p { margin: 0 0 14px; flex: 1; }
.game-card-modes { display: flex; flex-wrap: wrap; gap: 6px; }

.match-list { list-style: none; margin: 8px 0 0; padding: 0; }
.match-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.match-row:first-child { border-top: 0; }
.match-row-hot { background: linear-gradient(90deg, rgba(55, 214, 155, .1), transparent 60%); margin: 0 -10px; padding-left: 10px; padding-right: 10px; border-radius: 10px; }
.match-icon { flex: none; width: 40px; height: 36px; display: grid; place-items: center; }
.match-icon svg { max-width: 40px; max-height: 34px; }
.match-info { flex: 1; min-width: 0; }
.match-info > div:first-child { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.match-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.your-turn { color: var(--approve); }
.res-win { color: var(--approve); font-weight: 600; }
.res-loss { color: var(--danger); font-weight: 600; }
.online-setup { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 18px; align-items: start; }
.online-setup .panel { margin: 0; }
@media (max-width: 820px) { .online-setup { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .match-row { flex-wrap: wrap; } .match-actions { width: 100%; justify-content: flex-start; padding-left: 52px; } }

/* game page layout */
.gm { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.gm-online { grid-template-columns: minmax(0, 1fr); }
.gm-play { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.gm-status { font: 600 1.15rem var(--head); min-height: 1.6em; margin-bottom: 12px; text-align: center; }
.gm-status-thinking { color: var(--muted); }
.gm-status-turn, .gm-status-win { color: var(--approve); }
.gm-status-loss { color: var(--danger); }
.gm-status-draw { color: var(--accent-2); }
.gm-board { width: 100%; display: flex; justify-content: center; }
.gm-board > * { width: 100%; }
.gm-board .c4-frame { max-width: 620px; }
.gm-help { text-align: center; margin-top: 14px; max-width: 52ch; }
.gm-side .panel { padding: 18px; }
.gm-side h2 { font-size: 1rem; margin: 0 0 8px; }
.gm-side h2:not(:first-child) { margin-top: 18px; }
.gm-new { width: 100%; margin-top: 20px; }
.gm-score { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.gm-score div { display: flex; flex-direction: column; align-items: center; padding: 10px 4px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; }
.gm-score strong { font: 700 1.4rem var(--head); line-height: 1.1; }
.gm-score span { color: var(--muted); font-size: .75rem; }
.gm-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 14px; font-size: .85rem; color: var(--muted); }
.gm-legend span { display: inline-flex; align-items: center; gap: 6px; }
.gm-reset { margin-top: 10px; color: var(--muted); padding: 0; }
.gm-reset:hover { color: var(--danger); }
@media (max-width: 900px) { .gm { grid-template-columns: 1fr; } .gm-side { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; } .gm-side .panel { margin: 0; } }
@media (max-width: 600px) { .gm-side { grid-template-columns: 1fr; } .gm-board .c4-frame { padding: 6px; border-radius: 14px; } }

/* online players bar */
.gm-players { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; width: 100%; }
.gm-player { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); transition: border-color .2s, box-shadow .2s; }
.gm-player.is-turn { border-color: var(--approve); box-shadow: 0 0 0 3px rgba(55, 214, 155, .15); }
.gm-player .admin-badge { margin-left: 0; }
.gm-vs { color: var(--muted); font: 600 .8rem var(--head); text-transform: uppercase; }
.gm-waiting { width: 100%; max-width: 560px; margin-bottom: 12px; text-align: center; }
.gm-waiting .invite { justify-content: center; }
.gm-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 16px; }

/* X and O marks */
.mark-x, .mark-o { position: relative; }
.mark-x::before, .mark-x::after {
  content: ''; position: absolute; left: 50%; top: 50%; width: 62%; height: 12%; border-radius: 99px;
  background: linear-gradient(90deg, #ffd27a, #ffb648); box-shadow: 0 0 14px rgba(255, 182, 72, .35);
  transform: translate(-50%, -50%) rotate(45deg);
}
.mark-x::after { transform: translate(-50%, -50%) rotate(-45deg); }
.mark-o::before {
  content: ''; position: absolute; left: 50%; top: 50%; width: 52%; height: 52%; border-radius: 50%;
  border: solid #ff5d7d; border-width: max(3px, .55em); box-sizing: border-box; transform: translate(-50%, -50%);
  box-shadow: 0 0 14px rgba(255, 93, 125, .35);
}
.mini-mark { display: inline-block; width: 16px; height: 16px; font-size: 3px; flex: none; }
.mini-mark.mark-o::before { width: 80%; height: 80%; border-width: 2.5px; }
.mini-mark.mark-x::before, .mini-mark.mark-x::after { width: 100%; height: 3px; }

/* tic-tac-toe */
.ttt-board {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 420px; padding: 12px; border-radius: 20px;
  background: linear-gradient(160deg, #2a2160, #1a1640); border: 1px solid #3b3370; box-shadow: 0 24px 50px -24px rgba(139, 108, 255, .6);
}
.ttt-cell {
  aspect-ratio: 1; border: 0; border-radius: 14px; background: #0f1119; cursor: pointer; font-size: 16px; padding: 0;
  box-shadow: inset 0 3px 8px rgba(0, 0, 0, .6); transition: background .15s, box-shadow .15s; touch-action: manipulation;
}
.ttt-cell:hover:not(:disabled), .ttt-cell:focus-visible { background: #171a26; outline: none; box-shadow: inset 0 0 0 2px rgba(139, 108, 255, .5); }
.ttt-cell:disabled { cursor: default; }
.ttt-cell.is-new::before, .ttt-cell.is-new::after { animation: mark-in .22s ease-out; }
@keyframes mark-in { from { opacity: 0; scale: .4; } to { opacity: 1; scale: 1; } }
.ttt-cell.is-last { box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .14), inset 0 3px 8px rgba(0, 0, 0, .6); }
.ttt-cell.is-win { background: #1d2a26; box-shadow: inset 0 0 0 3px var(--approve); animation: win-pulse .9s ease-in-out infinite alternate; }
@keyframes win-pulse { to { background: #24382f; } }

/* tic-tac-toe XL */
.uttt-board {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 580px; padding: 10px; border-radius: 20px;
  background: linear-gradient(160deg, #2a2160, #1a1640); border: 1px solid #3b3370; box-shadow: 0 24px 50px -24px rgba(139, 108, 255, .6);
}
.uttt-small {
  position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 6px; border-radius: 12px;
  background: rgba(11, 13, 18, .55); border: 2px solid transparent; transition: border-color .2s, background .2s, opacity .2s;
}
.uttt-small .ttt-cell { border-radius: 7px; font-size: 7px; box-shadow: inset 0 2px 4px rgba(0, 0, 0, .6); }
.uttt-small .mark-o::before { border-width: max(2px, .5em); }
.uttt-small.is-active { border-color: rgba(55, 214, 155, .75); background: rgba(55, 214, 155, .08); box-shadow: 0 0 18px -4px rgba(55, 214, 155, .5); }
.gm-board-locked .uttt-small.is-active { border-color: rgba(139, 108, 255, .55); background: rgba(139, 108, 255, .07); box-shadow: none; }
.uttt-small.won-1 .ttt-cell, .uttt-small.won-2 .ttt-cell, .uttt-small.is-full .ttt-cell { opacity: .28; }
.uttt-small.is-full { opacity: .65; }
.uttt-claim { position: absolute; inset: 0; pointer-events: none; font-size: 26px; }
.uttt-claim.mark-x::before, .uttt-claim.mark-x::after { width: 70%; height: 11%; }
.uttt-claim.mark-o::before { width: 64%; height: 64%; border-width: max(6px, .45em); }
.uttt-small.won-1 { background: rgba(255, 182, 72, .08); }
.uttt-small.won-2 { background: rgba(255, 93, 125, .08); }
.uttt-small.is-win { border-color: #fff; animation: win-pulse-board .9s ease-in-out infinite alternate; }
@keyframes win-pulse-board { to { border-color: rgba(255, 255, 255, .35); } }
@media (max-width: 480px) {
  .uttt-board { gap: 5px; padding: 5px; border-radius: 14px; }
  .uttt-small { gap: 2px; padding: 3px; border-radius: 8px; }
  .uttt-small .ttt-cell { border-radius: 4px; font-size: 5px; }
  .ttt-board { gap: 7px; padding: 8px; }
}
@media (prefers-reduced-motion: reduce) { .ttt-cell.is-win, .uttt-small.is-win, .ttt-cell.is-new::before, .ttt-cell.is-new::after { animation: none; } }
