:root {
  color-scheme: dark;
  --bg: #09090b;
  --surface: #121216;
  --surface-2: #18181d;
  --surface-3: #202027;
  --line: rgba(255,255,255,.08);
  --text: #f7f7f8;
  --muted: #8d8d98;
  --accent: #ff453a;
  --accent-soft: rgba(255,69,58,.13);
  --green: #32d74b;
  --yellow: #ffd60a;
  --shadow: 0 20px 60px rgba(0,0,0,.34);
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 50% -15%, rgba(255,69,58,.09), transparent 35%), var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button, input, select { font: inherit; }
button { color: inherit; -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid rgba(255,255,255,.5); outline-offset: 2px; }
.hidden { display: none !important; }

.app-shell { width: min(760px, 100%); min-height: 100vh; margin: 0 auto; padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
.topbar {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 14px) 20px 12px;
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(to bottom, rgba(9,9,11,.97) 70%, rgba(9,9,11,0));
}
.brand-row { display: flex; align-items: center; gap: 11px; }
.brand-mark { width: 36px; height: 36px; border-radius: 11px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; gap: 2px; border: 1px solid var(--line); box-shadow: inset 0 1px rgba(255,255,255,.04); }
.brand-mark i { display: block; width: 3px; border-radius: 999px; background: var(--accent); }
.brand-mark i:nth-child(1), .brand-mark i:nth-child(5) { height: 9px; opacity: .55; }
.brand-mark i:nth-child(2), .brand-mark i:nth-child(4) { height: 17px; opacity: .78; }
.brand-mark i:nth-child(3) { height: 24px; }
h1 { margin: 0; font-size: 21px; letter-spacing: -.035em; }
.subtitle { color: var(--muted); font-size: 11px; margin-top: 2px; }
.icon-button { width: 38px; height: 38px; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; font-size: 22px; }

.view { display: none; padding: 0 16px 20px; }
.view.active { display: block; }
.recorder-stage { text-align: center; padding-top: 8px; }
.status-pill { display: inline-flex; align-items: center; gap: 7px; padding: 8px 11px; border-radius: 999px; background: rgba(255,255,255,.045); border: 1px solid var(--line); color: #c7c7ce; font-size: 12px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #6d6d78; }
.status-dot.recording { background: var(--accent); box-shadow: 0 0 0 5px rgba(255,69,58,.12); animation: pulse 1.7s infinite; }
.status-dot.paused { background: var(--yellow); }
.status-dot.recovering, .status-dot.error { background: var(--yellow); }
@keyframes pulse { 50% { box-shadow: 0 0 0 10px rgba(255,69,58,0); } }
.timer { margin-top: 21px; font-size: clamp(46px, 13vw, 68px); font-weight: 300; line-height: 1; letter-spacing: -.06em; font-variant-numeric: tabular-nums; }
.mode-label { margin-top: 9px; color: var(--muted); font-size: 12px; }

.wave-wrap { height: 132px; margin: 22px -4px 10px; position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden; }
#waveform { width: 100%; height: 120px; display: block; opacity: 0; transition: opacity .2s ease; }
#waveform.active { opacity: 1; }
.silent-wave { position: absolute; left: 4%; right: 4%; top: 50%; height: 1px; background: linear-gradient(90deg, transparent, #32323a 10%, #32323a 90%, transparent); }
.silent-wave::after { content: ""; position: absolute; left: 50%; top: -3px; width: 7px; height: 7px; border-radius: 50%; background: #3c3c44; }

.transport { display: grid; grid-template-columns: 1fr 126px 1fr; align-items: center; gap: 8px; margin: 8px auto 27px; max-width: 430px; }
.record-button { width: 112px; height: 112px; margin: auto; border-radius: 50%; border: 0; background: transparent; padding: 7px; box-shadow: 0 18px 55px rgba(255,69,58,.18); }
.record-button-inner { width: 100%; height: 100%; border-radius: 50%; border: 4px solid var(--accent); display: flex; align-items: center; justify-content: center; background: rgba(255,69,58,.035); transition: .18s ease; }
.record-shape { width: 76px; height: 76px; border-radius: 50%; background: var(--accent); transition: .18s ease; box-shadow: inset 0 1px rgba(255,255,255,.26); }
.record-button.recording .record-shape { width: 44px; height: 44px; border-radius: 12px; }
.record-button:active .record-button-inner { transform: scale(.96); }
.side-control { border: 0; background: transparent; display: grid; justify-items: center; gap: 7px; color: #b7b7bf; min-height: 64px; }
.side-control:disabled { opacity: .27; }
.side-control small { font-size: 11px; }
.pause-icon { width: 26px; height: 26px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line); position: relative; }
.pause-icon::before, .pause-icon::after { content: ""; position: absolute; top: 7px; width: 3px; height: 10px; background: currentColor; border-radius: 2px; }
.pause-icon::before { left: 8px; }
.pause-icon::after { right: 8px; }
.pause-icon.resume::before { left: 9px; top: 6px; width: 0; height: 0; border-top: 6px solid transparent; border-bottom: 6px solid transparent; border-left: 9px solid currentColor; background: none; border-radius: 0; }
.pause-icon.resume::after { display: none; }
.flag-icon { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line); font-size: 10px; }

.quick-panel { display: grid; gap: 8px; max-width: 560px; margin: 0 auto; }
.quick-setting { width: 100%; display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 11px; border: 1px solid var(--line); border-radius: 16px; background: rgba(18,18,22,.94); text-align: left; padding: 12px 13px; }
.quick-setting span:nth-child(2) { display: grid; gap: 2px; }
.quick-setting small { color: var(--muted); font-size: 10px; }
.quick-setting strong { font-size: 14px; }
.quick-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--surface-3); color: #dddde3; font-size: 12px; }
.chevron { color: #666670; font-size: 26px; font-weight: 200; }

.warning { max-width: 560px; margin: 12px auto 0; padding: 11px 12px; border: 1px solid rgba(255,214,10,.2); background: rgba(255,214,10,.08); color: #ffe66d; border-radius: 14px; text-align: left; font-size: 12px; line-height: 1.5; }
.live-card { max-width: 560px; margin: 12px auto 0; border: 1px solid var(--line); background: var(--surface); border-radius: 18px; padding: 14px; text-align: left; }
.section-heading { display: flex; align-items: center; justify-content: space-between; }
.section-heading h2 { margin: 0; font-size: 15px; }
.section-heading p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.live-transcript { margin-top: 12px; line-height: 1.65; color: #d6d6dd; white-space: pre-wrap; max-height: 190px; overflow: auto; font-size: 13px; }

.page-title { display: flex; align-items: flex-end; justify-content: space-between; padding: 9px 4px 15px; }
.page-title h2 { margin: 2px 0 0; font-size: 30px; letter-spacing: -.045em; }
.eyebrow { color: var(--muted); font-size: 9px; letter-spacing: .16em; font-weight: 700; }
.text-button { border: 0; background: transparent; color: #a8a8b2; padding: 8px; font-size: 13px; }
.library-summary { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin-bottom: 14px; }
.library-summary > div { border: 1px solid var(--line); background: var(--surface); border-radius: 15px; padding: 12px 10px; }
.library-summary span { display: block; color: var(--muted); font-size: 10px; margin-bottom: 5px; }
.library-summary strong { font-size: 14px; }

.recordings-list { display: grid; gap: 10px; }
.empty-state { border: 1px dashed rgba(255,255,255,.1); border-radius: 20px; padding: 42px 20px; text-align: center; color: var(--muted); background: rgba(255,255,255,.015); }
.empty-state strong { display: block; color: #d2d2d8; margin-bottom: 6px; }
.recording-card { border: 1px solid var(--line); background: linear-gradient(180deg, rgba(22,22,27,.98), rgba(16,16,20,.98)); border-radius: 19px; padding: 14px; box-shadow: 0 10px 28px rgba(0,0,0,.14); }
.recording-card-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.recording-title { min-width: 0; }
.recording-title strong { display: block; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recording-title small { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; }
.more-button { border: 0; background: transparent; color: #8b8b95; font-size: 20px; padding: 0 2px 6px 10px; }
.recording-meta { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 11px; }
.meta-chip { padding: 5px 7px; background: var(--surface-3); border-radius: 8px; color: #bfbfc7; font-size: 10px; }
.meta-chip.rolling { color: #ff9b94; background: var(--accent-soft); }
.player-wrap { margin-top: 12px; }
.player-wrap audio { width: 100%; height: 38px; }
.part-note { margin-top: 6px; color: var(--muted); font-size: 10px; }
.card-transcript { margin-top: 11px; padding: 10px 11px; border-radius: 12px; background: #0c0c0f; color: #c8c8d0; line-height: 1.55; font-size: 12px; white-space: pre-wrap; max-height: 130px; overflow: auto; }
.recording-actions { margin-top: 12px; display: grid; grid-template-columns: repeat(4,1fr); gap: 7px; }
.recording-actions button { border: 1px solid var(--line); background: var(--surface-2); border-radius: 10px; padding: 8px 5px; font-size: 10px; color: #c9c9d0; }
.recording-actions button.danger { color: #ff827a; }
.marker-list { margin-top: 9px; display: flex; flex-wrap: wrap; gap: 5px; }
.marker { font-size: 9px; color: #bebec6; border: 1px solid var(--line); border-radius: 999px; padding: 4px 6px; }

.settings-card { border: 1px solid var(--line); background: var(--surface); border-radius: 19px; margin-bottom: 12px; overflow: hidden; }
.setting-row, .setting-button { min-height: 68px; padding: 13px 14px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.setting-row:last-child, .setting-button:last-child { border-bottom: 0; }
.setting-row > span, .setting-button > span:first-child { min-width: 0; text-align: left; }
.setting-row strong, .setting-button strong { display: block; font-size: 14px; }
.setting-row small, .setting-button small { display: block; color: var(--muted); font-size: 10px; margin-top: 4px; line-height: 1.35; }
.setting-row select { max-width: 145px; border: 0; background: var(--surface-3); color: #e9e9ed; border-radius: 10px; padding: 9px 30px 9px 10px; }
.setting-row.stack { display: grid; align-items: stretch; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 3px; background: #0d0d10; border-radius: 11px; }
.segmented button { border: 0; border-radius: 8px; padding: 8px 10px; background: transparent; color: var(--muted); font-size: 11px; }
.segmented button.selected { background: var(--surface-3); color: var(--text); box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.switch-row input { appearance: none; width: 44px; height: 26px; flex: 0 0 auto; border-radius: 999px; background: #303037; position: relative; transition: .18s ease; }
.switch-row input::after { content: ""; position: absolute; width: 22px; height: 22px; border-radius: 50%; background: white; left: 2px; top: 2px; transition: .18s ease; box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.switch-row input:checked { background: var(--green); }
.switch-row input:checked::after { transform: translateX(18px); }
.setting-button { width: 100%; border-left: 0; border-right: 0; border-top: 0; background: transparent; color: var(--text); }
.endpoint-settings { padding: 13px 14px; display: grid; gap: 11px; }
.endpoint-settings label { display: grid; gap: 6px; text-align: left; color: var(--muted); font-size: 10px; }
.endpoint-settings input { width: 100%; border: 1px solid var(--line); background: #0d0d10; color: var(--text); padding: 11px; border-radius: 11px; }
.danger-zone .danger strong { color: #ff6b62; }
.settings-note { padding: 0 8px 24px; color: #686872; font-size: 10px; line-height: 1.55; }

.bottom-nav { position: fixed; z-index: 30; left: 50%; bottom: 0; transform: translateX(-50%); width: min(760px, 100%); height: calc(64px + env(safe-area-inset-bottom)); padding: 6px 10px env(safe-area-inset-bottom); display: grid; grid-template-columns: repeat(3,1fr); background: rgba(13,13,16,.92); border-top: 1px solid var(--line); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); }
.bottom-nav button { border: 0; background: transparent; display: grid; justify-items: center; align-content: center; gap: 4px; color: #696973; font-size: 9px; }
.bottom-nav button.active { color: #e8e8ed; }
.nav-icon { height: 20px; min-width: 22px; display: grid; place-items: center; font-size: 16px; }
.record-nav { width: 19px; height: 19px; border: 2px solid currentColor; border-radius: 50%; position: relative; }
.record-nav::after { content: ""; width: 9px; height: 9px; background: var(--accent); border-radius: 50%; }
.library-nav { font-size: 20px; line-height: 1; }
.settings-nav { font-size: 18px; }

@media (min-width: 680px) {
  .view { padding-left: 28px; padding-right: 28px; }
  .quick-panel { grid-template-columns: 1fr 1fr; }
  .recorder-stage { padding-top: 20px; }
  .bottom-nav { border: 1px solid var(--line); border-bottom: 0; border-radius: 20px 20px 0 0; }
}


/* Recording detail page */
.detail-toolbar { display:flex; align-items:center; justify-content:space-between; padding:4px 0 12px; }
.back-button { border:0; background:transparent; padding:8px 8px 8px 0; color:#d9d9df; font-size:13px; display:flex; align-items:center; gap:4px; }
.back-button span { font-size:28px; line-height:.7; font-weight:200; }
.detail-hero { text-align:center; border:1px solid var(--line); background:linear-gradient(180deg, rgba(24,24,29,.96), rgba(14,14,17,.98)); border-radius:24px; padding:25px 18px 18px; box-shadow:var(--shadow); }
.detail-art { width:112px; height:112px; margin:0 auto 18px; border-radius:28px; background:radial-gradient(circle at 30% 20%, rgba(255,100,90,.25), transparent 42%), #17171c; border:1px solid var(--line); display:flex; align-items:center; justify-content:center; gap:4px; box-shadow:inset 0 1px rgba(255,255,255,.05), 0 16px 44px rgba(255,69,58,.08); }
.detail-art span { width:4px; border-radius:99px; background:var(--accent); }
.detail-art span:nth-child(1), .detail-art span:nth-child(7) { height:22px; opacity:.45; }
.detail-art span:nth-child(2), .detail-art span:nth-child(6) { height:42px; opacity:.65; }
.detail-art span:nth-child(3), .detail-art span:nth-child(5) { height:60px; opacity:.82; }
.detail-art span:nth-child(4) { height:76px; }
.detail-hero h2 { margin:0; font-size:24px; letter-spacing:-.035em; overflow-wrap:anywhere; }
.detail-date { color:var(--muted); font-size:11px; margin:7px 0 18px; }
.detail-hero audio { width:100%; height:42px; }
.merge-note { margin-top:10px; color:#7f7f89; font-size:10px; }
.detail-metrics { display:grid; grid-template-columns:repeat(3,1fr); gap:8px; margin:12px 0; }
.detail-metrics > div { border:1px solid var(--line); background:var(--surface); border-radius:15px; padding:12px 10px; text-align:left; min-width:0; }
.detail-metrics small { display:block; color:var(--muted); font-size:9px; margin-bottom:5px; }
.detail-metrics strong { display:block; font-size:12px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.detail-section { border:1px solid var(--line); background:var(--surface); border-radius:19px; padding:14px; margin-bottom:12px; }
.detail-section-head { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:12px; }
.detail-section-head h3 { margin:2px 0 0; font-size:16px; }
.detail-markers { display:flex; gap:7px; flex-wrap:wrap; }
.detail-marker { border:1px solid var(--line); background:var(--surface-2); border-radius:11px; padding:8px 10px; display:flex; gap:7px; align-items:center; color:#d7d7dd; }
.detail-marker span { color:var(--accent); font-size:9px; }
.detail-marker strong { font-size:11px; font-variant-numeric:tabular-nums; }
.detail-empty { color:var(--muted); font-size:11px; }
.detail-transcript { min-height:74px; max-height:320px; overflow:auto; white-space:pre-wrap; line-height:1.7; font-size:13px; color:#d3d3da; background:#0c0c0f; border-radius:13px; padding:12px; }
.detail-actions { display:grid; grid-template-columns:repeat(3,1fr); gap:8px; padding-bottom:16px; }
.detail-actions button { border:1px solid var(--line); background:var(--surface); min-height:70px; border-radius:16px; display:grid; place-items:center; align-content:center; gap:6px; color:#d4d4db; font-size:10px; }
.detail-actions button.danger { color:#ff7f77; }
.detail-action-icon { font-size:18px; min-height:20px; }
.app-shell.detail-open { padding-bottom:calc(22px + env(safe-area-inset-bottom)); }
.app-shell.detail-open .bottom-nav { display:none; }

.recording-card-button { width:100%; text-align:left; color:inherit; cursor:pointer; }
.recording-card-main { display:grid; grid-template-columns:38px 1fr auto; gap:11px; align-items:center; }
.recording-play-icon { width:36px; height:36px; border-radius:50%; display:grid; place-items:center; background:var(--accent-soft); color:var(--accent); font-size:11px; padding-left:2px; }
.recording-chevron { color:#686872; font-size:28px; font-weight:200; }
.meta-chip.merged { color:#8fe39e; background:rgba(50,215,75,.09); }
.recording-card-button:active { transform:scale(.992); background:#17171c; }

@media (min-width:680px) {
  .detail-view { max-width:640px; margin:0 auto; }
  .detail-hero { padding-left:24px; padding-right:24px; }
}
