:root {
  --bg: #1a0f08;
  --bg-elev: #241509;
  --surface: #2e1a0c;
  --border: #3d2412;
  --text: #fff3e6;
  --muted: #c9a78a;
  --orange: #ff6a1f;
  --orange-bright: #ff8a3d;
  --orange-deep: #d44b00;
  --danger: #ff4d4d;
  --ok: #4ade80;
  --swift: #4154f1;
  --radius: 14px;
  --shadow: 0 30px 80px -20px rgba(255, 106, 31, 0.25), 0 10px 30px -10px rgba(0,0,0,0.6);
  font-synthesis: none;
}

* { box-sizing: border-box; }
a { color: inherit; text-decoration: none; }
html, body { margin: 0; padding: 0; }
body {
  background:
    var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, -apple-system, "Segoe UI", Inter, Roboto, sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.container { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  backdrop-filter: saturate(140%) blur(10px);
  background: color-mix(in oklab, var(--bg) 75%, transparent);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0;
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -0.01em; }

.brand-hub span {color: white;}

.brand-mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: var(--primary); color: var(--on-primary);
  display: grid; place-items: center; font-weight: 800; box-shadow: var(--shadow-sm);
}
.brand-name-swift .brand-hub {
  color: white;
}
.brand-name-swift span { color: var(--swift); }

.brand-logo {
  height: 40px;
  width: auto;
  display: block;
}

.back-link {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--text-muted); font-size: 14px; font-weight: 500;
}
.back-link:hover { color: var(--text); }
.back-mark {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--primary-50); color: var(--primary);
  display: grid; place-items: center;
}

/* ----------------- Landing ----------------- */
.shell {
  min-height: 80vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.card {
  width: 100%;
  max-width: 520px;
  background: linear-gradient(180deg, var(--bg-elev), var(--surface));
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 40px 36px;
  box-shadow: var(--shadow);
}

.logo { display: flex; align-items: center; gap: 10px; }

.logo-icon {
  width: 44px;
  height: 44px;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
}

.logo-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.logo .brand {
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: 20px;
  color: var(--text);
}

.logo.small .brand { font-size: 16px; }

.logo.small .logo-icon {
  width: 20px;
  height: 20px;
}

.flame {
  width: 18px; height: 18px;
  background: radial-gradient(circle at 50% 65%, #ffd28a, var(--orange) 55%, var(--orange-deep) 100%);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  box-shadow: 0 0 24px rgba(255,106,31,0.7);
  display: inline-block;
}
h1 {
  font-size: clamp(28px, 4vw, 38px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 28px 0 14px;
}
.lede { color: var(--muted); line-height: 1.6; margin: 0 0 28px; }
.primary {
  background: linear-gradient(180deg, var(--orange-bright), var(--orange-deep));
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 14px 22px;
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  box-shadow: 0 8px 24px -6px rgba(255,106,31,0.55);
  transition: transform 0.06s ease, filter 0.15s ease;
  width: 100%;
}
.primary.small { width: auto; padding: 10px 16px; font-size: 14px; }
.primary:hover { filter: brightness(1.08); }
.primary:active { transform: translateY(1px); }
.primary:disabled { opacity: 0.5; cursor: not-allowed; filter: grayscale(0.4); }

.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
}
.ghost:hover { border-color: var(--orange); color: var(--orange-bright); }
.ghost.danger:hover { border-color: var(--danger); color: var(--danger); }

.facts { list-style: none; padding: 0; margin: 26px 0 0; display: grid; gap: 10px; }
.facts li { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; }
.dot { width: 6px; height: 6px; background: var(--orange); border-radius: 50%; box-shadow: 0 0 10px var(--orange); }

.foot { text-align: center; margin-top: 22px; color: var(--muted); font-size: 12px; }

/* ----------------- Room ----------------- */
.room-body { min-height: 100vh; display: flex; }
.room-shell {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 18px 18px 0;
}
.room-header {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-wrap: wrap;
}
.room-meta { display: flex; align-items: center; gap: 10px; }
.status {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
}
.status.pending { color: var(--orange-bright); border-color: rgba(255,138,61,0.4); }
.status.connected { color: var(--ok); border-color: rgba(74,222,128,0.4); }
.status.ended { color: var(--danger); border-color: rgba(255,77,77,0.4); }
.timer {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--muted);
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
}
.timer.warn { color: var(--orange-bright); border-color: rgba(255,138,61,0.5); }
.timer.critical { color: var(--danger); border-color: rgba(255,77,77,0.5); }

.invite {
  margin: 16px 0 4px;
  padding: 14px;
  background: var(--bg-elev);
  border: 1px dashed rgba(255,106,31,0.45);
  border-radius: var(--radius);
}
.invite p { margin: 0 0 10px; color: var(--muted); font-size: 14px; }
.invite-row { display: flex; gap: 8px; }
.invite-row input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
.hidden { display: none !important; }

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 4px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.msg {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 16px;
  line-height: 1.4;
  font-size: 15px;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  animation: pop 0.18s ease-out;
}
@keyframes pop { from { transform: translateY(4px); opacity: 0; } to { transform: none; opacity: 1; } }
.msg.me {
  align-self: flex-end;
  background: linear-gradient(180deg, var(--orange-bright), var(--orange-deep));
  color: #fff;
  border-bottom-right-radius: 4px;
}
.msg.them {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.msg.system {
  align-self: center;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-style: italic;
  padding: 4px 10px;
  max-width: 90%;
  text-align: center;
}

.composer {
  display: flex;
  gap: 10px;
  padding: 12px 0 18px;
  position: sticky;
  bottom: 0;
  background: linear-gradient(180deg, transparent, var(--bg) 30%);
}
.composer input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s ease;
}
.composer input:focus { border-color: var(--orange); }
.composer input:disabled { opacity: 0.6; }
.composer .primary { width: auto; padding: 0 22px; }
