:root,
[data-theme="skog"] {
  --bg: #0e1412;
  --bg-elev: #161e1b;
  --bg-panel: #1c2623;
  --line: rgba(232, 220, 196, 0.1);
  --text: #f3ead8;
  --muted: #b7b09e;
  --pine: #2f6a57;
  --pine-bright: #3d8a70;
  --gold: #d4a574;
  --danger: #c45c4a;
  --btn-fg: #f7f3ea;
  --input-bg: #101714;
  --hero-bg: radial-gradient(900px 500px at -10% 0%, rgba(61, 138, 112, 0.28), transparent 50%),
    linear-gradient(180deg, #121a17 0%, #0e1412 70%);
  --room-bg: #0b100f;
  --topbar-bg: rgba(14, 20, 18, 0.92);
  --tile-bg: #121917;
  --video-bg: #0d1311;
  --avatar-from: #2a4038;
  --avatar-to: #121917;
  --ctrl-hover: #24332e;
  --live: #6fbf8a;
  --radius: 16px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  --btn-skew: 0deg;
}

[data-theme="nattbla"] {
  --bg: #0b0c0e;
  --bg-elev: #14161a;
  --bg-panel: #1a1d24;
  --line: rgba(52, 128, 200, 0.18);
  --text: #f4f7fb;
  --muted: #9aa8b8;
  --pine: #3480c8;
  --pine-bright: #4a94d8;
  --gold: #7eb6e8;
  --danger: #c45c4a;
  --btn-fg: #ffffff;
  --input-bg: #101318;
  --hero-bg: radial-gradient(900px 500px at -8% 0%, rgba(52, 128, 200, 0.28), transparent 52%),
    linear-gradient(180deg, #12151a 0%, #0b0c0e 72%);
  --room-bg: #08090b;
  --topbar-bg: rgba(11, 12, 14, 0.94);
  --tile-bg: #151820;
  --video-bg: #0c0e12;
  --avatar-from: #2a4a6a;
  --avatar-to: #151820;
  --ctrl-hover: #243044;
  --live: #5aa0dc;
  --radius: 14px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
  --btn-skew: 0deg;
}

[data-theme="frost"] {
  --bg: #e8eef5;
  --bg-elev: #ffffff;
  --bg-panel: #f4f7fb;
  --line: rgba(29, 29, 27, 0.12);
  --text: #1d1d1b;
  --muted: #5c6670;
  --pine: #3480c8;
  --pine-bright: #2a6eb0;
  --gold: #3480c8;
  --danger: #c45c4a;
  --btn-fg: #ffffff;
  --input-bg: #f4f7fb;
  --hero-bg: radial-gradient(900px 480px at -10% 0%, rgba(52, 128, 200, 0.18), transparent 50%),
    linear-gradient(180deg, #f4f8fc 0%, #d9e4f0 80%);
  --room-bg: #dce4ee;
  --topbar-bg: rgba(244, 247, 251, 0.94);
  --tile-bg: #cfd9e6;
  --video-bg: #b8c5d4;
  --avatar-from: #7eb6e8;
  --avatar-to: #3480c8;
  --ctrl-hover: #d5e3f2;
  --live: #2a6eb0;
  --radius: 16px;
  --shadow: 0 18px 40px rgba(29, 29, 27, 0.12);
  --btn-skew: 0deg;
}

[data-theme="signal"] {
  --bg: #111111;
  --bg-elev: #1a1a1a;
  --bg-panel: #222222;
  --line: rgba(52, 128, 200, 0.28);
  --text: #ffffff;
  --muted: #a8b0b8;
  --pine: #3480c8;
  --pine-bright: #5aa0dc;
  --gold: #3480c8;
  --danger: #c45c4a;
  --btn-fg: #ffffff;
  --input-bg: #161616;
  --hero-bg: linear-gradient(115deg, #0a0a0a 0%, #111111 42%, #16324c 100%);
  --room-bg: #0a0a0a;
  --topbar-bg: rgba(10, 10, 10, 0.94);
  --tile-bg: #1a1a1a;
  --video-bg: #0a0a0a;
  --avatar-from: #3480c8;
  --avatar-to: #1a1a1a;
  --ctrl-hover: #2a2a2a;
  --live: #4a94d8;
  --radius: 6px;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  --btn-skew: -12deg;
}

* { box-sizing: border-box; }

html, body, #app {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Instrument Sans", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  letter-spacing: -0.01em;
}

button, input { font-family: inherit; }
a { color: inherit; }

.home {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
}

.home-hero {
  padding: 64px 72px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--hero-bg);
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
}

.logo {
  height: 44px;
  width: auto;
  display: block;
}

.home-hero .logo {
  height: 72px;
}

.topbar .logo {
  height: 36px;
}

.hero-copy h1 {
  font-family: Newsreader, serif;
  font-size: clamp(42px, 5vw, 64px);
  font-weight: 500;
  line-height: 1.08;
  margin: 48px 0 16px;
  max-width: 22ch;
}

.hero-copy p {
  color: var(--muted);
  font-size: 18px;
  max-width: 38ch;
  line-height: 1.5;
}

.feature-row {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  color: var(--muted);
  font-size: 14px;
}

.home-panel {
  display: grid;
  place-items: center;
  padding: 40px;
}

.home-panel .card {
  width: min(480px, 100%);
}

.card {
  width: min(420px, 100%);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.card h2 { margin: 0 0 8px; font-size: 22px; }
.card .sub { color: var(--muted); margin: 0 0 24px; font-size: 14px; }

label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

input[type="text"],
input[type="password"],
input[type="number"],
.select {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 15px;
  outline: none;
}

input:focus { border-color: var(--pine-bright); }

.btn-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 18px;
}

.btn {
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary {
  background: var(--pine);
  color: var(--btn-fg);
  transform: skewX(var(--btn-skew));
}
.btn-primary:hover { background: var(--pine-bright); }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}

.split {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  margin: 16px 0;
}

.split::before, .split::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

.room {
  height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  display: grid;
  grid-template-rows: 56px minmax(0, 1fr) auto;
  background: var(--room-bg);
  position: relative;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: var(--topbar-bg);
}

.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pill {
  font-size: 12px;
  color: var(--muted);
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
}

.stage {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 0;
  overflow: hidden;
}

.stage.with-side { grid-template-columns: 1fr 340px; }

.main-col {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  height: 100%;
  overflow: hidden;
}

.screen-stage {
  display: none;
  position: relative;
  background: var(--video-bg);
  flex: 0 1 36%;
  max-height: min(36vh, 360px);
  min-height: 0;
  border-bottom: 1px solid var(--line);
}

.screen-stage.active { display: block; }

.screen-stage video,
.screen-stage img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--video-bg);
}

.screen-stage.mine #remote-screen { display: none; }
.screen-stage.theirs #local-screen { display: none; }

.share-picker {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.share-chip {
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg-elev) 88%, transparent);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
}

.share-chip.on {
  background: var(--pine);
  border-color: transparent;
}

.watch-btn {
  border: 1px solid var(--line);
  background: var(--bg-panel);
  color: var(--text);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}

.screen-label {
  position: absolute;
  left: 12px;
  bottom: 10px;
  font-size: 13px;
  background: rgba(8, 12, 11, 0.75);
  border-radius: 999px;
  padding: 6px 12px;
}

.grid {
  display: grid;
  gap: 12px;
  padding: 12px;
  min-height: 0;
  overflow: auto;
  flex: 1 1 0;
  width: 100%;
  align-content: stretch;
  justify-items: stretch;
}

.grid > * {
  min-width: 0;
  min-height: 0;
}

.grid.n1 {
  grid-template-columns: 1fr;
  grid-template-rows: minmax(0, 1fr);
}
.grid.n2 {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: minmax(0, 1fr);
}
.grid.n3,
.grid.n4 {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
}
.grid.n5,
.grid.n6 {
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
}

.tile {
  position: relative;
  background: var(--tile-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  width: 100%;
  height: 100%;
}

.tile video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--video-bg);
}

.tile.camera-off video { opacity: 0; }

.avatar {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  font-size: 42px;
  font-family: Newsreader, serif;
  background: radial-gradient(circle at 50% 40%, var(--avatar-from), var(--avatar-to));
}

.tile.camera-off .avatar { display: grid; }

.tile-meta {
  position: absolute;
  left: 10px;
  bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(8, 12, 11, 0.72);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 13px;
}

.icon-chip {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  background: var(--bg-panel);
}

.icon-chip.warn { background: var(--danger); }

.hand {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 22px;
}

.side {
  border-left: 1px solid var(--line);
  background: var(--bg-elev);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.tabs { display: flex; border-bottom: 1px solid var(--line); }

.tabs button {
  flex: 1;
  background: none;
  border: 0;
  color: var(--muted);
  padding: 12px;
  cursor: pointer;
}

.tabs button.active {
  color: var(--text);
  box-shadow: inset 0 -2px 0 var(--gold);
}

.chat-log {
  flex: 1;
  overflow: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.msg {
  background: var(--tile-bg);
  border-radius: 12px;
  padding: 8px 10px;
}

.msg b { font-size: 12px; color: var(--gold); }
.msg p { margin: 4px 0 0; font-size: 14px; }

.msg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.msg-del {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}

.msg-del:hover {
  color: var(--danger);
}

.chat-form {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--line);
}

.plist { padding: 12px; overflow: auto; }

.person small {
  color: var(--muted);
  font-size: 12px;
}

.live-dot {
  display: inline-block;
  color: var(--live);
  font-weight: 600;
  margin-right: 4px;
}

.limit-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: var(--muted);
  margin: 0;
}

.limit-input {
  width: 72px !important;
  padding: 8px 10px !important;
  font-size: 14px !important;
}

.person {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.controls {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  background: var(--bg-elev);
  z-index: 40;
}

.ctrl {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--bg-panel);
  color: var(--text);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 11px;
}

.ctrl:hover { background: var(--ctrl-hover); }
.ctrl.on { background: var(--pine); border-color: transparent; }
.ctrl.off { background: var(--danger); border-color: transparent; }
.ctrl.leave {
  background: var(--danger);
  width: auto;
  border-radius: 999px;
  padding: 0 16px;
  font-weight: 600;
  font-size: 13px;
}

.lobby {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

#add-user-panel {
  margin-bottom: 24px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  font-size: 13px;
  color: var(--muted);
}

.form-error {
  color: #f0b4a8;
  background: rgba(196, 92, 74, 0.15);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
  margin-bottom: 12px;
}

.select {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 15px;
}

.admin-page {
  padding: 40px 16px;
}

input[type="password"],
input[type="email"],
input[type="tel"],
select.select,
textarea {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 15px;
  outline: none;
  font-family: inherit;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.user-card {
  border-bottom: 1px solid var(--line);
}

.user-pick {
  cursor: pointer;
  flex: 1;
}

.user-card.selected {
  background: rgba(61, 138, 112, 0.1);
  border-radius: 12px;
  border-bottom: 0;
}

.person.meeting-row {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

.meeting-row .meeting-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 6px;
}

.meeting-pick {
  cursor: pointer;
  width: 100%;
}

.meeting-chat {
  padding: 0 8px 12px;
}

.meeting-chat-log {
  max-height: 240px;
  min-height: 80px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--input-bg);
}

.user-edit .btn-row {
  margin-top: 12px;
}

.reaction-float {
  position: absolute;
  left: 50%;
  bottom: 90px;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  pointer-events: none;
  z-index: 4;
}

.bubble {
  animation: rise 2.4s ease-out forwards;
  font-size: 28px;
}

@keyframes rise {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-80px); }
}

.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-panel);
  border: 1px solid var(--line);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  z-index: 10;
}

.theme-picker {
  margin-top: 28px;
}

.theme-picker p {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--muted);
}

.theme-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.theme-swatch {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.theme-swatch.active {
  background: var(--pine);
  color: var(--btn-fg);
  border-color: transparent;
}

[data-theme="signal"] .hero-copy h1 {
  font-style: italic;
  letter-spacing: -0.03em;
}

@media (max-width: 900px) {
  .home { grid-template-columns: 1fr; }
  .home-hero { padding: 32px 24px 24px; border-right: 0; }
  .stage.with-side { grid-template-columns: 1fr; }
  .side {
    position: absolute;
    inset: 56px 0 76px;
    z-index: 5;
  }
  .field-grid { grid-template-columns: 1fr; }
}
