/* Friend rooms: the home entry, the Play with friends window and the room screens (designs in plans/d1, plans/d2) */

/* home entry: the whole card is the button */
.party{display:grid;grid-template-columns:1fr auto;align-items:start;gap:4px 12px;width:100%;margin:16px 0 0;padding:18px;border:2px solid var(--accent);border-radius:var(--r);background:var(--surface);color:var(--text);font:inherit;text-align:left;cursor:pointer;position:relative;overflow:hidden}
.party:focus-visible{outline:3px solid var(--text);outline-offset:3px}
.party-text b{display:block;font-size:21px;font-weight:700;letter-spacing:-.01em;line-height:1.15}
.party-text span{display:block;margin-top:4px;font-size:14px;line-height:1.35;color:var(--muted)}
.party-text span+span{margin-top:2px}
.party-pic{display:block}
.party-go{grid-column:1/-1;justify-self:start;display:inline-flex;align-items:center;gap:8px;margin-top:12px;padding:10px 16px;border-radius:999px;font-size:15px;font-weight:700;background:var(--accent);color:var(--accent-ink)}
.party-notes{position:absolute;right:-6px;bottom:-14px;opacity:.14;color:var(--accent);pointer-events:none}

/* the Play with friends window */
.room-dlg{max-width:420px;position:fixed}
.room-x{position:absolute;top:10px;right:10px}
.room-seg{display:flex;margin:18px 0 16px}
.room-seg button{flex:1}
.room-name{margin-bottom:14px}
.room-path{padding:16px;border:1px solid var(--line);border-radius:var(--r-md);background:var(--surface-2)}
.room-path .hint{margin:0 0 12px}
.room-row{display:flex;gap:8px}
.room-row .input{flex:1;min-width:0}
.room-row .btn{flex:none}
.room-code-input{text-transform:uppercase;letter-spacing:.32em;font-weight:700;font-variant-numeric:tabular-nums;font-size:18px}
.room-code-input::placeholder{letter-spacing:.32em;font-weight:500;color:var(--faint)}
.room-error{margin:12px 0 0;color:var(--red);font-size:14px}
.room-error:empty{display:none}

/* the room screen: the lobby (plans/d1/lobby-*.html). Wider on big screens, room screens only */
body[data-screen=room] main,body[data-screen=room] .topbar{max-width:1000px}
.room-hero{text-align:center;margin:6px 0 22px}
.room-label{margin:0;font-size:12px;font-weight:600;letter-spacing:.09em;text-transform:uppercase;color:var(--faint)}
.room-code{margin:8px 0 14px;padding-left:.14em;font-size:46px;font-weight:800;letter-spacing:.14em;line-height:1;font-variant-numeric:tabular-nums}
.lobby-grid{display:grid;grid-template-columns:minmax(0,1fr)}
.lobby-grid .card{margin:0 0 16px}
@media (min-width:900px){
  .room-code{font-size:60px}
  .lobby-grid{grid-template-columns:1fr 1fr;gap:20px;align-items:start}
}
.players{list-style:none;margin:0;padding:0}
.pl{display:flex;align-items:center;gap:12px;min-height:54px;border-top:1px solid var(--line)}
.pl:first-child{border-top:0}
.av{position:relative;flex:none;width:36px;height:36px;border-radius:50%;background:var(--surface-3);display:grid;place-items:center;font-weight:700;font-size:15px}
.av .crown{position:absolute;top:-12px;left:-5px;transform:rotate(-22deg)}
.pl.me .av{outline:2px solid var(--accent);outline-offset:2px}
.players .pl-name{flex:1;min-width:0;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.pl-edit{height:44px;margin-left:-8px;padding:0 8px;border:1px solid var(--line);border-radius:var(--r-sm);background:none;color:var(--text);font:inherit;font-weight:600;outline:none}
.pl-edit:hover{border-color:var(--line-2)}
.pl-edit:focus{border-color:var(--accent);background:var(--surface-2)}
.pl.open .av{background:none;border:1px dashed var(--line-2)}
.players .pl.open .pl-name{color:var(--faint);font-weight:500}
.pl .x-btn{width:44px;height:44px;margin-right:-12px}
.state{display:inline-flex;align-items:center;gap:6px;white-space:nowrap;font-size:13px;font-weight:600;color:var(--faint)}
.state.ready{color:var(--accent)}
.state.ready::before{content:'';width:7px;height:7px;border-radius:50%;background:var(--accent)}
.state.wait{color:var(--muted)}
.state.wait::before{content:'';width:5px;height:5px;border-radius:50%;border:1px solid var(--faint)}
.songs-count{margin:0;font-variant-numeric:tabular-nums;font-size:34px;font-weight:800;letter-spacing:-.025em;line-height:1}
.songs-unit{margin-left:8px;font-size:16px;font-weight:600;letter-spacing:0;color:var(--muted)}
.songs .chips{margin:16px 0 14px}
.songs .chips:empty{display:none}
.artists{margin:0;color:var(--muted);font-size:15px}
.artists b{color:var(--text);font-weight:600}
.setting-line{display:flex;justify-content:space-between;gap:12px;margin:0}
.setting-line b{font-weight:600}
.setting-line+.setting-line{margin-top:10px}
.past{font-variant-numeric:tabular-nums;list-style:none;margin:0;padding:0;color:var(--muted);font-size:15px}
.past li+li{margin-top:8px}
.past b{color:var(--text);font-weight:600;margin-right:6px}
.start-in .locked{background:var(--surface-3);color:var(--muted);cursor:not-allowed}
.ready-btn[aria-pressed=true]{background:var(--accent-soft);border-color:var(--accent);color:var(--text)}
.setting-row{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;margin-top:6px;padding-top:16px;border-top:1px solid var(--line)}
.setting-row small{display:block;font-size:13px}
.change-btn{border-color:var(--accent);background:var(--accent-soft);color:var(--text)}
.change-btn:hover{border-color:var(--accent-hi)}

/* the last 2 minutes before a lobby with no game closes */
.notice{margin:0 0 20px;padding:14px 16px;border:1px solid var(--line-2);border-radius:var(--r);background:var(--surface-2);text-align:left;font-size:15px}
.notice.warn{border-color:var(--yellow);background:var(--yellow-soft)}
.notice.warn b{color:var(--yellow);font-variant-numeric:tabular-nums}

/* Change songs: a sheet from the bottom on phones, a panel on the right from 900 px */
dialog.sheet{margin:auto 0 0;padding:0;width:100%;max-width:none;max-height:90vh;max-height:90dvh;display:none;flex-direction:column;background:var(--bg);border:1px solid var(--line-2);border-bottom:0;border-radius:var(--r) var(--r) 0 0}
dialog.sheet[open]{display:flex}
.sheet-head{padding:18px 18px 4px}
.sheet-head h2{margin:0}
.sheet-body{overflow:auto;padding:0 18px 8px}
.sheet-body .card{margin:12px 0}
.sheet-foot{display:flex;flex-wrap:wrap;align-items:center;gap:10px 14px;padding:12px 18px calc(12px + env(safe-area-inset-bottom));border-top:1px solid var(--line);background:var(--surface)}
.sheet-foot .actions{display:flex;gap:10px;flex:1 1 100%}
.sheet-foot .actions .btn{flex:1}
.sheet-foot .actions .btn-primary{flex:2}
@media (min-width:900px){
  dialog.sheet{margin:0 0 0 auto;width:480px;height:100vh;height:100dvh;max-height:none;border:0;border-left:1px solid var(--line-2);border-radius:0}
  .sheet-head{padding:22px 22px 4px}
  .sheet-body{flex:1;padding:0 22px 8px}
  .sheet-foot{flex-wrap:nowrap;padding:14px 22px}
  .sheet-foot .actions{flex:none}
}
#songsDlg #addOwn{display:none} /* adding a playlist leaves the room screen: from home only */
#roomSeats{font-variant-numeric:tabular-nums}
/* messages sit above the room's bottom bar, as on home */
body[data-screen=room] .toast{bottom:112px}
body[data-screen=room] .net{bottom:100px}
.players:focus{outline:none}

/* during a room game: everyone's progress (plans/d2/game-party.html) */
.room-chips{display:flex;justify-content:center;margin:4px 0 14px;padding:0;list-style:none} /* (fewer than 5 sit in the middle) */
.rpc{width:20%;display:flex;flex-direction:column;align-items:center;gap:4px;min-width:0;padding-top:8px}
.ring{--p:0;position:relative;width:38px;height:38px;border-radius:50%;display:grid;place-items:center;background:conic-gradient(var(--accent) calc(var(--p)*1%),var(--surface-3) 0)}
.ring b{width:30px;height:30px;border-radius:50%;background:var(--surface-2);display:grid;place-items:center;font-size:14px;font-weight:700}
.rpc .nm{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px;color:var(--muted)}
.rpc.me .nm{color:var(--text);font-weight:600}
.rpc .pts{font-size:12px;font-weight:700;line-height:1;color:var(--accent);font-variant-numeric:tabular-nums}
.ring .crown{position:absolute;top:-12px;left:-5px;transform:rotate(-22deg)}
.rpc.me .ring,.rpr.me .av{outline:2px solid var(--accent);outline-offset:2px}
.room-panel{display:none}
.room-panel h2{margin:0 0 8px;font-size:17px;font-weight:700}
.room-panel ul{margin:0;padding:0;list-style:none}
.rpr{display:grid;grid-template-columns:30px 1fr auto;gap:4px 10px;align-items:center;padding:10px 0;border-top:1px solid var(--line)}
.rpr .av{width:30px;height:30px;font-size:13px;grid-row:span 2}
.rpr .n{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:600}
.rpr .r{font-size:15px;font-weight:700;color:var(--accent);font-variant-numeric:tabular-nums;text-align:right}
.rpr .bar{grid-column:2/4;height:4px;border-radius:9px;background:var(--surface-3);overflow:hidden}
.rpr .bar i{display:block;height:100%;width:calc(var(--p)*1%);background:var(--accent)}
@media (min-width:900px){
  /* the game keeps its column; the panel sits beside it */
  body.room-game main{max-width:940px}
  body.room-game #screen-game{max-width:868px;display:grid;grid-template-columns:minmax(0,560px) 280px;column-gap:28px;justify-content:center}
  body.room-game #screen-game>*{grid-column:1}
  body.room-game #screen-game>.room-party{grid-column:2;grid-row:1 / span 30}
  .room-chips{display:none}
  .room-panel{display:block;position:sticky;top:80px;padding:16px;border:1px solid var(--line);border-radius:var(--r);background:var(--surface)}
}
/* the last player's countdown: a bare number in the "careful" colour (plans/d2/game-countdown.html) */
.lastcall{margin:2px 0 14px;text-align:center;font-size:56px;font-weight:800;letter-spacing:-.04em;line-height:1;color:var(--orange);font-variant-numeric:tabular-nums}
@media (min-width:900px){.lastcall{font-size:72px}}

/* room results: who won, then every song played with "Who got it" (plans/d2/results.html) */
.rres .sum-hero{padding:14px 0 18px}
.rres .sum-score{font-size:44px}
.rres .sum-score.lead{font-size:32px}
.stand{list-style:none;margin:0;padding:0;display:flex;justify-content:center;gap:6px}
.st{flex:0 1 20%;display:flex;flex-direction:column;align-items:center;gap:3px;min-width:0;padding:10px 2px 9px;border-radius:var(--r-md);text-align:center}
.st .av{width:40px;height:40px;font-size:16px}
.av .rk{color:var(--text);position:absolute;right:-5px;bottom:-4px;min-width:19px;height:19px;padding:0 4px;border-radius:999px;background:var(--surface-2);border:1px solid var(--line-2);font-size:11px;font-weight:700;line-height:17px;font-variant-numeric:tabular-nums;box-sizing:border-box}
.st.me .av,.av.me{outline:2px solid var(--accent);outline-offset:2px}
.st .nm{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13px;color:var(--muted)}
.st .pt{font-size:14px;font-weight:700;line-height:1.1;font-variant-numeric:tabular-nums}
.st .gs{display:none;font-size:11px;color:var(--faint);font-variant-numeric:tabular-nums}
.st.playing .pt{font-weight:500;font-size:12px;color:var(--faint);white-space:nowrap}
.st .pt .of{display:inline;font-size:inherit;color:inherit}
.st.playing .pt.live{font-weight:700;font-size:14px;color:var(--text)}
.st .pt .pa{margin-top:2px;font-size:11px;font-weight:500;color:var(--faint)}
/* still playing: the avatar's ring fills with songs played, like the chips in the game */
.st.playing .av{background:radial-gradient(var(--surface-2) 64%,transparent 65%),conic-gradient(var(--accent) calc(var(--p)*1%),var(--surface-3) 0)}
.st.first .av{width:48px;height:48px;font-size:19px}
.st.first .av,.av.win{background:var(--accent);color:var(--accent-ink)}
.st.first .pt{color:var(--accent);font-size:16px}
.st:not(.first) .av{margin:4px 0}
.st.me .nm{color:var(--text);font-weight:600}
.songs-head{display:flex;align-items:baseline;justify-content:space-between;gap:12px;margin:28px 0 0}
.songs-head h2{margin:0;font-size:12px;font-weight:600;letter-spacing:.09em;text-transform:uppercase;color:var(--faint)}
.key{display:flex;gap:10px;font-size:12px;color:var(--faint)}
.key i{display:inline-block;width:8px;height:8px;margin-right:4px;border-radius:50%;vertical-align:1px}
.c-correct{background:var(--accent)}.c-artist{background:var(--yellow)}.c-miss{background:var(--red)}
.rres .sum-list{margin-top:6px}
.rres .sum-list>li{grid-template-columns:22px 48px minmax(0,1fr) auto;padding:10px 0 10px 6px}
.sum-art .ph{display:block;width:100%;height:100%;background:var(--surface-3)}
.who-btn{display:flex;align-items:center;gap:8px;height:44px;padding:0 8px 0 10px;border:1px solid transparent;border-radius:var(--r-md);background:none;color:var(--muted);font:inherit;font-size:13px;cursor:pointer}
.who-btn:hover,.who-btn[aria-expanded=true]{background:var(--surface-2);border-color:var(--line-2);color:var(--text)}
.who-btn .tx{display:none}
.dots{display:flex}
.dots i{width:18px;height:18px;border-radius:50%;display:grid;place-items:center;font-style:normal;font-size:10px;font-weight:700;color:var(--bg);box-shadow:0 0 0 2px var(--bg)}
.dots i+i{margin-left:-1px}
.dots i.none{background:var(--surface-3);color:var(--muted)}
.chev{width:14px;height:14px;transition:transform .15s}
.who-btn[aria-expanded=true] .chev{transform:rotate(180deg)}
.who{grid-column:1/-1;margin:2px 0 4px;padding:6px 14px;list-style:none;background:var(--surface);border:1px solid var(--line);border-radius:var(--r-md)}
.rres .sum-list .who li{display:grid;grid-template-columns:28px minmax(0,1fr) auto;gap:10px;align-items:center;padding:8px 0;border-bottom:1px solid var(--line)}
.rres .sum-list .who li:last-child{border-bottom:0}
.who .av{width:28px;height:28px;font-size:12px}
.who .nm{font-weight:600}
.who .pp{font-weight:700;font-variant-numeric:tabular-nums;text-align:right}
.who .pp.pos{color:var(--accent)}
.who .d{display:block;font-size:12px;font-weight:500}
.who .d.correct{color:var(--accent)}.who .d.artist{color:var(--yellow)}.who .d.miss{color:var(--red)}.who .d.playing{color:var(--faint)}
.rres .room-actions{margin-top:24px}
@media (max-width:420px){.rres .sum-list>li{grid-template-columns:48px minmax(0,1fr) auto;gap:10px;padding-left:0}.rres .sum-list>li>.n{display:none}.key{display:none}}
@media (min-width:900px){
  .rres{display:grid;grid-template-columns:240px minmax(0,560px);gap:40px;justify-content:center;align-items:start}
  .rres .side{position:sticky;top:80px}
  .rres .sum-hero{text-align:left;padding-top:4px}
  .stand{flex-direction:column;gap:2px}
  .st{flex-direction:row;gap:12px;padding:8px 10px;text-align:left}
  .st .who-col{display:flex;flex-direction:column;flex:1;min-width:0}
  .st .pt{margin-left:auto}
  .st .gs{display:block}
  .st:not(.first) .av{margin:0}
  .songs-head{margin-top:14px}
  .who-btn .tx{display:inline}
  .rres .room-actions{justify-content:flex-start}
}
@media (max-width:899px){.st .who-col{display:contents}.st .pt .of{display:none}} /* phones: the ring shows the songs played */
/* room closed / removed / unreachable: one centred message */
.room-msg{max-width:420px;margin:12vh auto 0;padding:24px;border:1px solid var(--line);border-radius:var(--r);background:var(--surface);text-align:center}
.room-msg h2{margin:0 0 6px;font-size:21px}
.room-msg p{margin:0 0 18px}
/* CP5 design audit */
.rres .sum-score{margin:0;overflow-wrap:anywhere} /* a long winner's name wraps instead of spilling over */
.rpc .pts.zero,.rpr .r.zero,.st.first .pt.zero{color:var(--text)} /* zero is white (DESIGN.md) */
.dots i.c-miss{background:transparent;color:var(--red);box-shadow:inset 0 0 0 2px var(--red),0 0 0 2px var(--bg)} /* hollow: a filled dot means they got something */
body.room-game .topbar{max-width:940px}
.rpr,.rres .sum-list .who li{padding-top:14px} /* room for the crown above the avatar */

/* the count-in before a game: a big green number over the room */
.room-go{position:fixed;inset:0;z-index:60;display:grid;place-items:center;background:rgba(13,13,15,.92);color:var(--accent);font-size:120px;font-weight:800;letter-spacing:-.04em;font-variant-numeric:tabular-nums}
/* your own name: a box with a pencil, so it's clear it can be changed */
.players .pl-editbox{position:relative;overflow:visible}
.pl-editbox .pl-edit{width:100%;padding-right:32px}
.pl-editbox .pencil{position:absolute;right:10px;top:50%;transform:translateY(-50%);color:var(--muted);pointer-events:none}
.pl-editbox:focus-within .pencil{color:var(--accent)}
