/*
 * CloseGates light (二次元) style — shared by every site.
 * Served at /_ui/light.css. Pick a streamer colour with data-accent="…" on
 * <html> or any element. Each accent has three roles:
 *   --c     fill (swatches, buttons, bars)      --c-rgb  the same as r,g,b for tints
 *   --c-ink text/lines in that colour on light   --on     text drawn on a --c fill
 */

@font-face { font-family: "JB Mono"; src: url(/_ui/fonts/JetBrainsMono-Regular.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "JB Mono"; src: url(/_ui/fonts/JetBrainsMono-Medium.woff2) format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "JB Mono"; src: url(/_ui/fonts/JetBrainsMono-Bold.woff2) format("woff2"); font-weight: 700; font-display: swap; }

:root {
  color-scheme: light;
  --bg: #f4f7fc;
  --panel: rgba(255, 255, 255, .84); --panel-2: rgba(255, 255, 255, .94); --panel-solid: #ffffff;
  --line: #e2e8f2; --line-2: #cfd8e6;
  --fg: #1d2333; --fg-2: #454e66; --fg-3: #69738c; --fg-4: #97a0b6;
  --ok: #1fb866; --ok-ink: #138a4a; --warn: #f2a516; --warn-ink: #a86d00; --err: #ff4d5e; --err-ink: #d42e40;
  --shadow: 0 10px 30px rgba(60, 80, 130, .10);
  --shadow-sm: 0 2px 10px rgba(60, 80, 130, .07);
  /* Latin/numbers in mono for a crisp, tidy feel; Chinese in the system UI font. */
  --mono: "JB Mono", "SF Mono", Menlo, Consolas, "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  /* Legibility over art: a thin light edge, not a blurred halo. */
  --text-lift: 0 0 1px rgba(255,255,255,.9), 0 1px 1px rgba(255,255,255,.55);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --radius: 10px; --radius-sm: 7px;
  /* neutral accent when a page has no streamer colour */
  --c: #5b6b8c; --c-rgb: 91, 107, 140; --c-ink: #46557a; --on: #ffffff;
}
[data-accent="sky"]      { --c: #3b8cff; --c-rgb: 59,140,255;  --c-ink: #1f6fe0; --on: #ffffff; }
[data-accent="lavender"] { --c: #9170ff; --c-rgb: 145,112,255; --c-ink: #6b47e6; --on: #ffffff; }
[data-accent="moon"]     { --c: #dde3ee; --c-rgb: 120,136,168; --c-ink: #5a6782; --on: #33405c; --c-edge: #aab5cb; }
[data-accent="sakura"]   { --c: #ff6fa8; --c-rgb: 255,111,168; --c-ink: #e0407f; --on: #ffffff; }
[data-accent="jade"]     { --c: #1fbfa2; --c-rgb: 31,191,162;  --c-ink: #0e8f78; --on: #ffffff; }
[data-accent="coral"]    { --c: #ff7a4d; --c-rgb: 255,122,77;  --c-ink: #e0562a; --on: #ffffff; }
[data-accent="amber"]    { --c: #f5ac1c; --c-rgb: 245,172,28;  --c-ink: #b57900; --on: #3b2800; }
[data-accent="mint"]     { --c: #2fc57c; --c-rgb: 47,197,124;  --c-ink: #17955a; --on: #ffffff; }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg); overflow-x: hidden; overflow-x: clip; }
body { margin: 0; min-height: 100vh; color: var(--fg); background: var(--bg); font: 15px/1.6 var(--sans); -webkit-font-smoothing: antialiased; overflow-x: hidden; overflow-x: clip; }
a { color: var(--fg); text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid rgba(var(--c-rgb), .55); outline-offset: 2px; }
.mono, .cg-num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ── Backdrop: anime art, soft white wash for legibility ─────────────── */
.cg-stage { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; contain: strict;
  /* painted while the art loads, and the fallback if it never does */
  background: linear-gradient(180deg, #cfe6ff 0%, #e9f3ff 45%, #f7f9ff 100%); }
.cg-stage picture, .cg-stage img { position: absolute; inset: -3%; width: 106%; height: 106%; object-fit: cover; object-position: 60% 40%; }
.cg-stage img { opacity: 0; transition: opacity .5s ease; }
/* Streamer art (wide, character on the right): pin the right edge so narrower
   screens crop the empty wall on the left, never the character. */
@media (min-width: 761px) { .cg-stage.cg-art img { object-position: 100% 30%; } }
/* Phones: streamer art is portrait with the character at the bottom. Scale it up
   a little from the bottom edge so the top sky is trimmed and the character sits
   higher, instead of hugging the bottom of the screen. Applies to every streamer. */
@media (max-width: 760px) { .cg-stage.cg-art img { top: auto; bottom: 3%; height: 112%; object-position: 60% 100%; } }
.cg-stage img.ready { opacity: 1; }
.cg-stage .scrim { position: absolute; inset: 0; background:
  linear-gradient(90deg, rgba(246,249,255,.92) 0%, rgba(246,249,255,.72) 40%, rgba(246,249,255,.2) 75%, rgba(246,249,255,.1) 100%),
  linear-gradient(0deg, var(--bg) 0%, rgba(244,247,252,0) 42%); }
.cg-stage .grain, .cg-stage .scan { display: none; }

/* ── Page shell ────────────────────────────────────────────────────── */
.cg-page { position: relative; z-index: 1; width: min(1200px, 100%); margin: 0 auto; padding: 26px 40px 40px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; }
.cg-page > * { min-width: 0; }
.cg-bar { display: flex; justify-content: space-between; align-items: center; gap: 8px 16px; flex-wrap: wrap; font-size: 13px; color: var(--fg-3); }
.cg-bar b { color: var(--fg); font-weight: 700; }
.cg-bar a { color: var(--fg-3); } .cg-bar a:hover { color: var(--c-ink); }
.cg-bar nav { display: flex; align-items: center; gap: 6px 18px; flex-wrap: wrap; }
/* Page header over streamer art (入口 / 录播 / 歌单): the path and every link are
   identical pills — same font, size, weight, height and spacing — so they read
   as one row and never blend into the picture. */
.cg-chips { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cg-crumb, .cg-chips > * { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; padding: 0 14px; border-radius: 999px; border: 1px solid rgba(255,255,255,.9); background: rgba(255,255,255,.86); color: var(--fg-2); font: 600 13px/1 var(--sans); font-variant-numeric: tabular-nums; white-space: nowrap; box-shadow: var(--shadow-sm); text-decoration: none; }
.cg-crumb a, .cg-crumb b { color: var(--fg-2); font-weight: 600; text-decoration: none; }
.cg-crumb a:hover { color: var(--c-ink); }
.cg-crumb i { font-style: normal; color: var(--fg-4); }
.cg-chips > a { transition: background .15s, color .15s, border-color .15s; }
.cg-chips > a:hover { background: var(--c); color: var(--on); border-color: var(--c-edge, var(--c)); }
@media (max-width: 760px) {
  .cg-crumb, .cg-chips > * { min-height: 30px; padding: 0 11px; font-size: 12px; background: rgba(255,255,255,.62); -webkit-backdrop-filter: blur(8px) saturate(1.2); backdrop-filter: blur(8px) saturate(1.2); }
}
/* Page footer (录播 / 歌单): credit bottom-left, 管理 as plain text bottom-right.
   A two-column grid keeps the link in the right corner at any width. */
.cg-foot { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; column-gap: 24px; width: 100%; margin: 0; padding: 16px 0 4px; border-top: 1px solid rgba(120,136,168,.18); font: 12px/1.6 var(--sans); letter-spacing: 0; color: var(--fg-3); text-shadow: var(--text-lift); }
.cg-foot > :last-child:not(:first-child) { justify-self: end; text-align: right; }
.cg-foot a { color: var(--fg-3); text-decoration: none; }
.cg-foot a:hover { color: var(--c-ink); }

/* ── Type ──────────────────────────────────────────────────────────── */
.cg-h1 { margin: 0; font-size: clamp(28px, 4vw, 40px); font-weight: 800; letter-spacing: -.01em; line-height: 1.15; }
.cg-h2 { margin: 0; font-size: 15px; font-weight: 700; }
.cg-label { font-size: 12px; letter-spacing: .06em; color: var(--fg-4); }
.cg-muted { color: var(--fg-3); }
.cg-faint { color: var(--fg-4); }

/* ── Surfaces ─────────────────────────────────────────────────────── */
.cg-panel { border: 1px solid rgba(255,255,255,.7); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.cg-panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.cg-panel-body { padding: 16px 18px; display: grid; gap: 14px; }
.cg-cell { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; background: var(--panel-2); }

/* ── Controls ──────────────────────────────────────────────────────── */
.cg-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 16px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--panel-solid); color: var(--fg); cursor: pointer; font-size: 13px; font-weight: 600; white-space: nowrap; transition: border-color .2s, background .2s, color .2s, transform .1s; }
.cg-btn:hover { border-color: var(--c); color: var(--c-ink); }
.cg-btn:active { transform: scale(.97); }
.cg-btn:disabled { opacity: .45; cursor: default; }
.cg-btn.primary { background: var(--c); color: var(--on); border-color: var(--c-edge, var(--c)); }
.cg-btn.primary:hover { filter: brightness(1.05); color: var(--on); }
.cg-btn.danger { color: var(--err-ink); }
.cg-btn.danger:hover { border-color: var(--err); background: rgba(255,77,94,.08); }
.cg-btn.confirm { border-color: var(--err); background: var(--err); color: #fff; }
.cg-btn.sm { min-height: 32px; padding: 0 12px; font-size: 12px; }
.cg-btn.icon { width: 34px; min-height: 34px; padding: 0; }
.cg-link { border: 0; background: none; padding: 4px 0; color: var(--fg-3); cursor: pointer; font-size: 13px; }
.cg-link:hover { color: var(--c-ink); }

.cg-input, .cg-textarea { width: 100%; min-height: 40px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--panel-solid); color: var(--fg); outline: 0; transition: border-color .2s, box-shadow .2s; }
.cg-textarea { min-height: 96px; padding: 10px 14px; resize: vertical; line-height: 1.5; }
.cg-input:focus, .cg-textarea:focus { border-color: var(--c); box-shadow: 0 0 0 3px rgba(var(--c-rgb), .18); }
.cg-input::placeholder, .cg-textarea::placeholder { color: var(--fg-4); }
.cg-field { display: grid; gap: 6px; font-size: 12px; color: var(--fg-3); }

.cg-switch { position: relative; width: 40px; height: 24px; flex-shrink: 0; border: 0; border-radius: 999px; background: #d6ddea; cursor: pointer; padding: 0; transition: background .2s; }
.cg-switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(40,60,100,.25); transition: transform .25s var(--ease); }
.cg-switch[aria-checked="true"] { background: var(--ok); }
.cg-switch[aria-checked="true"]::after { transform: translateX(16px); }
.cg-switch:disabled { opacity: .5; cursor: wait; }

.cg-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--fg-2); cursor: pointer; user-select: none; }
.cg-check input { accent-color: var(--c-ink); width: 15px; height: 15px; }
.cg-check.off { opacity: .4; cursor: default; }

/* ── Status bits ───────────────────────────────────────────────────── */
.cg-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #c3cbdb; flex-shrink: 0; }
.cg-dot.ok { background: var(--ok); } .cg-dot.warn { background: var(--warn); } .cg-dot.err { background: var(--err); } .cg-dot.accent { background: var(--c); box-shadow: inset 0 0 0 1px var(--c-edge, transparent); }
.cg-eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; }
.cg-eq i { width: 3px; border-radius: 1px; background: var(--c-ink); animation: cg-eq .9s ease-in-out infinite alternate; }
.cg-eq i:nth-child(2) { animation-delay: -.3s; } .cg-eq i:nth-child(3) { animation-delay: -.6s; } .cg-eq i:nth-child(4) { animation-delay: -.15s; }
@keyframes cg-eq { from { height: 3px; } to { height: 12px; } }
.cg-meter { height: 6px; background: #e3e9f3; border-radius: 999px; overflow: hidden; }
.cg-meter i { display: block; height: 100%; border-radius: inherit; background: var(--c); transition: width .5s var(--ease); }
.cg-meter.hot i { background: var(--err); }
.cg-msg { margin: 0; font-size: 12px; color: var(--fg-3); min-height: 1.4em; }
.cg-msg.ok { color: var(--ok-ink); } .cg-msg.err { color: var(--err-ink); }
.cg-tag { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; background: rgba(var(--c-rgb), .12); font-size: 12px; color: var(--c-ink); }
.cg-tag.warn { background: rgba(245,172,28,.14); color: var(--warn-ink); }
.cg-tag.err { background: rgba(255,77,94,.12); color: var(--err-ink); }

/* ── Motion ────────────────────────────────────────────────────────── */
.cg-rise { opacity: 0; transform: translateY(8px); animation: cg-rise .5s var(--ease) forwards; animation-delay: var(--d, 0s); }
@keyframes cg-rise { to { opacity: 1; transform: none; } }

@media (max-width: 760px) {
  .cg-page { padding: 18px 16px 28px; gap: 18px; }
  .cg-stage .scrim { background: linear-gradient(180deg, rgba(246,249,255,0) 0%, rgba(246,249,255,0) 60%, rgba(246,249,255,.1) 100%); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .cg-rise { opacity: 1 !important; transform: none !important; }
}
