:root {
  --bg: #f4f6f5; --card: #fff; --ink: #14201d; --muted: #5d6b67; --accent: #0f766e; --accent-ink: #fff;
  --mine: #d9f2ee; --theirs: #fff; --line: #dde3e1; --warn: #9a3412;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0e1513; --card: #17211e; --ink: #e8efed; --muted: #9aa8a4; --accent: #2dd4bf; --accent-ink: #062a26; --mine: #134e48; --theirs: #1d2a27; --line: #2a3734; --warn: #fdba74; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Noto Sans SC", sans-serif; }
button, input, select { font: inherit; color: inherit; }
button { border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 12px 16px; cursor: pointer; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
input, select { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.screen { min-height: 100%; }
#home { display: flex; align-items: center; justify-content: center; padding: 20px; }
.card { width: 100%; max-width: 420px; background: var(--card); border-radius: 20px; padding: 24px; display: grid; gap: 14px; box-shadow: 0 2px 20px rgb(0 0 0 / .06); }
h1 { margin: 0; font-size: 26px; }
.sub { margin: -8px 0 4px; color: var(--muted); }
label { display: grid; gap: 6px; font-size: 14px; color: var(--muted); }
.row { display: flex; gap: 8px; }
.row input { flex: 1; text-transform: uppercase; letter-spacing: 2px; }
#createBox, #joinBox { display: grid; gap: 10px; }
#createBox[hidden], #joinBox[hidden] { display: none; }
.or { text-align: center; color: var(--muted); font-size: 14px; }
.hint { font-size: 13px; color: var(--muted); margin: 0; }
.warn { font-size: 13px; color: var(--warn); margin: 0; }
.invite { margin: 0; }

#talk { display: flex; flex-direction: column; height: 100dvh; }
#talk[hidden] { display: none; }
header { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top)); background: var(--card); border-bottom: 1px solid var(--line); }
.room { font-size: 14px; color: var(--muted); }
.room b { color: var(--ink); letter-spacing: 1px; }
.people { font-size: 15px; font-weight: 600; }
.status { font-size: 13px; color: var(--warn); padding: 0 16px; }
.status:empty { display: none; }
main { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 85%; padding: 10px 14px; border-radius: 16px; background: var(--theirs); border: 1px solid var(--line); }
.msg.mine { align-self: flex-end; background: var(--mine); border-color: transparent; }
.msg .who { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.msg .text { font-size: 19px; }
.msg .orig { font-size: 13px; color: var(--muted); margin-top: 4px; }
.msg .replay { border: 0; background: none; padding: 2px 0 0; font-size: 13px; color: var(--accent); }
.empty { color: var(--muted); text-align: center; margin: auto; max-width: 300px; }
.live { margin: 0 12px 6px; padding: 8px 12px; border-radius: 12px; border: 1px dashed var(--line); color: var(--muted); font-size: 15px; }
footer { padding: 10px 12px; padding-bottom: max(10px, env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--line); display: grid; gap: 10px; }
#typeForm { display: flex; gap: 8px; }
.controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.mic { flex: 1; min-width: 180px; font-weight: 600; }
.mic.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.mic.on.hot { box-shadow: 0 0 0 4px rgb(45 212 191 / .35); }
.toggle { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--ink); }
.toggle input { width: auto; }
dialog { border: 0; border-radius: 20px; padding: 24px; background: var(--card); color: var(--ink); text-align: center; max-width: 360px; }
dialog::backdrop { background: rgb(0 0 0 / .5); }
dialog h2 { margin: 0 0 4px; font-size: 20px; }
dialog img { width: 240px; height: 240px; background: #fff; border-radius: 12px; padding: 8px; }
.link { word-break: break-all; font-size: 13px; color: var(--muted); }
