:root {
  --bg: #0a0e13;
  --panel: #111823;
  --line: #1f2a38;
  --text: #e6edf5;
  --dim: #7d8da1;
  --accent: #34d399;
  --accent-dim: #1c6b4f;
  --danger: #f87171;
}

* { box-sizing: border-box; }

/* author display rules below would otherwise beat the [hidden] attribute */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(60rem 40rem at 50% -10%, #10202b 0%, transparent 60%),
    var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
  gap: 24px;
}

/* ── join ─────────────────────────────────────────────── */

.join { justify-content: center; text-align: center; max-width: 360px; margin: 0 auto; }

.join h1 { font-size: 44px; letter-spacing: .28em; margin: 0; font-weight: 700; }
.join h1 span { color: var(--accent); }
.sub { color: var(--dim); margin: -16px 0 4px; }

#joinForm { width: 100%; display: grid; gap: 14px; text-align: left; }
#joinForm label { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--dim); display: grid; gap: 6px; }

input {
  width: 100%;
  padding: 13px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font: inherit;
  outline: none;
}
input:focus { border-color: var(--accent-dim); }

.primary {
  margin-top: 4px;
  padding: 14px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: #04120c;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.primary:active { transform: translateY(1px); }

.err { color: var(--danger); font-size: 13px; margin: 0; }

/* ── app ──────────────────────────────────────────────── */

.app { width: 100%; max-width: 420px; margin: 0 auto; }

header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.pill {
  font-size: 12px;
  letter-spacing: .06em;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pill.on { color: var(--accent); border-color: var(--accent-dim); }
.pill.off { color: var(--danger); }

.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  width: 100%;
  min-height: 340px;
}

.status { margin: 0; color: var(--dim); font-size: 14px; letter-spacing: .02em; min-height: 1.5em; }
.status.live { color: var(--accent); }
.status.busy { color: var(--danger); }

.ptt {
  --size: min(62vw, 230px);
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  border: 1px solid #253444;
  background:
    radial-gradient(circle at 40% 30%, #1b2735 0%, #121a24 55%, #0d141c 100%);
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  box-shadow:
    0 0 0 10px rgba(255, 255, 255, .015),
    0 24px 60px rgba(0, 0, 0, .55),
    inset 0 1px 0 rgba(255, 255, 255, .06);
  transition: transform .08s ease, box-shadow .2s ease, background .2s ease;
}
.ptt .icon svg { width: 46px; height: 46px; opacity: .85; }
.ptt .label { font-size: 10px; letter-spacing: .22em; color: var(--dim); text-align: center; }

.ptt.talking {
  background: radial-gradient(circle at 40% 30%, #1d5c45 0%, #14402f 55%, #0d2a20 100%);
  border-color: var(--accent-dim);
  box-shadow:
    0 0 0 10px rgba(52, 211, 153, .07),
    0 0 60px rgba(52, 211, 153, .35),
    inset 0 1px 0 rgba(255, 255, 255, .08);
}
.ptt.talking .icon svg { opacity: 1; color: var(--accent); }
.ptt.talking .label { color: var(--accent); }

.ptt.busy {
  border-color: #6b2a2a;
  background: radial-gradient(circle at 40% 30%, #3a1b1b 0%, #241010 55%, #170b0b 100%);
  animation: shake .3s ease;
}
@keyframes shake {
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.hint { margin: 0; color: #4d5b6d; font-size: 12px; }
kbd {
  font: inherit;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.people { width: 100%; }
.people h2 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--dim);
  margin: 0 0 8px;
  font-weight: 600;
}
.people h2 span { color: var(--text); }

#roster { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
#roster li {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-size: 13px;
  color: var(--dim);
}
#roster li.me { color: var(--text); border-color: #2b3a4b; }
#roster li.talking { color: #04120c; background: var(--accent); border-color: var(--accent); font-weight: 600; }

.log {
  width: 100%;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 12px;
  color: #56657a;
  display: grid;
  gap: 2px;
  min-height: 3em;
}

/* ── fix-it popup ─────────────────────────────────────── */

.help {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: center;
  padding: 14px 14px calc(14px + env(safe-area-inset-bottom));
  z-index: 20;
  pointer-events: none;
}

/* On the join screen it belongs in the flow, under the form, not over it. */
.help.inline {
  position: static;
  padding: 0;
  width: 100%;
  pointer-events: auto;
}
.help.inline .help-card { box-shadow: none; }
.help-card {
  pointer-events: auto;
  width: 100%;
  max-width: 440px;
  background: #141c26;
  border: 1px solid #2b3a4b;
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .6);
  animation: rise .18s ease;
}
@keyframes rise {
  from { transform: translateY(14px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.help h3 {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--danger);
}
.help-body { color: var(--dim); font-size: 13px; text-align: left; }
.help-body p { margin: 0 0 8px; }
.help-body ol { margin: 0 0 14px; padding-left: 18px; display: grid; gap: 5px; }
.help-body b { color: var(--text); font-weight: 600; }
.help-body code {
  font-size: 12px;
  background: #0d141c;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 5px;
  word-break: break-all;
}
.ghost {
  background: none;
  border: 1px solid var(--line);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  padding: 7px 14px;
  border-radius: 9px;
  cursor: pointer;
}
.ghost:hover { border-color: #3a4a5c; }
