* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh; color: #f3f4f6; font-family: 'Kanit', system-ui, sans-serif; font-size: 15px;
  background: #08090d radial-gradient(circle at 50% 0%, rgba(255, 90, 0, .18), transparent 60%) no-repeat;
  padding-bottom: env(safe-area-inset-bottom);
}
.hidden { display: none !important; }
.muted { color: #9ca3af; }
.small { font-size: 12.5px; }
b { color: #fff; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; padding-top: max(14px, env(safe-area-inset-top));
  border-bottom: 1px solid rgba(255,255,255,.08); background: rgba(8,9,13,.6); backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 800; letter-spacing: .06em; font-size: 18px; display: flex; align-items: center; gap: 8px; }
.brand b { color: #f97316; }
.logo { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: linear-gradient(135deg, #f97316, #dc2626); font-size: 16px; }
.who { display: flex; align-items: center; gap: 10px; font-size: 13px; min-width: 0; }
.who span { color: #fdba74; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40vw; }
.who a { color: #9ca3af; text-decoration: none; border: 1px solid rgba(255,255,255,.15); padding: 4px 10px; border-radius: 999px; white-space: nowrap; }

main { max-width: 980px; margin: 0 auto; padding: 22px 14px 40px; }
.card { background: rgba(17, 19, 27, .72); border: 1px solid rgba(255,255,255,.09); border-radius: 18px; padding: 20px; backdrop-filter: blur(14px); }
.card h1 { margin: 0 0 6px; font-size: 22px; }
.card h2 { margin: 0 0 12px; font-size: 16px; }
.center { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; }
.grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .grid { grid-template-columns: 1fr 1fr; } .wide { grid-column: 1 / -1; } }

.login { max-width: 420px; margin: 6vh auto 0; }
.login form { display: grid; gap: 12px; margin-top: 14px; }
.login label { display: grid; gap: 6px; font-size: 13px; color: #d1d5db; }
input:not([type]), input[type=password], select {
  width: 100%; background: rgba(0,0,0,.45); color: #fff; border: 1px solid rgba(255,255,255,.15); border-radius: 12px;
  padding: 12px 13px; font: inherit; outline: none; }
input:focus, select:focus { border-color: #f97316; }
.err { background: rgba(220,38,38,.15); border: 1px solid rgba(220,38,38,.4); color: #fecaca; padding: 10px 12px; border-radius: 12px; font-size: 13px; margin-top: 10px; }
.warn { color: #fde68a; font-size: 12.5px; }

.btn { font: inherit; font-weight: 600; color: #fff; background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.12);
  padding: 10px 18px; border-radius: 999px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.btn:active { transform: scale(.97); }
.btn.primary { background: linear-gradient(90deg, #f97316, #dc2626); border: 0; box-shadow: 0 8px 24px rgba(249,115,22,.3); }
.btn.big { font-size: 18px; padding: 14px 32px; }
.btn:disabled { opacity: .5; }

.badge { font-size: 12px; padding: 4px 12px; border-radius: 999px; background: #374151; }
.badge.ok { background: rgba(21,128,61,.6); color: #dcfce7; }
.badge.wait { background: rgba(161,98,7,.6); color: #fef9c3; }

.mic { width: 168px; height: 168px; border-radius: 50%; border: 0; color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; font: inherit; font-weight: 700; cursor: pointer; transition: transform .12s, box-shadow .2s, background .2s; -webkit-tap-highlight-color: transparent; }
.mic .slash { display: none; }
.mic.off { background: #1f2937; }
.mic.idle { background: radial-gradient(circle, #6b7280, #374151); box-shadow: 0 0 0 6px rgba(156,163,175,.15); }
.mic.live { background: radial-gradient(circle, #22c55e, #15803d); box-shadow: 0 0 0 8px rgba(34,197,94,.22), 0 0 46px rgba(34,197,94,.55); transform: scale(1.04); }
.mic.muted { background: radial-gradient(circle, #ef4444, #991b1b); box-shadow: 0 0 0 6px rgba(239,68,68,.15); }
.mic.muted .slash { display: inline; }

.settings { display: grid; gap: 8px; align-content: start; }
.lbl { font-weight: 600; font-size: 13.5px; margin-top: 6px; }
.lbl.row { display: flex; justify-content: space-between; }
.lbl span { color: #9ca3af; font-weight: 400; }
input[type=range] { width: 100%; accent-color: #f97316; }
.meter { height: 9px; border-radius: 999px; background: rgba(255,255,255,.08); overflow: hidden; position: relative; margin-top: 6px; }
.meter i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #22c55e, #eab308, #ef4444); transition: width .06s; }
.meter b { position: absolute; top: 0; bottom: 0; width: 2px; background: #fff; opacity: .7; }
.checks { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12.5px; color: #d1d5db; margin-top: 6px; }

.peers { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.peer { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; background: rgba(0,0,0,.3); border: 1px solid rgba(255,255,255,.08); }
.peer.talk { border-color: #22c55e; box-shadow: 0 0 14px rgba(34,197,94,.35); }
.peer img { width: 36px; height: 36px; border-radius: 9px; image-rendering: pixelated; }
.peer .info { flex: 1; min-width: 0; }
.peer .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.peer .sub { font-size: 11.5px; color: #9ca3af; }
.peer .sub .on { color: #4ade80; }
.tips p { margin: 4px 0; }
.toast { position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: rgba(0,0,0,.88);
  border: 1px solid rgba(255,255,255,.15); padding: 10px 16px; border-radius: 12px; font-size: 14px; z-index: 50; max-width: 92vw; }
