:root {
  color-scheme: light;
  --bg: #f6f1e6;
  --fg-primary: #1f2937;
  --fg-muted: #4b5563;
  --surface: rgba(255, 255, 255, 0.92);
  --text: #1f2937;
  --muted: #6b7280;
  --accent: #ec6f47;
  --accent-secondary: #3b82f6;
  --success: #22c55e;
  --warn: #f59e0b;
  --border: rgba(31, 41, 55, 0.12);
  --radius: 16px;
  --shadow: 0 24px 50px rgba(17, 24, 39, 0.12);
  --font-body: "Sora", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Sora", "Inter", system-ui, sans-serif;
  --radius-xl: 20px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(120% 120% at 20% 0%, rgba(255, 207, 160, 0.35), transparent 50%),
    radial-gradient(90% 90% at 90% 10%, rgba(117, 182, 255, 0.3), transparent 55%),
    radial-gradient(120% 120% at 50% 100%, rgba(255, 255, 255, 0.6), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  padding: clamp(1.5rem, 2vw + 1rem, 3rem);
}

.app-shell {
  width: min(1100px, 100%);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.surface {
  background: var(--surface);
  border-radius: var(--radius);
  padding: clamp(1.25rem, 2vw + 0.5rem, 1.75rem);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.site-header h1 {
  margin: 0 0 0.35rem;
  font-size: clamp(1.9rem, 2vw + 1rem, 2.4rem);
  font-family: var(--font-display);
  color: #111827;
}

.site-tagline,
.site-label {
  margin: 0;
  color: var(--muted);
}

.fallback-banner {
  border: 1px solid rgba(245, 158, 11, 0.35);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.18), rgba(59, 130, 246, 0.1));
}

.fallback-banner ul,
.status-block ul {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
  color: #92400e;
}

.status-block {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: var(--radius);
  border: 1px dashed rgba(31, 41, 55, 0.15);
  background: rgba(255, 255, 255, 0.75);
}

.site-footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.submit-streamer-result {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  background: rgba(59, 130, 246, 0.15);
}

.admin-auth {
  display: grid;
  gap: 1rem;
  max-width: 460px;
  padding: 1.5rem;
  border-radius: calc(var(--radius-xl) * 0.66);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.85);
}

.admin-help {
  margin: 0;
  color: var(--fg-muted);
  font-size: 0.9rem;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.form-field-wide {
  grid-column: 1 / -1;
}

.form-field span {
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--fg-muted);
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  border: 1px solid rgba(31, 41, 55, 0.18);
  background: rgba(255, 255, 255, 0.85);
  color: var(--fg-primary);
  font: inherit;
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

.submit-streamer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.submit-streamer-submit {
  padding: 0.75rem 1.75rem;
  border-radius: 999px;
  border: none;
  background: linear-gradient(120deg, rgba(236, 111, 71, 0.95), rgba(59, 130, 246, 0.9));
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.submit-streamer-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.submit-streamer-submit:not(:disabled):hover,
.submit-streamer-submit:not(:disabled):focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px -12px rgba(236, 111, 71, 0.4);
}

.admin-shell {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.admin-lumen {
  gap: 1.25rem;
}

.eyebrow {
  margin: 0 0 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  color: var(--fg-muted);
}

.admin-masthead {
  display: grid;
  grid-template-columns: 2fr 1fr;
  align-items: start;
  gap: 1rem;
  background: linear-gradient(135deg, rgba(236, 111, 71, 0.08), rgba(59, 130, 246, 0.08)), var(--surface);
}

.masthead-text h2 {
  margin: 0 0 0.3rem;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 2vw + 1rem, 2.3rem);
  color: #0f172a;
}

.masthead-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.4rem;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--fg-primary);
  background: rgba(255, 255, 255, 0.8);
  font-size: 0.85rem;
  box-shadow: 0 10px 22px rgba(17, 24, 39, 0.08);
}

.tone-accent {
  border-color: rgba(236, 111, 71, 0.5);
  background: rgba(236, 111, 71, 0.12);
  color: #9a3412;
}

.tone-ghost {
  border-color: rgba(31, 41, 55, 0.15);
  background: rgba(17, 24, 39, 0.05);
  color: #334155;
}

.tone-warn {
  border-color: rgba(245, 158, 11, 0.5);
  background: rgba(245, 158, 11, 0.12);
  color: #92400e;
}

button.pill {
  transition: all 0.2s ease;
  background-color: inherit;
}

button.pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(17, 24, 39, 0.12);
}

button.pill:active {
  transform: translateY(0);
}

.button-row {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.action-button,
.action-button:visited {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.7rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(31, 41, 55, 0.18);
  background: rgba(255, 255, 255, 0.9);
  color: var(--fg-primary);
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.action-button.primary {
  background: linear-gradient(120deg, rgba(236, 111, 71, 0.95), rgba(59, 130, 246, 0.9));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 16px 32px -18px rgba(236, 111, 71, 0.7);
}

.action-button.ghost {
  background: rgba(255, 255, 255, 0.85);
  color: var(--fg-primary);
}

.action-button:hover,
.action-button:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 16px 32px -18px rgba(17, 24, 39, 0.22);
}

.admin-banner {
  padding: 0.9rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 12px 26px -18px rgba(17, 24, 39, 0.16);
}

.admin-banner.success {
  border-color: rgba(34, 197, 94, 0.4);
  background: rgba(34, 197, 94, 0.12);
  color: #14532d;
}

.admin-banner.error {
  border-color: rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.12);
  color: #7f1d1d;
}

.admin-help.subtle {
  color: rgba(75, 85, 99, 0.9);
}

.admin-grid {
  display: grid;
  gap: 1rem;
}

.auth-layout {
  grid-template-columns: 1.15fr 0.85fr;
}

.dashboard {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.span-2 {
  grid-column: span 2;
}

.admin-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  padding: 1.25rem;
  box-shadow: 0 18px 34px -24px rgba(17, 24, 39, 0.4);
}

.admin-card-header {
  margin-bottom: 0.75rem;
}

.admin-card h3 {
  margin: 0 0 0.2rem;
  font-family: var(--font-display);
}

.other-sites {
  margin-top: 1rem;
  border-top: 1px solid rgba(31, 41, 55, 0.12);
  padding-top: 0.75rem;
}

.stat-deck {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(255, 255, 255, 0.85));
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
}

.stat-chip {
  border: 1px solid rgba(31, 41, 55, 0.12);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 12px 22px -18px rgba(17, 24, 39, 0.2);
}

.stat-label {
  margin: 0 0 0.25rem;
  color: var(--fg-muted);
  font-size: 0.9rem;
}

.stat-value {
  margin: 0;
  font-size: 1.8rem;
  font-weight: 800;
}

.stat-note {
  margin: 0.3rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.admin-youtube-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.admin-youtube-toggle {
  margin: 0;
}

.admin-youtube-label {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem;
  border: 1px solid rgba(31, 41, 55, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.95);
  cursor: pointer;
}

.admin-youtube-details {
  display: grid;
  gap: 0.2rem;
}

.admin-youtube-site-name {
  font-weight: 700;
}

.admin-youtube-meta {
  color: var(--muted);
  font-size: 0.85rem;
}

.admin-toggle {
  appearance: none;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid rgba(31, 41, 55, 0.2);
  background: rgba(244, 244, 245, 0.9);
  position: relative;
  cursor: pointer;
  transition: background 0.2s ease, border 0.2s ease;
}

.admin-toggle::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 8px 14px -8px rgba(17, 24, 39, 0.35);
  transition: transform 0.2s ease;
}

.admin-toggle:checked {
  background: linear-gradient(120deg, rgba(236, 111, 71, 0.8), rgba(59, 130, 246, 0.8));
  border-color: rgba(236, 111, 71, 0.6);
}

.admin-toggle:checked::after {
  transform: translateX(18px);
}

.site-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.site-chip {
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  border: 1px dashed rgba(31, 41, 55, 0.2);
  color: var(--fg-primary);
  background: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  display: inline-block;
  transition: all 0.2s ease;
}

a.site-chip:hover {
  background: rgba(31, 41, 55, 0.05);
  border-color: rgba(31, 41, 55, 0.4);
  transform: translateY(-1px);
}

a.site-chip:active {
  transform: translateY(0);
}

/* Configuration page styles */
.config-details {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.5rem 0;
}

.config-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(31, 41, 55, 0.1);
}

.config-row:last-child {
  border-bottom: none;
}

.config-label {
  font-weight: 600;
  color: var(--fg-secondary);
  font-size: 0.9rem;
  min-width: 140px;
}

.config-value {
  color: var(--fg-primary);
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  font-size: 0.85rem;
  word-break: break-all;
  text-align: right;
}

.config-value code {
  background: rgba(31, 41, 55, 0.05);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  font-size: 0.85rem;
}

.fallback-list {
  margin: 0.25rem 0 0;
  padding-left: 1.25rem;
  color: #92400e;
}

.fallback-list li + li {
  margin-top: 0.35rem;
}

.log-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.9));
}

.log-card-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.admin-logs-frame {
  width: 100%;
  min-height: 820px;
  border: 1px solid rgba(31, 41, 55, 0.15);
  border-radius: 14px;
  background: #0a0f1a;
}

@media (max-width: 900px) {
  .admin-masthead {
    grid-template-columns: 1fr;
  }

  .masthead-actions {
    align-items: flex-start;
  }

  .auth-layout {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: span 1;
  }
}
