:root {
  color-scheme: light;
  --ink: #241910;
  --muted: #6b5848;
  --paper: #f6f0e6;
  --card: #fffaf3;
  --line: #e4d5c3;
  --copper: #8d3d22;
  --copper-deep: #6e2e18;
  --note: #f3e0c4;
  --good: #1f6b45;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, #f3d7b5, transparent 36%),
    var(--paper);
}

button, input, select { font: inherit; color: inherit; }

#entry {
  width: min(640px, calc(100% - 32px));
  margin: 48px auto;
  padding: 32px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 20px 50px rgb(36 25 16 / 8%);
}

.eyebrow {
  margin: 0 0 8px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.75rem;
  color: var(--copper);
}

h1 { margin: 0 0 12px; font-family: Palatino, "Iowan Old Style", Georgia, serif; font-size: 2.4rem; font-weight: 600; }

.lede, .hint, .endpoint { color: var(--muted); line-height: 1.5; }

.note {
  margin: 16px 0;
  padding: 12px 14px;
  background: var(--note);
  border-radius: 12px;
  color: var(--ink);
}

form { display: grid; gap: 8px; }

label { font-size: 0.92rem; }

input, select {
  width: 100%;
  margin-top: 4px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
}

.pair, .link-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: end; }

.link-row input { margin-top: 0; }

button {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  background: var(--copper);
  color: white;
  cursor: pointer;
}

button:hover { background: var(--copper-deep); }

button[aria-pressed="true"] { background: var(--ink); }

button:disabled { cursor: not-allowed; opacity: 0.45; }

#join-form button { margin-top: 8px; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.actions form { margin: 0; }

.meter {
  height: 28px;
  background: #e4d5c3;
  border-radius: 999px;
  overflow: hidden;
}

.meter > span {
  display: block;
  height: 100%;
  width: 0%;
  background: #1f6b45;
}

#mic-preview {
  width: min(100%, 420px);
  height: 240px;
  object-fit: cover;
  background: #2b211b;
  border-radius: 18px;
}

#room {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px 20px 16px;
}

.room-bar, .controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modes, .controls { display: flex; gap: 8px; align-items: end; }

.modes button { background: transparent; color: var(--ink); border: 1px solid var(--line); }

.modes button[aria-pressed="true"] {
  background: var(--ink);
  color: white;
  border-color: var(--ink);
}

#stage {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  align-content: start;
}

.tile {
  position: relative;
  min-height: 220px;
  overflow: hidden;
  border-radius: 18px;
  background: #2b211b;
  border: 2px solid transparent;
}

.tile.speaking { border-color: var(--copper); }

.tile .avatar {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #f6f0e6;
  font-family: Palatino, "Iowan Old Style", Georgia, serif;
  font-size: 4rem;
}

.tile video {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 220px;
  object-fit: cover;
  background: transparent;
}

.tile p {
  position: absolute;
  z-index: 2;
  left: 12px;
  bottom: 12px;
  margin: 0;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgb(255 250 243 / 92%);
  font-size: 0.9rem;
}

#talk { min-width: 160px; font-weight: 650; }

#speech-status { flex-basis: 100%; min-height: 1.4em; margin: 0; color: var(--muted); }

.controls label { font-size: 0.85rem; }

.controls select { min-width: 180px; }

@media (max-width: 700px) {
  #entry { margin: 16px auto; padding: 20px; }
  h1 { font-size: 2rem; }
  .pair, .room-bar, .controls { grid-template-columns: 1fr; display: grid; }
  .controls select, #talk, #claim-speaker, .modes button { width: 100%; }
}
