:root {
  --orange: #F16722;
  --orange-soft: #FDEDE4;
  --orange-line: #F6C9AE;
  --orange-text: #B5440F;
  --bg: #FAF7F5;
  --ink: #1F2328;
  --ink2: #4A505A;
  --ink3: #5C6169;
  --mic-off: #7A7F87;
  --red: #B42318;
  --shadow: 0 2px 4px rgba(31,35,40,0.10), 0 1px 1px rgba(31,35,40,0.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font-family: 'IBM Plex Sans Thai', system-ui, sans-serif; -webkit-text-size-adjust: 100%; }
button { font-family: inherit; cursor: pointer; }
.hidden { display: none !important; }

.screen {
  max-width: 480px; margin: 0 auto; min-height: 100dvh;
  padding: calc(20px + env(safe-area-inset-top)) 20px calc(24px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 16px;
}

/* ── join ── */
#join { align-items: center; text-align: center; }
.logo { height: 30px; width: auto; }
.join-icon {
  margin-top: 24px; width: 104px; height: 104px; border-radius: 50%;
  background: #FFF1E8; border: 3px solid var(--orange-line); color: var(--orange);
  display: flex; align-items: center; justify-content: center;
}
h1 { margin: 0; font-size: 28px; }
.card { width: 100%; background: #fff; border-radius: 20px; padding: 16px 18px; box-shadow: var(--shadow); }
.label { display: block; font-size: 18px; font-weight: 600; margin-bottom: 10px; text-align: left; }
#nameInput {
  width: 100%; height: 60px; border-radius: 14px; border: 2px solid #E3E0DD; padding: 0 16px;
  font: inherit; font-size: 22px; color: var(--ink); background: #fff;
}
#nameInput:focus { outline: none; border-color: var(--orange); }
.hint { margin-top: 8px; font-size: 15px; color: var(--ink3); text-align: left; }
.hello { font-size: 22px; }
.link { margin-top: 6px; background: none; border: none; color: var(--orange-text); font-size: 16px; text-decoration: underline; padding: 6px; }
.big-btn {
  width: 100%; height: 70px; border-radius: 20px; border: none; background: var(--orange); color: #fff;
  font-size: 23px; font-weight: 700; box-shadow: 0 4px 14px rgba(241,103,34,0.35);
}
.big-btn:disabled { opacity: .6; }
.ghost-btn { width: 100%; height: 60px; border-radius: 18px; border: none; background: #F0EEEC; color: var(--ink); font-size: 20px; font-weight: 600; }
.err { color: var(--red); font-size: 16px; }
.foot { margin-top: auto; font-size: 14px; color: var(--ink3); }

/* ── room ── */
.top { display: flex; align-items: center; justify-content: space-between; }
.logo-sm { height: 26px; width: auto; }
.leave { height: 40px; padding: 0 18px; border-radius: 999px; border: none; background: var(--red); color: #fff; font-size: 17px; font-weight: 700; box-shadow: var(--shadow); }
.room-title h2 { margin: 0; font-size: 24px; }
.count { font-size: 16px; color: var(--ink2); }
.count b { color: var(--orange); }
.speaker-bar {
  background: var(--orange); color: #fff; border-radius: 16px; padding: 12px 16px;
  font-size: 18px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.speaker-bar.quiet { background: #fff; color: var(--ink3); box-shadow: var(--shadow); font-weight: 500; }
.unlock { height: 64px; border-radius: 18px; border: 3px solid var(--orange); background: #FFF1E8; color: var(--orange-text); font-size: 20px; font-weight: 700; }

.mic {
  height: 84px; border-radius: 24px; border: none; color: #fff; font-size: 24px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; gap: 12px; box-shadow: var(--shadow);
}
.mic.off { background: var(--mic-off); }
.mic.on { background: var(--orange); box-shadow: 0 4px 16px rgba(241,103,34,0.45); }
.mic:disabled { opacity: .6; }
.mic-ic { width: 30px; height: 30px; background: currentColor; -webkit-mask: var(--ic) center/contain no-repeat; mask: var(--ic) center/contain no-repeat; }
.mic.on .mic-ic { --ic: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2" stroke-linecap="round"><rect x="9" y="3" width="6" height="11" rx="3"/><path d="M5 11a7 7 0 0 0 14 0M12 18v3"/></svg>'); }
.mic.off .mic-ic { --ic: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2" stroke-linecap="round"><rect x="9" y="3" width="6" height="11" rx="3"/><path d="M5 11a7 7 0 0 0 14 0M12 18v3M3 3l18 18"/></svg>'); }
.mic-hint { text-align: center; font-size: 15px; color: var(--ink3); margin-top: -8px; }

.people { padding: 14px 16px; }
.people-head { font-size: 16px; font-weight: 700; color: var(--ink2); margin-bottom: 6px; }
.people ul { list-style: none; margin: 0; padding: 0; }
.people li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid #F0EEEC; font-size: 18px; }
.people li:first-child { border-top: none; }
.av { width: 36px; height: 36px; border-radius: 50%; background: #EEE9E5; color: var(--ink2); display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; }
.people li.live .av { background: var(--orange); color: #fff; }
.pname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { font-size: 13px; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: var(--orange-soft); border: 1px solid var(--orange-line); color: var(--orange-text); }
.me-tag { font-size: 14px; color: var(--ink3); }
.net { text-align: center; font-size: 13px; color: var(--ink3); }

/* ── sheet ── */
.sheet-wrap { position: fixed; inset: 0; background: rgba(31,35,40,0.45); display: flex; align-items: flex-end; justify-content: center; z-index: 10; }
.sheet {
  width: 100%; max-width: 480px; background: #fff; border-radius: 24px 24px 0 0;
  padding: 10px 20px calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; text-align: center;
}
.handle { width: 44px; height: 5px; border-radius: 3px; background: #D8D4D0; margin: 0 auto 6px; }
.sheet h3 { margin: 4px 0 0; font-size: 26px; }
.sheet p { margin: 0 0 8px; font-size: 18px; color: var(--ink2); }
