/* LiveTTok Creator Studio — hand-written, no build step. */

:root {
  --bg: #000;
  --bg-1: #0a0a0b;
  --bg-2: #111113;
  --bg-3: #18181b;
  --bg-4: #202024;
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.14);
  --text: #fff;
  --text-2: rgba(255, 255, 255, 0.64);
  --text-3: rgba(255, 255, 255, 0.4);
  --blue: #0099ff;
  --violet: #8b5cf6;
  --pink: #ff3cac;
  --green: #34d399;
  --amber: #fbbf24;
  --red: #ff4d57;
  --radius: 18px;
  --radius-sm: 12px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --side: 248px;
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background: var(--bg);
  font-family: var(--sans);
  font-size: 14px;
  font-optical-sizing: auto;
  font-feature-settings: "cv11", "ss01", "ss03";
  line-height: 1.5;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
}

img,
svg {
  display: block;
  max-width: 100%;
}

svg.i {
  width: 18px;
  height: 18px;
  flex: none;
}

::selection {
  background: rgba(0, 153, 255, 0.5);
}

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  border-radius: 8px;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12) padding-box;
}

[hidden] {
  display: none !important;
}

/* ───────────── Primitives ───────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  transition: transform 0.3s var(--ease), background 0.2s, opacity 0.2s, box-shadow 0.3s var(--ease);
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn-primary {
  color: #000;
  background: #fff;
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 8px 30px rgba(255, 255, 255, 0.15);
}

.btn-blue {
  color: #fff;
  background: var(--blue);
}

.btn-blue:hover:not(:disabled) {
  box-shadow: 0 8px 30px rgba(0, 153, 255, 0.35);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.08);
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.14);
}

.btn-danger {
  color: #fff;
  background: rgba(255, 77, 87, 0.18);
}

.btn-danger:hover:not(:disabled) {
  background: rgba(255, 77, 87, 0.3);
}

.btn-sm {
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
}

.btn-icon {
  width: 36px;
  padding: 0;
}

.btn-block {
  width: 100%;
}

.card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-1);
}

.card-pad {
  padding: 20px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.card-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.card-head small {
  color: var(--text-3);
  font-size: 12px;
}

.card-body {
  padding: 20px;
}

.label {
  color: var(--text-3);
  font-size: 12px;
  font-weight: 500;
}

.muted {
  color: var(--text-2);
}

.dim {
  color: var(--text-3);
}

.mono {
  font-family: var(--mono);
  font-size: 12.5px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  color: var(--text-2);
  background: rgba(255, 255, 255, 0.07);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge.green {
  color: var(--green);
  background: rgba(52, 211, 153, 0.12);
}

.badge.red {
  color: var(--red);
  background: rgba(255, 77, 87, 0.12);
}

.badge.amber {
  color: var(--amber);
  background: rgba(251, 191, 36, 0.12);
}

.badge.blue {
  color: #5eb4ff;
  background: rgba(0, 153, 255, 0.14);
}

.badge.violet {
  color: #a78bfa;
  background: rgba(139, 92, 246, 0.14);
}

.dot-live {
  position: relative;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
}

.dot-live::after {
  position: absolute;
  inset: -4px;
  border: 1px solid var(--red);
  border-radius: 50%;
  animation: ping 1.8s var(--ease) infinite;
  content: "";
}

@keyframes ping {
  from {
    opacity: 0.9;
    transform: scale(0.5);
  }
  to {
    opacity: 0;
    transform: scale(1.8);
  }
}

/* Forms */
.field {
  display: grid;
  gap: 6px;
}

.field > span {
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
}

.input,
.select,
.textarea {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  outline: none;
  background: var(--bg-2);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.textarea {
  height: auto;
  min-height: 90px;
  padding: 10px 12px;
  resize: vertical;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 153, 255, 0.2);
}

.input-group {
  display: flex;
  align-items: center;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--bg-2);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-group:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 153, 255, 0.2);
}

.input-group > span {
  padding-left: 12px;
  color: var(--text-3);
}

.input-group .input {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.switch input {
  position: absolute;
  opacity: 0;
}

.switch i {
  position: relative;
  width: 36px;
  height: 20px;
  flex: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  transition: background 0.25s;
}

.switch i::after {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.3s var(--ease);
  content: "";
}

.switch input:checked + i {
  background: var(--blue);
}

.switch input:checked + i::after {
  transform: translateX(16px);
}

.switch input:focus-visible + i {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.range {
  width: 100%;
  accent-color: var(--blue);
}

.seg {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: var(--bg-2);
}

.seg button {
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.2s, color 0.2s;
}

.seg button.is-active {
  color: #000;
  background: #fff;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

th {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--text-3);
  font-size: 12px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
}

td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

tr:last-child td {
  border-bottom: 0;
}

tbody tr {
  transition: background 0.15s;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.025);
}

.empty {
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 48px 20px;
  color: var(--text-3);
  text-align: center;
}

.empty b {
  color: var(--text-2);
  font-size: 15px;
  font-weight: 600;
}

.av {
  display: grid;
  flex: none;
  width: 30px;
  height: 30px;
  overflow: hidden;
  border-radius: 50%;
  place-items: center;
  background: var(--bg-4);
  font-size: 12px;
  font-weight: 700;
}

.av img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.who {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.who div {
  min-width: 0;
}

.who b {
  display: block;
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.who small {
  color: var(--text-3);
  font-size: 12px;
}

/* ───────────── Auth ───────────── */

.auth {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  min-height: 100vh;
}

.auth-art {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 40px;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background: var(--bg-1);
}

.auth-art::before {
  position: absolute;
  inset: -20% -20% auto;
  height: 80%;
  background:
    radial-gradient(40% 50% at 40% 40%, rgba(0, 153, 255, 0.4), transparent 70%),
    radial-gradient(30% 40% at 70% 30%, rgba(139, 92, 246, 0.35), transparent 70%),
    radial-gradient(30% 40% at 30% 70%, rgba(255, 60, 172, 0.2), transparent 70%);
  filter: blur(40px);
  animation: aurora 14s ease-in-out infinite alternate;
  content: "";
}

@keyframes aurora {
  to {
    transform: translate(6%, 8%) scale(1.1);
  }
}

.auth-art > * {
  position: relative;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.brand img {
  width: 28px;
  height: 28px;
}

.auth-art h1 {
  max-width: 520px;
  margin: 0;
  font-size: clamp(40px, 4.4vw, 64px);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.05em;
}

.auth-art h1 span {
  color: var(--text-3);
}

.auth-art p {
  max-width: 440px;
  color: var(--text-2);
  font-size: 17px;
}

.auth-tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.auth-tiles img {
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 14px;
  object-fit: cover;
  opacity: 0.85;
  animation: tile-in 1s var(--ease) both;
}

@keyframes tile-in {
  from {
    opacity: 0;
    filter: blur(10px);
    transform: translateY(20px);
  }
}

.auth-form {
  display: grid;
  place-items: center;
  padding: 40px 24px;
}

.auth-box {
  width: min(380px, 100%);
  animation: tile-in 0.8s var(--ease) both;
}

.auth-box h2 {
  margin: 0 0 6px;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.04em;
}

.auth-box > p {
  margin: 0 0 28px;
  color: var(--text-2);
}

.auth-box form {
  display: grid;
  gap: 14px;
}

.google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 44px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  font-weight: 600;
  transition: background 0.2s;
}

.google-btn:hover {
  background: rgba(255, 255, 255, 0.05);
}

.or {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  color: var(--text-3);
  font-size: 12px;
}

.or::before,
.or::after {
  flex: 1;
  height: 1px;
  background: var(--line);
  content: "";
}

.auth-switch {
  margin-top: 20px;
  color: var(--text-2);
  text-align: center;
}

.auth-switch button {
  color: #fff;
  font-weight: 600;
}

.form-error {
  padding: 10px 12px;
  border-radius: 10px;
  color: #ffb3b8;
  background: rgba(255, 77, 87, 0.12);
  font-size: 13px;
}

/* ───────────── Shell ───────────── */

.shell {
  display: grid;
  grid-template-columns: var(--side) minmax(0, 1fr);
  min-height: 100vh;
}

.side {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 16px 12px;
  border-right: 1px solid var(--line);
  background: var(--bg-1);
}

.side .brand {
  padding: 6px 10px 20px;
}

.nav-group {
  margin-top: 8px;
}

.nav-group > small {
  display: block;
  padding: 8px 10px 6px;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border-radius: 10px;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  transition: background 0.2s, color 0.2s;
}

.nav-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.nav-item.is-active {
  color: #fff;
  background: rgba(255, 255, 255, 0.09);
}

.nav-item .badge {
  height: 20px;
  margin-left: auto;
  padding: 0 7px;
  font-size: 11px;
}

.side-foot {
  display: grid;
  gap: 8px;
  margin-top: auto;
}

.plan-chip {
  display: block;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: radial-gradient(120% 120% at 0% 0%, rgba(0, 153, 255, 0.14), transparent 60%), var(--bg-2);
}

.plan-chip b {
  display: block;
  font-size: 13px;
}

.plan-chip small {
  color: var(--text-3);
  font-size: 12px;
}

.plan-chip .meter {
  margin: 10px 0 2px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 6px;
  border-radius: 12px;
  transition: background 0.2s;
}

.user-chip:hover {
  background: rgba(255, 255, 255, 0.05);
}

.user-link {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.user-link div {
  min-width: 0;
  flex: 1;
}

.side {
  min-width: 0;
  overflow-y: auto;
}

.user-chip b {
  display: block;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-chip small {
  display: block;
  overflow: hidden;
  color: var(--text-3);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.main {
  min-width: 0;
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 60px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}

.topbar h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.topbar .spacer {
  flex: 1;
}

.session-pick {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 6px 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-1);
}

.session-pick select {
  max-width: 220px;
  height: 100%;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.session-pick select option {
  background: var(--bg-2);
}

.menu-btn {
  display: none;
}

.page {
  padding: 24px;
  animation: page-in 0.5s var(--ease) both;
}

@keyframes page-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.page-head h2 {
  margin: 0;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.04em;
}

.page-head p {
  margin: 4px 0 0;
  color: var(--text-2);
}

.page-head .actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.grid {
  display: grid;
  gap: 16px;
}

.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

/* ───────────── Studio ───────────── */

.room-hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding: 24px;
  overflow: hidden;
}

.room-hero::before {
  position: absolute;
  inset: 0;
  background: radial-gradient(60% 140% at 0% 0%, color-mix(in srgb, var(--accent, #0099ff) 22%, transparent), transparent 60%);
  pointer-events: none;
  content: "";
}

.room-hero > * {
  position: relative;
}

.room-id {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.room-id img {
  width: 64px;
  height: 64px;
  flex: none;
  border-radius: 16px;
  object-fit: cover;
}

.room-id h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.035em;
}

.room-id p {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 6px 0 0;
  color: var(--text-2);
}

.room-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13px;
}

.notice svg {
  margin-top: 1px;
}

.notice.amber {
  color: #fde68a;
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.25);
}

.notice.green {
  color: #a7f3d0;
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.25);
}

.notice.blue {
  color: #bfe3ff;
  background: rgba(0, 153, 255, 0.1);
  border: 1px solid rgba(0, 153, 255, 0.25);
}

.stat {
  padding: 18px 20px;
}

.stat small {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 500;
}

.stat b {
  display: block;
  margin-top: 8px;
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.045em;
  font-variant-numeric: tabular-nums;
}

.stat b.flash {
  animation: flash 0.6s var(--ease);
}

@keyframes flash {
  40% {
    color: #5eb4ff;
    transform: translateY(-2px);
  }
}

.studio-grid {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr) 340px;
  gap: 16px;
  align-items: start;
}

.preview-frame {
  position: relative;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  border-radius: 14px;
  background: #050505;
}

.preview-frame iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 1080px;
  height: 1920px;
  border: 0;
  transform-origin: 0 0;
}

.preview-frame .placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  color: var(--text-3);
  text-align: center;
}

.url-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 6px 6px 6px 12px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--bg-2);
}

.url-row code {
  flex: 1;
  overflow: hidden;
  color: var(--text-2);
  font: 12px var(--mono);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sim-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}

.sim-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-height: 64px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-2);
  text-align: left;
  transition: border-color 0.2s, background 0.2s, transform 0.3s var(--ease);
}

.sim-btn:hover {
  border-color: var(--line-2);
  background: var(--bg-3);
}

.sim-btn:active {
  transform: scale(0.97);
}

.sim-btn b {
  font-size: 13px;
  font-weight: 600;
}

.sim-btn small {
  color: var(--text-3);
  font: 10.5px var(--mono);
}

.sim-btn.fired {
  border-color: var(--blue);
  background: rgba(0, 153, 255, 0.12);
}

.feed {
  display: flex;
  flex-direction: column;
  max-height: 520px;
  overflow-y: auto;
}

.feed-item {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  animation: feed-in 0.5s var(--ease) both;
}

@keyframes feed-in {
  from {
    opacity: 0;
    filter: blur(6px);
    transform: translateY(-8px);
  }
}

.feed-item p {
  margin: 0;
  overflow: hidden;
  color: var(--text-2);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feed-item p b {
  color: #fff;
  font-weight: 600;
}

.feed-item time {
  color: var(--text-3);
  font: 11px var(--mono);
}

.type-COMMENT { color: #5eb4ff; }
.type-GIFT { color: var(--pink); }
.type-LIKE { color: #fb7185; }
.type-JOIN { color: var(--green); }
.type-FOLLOW { color: #a78bfa; }
.type-SHARE { color: var(--amber); }

.board-list {
  display: grid;
}

.board-row {
  display: grid;
  grid-template-columns: 24px 30px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}

.board-row:last-child {
  border-bottom: 0;
}

.board-row .rk {
  color: var(--text-3);
  font: 12px var(--mono);
}

.board-row .rk.top {
  color: var(--amber);
}

.board-row b {
  font-variant-numeric: tabular-nums;
}

.health {
  display: grid;
  gap: 10px;
}

.health div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
}

/* ───────────── Games ───────────── */

.games {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.game {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: border-color 0.3s, transform 0.5s var(--ease);
}

.game:hover {
  border-color: var(--line-2);
  transform: translateY(-3px);
}

.game.is-current {
  border-color: color-mix(in srgb, var(--accent) 60%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent);
}

.game-thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--bg-2);
}

.game-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 1s var(--ease);
}

.game:hover .game-thumb img {
  transform: scale(1.05);
}

.game-thumb .badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
}

.game-thumb .badge.cur {
  right: 10px;
  left: auto;
  color: #fff;
  background: var(--blue);
}

.game-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 6px;
  padding: 16px;
}

.game-body small {
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.game-body h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.game-body p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--text-2);
  font-size: 13px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.game-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
  padding-top: 12px;
}

.game-actions .btn {
  flex: 1;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.toolbar .input-group {
  width: min(320px, 100%);
}

/* ───────────── Billing ───────────── */

.plan-current {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  overflow: hidden;
}

.plan-current .left {
  padding: 28px;
  background: radial-gradient(80% 120% at 0% 0%, rgba(0, 153, 255, 0.2), transparent 60%);
}

.plan-current .left h3 {
  margin: 8px 0 4px;
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.045em;
}

.plan-current .right {
  display: grid;
  gap: 16px;
  padding: 28px;
  border-left: 1px solid var(--line);
}

.meter {
  height: 6px;
  overflow: hidden;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
}

.meter i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--violet));
  transition: width 1s var(--ease);
}

.meter.warn i {
  background: linear-gradient(90deg, var(--amber), var(--red));
}

.usage-row {
  display: grid;
  gap: 6px;
}

.usage-row div {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

.usage-row b {
  font-variant-numeric: tabular-nums;
}

.plans {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.plan {
  display: flex;
  flex-direction: column;
  padding: 24px;
  transition: border-color 0.3s, transform 0.5s var(--ease);
}

.plan:hover {
  border-color: var(--line-2);
  transform: translateY(-3px);
}

.plan.featured {
  border-color: rgba(0, 153, 255, 0.5);
  background: radial-gradient(100% 50% at 50% 0%, rgba(0, 153, 255, 0.16), transparent 70%), var(--bg-1);
}

.plan.is-current {
  border-color: rgba(52, 211, 153, 0.5);
}

.plan-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 24px;
  color: var(--text-2);
  font-weight: 500;
}

.plan-price {
  margin: 16px 0 2px;
  font-size: 36px;
  font-weight: 600;
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
}

.plan-price small {
  color: var(--text-3);
  font-size: 16px;
}

.plan ul {
  display: grid;
  gap: 10px;
  flex: 1;
  margin: 20px 0;
  padding: 20px 0 0;
  border-top: 1px solid var(--line);
  list-style: none;
}

.plan li {
  display: flex;
  gap: 8px;
  color: var(--text-2);
  font-size: 13.5px;
}

.plan li svg {
  width: 16px;
  height: 16px;
  color: var(--blue);
}

.qr-box {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 24px;
  align-items: start;
}

.qr-box img {
  width: 240px;
  height: 240px;
  padding: 10px;
  border-radius: 16px;
  background: #fff;
  object-fit: contain;
}

.kv {
  display: grid;
  gap: 10px;
}

.kv div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}

.kv div:last-child {
  border-bottom: 0;
}

.kv span {
  color: var(--text-3);
}

.kv b {
  font-weight: 600;
  text-align: right;
}

.copyable {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.copyable:hover {
  color: #5eb4ff;
}

/* ───────────── Settings forms ───────────── */

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.form-grid .full {
  grid-column: 1 / -1;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.setting-row:last-child {
  border-bottom: 0;
}

.setting-row b {
  display: block;
  font-size: 14px;
  font-weight: 500;
}

.setting-row small {
  color: var(--text-3);
  font-size: 12.5px;
}

.color-input {
  width: 44px;
  height: 36px;
  padding: 2px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--bg-2);
  cursor: pointer;
}

.chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  color: var(--text-2);
  font-size: 13px;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.chip.is-on {
  border-color: transparent;
  color: #000;
  background: #fff;
}

/* Guide */
.steps {
  display: grid;
  gap: 12px;
  counter-reset: step;
}

.step {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 16px;
  padding: 20px;
}

.step::before {
  display: grid;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  place-items: center;
  background: linear-gradient(135deg, var(--blue), var(--violet));
  font-weight: 700;
  counter-increment: step;
  content: counter(step);
}

.step h3 {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 600;
}

.step p {
  margin: 0;
  color: var(--text-2);
}

/* Admin */
.tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 16px;
  padding: 3px;
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
  border-radius: 999px;
  background: var(--bg-1);
  border: 1px solid var(--line);
}

.tabs button {
  height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s;
}

.tabs button.is-active {
  color: #000;
  background: #fff;
}

.row-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.select-sm {
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: var(--bg-2);
  font-size: 13px;
}

/* ───────────── Modal & toast ───────────── */

.modal {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fade 0.3s var(--ease);
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

.modal-panel {
  width: min(560px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  border: 1px solid var(--line-2);
  border-radius: 22px;
  background: var(--bg-1);
  animation: pop 0.45s var(--ease);
}

.modal-panel.wide {
  width: min(860px, 100%);
}

@keyframes pop {
  from {
    opacity: 0;
    filter: blur(6px);
    transform: translateY(16px) scale(0.98);
  }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.modal-head h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.modal-body {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 20px;
  border-top: 1px solid var(--line);
}

.toasts {
  position: fixed;
  z-index: 200;
  right: 20px;
  bottom: 20px;
  display: grid;
  gap: 8px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 380px;
  padding: 12px 16px;
  border: 1px solid var(--line-2);
  border-radius: 14px;
  background: rgba(24, 24, 27, 0.92);
  backdrop-filter: blur(16px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  font-size: 13.5px;
  animation: pop 0.4s var(--ease);
}

.toast.out {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s, transform 0.3s;
}

.toast i {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--green);
}

.toast.error i {
  background: var(--red);
}

.skeleton {
  border-radius: 10px;
  background: linear-gradient(90deg, var(--bg-2), var(--bg-3), var(--bg-2));
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

.boot {
  display: grid;
  place-items: center;
  height: 100vh;
}

.boot img {
  width: 44px;
  height: 44px;
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.4;
    transform: scale(0.92);
  }
}

/* ───────────── Responsive ───────────── */

@media (max-width: 1320px) {
  .studio-grid {
    grid-template-columns: 300px minmax(0, 1fr);
  }

  .studio-grid > :last-child {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }
}

@media (max-width: 1080px) {
  .cols-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .plans,
  .cols-3 {
    grid-template-columns: minmax(0, 1fr);
  }

  .plan-current {
    grid-template-columns: minmax(0, 1fr);
  }

  .plan-current .right {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 900px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .side {
    position: fixed;
    z-index: 50;
    width: 280px;
    transform: translateX(-100%);
    transition: transform 0.4s var(--ease);
  }

  .shell.nav-open .side {
    transform: none;
    box-shadow: 30px 0 80px rgba(0, 0, 0, 0.6);
  }

  .menu-btn {
    display: grid;
  }

  .auth {
    grid-template-columns: minmax(0, 1fr);
  }

  .auth-art {
    display: none;
  }

  .studio-grid,
  .studio-grid > :last-child,
  .cols-2,
  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .qr-box {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
  }
}

@media (max-width: 600px) {
  .page {
    padding: 16px;
  }

  .topbar {
    padding: 0 12px;
  }

  .topbar h1 {
    display: none;
  }

  .session-pick {
    min-width: 0;
    flex: 1;
  }

  .session-pick select {
    max-width: none;
    min-width: 0;
    width: 100%;
  }

  #conn-pill,
  [data-action="new-session"] span {
    display: none;
  }

  .topbar .btn[data-action="new-session"] {
    width: 36px;
    padding: 0;
  }

  .room-actions {
    width: 100%;
  }

  .room-actions .btn {
    flex: 1;
  }

  .cols-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stat b {
    font-size: 24px;
  }

  .room-hero {
    padding: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ═════════════ Go live ═════════════ */
.golive > *, .gl-main > * { min-width: 0; }
.golive .url-row code { min-width: 0; }
.golive {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
  align-items: start;
}
.gl-main { gap: 16px; align-content: start; }
.gl-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.gl-small { margin: 14px 0 0; font-size: 12px; line-height: 1.55; }
.gl-tabs { display: flex; width: 100%; }
.gl-tabs button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; }
.gl-tabs button .i { width: 16px; height: 16px; }
.gl-steps { list-style: none; counter-reset: gl; margin: 0; padding: 0; display: grid; gap: 14px; }
.gl-steps li { counter-increment: gl; display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 12px; align-items: start; }
.gl-steps li::before {
  content: counter(gl);
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 10px;
  background: rgba(0, 153, 255, 0.14); color: #6cc4ff; font-weight: 700; font-size: 13px;
}
.gl-steps li > div > b { display: block; font-weight: 600; padding-top: 4px; }
.gl-steps p { margin: 2px 0 0; color: var(--text-2); font-size: 13px; }
.kbd { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 6px; border: 1px solid var(--line-2); background: var(--bg-3); font: 600 12px var(--mono); }
.gl-switch { display: flex; align-items: center; gap: 12px; margin: 14px 0 4px; }
.gl-switch span { display: grid; }
.gl-switch small { color: var(--text-3); font-size: 12px; }
.gl-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.gl-two p { margin: 4px 0 0; font-size: 13px; }
.gl-list { margin: 6px 0 0; padding-left: 18px; }
.gl-list li { margin: 2px 0; }
.gl-warn { margin: 8px 0 0; color: var(--amber); }
.gl-phone { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 22px; align-items: start; margin: 4px 0 4px; }
.gl-qr { width: 220px; aspect-ratio: 1; padding: 10px; border-radius: 16px; background: #fff; }
.gl-qr svg { display: block; width: 100%; height: 100%; }
.notice + .gl-phone { margin-top: 16px; }
.link { color: #6cc4ff; text-decoration: underline; text-underline-offset: 3px; }

.gl-check { position: sticky; top: 76px; }
.gl-checklist { list-style: none; margin: 0; padding: 4px 16px 16px; display: grid; gap: 4px; }
.gl-item { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.gl-item:first-child { border-top: 0; }
.gl-item > div > b { display: block; font-weight: 600; padding-top: 3px; overflow-wrap: anywhere; }
.gl-item p { margin: 3px 0 8px; color: var(--text-2); font-size: 13px; }
.gl-item p:last-child { margin-bottom: 0; }
.gl-ic { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--bg-3); color: var(--text-3); }
.gl-ic .i { width: 15px; height: 15px; }
.gl-item.is-ok .gl-ic { background: rgba(52, 211, 153, 0.16); color: var(--green); }
.gl-item.is-warn .gl-ic, .gl-item.is-bad .gl-ic { background: rgba(251, 191, 36, 0.16); color: var(--amber); }
.gl-item.is-bad .gl-ic { background: rgba(255, 77, 87, 0.16); color: var(--red); }
.todo-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.18); border-top-color: var(--blue); animation: gl-spin 0.9s linear infinite; }
@keyframes gl-spin { to { transform: rotate(360deg); } }
.gl-devices { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 6px; }
.gl-devices li { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.gl-devices b { font-weight: 500; }
.gl-devices small { margin-left: auto; color: var(--text-3); }
.dot-ok { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.18); flex: none; }

@media (max-width: 1180px) {
  .golive { grid-template-columns: minmax(0, 1fr); }
  .gl-check { position: static; }
}
@media (max-width: 700px) {
  .gl-phone { grid-template-columns: minmax(0, 1fr); justify-items: center; }
  .gl-phone > div:last-child { justify-self: stretch; }
  .gl-two { grid-template-columns: minmax(0, 1fr); }
  .gl-tabs button { padding: 0 8px; font-size: 12.5px; }
}
@media (prefers-reduced-motion: reduce) { .spin { animation: none; } }

/* ═════════════ Plan banner & support ═════════════ */
.plan-banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 16px 24px 0; padding: 12px 16px; border-radius: 14px; font-size: 13.5px;
  border: 1px solid rgba(251, 191, 36, 0.35); background: rgba(251, 191, 36, 0.08);
}
.plan-banner.red { border-color: rgba(255, 77, 87, 0.4); background: rgba(255, 77, 87, 0.08); }
.plan-banner > .i { width: 18px; height: 18px; flex: none; color: var(--amber); }
.plan-banner.red > .i { color: var(--red); }
.plan-banner span { flex: 1; min-width: 200px; }
.support-fab {
  position: fixed; right: 18px; bottom: 18px; z-index: 40;
  display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 16px 0 12px;
  border-radius: 999px; background: #0068ff; color: #fff; font-weight: 600; font-size: 13.5px;
  box-shadow: 0 10px 30px rgba(0, 104, 255, 0.35);
}
.support-fab svg { width: 20px; height: 20px; fill: #fff; }
.support-fab:hover { filter: brightness(1.1); }
@media (max-width: 600px) {
  .plan-banner { margin: 12px 16px 0; }
  .support-fab span { display: none; }
  .support-fab { padding: 0 12px; }
}
