body.phone {
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.screen { position: fixed; inset: 0; padding: max(16px, env(safe-area-inset-top)) 20px max(16px, env(safe-area-inset-bottom)); }
.muted { color: var(--muted); }
.fine { color: var(--faint); font-size: 0.85rem; text-align: center; line-height: 1.5; margin: 0; }

/* ── Join ──────────────────────────────────────────────────────────────── */
.join { display: flex; flex-direction: column; justify-content: center; gap: 28px; max-width: 460px; margin: 0 auto; }
.join-brand { text-align: center; display: grid; gap: 8px; justify-items: center; }
.join-brand h1 { margin: 0; line-height: 0; }
.join-logo { width: min(68vw, 280px); height: auto; display: block; filter: drop-shadow(0 8px 22px rgba(0, 0, 0, 0.4)); }
.join-brand p { margin: 0; line-height: 1.45; }
#join-form { display: grid; gap: 14px; }
#join-form label { display: grid; gap: 6px; font-weight: 700; color: var(--muted); }
#join-form input { width: 100%; min-width: 0; font-size: 1.4rem; padding: 14px 16px; border-radius: 20px; border-width: 3px; font-weight: 800; -webkit-user-select: text; user-select: text; box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.3); }
#code { letter-spacing: 0.3em; text-transform: uppercase; text-align: center; font-size: 2rem !important; }
.err { color: var(--bad); font-weight: 700; margin: 0; min-height: 1.2em; text-align: center; }

/* ── Main ──────────────────────────────────────────────────────────────── */
.main { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.main::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 45%, var(--flash, transparent), transparent 70%);
  opacity: 0;
  pointer-events: none;
}
.main.flash::before { animation: flash 0.5s ease-out; }
@keyframes flash { from { opacity: 0.85; } to { opacity: 0; } }

.bar { width: 100%; display: flex; align-items: center; gap: 10px; font-weight: 800; position: relative; z-index: 2; }
.bar-room { color: var(--accent); letter-spacing: 0.1em; }
.bar-name { flex: 1; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn { width: 46px; height: 46px; padding: 0; display: grid; place-items: center; }
.icon-btn img { width: 30px; height: 30px; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.4)); }

.status { min-height: 1.5em; font-weight: 800; font-size: 1.15rem; text-align: center; position: relative; z-index: 2; }

.bell-area { flex: 1; width: 100%; display: grid; place-items: center; position: relative; touch-action: none; cursor: pointer; }
.bell {
  --c: #6a6f8f;
  --ink: #fff;
  width: min(74vw, 46dvh);
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 2px;
  background: radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.55), transparent 42%), var(--c);
  color: var(--ink);
  border: 5px solid var(--outline);
  box-shadow: 0 0 0 8px rgba(255, 255, 255, 0.07), 0 8px 0 var(--outline), 0 30px 80px -10px var(--c), inset 0 -14px 40px rgba(0, 0, 0, 0.25), inset 0 6px 0 rgba(255, 255, 255, 0.25);
  transition: background-color 0.2s, box-shadow 0.2s;
  position: relative;
  z-index: 1;
}
.bell.ring { animation: ding 0.32s cubic-bezier(0.3, 1.8, 0.4, 1); }
.bell.holding { animation: wobble 0.35s ease-in-out infinite; }
@keyframes ding { 0% { transform: scale(1.12) rotate(-4deg); } 100% { transform: scale(1) rotate(0); } }
@keyframes wobble { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }
.bell-label { font-size: clamp(3.2rem, 20vw, 7.5rem); font-weight: 900; line-height: 1; letter-spacing: -0.02em; text-shadow: 0 4px 0 rgba(13, 3, 23, 0.35); }
.bell-sub { font-weight: 800; opacity: 0.75; font-size: 1rem; min-height: 1.2em; }
.approach {
  position: absolute;
  width: min(74vw, 46dvh);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 6px solid var(--ac, #fff);
  opacity: 0;
  pointer-events: none;
}

.chips-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; min-height: 2.2em; position: relative; z-index: 2; }
.chips-row .chip { font-size: 1.15rem; padding: 6px 14px; border-width: 3px; cursor: pointer; }
.chips-row .chip.on { border-color: #fff; transform: scale(1.08); }
.hint { color: var(--muted); font-weight: 700; text-align: center; min-height: 1.4em; position: relative; z-index: 2; }
.hint.loud { color: var(--accent); font-size: 1.2rem; }

.my-results { width: 100%; max-width: 440px; text-align: center; position: relative; z-index: 2; background: linear-gradient(180deg, var(--panel-top), var(--panel-bot)); border: 3px solid var(--edge); border-radius: 24px; padding: 14px; box-shadow: 0 5px 0 var(--outline); }
.my-results .big { font-size: 2.8rem; font-weight: 900; line-height: 1.05; }
.my-results .line { color: var(--muted); margin-top: 6px; }
.my-results .awards { display: flex; gap: 4px; justify-content: center; flex-wrap: wrap; margin-top: 8px; }
.lead .awards { display: flex; gap: 4px; flex-wrap: wrap; }
.award-img { width: 96px; height: 96px; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.35)); animation: award-pop 0.5s cubic-bezier(0.3, 0.7, 0.4, 1) both; }
.lead .award-img { width: 72px; height: 72px; }
@keyframes award-pop { 0% { opacity: 0; transform: scale(0) rotate(-20deg); } 55% { opacity: 1; transform: scale(1.15) rotate(6deg); } 100% { transform: none; } }

.meter { width: min(80vw, 360px); height: 10px; border-radius: 99px; background: rgba(10, 2, 20, 0.55); border: 2px solid var(--outline); position: relative; overflow: hidden; }
.meter-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent-2), var(--accent)); border-radius: 99px; }
.meter-mark { position: absolute; top: 0; bottom: 0; left: 62.5%; width: 2px; background: rgba(255, 255, 255, 0.6); }

.banner {
  width: 100%;
  max-width: 460px;
  background: linear-gradient(180deg, var(--panel-top), var(--panel-bot));
  border: 3px solid var(--bad);
  color: var(--text);
  border-radius: 20px;
  box-shadow: 0 5px 0 var(--outline);
  padding: 12px 14px;
  font-weight: 700;
  text-align: center;
  z-index: 5;
}

/* ── Host's controls (the first player's phone, between songs) ────────── */
.who-leads { color: var(--muted); font-weight: 700; text-align: center; min-height: 1.2em; margin-top: -6px; position: relative; z-index: 2; }
.who-leads b { color: var(--accent); }
.main.leading > .status,
.main.leading > .who-leads,
.main.leading > .bell-area,
.main.leading > .chips-row,
.main.leading > .hint,
.main.leading > .my-results,
.main.leading > .meter { display: none; }
.lead {
  flex: 1;
  min-height: 0;
  width: calc(100% + 40px);
  margin: 0 -20px;
  padding: 2px 20px max(16px, env(safe-area-inset-bottom));
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  z-index: 2;
}
.lead > * { width: 100%; max-width: 520px; margin: 0 auto; flex: none; }
.lead-card { background: linear-gradient(180deg, var(--panel-top), var(--panel-bot)); border: 3px solid var(--edge); border-radius: 24px; padding: 16px; display: grid; gap: 10px; box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.08), 0 5px 0 var(--outline); }
.lead-card h3, .lead-card summary { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 800; display: flex; align-items: center; gap: 8px; }
.lead-card summary { cursor: pointer; list-style: none; }
.lead-card summary::-webkit-details-marker { display: none; }
.lead-card summary::after { content: '▸'; margin-left: auto; font-size: 1rem; transition: transform 0.15s; }
.lead-card[open] summary::after { transform: rotate(90deg); }
.lead-card[open] summary { margin-bottom: 4px; }
.lead-kicker { color: var(--accent); font-weight: 900; font-size: 0.9rem; }
.lead-title { font-size: 1.6rem; line-height: 1.15; }
.lead-credit { color: var(--muted); font-style: italic; margin-top: -4px; }
.lead-now .muted { margin: 0; font-weight: 600; }
.lead-now small.muted { font-size: 0.85rem; }
.lead-mine { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--muted); font-weight: 700; }
.lead-mine .chip { font-size: 1rem; padding: 4px 11px; }
.lead-mine.counted { gap: 14px 20px; padding: 8px 10px 0 0; }
.lead-mine .btn { margin-left: auto; padding: 7px 12px; }
.lead-now .btn.big { width: 100%; }
.lead-score { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; color: var(--muted); font-weight: 700; }
.lead-score b { font-size: 2.6rem; color: var(--accent); line-height: 1; }
.lead-tip { background: rgba(10, 2, 20, 0.35); border-radius: 18px; padding: 10px 12px; color: var(--muted); line-height: 1.4; display: grid; gap: 8px; }
.warn { color: var(--bad); font-weight: 700; margin: 0; }
#song-search { width: 100%; font-size: 1rem; padding: 11px 14px; border-radius: 12px; -webkit-user-select: text; user-select: text; }
.lead-songs { display: grid; gap: 6px; }
.song-filter button.on { background: var(--accent-grad); color: var(--accent-ink); box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.9), 0 2px 0 var(--outline); }
.lead-song { text-align: left; padding: 11px 13px; border-radius: 18px; border: 2px solid rgba(255, 255, 255, 0.08); background: rgba(255, 255, 255, 0.045); color: var(--text); font: inherit; cursor: pointer; }
.lead-song.on { border-color: var(--accent); background: rgba(0, 204, 233, 0.14); box-shadow: 0 0 0 1px var(--accent) inset, 0 4px 0 var(--outline); }
.lead-song b { display: block; line-height: 1.25; }
.lead-pack-head { margin: 8px 2px 0; font-size: 0.74rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.lead-pack-head:first-child { margin-top: 0; }
.song-pack { width: 100%; }
.lead-song small { color: var(--muted); font-size: 0.82rem; }
.lead-song:disabled { opacity: 0.5; }
/* bellswithfriends.com: songs in a pack nobody in the room owns, and the account line in Settings */
.lead-song.locked { opacity: 0.55; border-style: dashed; }
.lock-note { margin-left: 6px; letter-spacing: 0.02em; text-transform: none; font-weight: 800; color: var(--accent); text-decoration: none; }
.account-row { display: grid; gap: 4px; padding: 12px 14px; border-radius: 18px; background: rgba(255, 255, 255, 0.05); color: var(--muted); line-height: 1.4; }
.account-row b { color: var(--text); overflow-wrap: anywhere; }
.account-row a { color: var(--accent); font-weight: 800; }
.lead-opts { display: grid; gap: 14px; }
.lead-opts label { display: grid; gap: 6px; font-weight: 700; color: var(--muted); }
.lead-opts label small { font-weight: 500; font-size: 0.8rem; }
.lead-opts label.check { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 600; }
.lead-opts label.check input { flex: none; width: 22px; height: 22px; margin: 0; }
.lead-opts select { font-size: 1rem; width: 100%; padding: 10px 12px; }
.range { display: flex; align-items: center; gap: 10px; }
.range input { flex: 1; min-width: 0; }
.range output { color: var(--text); min-width: 4.2em; text-align: right; font-variant-numeric: tabular-nums; }
.lead-track { display: grid; gap: 6px; padding: 10px 12px; border-radius: 18px; background: rgba(10, 2, 20, 0.3); margin-bottom: 6px; }
.lead-track b { display: block; }
.lead-track small { color: var(--muted); font-weight: 500; }
.seg { display: flex; gap: 2px; background: rgba(10, 2, 20, 0.55); border: 3px solid var(--outline); border-radius: 999px; padding: 3px; box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.35); }
.seg button { flex: 1; border: 0; background: none; color: var(--muted); font: inherit; font-size: 0.9rem; font-weight: 800; padding: 8px 6px; border-radius: 999px; cursor: pointer; }
.seg button.on { background: linear-gradient(180deg, #6c3aa0, #47207a); color: var(--text); box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.24), 0 2px 0 var(--outline); }
.seg button.on[data-role='bells'], .seg.mode-seg button.on { background: var(--accent-grad); color: var(--accent-ink); box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.9), 0 2px 0 var(--outline); }
.seg.mode-seg button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; line-height: 1.15; }
.mode-icon { width: 26px; height: 26px; flex: none; margin: -4px 0; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35)); }

/* Real bells: the phone isn't a bell, just the remote (or nothing) */
.main.real-bells > .bell-area,
.main.real-bells > .chips-row,
.main.real-bells > .meter { display: none; }
.main.real-bells:not(.leading) > .hint { flex: 1; display: grid; place-items: center; text-align: center; font-size: 1.25rem; line-height: 1.45; padding: 0 12px; }
.count { background: var(--accent-grad); color: var(--accent-ink); border: 2px solid var(--outline); border-radius: 999px; padding: 0 9px; font-size: 0.85rem; letter-spacing: 0; }
.lead-players { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.lead-players li { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 18px; background: rgba(255, 255, 255, 0.05); }
.lead-players li.offline { opacity: 0.5; }
.lead-players .pname { flex: 1; min-width: 0; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lead-players .chips { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.lead-players em { color: var(--faint); font-style: normal; font-size: 0.85rem; }
.lead-players .kick { background: none; border: 0; color: var(--faint); font-size: 1rem; padding: 4px 6px; cursor: pointer; }
.lead.results-mode .lead-lobby-only { display: none; }
.lead:not(.bells-mode) .lead-bells-only { display: none; }
.lead-bells-note { margin: 0; color: var(--muted); font-size: 0.9rem; line-height: 1.4; }
.lead-bells-note .robot { width: 24px; height: 24px; vertical-align: -0.45em; }
#lo-bells .bell-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 11px 5px; }
#lo-bells .bell-pick { font-size: 0.82rem; padding: 8px 0; }
.lead-robot .robot { width: 30px; height: 30px; margin: -4px -2px -4px -4px; }

/* ── Settings sheet ────────────────────────────────────────────────────── */
.sheet { position: fixed; inset: 0; background: rgba(10, 2, 20, 0.6); display: flex; align-items: flex-end; z-index: 10; }
.sheet-card {
  width: 100%;
  background: linear-gradient(180deg, var(--panel-top), var(--panel-bot));
  border: 3px solid var(--edge);
  border-bottom: 0;
  border-radius: 30px 30px 0 0;
  padding: 22px 20px max(22px, env(safe-area-inset-bottom));
  display: grid;
  gap: 16px;
  max-height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
}
.sheet-card label { display: grid; gap: 8px; font-weight: 700; }
.sheet-card input[type='range'] { width: 100%; }
.row { display: flex; gap: 10px; }
.row > .btn { flex: 1; }
.row.between { justify-content: space-between; color: var(--faint); }
