:root {
  --bg: #14161a;
  --card: #1e2127;
  --line: #2c3038;
  --text: #eceef2;
  --muted: #9aa1ad;
  --accent: #ff4d4f;
  --accent2: #5b8cff;
  --ok: #3ccf8e;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { touch-action: manipulation; -webkit-user-select: none; user-select: none; }
.rec span { pointer-events: none; }
a { color: var(--accent2); }

.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; background: var(--bg); border-bottom: 1px solid var(--line);
}
.top h1 { flex: 1; margin: 0; font-size: 18px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { background: none; border: 0; font-size: 26px; line-height: 1; padding: 4px 8px; cursor: pointer; color: var(--muted); }

main { max-width: 680px; margin: 0 auto; padding: 16px; }
h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 24px 0 8px; }

.recorder { background: var(--card); border-radius: 20px; padding: 20px 16px; text-align: center; }
.timer { font-size: 44px; font-variant-numeric: tabular-nums; font-weight: 300; }
#level { width: 100%; height: 40px; display: block; margin: 6px 0 10px; }
.rec-controls { display: flex; align-items: center; justify-content: center; gap: 24px; }
.rec {
  width: 84px; height: 84px; border-radius: 50%; border: 4px solid var(--text);
  background: none; padding: 0; cursor: pointer; display: grid; place-items: center;
}
.rec span { width: 62px; height: 62px; border-radius: 50%; background: var(--accent); transition: all .2s; }
.rec.on span { width: 32px; height: 32px; border-radius: 8px; }
.ctl { background: var(--line); border: 0; border-radius: 999px; padding: 10px 18px; cursor: pointer; min-width: 84px; }
.hint { color: var(--muted); font-size: 14px; margin-top: 10px; }
.toggle { display: flex; gap: 8px; justify-content: center; align-items: center; font-size: 14px; color: var(--muted); margin-top: 12px; }
.live { text-align: left; margin-top: 12px; max-height: 180px; overflow-y: auto; font-size: 15px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 10px; }
.live i { color: #6b7280; }

.list-head { display: flex; align-items: baseline; justify-content: space-between; }
.link-btn { color: var(--accent2); font-size: 14px; cursor: pointer; }
.search { width: 100%; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); }
.list { list-style: none; padding: 0; margin: 8px 0 0; }
.list li { background: var(--card); border-radius: 14px; padding: 12px 14px; margin-bottom: 8px; cursor: pointer; }
.list .t { font-weight: 600; }
.list .s { color: var(--muted); font-size: 13px; display: flex; gap: 8px; flex-wrap: wrap; }
.list .p { color: var(--muted); font-size: 14px; margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.badge { font-size: 12px; padding: 0 8px; border-radius: 999px; background: var(--line); }
.badge.work { background: #3a3220; color: #f5c451; }
.badge.err { background: #3a2022; color: #ff8a8c; }
.empty { color: var(--muted); text-align: center; }

.rename { width: 100%; font-size: 20px; font-weight: 600; background: none; border: 0; border-bottom: 1px solid transparent; padding: 4px 0; }
.rename:focus { outline: none; border-bottom-color: var(--line); }
.meta { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
audio { width: 100%; margin-bottom: 10px; }
.status { background: #3a3220; color: #f5c451; border-radius: 10px; padding: 8px 12px; font-size: 14px; margin-bottom: 10px; }
.status.err { background: #3a2022; color: #ff8a8c; }
.tabs { display: flex; gap: 4px; background: var(--card); border-radius: 12px; padding: 4px; margin-bottom: 12px; }
.tabs button { flex: 1; border: 0; background: none; padding: 8px 4px; border-radius: 9px; cursor: pointer; color: var(--muted); font-size: 14px; }
.tabs button.active { background: var(--line); color: var(--text); }
.md h3 { font-size: 16px; margin: 18px 0 6px; }
.md ul { padding-left: 20px; margin: 4px 0; }
.md p { margin: 6px 0; }
.tx p { margin: 0 0 10px; }
.tx .ts { color: var(--accent2); font-size: 12px; font-variant-numeric: tabular-nums; margin-right: 6px; cursor: pointer; }
.ask { display: flex; gap: 8px; margin-top: 10px; }
.ask input { flex: 1; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); }
.ask button, .primary { background: var(--accent2); border: 0; border-radius: 12px; padding: 10px 16px; cursor: pointer; color: #fff; }
.q { color: var(--muted); margin: 14px 0 4px; font-weight: 600; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 24px 0 40px; }
.actions button { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; cursor: pointer; font-size: 14px; }
.actions .danger { color: #ff8a8c; }

#viewSettings label { display: block; margin: 12px 0 4px; font-size: 14px; }
#viewSettings input, #viewSettings select, #viewSettings textarea {
  display: block; width: 100%; margin-top: 4px; padding: 10px 12px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--card);
}
.small { color: var(--muted); font-size: 13px; }
.small.good { color: var(--ok); }
.small.bad { color: #ff8a8c; }
.banner {
  display: block; width: 100%; text-align: left; margin-bottom: 12px; cursor: pointer;
  background: #3a3220; color: #f5c451; border: 0; border-radius: 14px; padding: 12px 14px; font-size: 14px;
}
.status.err { cursor: pointer; }
.primary { margin-top: 16px; width: 100%; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: 14px; z-index: 10;
  max-width: calc(100% - 32px);
}
