:root {
  --bg: #14161c;
  --panel: #1e212a;
  --panel-2: #272b36;
  --text: #f2f4f8;
  --muted: #9aa3b5;
  --accent: #3ddc84;
  --accent-text: #0d1a12;
  --danger: #ef5350;
  --border: #323746;
  --radius: 18px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  -webkit-tap-highlight-color: transparent;
}

.screen {
  min-height: 100%;
  padding: 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
}

/* ---------- Login ---------- */
#login-screen { display: grid; place-items: center; }
.card {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.logo { font-size: 44px; text-align: center; }
h1 { font-size: 1.4rem; text-align: center; margin: 0 0 12px; }
label { font-size: 0.9rem; color: var(--muted); margin-top: 6px; }
input {
  font: inherit;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  width: 100%;
}
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.error { color: var(--danger); margin: 6px 0 0; text-align: center; }
.tip { color: var(--muted); font-size: 0.85rem; text-align: center; margin: 10px 0 0; }

/* ---------- Knapper ---------- */
.btn {
  font: inherit;
  font-weight: 600;
  border: 0;
  border-radius: 999px;
  padding: 12px 20px;
  cursor: pointer;
  color: var(--text);
  background: var(--panel-2);
}
.btn:disabled { opacity: 0.6; cursor: default; }
.btn.primary { background: var(--accent); color: var(--accent-text); margin-top: 14px; }
.btn.small { padding: 8px 14px; font-size: 0.9rem; }
.btn.danger { background: var(--danger); }
.btn:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

/* ---------- Rummet ---------- */
#room-screen {
  display: flex;
  flex-direction: column;
  max-width: 960px;
  margin: 0 auto;
}
.room-header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.room-header h2 { margin: 4px 0 12px; font-size: 1.3rem; }
.count { color: var(--muted); font-size: 0.95rem; }

.banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: #3a3220; border: 1px solid #6b5a2a; border-radius: 12px;
  padding: 10px 14px; margin-bottom: 12px;
}

.tiles {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  align-content: start;
}
.tile {
  background: var(--panel);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 12px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: border-color 0.12s, box-shadow 0.12s;
  min-width: 0;
}
.tile.speaking {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(61, 220, 132, 0.25);
}
.avatar {
  width: 64px; height: 64px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 1.6rem; font-weight: 700;
  color: #fff;
}
.tile-name {
  font-weight: 600;
  max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tile-status { font-size: 0.8rem; color: var(--muted); min-height: 1.1em; }
.tile.is-muted .tile-status { color: var(--danger); }
.volume { width: 100%; accent-color: var(--accent); }

.controls {
  position: sticky;
  bottom: 0;
  display: flex; justify-content: center; gap: 12px;
  padding: 16px 0 4px;
  background: linear-gradient(transparent, var(--bg) 30%);
}
.control { display: flex; align-items: center; gap: 8px; padding: 14px 22px; }
#mute-btn[aria-pressed="true"] { background: var(--danger); }
.icon { font-size: 1.2rem; }

@media (max-width: 420px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .control .label { font-size: 0.95rem; }
}
