/* Phones: players and the host's controls. */
body.phone { min-height: 100vh; min-height: 100dvh; overscroll-behavior: none; }
.screen { max-width: 560px; margin: 0 auto; padding: 16px 16px 40px; display: flex; flex-direction: column; gap: 16px; }
.screen.center { min-height: 100vh; min-height: 100dvh; justify-content: center; align-items: center; text-align: center; }
.logo { font-size: 34px; }
.logo.xl { font-size: clamp(54px, 16vw, 76px); text-shadow: 0 5px 0 var(--grape-deep); }
.small { font-size: 0.9rem; }
.between { justify-content: space-between; }

.join { min-height: 100vh; min-height: 100dvh; justify-content: center; text-align: center; }
.join .tag { margin: -10px 0 6px; font-weight: 800; color: var(--sky); }
.lbl { display: block; font-weight: 800; font-size: 0.95rem; margin: 4px 0 8px; text-align: left; color: #5B4B8A; }
.codeinput {
  width: 100%; border: 4px solid #E3D8FF; border-radius: 20px; background: #fff; color: var(--grape);
  font-family: var(--head); font-weight: 800; font-size: 56px; text-align: center; letter-spacing: 12px;
  padding: 6px 0 0; margin-bottom: 14px; text-transform: uppercase; outline: none;
}
.codeinput:focus, .nameinput:focus, .txt:focus { border-color: var(--yellow); }
.nameinput, .txt {
  width: 100%; border: 3px solid #E3D8FF; border-radius: 16px; background: #fff; color: var(--ink);
  font-weight: 800; font-size: 1.2rem; padding: 12px 14px; outline: none; margin-bottom: 10px;
}
textarea.txt { font-size: 1rem; font-weight: 700; resize: vertical; }

.profile .card h3 { font-size: 1.2rem; margin-bottom: 10px; }
.roomtag { font-weight: 800; background: rgba(255, 255, 255, 0.14); padding: 6px 12px; border-radius: 999px; font-size: 0.9rem; letter-spacing: 1px; }
.roomtag b { color: var(--yellow); }
.avgrid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.avpick { border: 0; background: transparent; padding: 3px; border-radius: 50%; cursor: pointer; position: relative; }
.avpick .av.lg { width: 100%; height: auto; aspect-ratio: 1; }
.avpick.on { background: var(--yellow); box-shadow: 0 0 0 3px var(--grape); transform: scale(1.06); }
.avpick.taken { opacity: 0.3; }
.saved { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.savedp { border: 0; background: #EFE8FF; border-radius: 18px; padding: 8px 10px; display: flex; flex-direction: column; align-items: center; gap: 4px; font-weight: 800; color: var(--ink); cursor: pointer; min-width: 84px; }
.savedp.on { background: var(--yellow); }
.savedp .av.lg { width: 56px; height: 56px; }
.sticky-go { position: sticky; bottom: 12px; z-index: 3; }

/* In-room header */
.ph { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.phbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 8px; padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top)); background: rgba(43, 20, 100, 0.9); backdrop-filter: blur(6px); flex-wrap: wrap; }
.phbar .me { display: flex; align-items: center; gap: 8px; background: transparent; border: 0; font-weight: 800; font-size: 1rem; cursor: pointer; padding: 0; min-width: 0; }
.phbar .me span { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.phbar .seg { margin-left: auto; display: flex; background: rgba(255, 255, 255, 0.12); border-radius: 999px; padding: 3px; }
.phbar .seg button { border: 0; background: transparent; font-weight: 800; padding: 8px 12px; border-radius: 999px; cursor: pointer; font-size: 0.9rem; }
.phbar .seg button.on { background: var(--yellow); color: var(--ink); }
#phgame, #phhost { flex: 1; }

.lobbyme { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; padding-top: 20px; }
.lobbyme h2 { font-size: 2rem; }
.lobbyme p { margin: 0; }
.mystats { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; font-weight: 800; }
.others { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.others .pchip { background: rgba(255, 255, 255, 0.1); border-radius: 999px; padding: 4px 12px 4px 4px; font-weight: 800; display: inline-flex; align-items: center; gap: 6px; }
.others .pchip.off { opacity: 0.45; }
.bigmsg { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; padding-top: 24px; }
.bigmsg .emoji { font-size: 84px; line-height: 1; }
.bigmsg h2 { font-size: 2.1rem; color: var(--yellow); }
.bigmsg p { margin: 0; font-weight: 700; }
.bigmsg .howto { text-align: left; font-weight: 700; margin: 4px 0; padding-left: 22px; }
.bigmedal { font-size: 110px; line-height: 1; animation: pop 0.5s both, bob 2s 0.5s infinite; }
.bignum { font-family: var(--head); font-weight: 800; font-size: 90px; line-height: 0.9; color: var(--white); display: flex; flex-direction: column; }
.bignum small { font-size: 1.1rem; color: var(--muted); }

/* Host controls */
.host h3 { font-size: 1.5rem; margin: 10px 0 8px; color: var(--yellow); }
.host h4 { font-size: 1.1rem; margin: 14px 0 6px; }
.hcsec { display: flex; flex-direction: column; gap: 10px; }
.hcsec:empty { display: none; }
.segpick { display: flex; flex-wrap: wrap; gap: 6px; background: rgba(0, 0, 0, 0.18); padding: 5px; border-radius: 18px; }
.segpick button { flex: 1 1 auto; border: 0; background: transparent; padding: 10px 10px; border-radius: 14px; font-weight: 800; cursor: pointer; min-height: 44px; font-size: 0.95rem; }
.segpick button.on { background: var(--yellow); color: var(--ink); box-shadow: 0 3px 0 #C98F00; }
.gamegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.gamecard { border: 0; background: rgba(255, 255, 255, 0.1); border-radius: 18px; padding: 10px 6px; display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; }
.gamecard span { font-size: 34px; line-height: 1.1; }
.gamecard b { font-family: var(--head); font-size: 1rem; line-height: 1.1; }
.gamecard small { font-size: 0.72rem; font-weight: 700; opacity: 0.8; }
.gamecard.on { background: var(--yellow); color: var(--ink); box-shadow: 0 4px 0 #C98F00; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips .chip { border: 0; min-height: 40px; }
.gsettings { background: rgba(255, 255, 255, 0.06); border-radius: 18px; padding: 4px 12px 12px; margin-top: 10px; }
.setrow { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.setrow label { font-weight: 800; font-size: 0.95rem; }
.toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.toggle { display: flex; align-items: center; gap: 10px; border: 0; background: rgba(255, 255, 255, 0.1); border-radius: 16px; padding: 12px; font-weight: 800; cursor: pointer; text-align: left; font-size: 0.95rem; }
.toggle .knob { flex: 0 0 auto; width: 40px; height: 24px; border-radius: 99px; background: rgba(0, 0, 0, 0.3); position: relative; transition: background 0.2s; }
.toggle .knob::after { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left 0.2s; }
.toggle.on .knob { background: var(--mint); }
.toggle.on .knob::after { left: 19px; }
.setrow .toggle { align-self: flex-start; }
.plist { display: flex; flex-direction: column; gap: 6px; }
.prow { display: flex; align-items: center; gap: 8px; background: rgba(255, 255, 255, 0.08); border-radius: 16px; padding: 6px 8px; font-weight: 800; }
.prow.off { opacity: 0.55; }
.prow .btn.small { min-height: 36px; padding: 0.4em 0.8em; font-size: 0.85rem; }
.hosttag { font-size: 0.85rem; color: var(--yellow); }
.warnnote { background: var(--coral); color: #3A0808; font-weight: 800; border-radius: 14px; padding: 10px 12px; margin: 0; }
.groupcard p { margin: 8px 0 6px; }
.keybox { font-family: var(--head); font-weight: 800; font-size: 1.6rem; background: #fff; border: 3px dashed var(--grape-light); color: var(--grape); border-radius: 14px; padding: 8px; text-align: center; letter-spacing: 1px; user-select: all; -webkit-user-select: all; margin-bottom: 10px; word-break: break-all; }
.btn.ghost-ink { background: #EFE8FF; color: var(--ink); box-shadow: 0 4px 0 #CBBDF2; }
.formcard .row { gap: 8px; }
.formcard .txt { margin-bottom: 8px; }
.formcard .btn.small { margin-bottom: 8px; }

/* Messages sit at the bottom on phones so they don't cover the game. */
body.phone #toasts { top: auto; bottom: max(18px, env(safe-area-inset-bottom)); }
