:root {
  --bg: #07090d;
  --card: #12161d;
  --card-2: #181d27;
  --text: #f3f6fb;
  --muted: #8b9bb0;
  --line: #243041;
  --accent1: #14b8a6;
  --accent2: #3b82f6;
  --go: #22c55e;
  --go-text: #04140a;
  --danger: #ef4444;
  --radius: 16px;
  --font: Inter, system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(900px 420px at 12% -10%, rgba(20,184,166,0.14), transparent 55%),
    radial-gradient(800px 380px at 100% 0%, rgba(59,130,246,0.12), transparent 50%),
    var(--bg);
}
a { color: #7dd3fc; text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.85rem 1.4rem; border-bottom: 1px solid var(--line);
  background: rgba(7,9,13,0.88); backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 20;
}
.brand { font-weight: 800; font-size: 1.15rem; color: var(--text); text-decoration: none; }
.brand-sea {
  background: linear-gradient(90deg, var(--accent1), var(--accent2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.nav { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.nav a { color: var(--muted); font-weight: 600; }
.nav a:hover, .nav a.nav-active { color: var(--text); }
.inline { display: inline; margin: 0; }
.linkish {
  background: none; border: none; color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; padding: 0;
}
.linkish:hover { color: var(--text); }

.main { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1.2rem 3rem; }
.stack { display: flex; flex-direction: column; gap: 1rem; }
.row { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.1rem 1.2rem; box-shadow: 0 10px 28px rgba(0,0,0,0.28);
}
.page-head h1 { margin: 0 0 0.25rem; font-size: 1.7rem; }
.muted { color: var(--muted); }
.tiny { font-size: 0.85rem; }
label { display: flex; flex-direction: column; gap: 0.35rem; font-weight: 600; font-size: 0.92rem; }
label.check, .switch-row { flex-direction: row; align-items: center; justify-content: space-between; font-weight: 500; gap: 0.75rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], select, textarea {
  background: #0b121a; border: 1px solid #2a3a4d; color: var(--text);
  border-radius: 10px; padding: 0.55rem 0.7rem; font: inherit; width: 100%;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  background: #1c2a3a; color: var(--text); border: 1px solid #2f4158;
  border-radius: 12px; padding: 0.55rem 1rem; font-weight: 700; cursor: pointer;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(90deg, var(--accent1), var(--accent2));
  border: none; color: #041018;
}
.btn-danger { background: #3b1515; border-color: #7f1d1d; color: #fecaca; }
.auth-wrap { min-height: 70vh; display: grid; place-items: center; }
.auth-card { width: min(420px, 100%); }
.alert { padding: 0.7rem 0.9rem; border-radius: 10px; }
.alert-error { background: #3b1515; color: #fecaca; border: 1px solid #7f1d1d; }
.alert-ok { background: #0f2a1c; color: #bbf7d0; border: 1px solid #166534; }
.hidden { display: none !important; }
.badge {
  display: inline-block; padding: 0.15rem 0.45rem; border-radius: 999px;
  background: #1e293b; font-size: 0.75rem; font-weight: 700; margin-right: 0.2rem;
}
.badge.ok { background: #14532d; color: #bbf7d0; }
.badge.bad { background: #7f1d1d; color: #fecaca; }
.badge.warn { background: #78350f; color: #fde68a; }
.copy-row { display: flex; gap: 0.5rem; }
.copy-row input { flex: 1; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 0.55rem 0.4rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.modal {
  border: 1px solid #2a3a4d; border-radius: 12px; background: var(--card); color: var(--text);
  padding: 1.2rem; max-width: 720px; width: calc(100% - 2rem);
}
.modal::backdrop { background: rgba(0,0,0,0.65); }
.chips { display: flex; flex-wrap: wrap; gap: 0.35rem 0.8rem; max-height: 160px; overflow: auto; }
fieldset { border: 1px solid #2a3a4d; border-radius: 8px; padding: 0.7rem; }
code { background: #0b121a; padding: 0.1rem 0.35rem; border-radius: 4px; }
.linkish-btn {
  align-self: flex-start; background: transparent; border: none; color: var(--muted);
  font-weight: 700; padding: 0.25rem 0; cursor: pointer;
}
.linkish-btn:hover { color: var(--text); text-decoration: underline; }

.studio {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.25rem 1.2rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.studio-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.15rem 1.15rem;
}
.studio-card-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem;
  margin-bottom: 0.85rem;
}
.studio-card-head h2 {
  margin: 0; font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
}
.lang-panel-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 0.15rem 0;
  font: inherit;
  text-align: left;
}
.lang-panel-label {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  min-width: 7rem;
}
.lang-panel-current {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex: 1;
  font-weight: 700;
}
.lang-panel .chevron {
  color: var(--muted);
  transition: transform 0.15s ease;
}
.lang-panel.is-open .chevron { transform: rotate(180deg); }
.lang-panel .lang-grid {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}
.flag-img {
  width: 28px;
  height: 21px;
  object-fit: cover;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.12);
  display: block;
}
.flag-img.flag-lg { width: 36px; height: 27px; }
.lang-chip .flag-img { width: 36px; height: 27px; margin-bottom: 0.15rem; }
.switch-row small { display: block; font-weight: 500; margin-top: 0.15rem; }

.lang-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 0.55rem;
}
.lang-chip {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.25rem; min-height: 72px; padding: 0.55rem 0.4rem;
  background: var(--card-2); border: 1px solid transparent; border-radius: 12px;
  color: var(--text); cursor: pointer; font: inherit;
}
.lang-chip:hover { border-color: #3a4d66; }
.lang-chip.is-selected {
  border-color: #e8eef6;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.2);
}
.lang-flag { font-size: 1.45rem; line-height: 1; }
.lang-name { font-size: 0.72rem; font-weight: 700; text-align: center; color: #d5deea; }

.studio-main {
  display: grid;
  grid-template-columns: 1.45fr 0.9fr;
  gap: 1rem;
  align-items: stretch;
}
.viewer-stage {
  position: relative;
  min-height: 340px;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(180deg, #0d1520 0%, #101826 40%, #0a1018 100%);
  border: 1px solid #1c2838;
}
.viewer-captions {
  position: absolute; left: 50%; bottom: 8%; transform: translateX(-50%);
  width: 92%; text-align: center; pointer-events: none;
}
.ov-line, .ov-original {
  color: #fff; font-weight: 700; line-height: 1.2; white-space: pre-wrap;
  text-shadow: 0 0 10px #000, 3px 3px 0 #000, -3px 3px 0 #000, 3px -3px 0 #000, -3px -3px 0 #000;
}
.ov-original { opacity: 0.8; margin-bottom: 0.15em; }
.ov-line:empty, .ov-original:empty { display: none; }

.style-card .field-label {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.8rem; color: var(--muted); font-weight: 700; margin: 0.7rem 0 0.35rem;
}
.style-card input[type="range"] { width: 100%; accent-color: var(--accent1); }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem; }
.seg-btn, .font-btn {
  background: var(--card-2); border: 1px solid transparent; color: var(--text);
  border-radius: 10px; padding: 0.65rem 0.5rem; font-weight: 700; cursor: pointer;
}
.seg-btn.is-on, .font-btn.is-on {
  border-color: #e8eef6; background: #1a2230;
}
.font-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.4rem; }
.switch-row {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--card-2); border-radius: 12px; padding: 0.75rem 0.9rem; margin-top: 0.65rem;
  font-weight: 600; font-size: 0.88rem;
}
.switch-row.compact { margin-top: 0; flex: 1; }
.switch-row input[type="checkbox"] { width: 1.15rem; height: 1.15rem; accent-color: var(--accent1); }
.color-row { display: flex; gap: 0.6rem; align-items: stretch; margin-top: 0.65rem; }
.color-swatch {
  display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.75rem; color: var(--muted); font-weight: 700;
  background: var(--card-2); border-radius: 12px; padding: 0.65rem 0.75rem; min-width: 110px;
}
.color-swatch input[type="color"] {
  width: 100%; height: 36px; border: none; background: transparent; padding: 0; cursor: pointer;
}
.advanced-style {
  border-top: 1px solid var(--line); margin-top: 0.75rem; padding-top: 0.5rem;
}
.style-actions { margin-top: 0.9rem; }
.save-pill {
  font-size: 0.72rem; font-weight: 800; color: #041018;
  background: linear-gradient(90deg, var(--accent1), var(--accent2));
  padding: 0.2rem 0.55rem; border-radius: 999px;
}

.studio-bottom {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 1rem;
}
.btn-go {
  width: 100%;
  border: none;
  border-radius: 999px;
  padding: 1.05rem 1.2rem;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
  color: var(--go-text);
  background: linear-gradient(90deg, #4ade80, #22c55e);
  box-shadow: 0 10px 30px rgba(34,197,94,0.28);
}
.btn-go:hover { filter: brightness(1.05); }
.btn-go.is-live {
  background: linear-gradient(90deg, #f87171, #ef4444);
  color: #fff;
  box-shadow: 0 10px 30px rgba(239,68,68,0.28);
}
.btn-go:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
.mic-row { margin-top: 0.85rem; }
.status-card {
  display: flex; flex-direction: column; gap: 0.75rem; justify-content: center;
}
.status-block {
  display: flex; align-items: center; gap: 0.75rem;
  background: var(--card-2); border-radius: 12px; padding: 0.85rem 1rem;
}
.status-flag { font-size: 1.6rem; }
.status-live {
  text-align: center; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted); padding: 0.55rem; border-radius: 10px; background: #0d121a;
}
.status-live.on { color: #bbf7d0; background: #0f2a1c; }

@media (max-width: 920px) {
  .studio-main, .studio-bottom { grid-template-columns: 1fr; }
  .viewer-stage { min-height: 260px; }
}

/* —— Admin —— */
.admin-page { max-width: 1100px; margin: 0 auto; }
.admin-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.page-sub { margin: 0.2rem 0 0; }
.back-link {
  display: inline-block; color: var(--muted); text-decoration: none; font-size: 0.9rem; margin-bottom: 0.35rem;
}
.back-link:hover { color: var(--text); }
.admin-card { padding: 1.15rem 1.25rem; }
.admin-card h2 { margin: 0 0 0.85rem; font-size: 1.1rem; display: flex; align-items: center; gap: 0.5rem; }
.admin-card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap;
  margin-bottom: 0.75rem;
}
.admin-card-head h2 { margin: 0; }
.count-pill {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.5rem; height: 1.5rem; padding: 0 0.45rem;
  border-radius: 999px; font-size: 0.75rem; font-weight: 700;
  background: var(--card-2); color: var(--muted); border: 1px solid var(--line);
}
.admin-search input {
  width: min(260px, 100%); background: var(--card-2); border: 1px solid var(--line);
  color: var(--text); border-radius: 10px; padding: 0.55rem 0.75rem;
}
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th, .admin-table td {
  text-align: left; padding: 0.75rem 0.55rem; border-bottom: 1px solid var(--line); vertical-align: middle;
}
.admin-table th { color: var(--muted); font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.admin-table-compact td, .admin-table-compact th { padding: 0.45rem 0.4rem; }
.user-cell { display: flex; flex-direction: column; gap: 0.15rem; }
.badge-row { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.lang-summary {
  display: inline-block; padding: 0.25rem 0.55rem; border-radius: 8px;
  background: var(--card-2); border: 1px solid var(--line); font-size: 0.85rem;
}
.td-actions { text-align: right; white-space: nowrap; }
.btn-sm { padding: 0.4rem 0.7rem; font-size: 0.85rem; border-radius: 9px; }
.admin-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1rem;
}
.session-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.65rem; }
.session-list li {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  padding: 0.65rem 0.75rem; border-radius: 12px; background: var(--card-2); border: 1px solid var(--line);
}
.admin-form { display: flex; flex-direction: column; gap: 1rem; }
.form-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.85rem;
}
.field { display: flex; flex-direction: column; gap: 0.35rem; }
.field > span { font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.field input {
  background: var(--card-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 0.65rem 0.75rem;
}
.field-static {
  padding: 0.65rem 0.75rem; border-radius: 10px; background: #0d121a; border: 1px solid var(--line);
  color: var(--muted);
}
.perm-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.55rem; margin-top: 0.35rem;
}
.switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  padding: 0.7rem 0.85rem; border-radius: 12px; background: var(--card-2); border: 1px solid var(--line);
  cursor: pointer; user-select: none;
}
.switch-row.compact { padding: 0.45rem 0.7rem; background: transparent; border: none; }
.switch-row input { width: 1.1rem; height: 1.1rem; accent-color: var(--accent1); }
.lang-block {
  padding: 0.85rem; border-radius: 14px; border: 1px solid var(--line); background: #0d121a;
}
.lang-block + .lang-block { margin-top: 0.75rem; }
.lang-block-head {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap;
}
.lang-block h3 { margin: 0; font-size: 0.95rem; }
.lang-chips { margin-top: 0.75rem; max-height: 220px; }
.lang-chips.is-hidden { display: none; }
.chip-check {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.35rem 0.55rem; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); font-size: 0.85rem; cursor: pointer;
}
.chip-check input { accent-color: var(--accent1); }
.form-actions { display: flex; gap: 0.65rem; flex-wrap: wrap; }
.danger-zone { border-color: #7f1d1d; }
.danger-zone h2 { color: #fecaca; }
.token-code {
  display: inline-block; max-width: 100%; overflow-wrap: anywhere;
  font-size: 0.8rem; color: #cbd5e1;
}
.alert-bad {
  background: #3b1515; border: 1px solid #7f1d1d; color: #fecaca;
  padding: 0.75rem 1rem; border-radius: 12px;
}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.hidden { display: none !important; }
.row.between { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }

@media (max-width: 820px) {
  .admin-grid { grid-template-columns: 1fr; }
}

