/* ===== Tokens: Jessie Calm brand ===== */
:root {
  --bg: #050505;
  --surface: #0f0f0f;
  --surface-2: #17140c;
  --text: #e0e0e0;
  --text-strong: #f5f1e6;
  --muted: #a8a8a8;
  --gold: #d4af37;
  --gold-light: #e0cb70;
  --gold-dark: #967b27;
  --gold-soft: rgba(212, 175, 55, 0.14);
  --line: rgba(212, 175, 55, 0.22);
  --line-strong: rgba(212, 175, 55, 0.55);
  --danger: #e58a7b;
  --danger-soft: rgba(229, 138, 123, 0.12);

  --serif: "Playfair Display", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Fira Code", ui-monospace, Menlo, Consolas, monospace;

  --font-body: clamp(1rem, 0.95rem + 0.2vw, 1.1rem);
  --font-small: clamp(0.85rem, 0.82rem + 0.12vw, 0.92rem);
  --space: clamp(0.75rem, 2.2vw, 1.5rem);
  --radius: 0.75rem;
  --tap: 2.75rem;
}

/* ===== Base ===== */
[hidden] { display: none !important; }
*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  min-block-size: 100dvh;
  display: flex;
  flex-direction: column;
  background: radial-gradient(ellipse at 85% 0%, rgba(212, 175, 55, 0.12), transparent 55%), var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: var(--font-body);
  line-height: 1.5;
}
h1, h2, h3, p, ol, ul { margin: 0; }
ol, ul { padding: 0; list-style: none; }
h2, h3 { font-family: var(--serif); color: var(--text-strong); line-height: 1.2; }
h2 { font-size: clamp(1.3rem, 1.1rem + 0.9vw, 1.7rem); }
h3 { font-size: 1.1rem; }
p, li { overflow-wrap: anywhere; }
:focus-visible { outline: 3px solid var(--gold-light); outline-offset: 2px; }
.muted { color: var(--muted); }
.sr-only { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ===== Top bar ===== */
.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem var(--space);
  padding: 0.75rem var(--space);
  border-block-end: 1px solid var(--line);
}
.top__brand { display: flex; align-items: center; gap: 0.75rem; min-inline-size: 0; }
.mark { display: grid; place-items: center; flex: none; inline-size: 2.5rem; aspect-ratio: 1; border: 1px solid var(--line-strong); border-radius: 0.6rem; font-family: var(--serif); font-weight: 700; color: var(--gold); }
.top__title { font-family: var(--serif); font-size: clamp(1.1rem, 1rem + 0.6vw, 1.4rem); line-height: 1.2; color: var(--text-strong); }
.top__event { font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.12em; color: var(--gold); }
.status { padding: 0.25rem 0.75rem; border: 1px solid var(--line); border-radius: 999rem; font-family: var(--mono); font-size: var(--font-small); color: var(--gold-light); }

/* ===== Layout ===== */
.stage { flex: 1; display: flex; flex-direction: column; inline-size: min(100% - 2 * var(--space), 48rem); margin-inline: auto; padding-block: var(--space); min-block-size: 0; }
.host .stage { inline-size: min(100% - 2 * var(--space), 80rem); }
.panel { display: grid; gap: var(--space); align-content: start; padding: var(--space); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }

/* ===== Forms and buttons ===== */
.join { display: flex; flex-wrap: wrap; align-items: end; gap: 0.75rem; }
.join .field { flex: 1 1 14rem; }
.field { display: grid; gap: 0.35rem; }
.field__label { font-size: var(--font-small); font-weight: 600; color: var(--text-strong); }
input, select, textarea {
  inline-size: 100%;
  min-block-size: var(--tap);
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--line-strong);
  border-radius: 0.6rem;
  background: var(--bg);
  color: var(--text-strong);
  font: inherit;
}
textarea { resize: vertical; min-block-size: 3.5rem; max-block-size: 40dvh; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-block-size: var(--tap);
  padding: 0.5rem 1.1rem;
  border: 1px solid var(--line-strong);
  border-radius: 999rem;
  background: transparent;
  color: var(--text-strong);
  font: 600 var(--font-small) var(--sans);
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { border-color: var(--gold-light); }
.btn--primary { background: var(--gold); border-color: var(--gold); color: var(--bg); }
.btn--primary:hover { background: var(--gold-light); }
.btn--danger { border-color: var(--danger); color: var(--danger); }
.btn--danger:hover { background: var(--danger-soft); }
.btn--small { min-block-size: var(--tap); padding-inline: 0.8rem; font-size: 0.8rem; }
.error { min-block-size: 1.2em; color: var(--danger); font-size: var(--font-small); }

/* ===== Chat ===== */
.chat { flex: 1; display: flex; flex-direction: column; gap: 0.75rem; min-block-size: 0; }
.msgs {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-block-size: 12rem;
  max-block-size: calc(100dvh - 15rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0.25rem;
}
.empty { text-align: center; padding-block: 1rem; }
.msg { display: grid; gap: 0.2rem; padding: 0.7rem 0.9rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.msg--mine { border-color: var(--line-strong); background: var(--surface-2); }
.msg--host { border-color: var(--gold); background: var(--gold-soft); }
.msg__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 0.6rem; }
.msg__name { font-weight: 700; color: var(--text-strong); }
.msg--host .msg__name { color: var(--gold-light); }
.msg__time { font-family: var(--mono); font-size: 0.75rem; color: var(--muted); }
.msg__text { white-space: pre-wrap; }
.msg__link { color: var(--gold-light); text-underline-offset: 0.15em; word-break: break-all; }
.msg__tools { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-block-start: 0.3rem; }

.composer { display: grid; gap: 0.5rem; position: sticky; inset-block-end: 0; padding-block: 0.5rem calc(0.5rem + env(safe-area-inset-bottom)); background: var(--bg); }
.composer__row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; }
.composer__info { font-family: var(--mono); font-size: 0.8rem; color: var(--muted); }

/* ===== Host ===== */
.host-grid { display: grid; gap: var(--space); grid-template-columns: minmax(0, 1fr); flex: 1; min-block-size: 0; }
@media (min-width: 60rem) { .host-grid { grid-template-columns: minmax(0, 22rem) minmax(0, 1fr); } }
.controls { align-self: start; }
.controls__row { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.room-state { font-weight: 600; color: var(--gold-light); }
.links { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.danger { display: grid; gap: 0.5rem; padding: 0.9rem; border: 1px solid var(--danger); border-radius: var(--radius); background: var(--danger-soft); }
.people-title { font-size: 1.15rem; }
.people { display: grid; gap: 0.4rem; max-block-size: 40dvh; overflow-y: auto; }
.person { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.3rem 0.3rem 0.3rem 0.7rem; border: 1px solid var(--line); border-radius: 0.6rem; }
.person__name { min-inline-size: 0; overflow-wrap: anywhere; }

.confirm { inline-size: min(100% - 2rem, 28rem); padding: var(--space); border: 1px solid var(--danger); border-radius: var(--radius); background: var(--surface); color: var(--text); }
.confirm form { display: grid; gap: var(--space); }
.confirm::backdrop { background: rgba(0, 0, 0, 0.7); }

/* ===== Projector ===== */
.screen { flex-direction: row; block-size: 100dvh; overflow: hidden; font-size: clamp(1.1rem, 0.6rem + 1.1vw, 2rem); }
.screen__side {
  flex: 0 0 clamp(16rem, 26vw, 30rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1.5rem;
  padding: clamp(1.5rem, 3vw, 3rem);
  border-inline-end: 1px solid var(--line);
}
.screen .top__title { font-size: clamp(1.5rem, 1rem + 1.4vw, 2.6rem); }
.screen__qr { inline-size: 100%; max-inline-size: 22rem; block-size: auto; aspect-ratio: 1; border-radius: var(--radius); background: #f5f1e6; }
.screen__url { font-family: var(--mono); color: var(--gold-light); overflow-wrap: anywhere; }
.screen__people { font-weight: 700; color: var(--text-strong); }
.screen__note { font-size: 0.7em; }
.screen__main { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; min-inline-size: 0; padding: clamp(1.5rem, 3vw, 3rem); overflow: hidden; }
.screen__closed { font-family: var(--serif); font-size: 1.6em; color: var(--text-strong); }
.msgs--screen { flex: 0 1 auto; max-block-size: none; overflow: hidden; gap: 0.8rem; justify-content: flex-end; }
.msgs--screen .msg { padding: 0.8rem 1.2rem; }
.msgs--screen .msg__time { font-size: 0.6em; }

@media (max-width: 48rem) {
  .screen { flex-direction: column; block-size: auto; overflow: auto; }
  .screen__side { flex-basis: auto; border-inline-end: 0; border-block-end: 1px solid var(--line); }
}

.screen .mark { inline-size: 3.2rem; font-size: 1.3rem; }
