:root {
  --bg: #f6f4ef;
  --card: #ffffff;
  --ink: #1f2a24;
  --muted: #6b726d;
  --line: #e4e0d8;
  --ok: #2f7d4f;
  --warn: #b7791f;
  --bad: #c0392b;
  --accent: #3b6e55;
  --rec: #d64541;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141816;
    --card: #1d2320;
    --ink: #e8ece9;
    --muted: #9aa39d;
    --line: #2c3430;
    --ok: #5cc28a;
    --warn: #e0a84a;
    --bad: #ef6a5a;
    --accent: #6fb08f;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  padding-bottom: env(safe-area-inset-bottom);
  -webkit-text-size-adjust: 100%;
}
button, select { font: inherit; color: inherit; }

/* 녹음 표시 */
.recbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 8px;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  background: var(--rec); color: #fff; font-weight: 600;
}
.recbar .dot { width: 12px; height: 12px; border-radius: 50%; background: #fff; animation: pulse 1.6s infinite; }
.recbar .uptime { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 500; opacity: .9; }
.recbar.off { background: var(--line); color: var(--muted); }
.recbar.off .dot { background: var(--muted); animation: none; }
.recbar.speaking .dot { transform: scale(1.4); }
.recbar.stalled { background: #7a1f16; }
.recbar.stalled .dot { animation: none; opacity: .4; }
@keyframes pulse { 50% { opacity: .35; } }

.alert {
  margin: 12px 16px 0; padding: 14px 16px; border-radius: 12px;
  background: var(--bad); color: #fff; display: grid; gap: 6px;
}
.alert button { justify-self: start; margin-top: 4px; padding: 10px 18px; border: 0; border-radius: 10px; background: #fff; color: var(--bad); font-weight: 700; }
.hidden { display: none !important; }

main { max-width: 560px; margin: 0 auto; padding: 16px; display: grid; gap: 16px; }

.hero { text-align: center; padding: 16px 0 4px; }
.big {
  width: 180px; height: 180px; border-radius: 50%; border: 0;
  background: var(--accent); color: #fff; font-size: 34px; font-weight: 700;
  box-shadow: 0 6px 20px rgba(0,0,0,.15);
}
.big.stop { background: var(--card); color: var(--ink); border: 3px solid var(--line); box-shadow: none; }
.big:disabled { opacity: .6; }
.hint { color: var(--muted); margin: 14px 0 0; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.card h2 { font-size: 15px; margin: 0 0 10px; color: var(--muted); font-weight: 600; }

.status { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; }
.status dt { color: var(--muted); }
.status dd { margin: 0; text-align: right; font-weight: 600; }
.ok { color: var(--ok); } .warn { color: var(--warn); } .bad { color: var(--bad); }

.meter { margin-top: 12px; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.meter div { height: 100%; width: 0; background: var(--accent); transition: width .08s linear; }

.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.row select { padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); }
.small { color: var(--muted); font-size: 13px; margin: 8px 0 0; }

.card button:not(.big) {
  padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); font-weight: 600; margin-top: 10px;
}
.card button:disabled { opacity: .45; }
.card button.ghost { background: transparent; color: var(--muted); }
.buttons { display: flex; gap: 8px; flex-wrap: wrap; }

.events { list-style: none; padding: 0; margin: 0; max-height: 300px; overflow-y: auto; font-size: 13px; font-variant-numeric: tabular-nums; }
.events li { padding: 5px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.events li:last-child { border-bottom: 0; }
.ev-bad { color: var(--bad); } .ev-warn { color: var(--warn); }

.tip p { margin: 0; }
