:root {
  color-scheme: light dark;
  --ink: #16181d;
  --paper: #f6f7f9;
  --card: #ffffff;
  --line: #d8dbe1;
  --muted: #6a707c;
  --accent: #2a6df4;
  --bad: #c02236;
  --good: #1a7f37;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e8eaee;
    --paper: #14161a;
    --card: #1c1f25;
    --line: #333842;
    --muted: #969ca8;
    --accent: #5b93ff;
    --bad: #ff8095;
    --good: #63d089;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* MARK: connect screen */

#connect {
  max-width: 34rem;
  margin: 0 auto;
  padding: 3rem 1.25rem 4rem;
}

header h1 { font-size: 1.6rem; margin: 0 0 .25rem; letter-spacing: -.01em; }
.subtitle { color: var(--muted); margin: 0 0 2rem; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}
.card.quiet { background: transparent; }
.card h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .07em;
           color: var(--muted); margin: 0 0 .9rem; }

label { display: block; font-weight: 600; font-size: .85rem; margin-bottom: .3rem; }

input {
  width: 100%;
  padding: .6rem .7rem;
  font: inherit;
  color: inherit;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
}
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }

#hostId {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.35rem;
  letter-spacing: .12em;
  text-align: center;
}

.hint { color: var(--muted); font-size: .82rem; margin: .35rem 0 1.1rem; line-height: 1.45; }

button {
  font: inherit;
  font-weight: 600;
  padding: .55rem 1rem;
  border-radius: 8px;
  border: 1px solid transparent;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}
button:disabled { opacity: .5; cursor: default; }
button.secondary { background: transparent; color: inherit; border-color: var(--line); }
button.secondary:hover:not(:disabled) { border-color: var(--muted); }
#pairButton { width: 100%; padding: .7rem; margin-top: .3rem; }

.status { min-height: 1.4em; font-size: .87rem; margin: .8rem 0 0; }
.status.error { color: var(--bad); }
.status.good { color: var(--good); }

.hosts { list-style: none; margin: 0; padding: 0; }
.hosts li {
  display: flex; align-items: center; gap: .7rem;
  padding: .6rem 0; border-bottom: 1px solid var(--line);
}
.hosts li:last-child { border-bottom: 0; }
.hosts .dot { width: .55rem; height: .55rem; border-radius: 50%; background: var(--muted); flex: none; }
.hosts .dot.online { background: var(--good); }
.hosts .who { flex: 1; min-width: 0; }
.hosts .who b { display: block; font-weight: 600; }
.hosts .who span { color: var(--muted); font-size: .8rem; }

footer { margin-top: 2rem; }

/* MARK: session screen */

#session { display: flex; flex-direction: column; height: 100vh; }

.stage {
  position: relative;
  flex: 1;
  min-height: 0;
  background: #000;
}

video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  cursor: none;
  outline: none;
}
video.showCursor { cursor: default; }

.waiting {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1rem; color: #cfd3da; background: #000;
}
#waitingDetail {
  font-size: .72rem; opacity: .6; margin: 0; text-align: center; line-height: 1.7;
  max-width: 30rem;
}

.spinner {
  width: 2rem; height: 2rem; border-radius: 50%;
  border: 2px solid #ffffff30; border-top-color: #fff;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.bar {
  display: flex; align-items: center; gap: .6rem;
  padding: .5rem .75rem;
  background: var(--card);
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}
.bar .name { font-weight: 600; }
.bar .stats { color: var(--muted); font-size: .78rem; }
.bar .spacer { flex: 1; }
.bar button { padding: .4rem .7rem; font-size: .85rem; }

.chords { display: flex; gap: .35rem; }
.chords button {
  background: transparent; color: inherit; border-color: var(--line);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .78rem;
  padding: .35rem .55rem;
}

#sessionMessage { padding: 0 .75rem .5rem; margin: 0; }

@media (max-width: 40rem) {
  .bar .stats { width: 100%; order: 10; }
}
