/* Dark (padrão) */
:root,
[data-theme='dark'] {
  --ink: #e8f4f2;
  --ink-soft: #9ec4bd;
  --paper: #0a1619;
  --paper-deep: #0f2428;
  --accent: #14b8a6;
  --accent-deep: #0d9488;
  --amber: #f59e0b;
  --danger: #f87171;
  --glass: rgba(255, 255, 255, 0.06);
  --border: rgba(232, 244, 242, 0.16);
  --border-strong: rgba(232, 244, 242, 0.28);
  --focus-ring: rgba(20, 184, 166, 0.28);
  --atmosphere-1: rgba(20, 184, 166, 0.18);
  --atmosphere-2: rgba(245, 158, 11, 0.1);
  --atmosphere-3: rgba(13, 148, 136, 0.12);
  --atmosphere-base: linear-gradient(165deg, #071214 0%, #0c1f24 45%, #102a2f 100%);
  --room-atmosphere: linear-gradient(180deg, #061214 0%, #0c1f24 40%, #14343a 100%);
  --thumb-border: rgba(232, 244, 242, 0.12);
  --status: #9ec4bd;
  --ghost-fg: #c5e4de;
  --ghost-border: rgba(200, 224, 220, 0.35);
  --font-display: 'Syne', sans-serif;
  --font-body: 'Outfit', sans-serif;
  --radius: 2px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: dark;
}

/* Light */
[data-theme='light'] {
  --ink: #0c1f24;
  --ink-soft: #3a555c;
  --paper: #e8f4f2;
  --paper-deep: #c5e4de;
  --accent: #0d9488;
  --accent-deep: #0f766e;
  --amber: #d97706;
  --danger: #b91c1c;
  --glass: rgba(255, 255, 255, 0.55);
  --border: rgba(12, 31, 36, 0.15);
  --border-strong: rgba(12, 31, 36, 0.25);
  --focus-ring: rgba(13, 148, 136, 0.2);
  --atmosphere-1: rgba(13, 148, 136, 0.28);
  --atmosphere-2: rgba(217, 119, 6, 0.18);
  --atmosphere-3: rgba(15, 118, 110, 0.2);
  --atmosphere-base: linear-gradient(165deg, #f3faf8 0%, #d6ebe6 45%, #c8e0dc 100%);
  --room-atmosphere: linear-gradient(180deg, #0c1f24 0%, #14343a 40%, #1a454c 100%);
  --thumb-border: rgba(12, 31, 36, 0.2);
  --status: #3a555c;
  --ghost-fg: #c5e4de;
  --ghost-border: rgba(200, 224, 220, 0.35);
  color-scheme: light;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.5;
  overflow-x: hidden;
  transition:
    background 0.25s var(--ease),
    color 0.25s var(--ease);
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 80% 60% at 10% 0%, var(--atmosphere-1), transparent 55%), radial-gradient(ellipse 70% 50% at 90% 20%, var(--atmosphere-2), transparent 50%),
    radial-gradient(ellipse 60% 40% at 50% 100%, var(--atmosphere-3), transparent 45%), var(--atmosphere-base);
  animation: drift 18s var(--ease) infinite alternate;
}

.atmosphere-room {
  background: radial-gradient(ellipse 90% 70% at 50% -10%, var(--atmosphere-1), transparent 50%), var(--room-atmosphere);
  animation: none;
}

@keyframes drift {
  from {
    transform: scale(1) translate(0, 0);
  }
  to {
    transform: scale(1.05) translate(-1%, 1%);
  }
}

.theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 20;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink);
  background: var(--glass);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 0.45rem 0.75rem;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition:
    transform 0.2s var(--ease),
    background 0.2s,
    border-color 0.2s;
}

.theme-toggle:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
}

.page-room .theme-toggle {
  top: auto;
  bottom: 1rem;
  right: 1rem;
}

.brand-mark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(3rem, 10vw, 5.5rem);
  letter-spacing: -0.04em;
  line-height: 0.95;
  margin: 0;
  color: var(--ink);
  animation: rise 0.8s var(--ease) both;
}

.brand-mark-sm {
  font-size: 1.25rem;
  text-decoration: none;
  color: var(--ink);
}

.brand-tagline {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.15rem, 3vw, 1.5rem);
  letter-spacing: -0.02em;
  max-width: 22ch;
  margin: 1rem 0 0.5rem;
  animation: rise 0.8s var(--ease) 0.1s both;
}

.brand-lead {
  margin: 0;
  color: var(--ink-soft);
  max-width: 36ch;
  animation: rise 0.8s var(--ease) 0.2s both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.home {
  min-height: 100vh;
  display: grid;
  align-content: center;
  gap: 2.5rem;
  padding: clamp(1.5rem, 4vw, 3rem);
  max-width: 960px;
  margin: 0 auto;
}

.home-with-hub {
  align-content: start;
  max-width: 1100px;
  padding-top: clamp(2rem, 6vw, 4rem);
  padding-bottom: 3rem;
}

.hub {
  animation: rise 0.9s var(--ease) 0.15s both;
}

.hub-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  padding-right: 5.5rem;
}

.hub-head h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
}

.hub-status {
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.hub-empty {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.hub-card {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s var(--ease);
}

.hub-card:hover {
  transform: translateY(-3px);
}

.hub-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: radial-gradient(ellipse 70% 60% at 50% 40%, #1a3338 0%, #061214 70%);
  border: 1px solid var(--thumb-border);
  overflow: hidden;
  display: grid;
  place-items: center;
}

.hub-thumb.is-live {
  background:
    radial-gradient(ellipse 80% 70% at 30% 20%, rgba(13, 148, 136, 0.35), transparent 55%), radial-gradient(ellipse 60% 50% at 80% 80%, rgba(217, 119, 6, 0.2), transparent 50%),
    linear-gradient(160deg, #0c1f24 0%, #061214 100%);
}

.hub-thumb-label {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.5rem;
  letter-spacing: 0.12em;
  color: rgba(232, 244, 242, 0.35);
}

.hub-thumb.is-live .hub-thumb-label {
  color: rgba(232, 244, 242, 0.85);
}

.hub-live-dot {
  position: absolute;
  top: 0.6rem;
  left: 0.6rem;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5);
  animation: pulse-live 1.6s ease-out infinite;
}

@keyframes pulse-live {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.45);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

.hub-card-meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.hub-card-name {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hub-card-sub {
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.actions {
  display: grid;
  gap: 1.75rem;
  grid-template-columns: 1fr;
  animation: rise 0.9s var(--ease) 0.25s both;
}

@media (min-width: 720px) {
  .actions {
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
  }
}

.action-block {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 0;
  background: none;
  border: none;
}

.action-block h2 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 0.25rem;
  letter-spacing: -0.02em;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink-soft);
}

label em {
  font-style: normal;
  font-weight: 400;
  opacity: 0.75;
}

input {
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.7rem 0.85rem;
  outline: none;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}

input::placeholder {
  color: var(--ink-soft);
  opacity: 0.7;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.btn {
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  border: none;
  border-radius: var(--radius);
  padding: 0.75rem 1.15rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition:
    transform 0.2s var(--ease),
    background 0.2s,
    color 0.2s;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--accent);
  color: #041112;
}

[data-theme='light'] .btn-primary {
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-deep);
}

.btn-secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--border-strong);
}

.btn-ghost {
  background: transparent;
  color: var(--ghost-fg);
  border: 1px solid var(--ghost-border);
  padding: 0.45rem 0.85rem;
  font-size: 0.85rem;
}

[data-theme='light'] .page-home .btn-ghost {
  color: var(--ink);
  border-color: var(--border-strong);
}

.error {
  color: var(--danger);
  font-size: 0.9rem;
  margin: 0;
}

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

/* Room */
.page-room {
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.room-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem clamp(1rem, 3vw, 2rem);
  flex-wrap: wrap;
}

.room-meta {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  font-size: 0.9rem;
}

.room-meta code {
  font-family: ui-monospace, monospace;
  background: var(--glass);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius);
  letter-spacing: 0.04em;
}

.btn-copy-link {
  padding: 0.25rem 0.55rem;
  font-size: 0.75rem;
}

.badge {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--amber);
  border: 1px solid rgba(217, 119, 6, 0.45);
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius);
}

.room-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  padding: 0 clamp(1rem, 3vw, 2rem) 2rem;
}

.stage-frame {
  position: relative;
  width: min(100%, 1100px);
  aspect-ratio: 16 / 9;
  background: #061214;
  overflow: hidden;
  animation: rise 0.7s var(--ease) both;
}

.stage-frame video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #061214;
}

.stage-hint {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  color: rgba(200, 224, 220, 0.55);
  font-size: 1rem;
  pointer-events: none;
}

.btn-fullscreen {
  position: absolute;
  right: 0.75rem;
  bottom: 0.75rem;
  z-index: 2;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid rgba(232, 244, 242, 0.35);
  border-radius: var(--radius);
  background: rgba(6, 18, 20, 0.72);
  color: #e8f4f2;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition:
    background 0.2s,
    transform 0.2s var(--ease);
}

.btn-fullscreen:hover {
  background: rgba(13, 148, 136, 0.85);
  transform: translateY(-1px);
}

.stage-frame:fullscreen,
.stage-frame:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  aspect-ratio: auto;
  background: #000;
}

.stage-frame:fullscreen .btn-fullscreen,
.stage-frame:-webkit-full-screen .btn-fullscreen {
  right: 1.25rem;
  bottom: 1.25rem;
}

.stage-frame:fullscreen .fs-enter,
.stage-frame:-webkit-full-screen .fs-enter {
  display: none;
}

.stage-frame:fullscreen .fs-exit,
.stage-frame:-webkit-full-screen .fs-exit {
  display: inline !important;
}

.host-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  justify-content: center;
}

.host-hint {
  width: 100%;
  text-align: center;
  margin: 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.page-room .btn-secondary {
  color: var(--ink);
  border-color: var(--border-strong);
}

.page-room .error {
  color: var(--danger);
}

[data-theme='light'] .page-room {
  color: #e8f4f2;
}

[data-theme='light'] .page-room .brand-mark-sm,
[data-theme='light'] .page-room .room-meta,
[data-theme='light'] .page-room .status,
[data-theme='light'] .page-room .host-hint {
  color: #e8f4f2;
}

[data-theme='light'] .page-room .status,
[data-theme='light'] .page-room .host-hint {
  color: #9ec4bd;
}

[data-theme='light'] .page-room .btn-secondary {
  color: #e8f4f2;
  border-color: rgba(232, 244, 242, 0.35);
}

[data-theme='light'] .page-room .error {
  color: #fca5a5;
}

/* File broadcast beta */
.beta-strip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  margin-top: 0.5rem;
  animation: rise 0.9s var(--ease) 0.35s both;
}

.btn-beta {
  gap: 0.5rem;
}

.beta-tag {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--amber);
  border: 1px solid rgba(217, 119, 6, 0.45);
  padding: 0.1rem 0.35rem;
  border-radius: var(--radius);
}

.beta-note {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.file-beta-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 0 clamp(1rem, 3vw, 2rem) 2rem;
  width: min(100%, 1100px);
  margin: 0 auto;
}

.file-beta-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

@media (min-width: 900px) {
  .file-beta-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.file-beta-panel {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.file-beta-panel h2 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
}

.file-beta-panel video {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #061214;
  object-fit: contain;
}

.file-beta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.file-beta-file {
  cursor: pointer;
}

[data-theme='light'] .page-file-beta .file-beta-panel h2,
[data-theme='light'] .page-file-beta .beta-note {
  color: #e8f4f2;
}
