:root {
  --bg: #f7f6f4; --surface: #ffffff; --fg: #141414; --muted: #77736f; --line: #e8e5e1; --line-strong: #d6d2cc;
  --accent: #e5483a; --accent-ink: #ffffff; --accent-weak: rgba(229, 72, 58, .08);
  --wave: #d3cec8; --wave-done: var(--accent);
  --radius: 16px; --shadow: 0 1px 2px rgba(20, 20, 20, .04), 0 8px 24px -12px rgba(20, 20, 20, .12);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f10; --surface: #18181a; --fg: #f1efec; --muted: #9a9692; --line: #29292c; --line-strong: #3a3a3e;
    --accent: #ff6450; --accent-weak: rgba(255, 100, 80, .12); --wave: #3b3b40;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -12px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 15px/1.6 "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  letter-spacing: -0.01em; -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
svg { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.err { color: var(--accent); font-size: 13px; margin: 8px 0 0; }

/* ------------------------------------------------------------------ frame */
.top, main, .foot { max-width: 760px; margin: 0 auto; padding: 0 20px; }
.top { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: inherit; text-decoration: none; letter-spacing: -0.02em; }
.brand-sub { font-weight: 500; color: var(--muted); margin-left: -4px; }
.logo { display: inline-flex; align-items: center; gap: 2px; height: 22px; width: 22px; justify-content: center; background: var(--accent); border-radius: 7px; }
.logo i { display: block; width: 2px; border-radius: 1px; background: #fff; }
.logo i:nth-child(1) { height: 6px } .logo i:nth-child(2) { height: 12px } .logo i:nth-child(3) { height: 8px } .logo i:nth-child(4) { height: 4px }
.pill { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); padding: 5px 11px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); }
.pill.ok .dot { background: #2fb36d; } .pill.busy .dot { background: #e0a526; animation: blink 1s infinite; } .pill.bad .dot { background: var(--accent); }
@keyframes blink { 50% { opacity: .3 } }

.hero { padding: 40px 0 28px; }
.hero h1 { font-size: clamp(30px, 6vw, 44px); line-height: 1.18; letter-spacing: -0.035em; margin: 0 0 16px; font-weight: 750; }
.hero p { margin: 0; color: var(--muted); font-size: 16px; }
@media (max-width: 560px) { .wide { display: none; } }

.block { margin: 34px 0; }
.head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
h2 { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0; }
.notice { border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: 14px 16px; font-size: 14px; }
.notice b { color: var(--accent); }

.link { background: none; border: 0; padding: 0; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-strong); cursor: pointer; font-size: 13px; }
.link:hover { color: var(--fg); }

/* ------------------------------------------------------------------ buttons */
.primary, .ghost { border-radius: 999px; padding: 10px 20px; font-weight: 600; cursor: pointer; border: 1px solid transparent; transition: transform .08s, background .15s, opacity .15s; }
.primary { background: var(--fg); color: var(--bg); }
.primary:hover { opacity: .9; }
.primary:active, .ghost:active { transform: scale(.98); }
.primary:disabled { opacity: .35; cursor: default; transform: none; }
.primary.big { width: 100%; padding: 15px 20px; font-size: 16px; }
.ghost { background: transparent; border-color: var(--line-strong); }
.ghost:hover { background: var(--surface); }

/* ------------------------------------------------------------------ voices */
.voices { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.voice {
  position: relative; text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius);
  padding: 13px 14px 12px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; min-height: 104px;
  transition: border-color .15s, box-shadow .15s, transform .1s;
}
.voice:hover { border-color: var(--line-strong); }
.voice:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.voice[aria-checked="true"] { border-color: var(--fg); box-shadow: var(--shadow); }
.voice[aria-checked="true"]::after { content: ""; position: absolute; top: 14px; right: 14px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.v-name { font-weight: 650; font-size: 15px; }
.v-desc { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 14px; }
.v-tag { display: inline-block; font-size: 11px; font-weight: 600; color: var(--accent); background: var(--accent-weak); border-radius: 6px; padding: 1px 6px; margin-left: 6px; vertical-align: 2px; }
.voice .wp { margin-top: auto; padding-top: 8px; }
.voice .v-menu { position: absolute; right: 8px; bottom: 9px; }
.voice.add { border-style: dashed; align-items: flex-start; justify-content: center; background: transparent; }
.voice.add:hover { background: var(--surface); border-color: var(--accent); }
.voice.add .add-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff; margin-bottom: 8px; font-size: 16px; }
.voice.add .add-icon svg { stroke-width: 2.4; }
.v-actions { display: flex; gap: 10px; margin-top: 6px; }
.v-actions .link { font-size: 12px; }

/* ------------------------------------------------------------------ waveform player */
.wp { display: flex; align-items: center; gap: 10px; min-width: 0; }
.wp-btn { flex: none; width: 30px; height: 30px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; background: var(--fg); color: var(--bg); padding: 0; }
.wp-btn svg { width: 13px; height: 13px; fill: currentColor; stroke: none; }
.wp .i-pause, .wp.playing .i-play { display: none; }
.wp.playing .i-pause { display: inline; }
.wp-wave { flex: 1; min-width: 0; height: 26px; cursor: pointer; touch-action: none; }
.wp-time { flex: none; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 30px; text-align: right; }
.voice .wp-btn { width: 26px; height: 26px; }
.voice .wp-btn svg { width: 11px; height: 11px; }
.voice .wp-time { display: none; }
.wp.large .wp-btn { width: 44px; height: 44px; }
.wp.large .wp-btn svg { width: 17px; height: 17px; }
.wp.large .wp-wave { height: 48px; }

/* ------------------------------------------------------------------ text */
.editor { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); transition: border-color .15s, box-shadow .15s; }
.editor:focus-within { border-color: var(--line-strong); box-shadow: var(--shadow); }
.editor textarea { display: block; width: 100%; border: 0; background: transparent; resize: vertical; padding: 16px 18px 6px; font-size: 17px; line-height: 1.65; outline: none; min-height: 112px; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 8px 12px 12px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: 5px 12px; font-size: 13px; cursor: pointer; color: var(--muted); transition: color .15s, border-color .15s; }
.chip:hover { color: var(--fg); border-color: var(--line-strong); }
.chip[aria-pressed="true"] { color: var(--fg); border-color: var(--fg); }

/* ------------------------------------------------------------------ generate */
.gen .muted.center { margin: 10px 0 0; }
.progress { margin-top: 16px; }
.bar { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 2px; transition: width .25s ease; }
.prog-row { display: flex; justify-content: space-between; margin-top: 8px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.advanced { margin-top: 18px; font-size: 14px; }
.advanced summary { cursor: pointer; color: var(--muted); font-size: 13px; list-style: none; display: inline-flex; align-items: center; gap: 6px; }
.advanced summary::-webkit-details-marker { display: none; }
.advanced summary::before { content: ""; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform .15s; margin-right: 2px; }
.advanced[open] summary::before { transform: rotate(45deg); }
.adv-grid { display: flex; gap: 14px; margin-top: 12px; flex-wrap: wrap; }
.adv-grid label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
input[type=number], input[type=text] { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 7px 10px; outline: none; }
input[type=number] { width: 96px; font-variant-numeric: tabular-nums; }
input:focus, textarea:focus { border-color: var(--line-strong); }

/* ------------------------------------------------------------------ results */
.results { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.result { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; animation: rise .35s ease; }
.result.new { box-shadow: var(--shadow); }
@keyframes rise { from { opacity: 0; transform: translateY(6px) } }
.r-text { margin: 0 0 12px; font-size: 15px; line-height: 1.55; }
.r-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.r-meta .r-actions { display: flex; gap: 14px; }

/* ------------------------------------------------------------------ about / footer */
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; border-top: 1px solid var(--line); padding-top: 26px; }
.facts b { display: block; font-size: 14px; margin-bottom: 4px; }
.facts span { font-size: 13px; color: var(--muted); line-height: 1.6; }
.facts em { font-style: normal; color: var(--fg); }
@media (max-width: 640px) { .facts { grid-template-columns: 1fr; gap: 16px; } }
.foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 18px; padding-bottom: 40px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }

/* ------------------------------------------------------------------ registration dialog */
dialog {
  border: 0; padding: 30px 28px 26px; border-radius: 22px; width: min(480px, calc(100vw - 24px)); max-height: calc(100dvh - 24px);
  background: var(--surface); color: var(--fg); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .35);
}
dialog::backdrop { background: rgba(10, 10, 10, .42); backdrop-filter: blur(3px); }
dialog[open] { animation: pop .22s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98) } }
dialog h3 { font-size: 21px; letter-spacing: -0.025em; margin: 0 0 6px; }
dialog p { margin: 0 0 14px; }
.dlg-close { position: absolute; top: 14px; right: 14px; margin: 0; }
.dlg-close button { border: 0; background: transparent; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; color: var(--muted); font-size: 18px; }
.dlg-close button:hover { background: var(--bg); color: var(--fg); }
.script { background: var(--bg); border-radius: 14px; padding: 16px 18px 12px; margin: 16px 0; }
.script p { font-size: 18px; line-height: 1.6; margin: 0 0 6px; letter-spacing: -0.02em; }
.rec { display: flex; flex-direction: column; align-items: stretch; gap: 14px; margin: 8px 0 14px; }
.live { --wave: var(--line-strong); --wave-done: var(--accent); height: 56px; width: 100%; }
.rec-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; }
.rec-time { font-variant-numeric: tabular-nums; font-size: 14px; color: var(--muted); }
.rec-hint { text-align: right; }
.consent { margin: -6px 0 0; font-size: 12px; opacity: .8; }
.rec-btn { width: 64px; height: 64px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--surface); display: grid; place-items: center; cursor: pointer; transition: transform .1s; }
.rec-btn i { width: 24px; height: 24px; border-radius: 50%; background: var(--accent); transition: all .2s; }
.rec-btn:active { transform: scale(.96); }
.rec-btn.on { border-color: var(--accent); box-shadow: 0 0 0 6px var(--accent-weak); }
.rec-btn.on i { width: 20px; height: 20px; border-radius: 5px; }
.wp-host { background: var(--bg); border-radius: 14px; padding: 12px 14px; margin: 14px 0 16px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); margin: 0 0 14px; }
.field textarea, .field input[type=text], .field input[type=number] { color: var(--fg); font-size: 15px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--surface); outline: none; resize: vertical; width: 100%; }
.field input[type=file] { font-size: 13px; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; margin: 12px 0; }
dialog .advanced { margin: 0 0 14px; }
dialog .advanced[open] { padding-bottom: 2px; }
dialog .advanced > :not(summary) { margin-top: 12px; }
.dl-status { min-height: 18px; margin-bottom: 4px; }
.actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }
.actions.col { flex-direction: column; }
.done { text-align: center; padding-top: 8px; }
.check-mark { width: 56px; height: 56px; border-radius: 50%; background: var(--accent-weak); color: var(--accent); display: grid; place-items: center; margin: 0 auto 16px; font-size: 26px; }
.check-mark svg { stroke-width: 2.4; }

/* ------------------------------------------------------------------ toast */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px; box-shadow: var(--shadow); z-index: 10; animation: rise .2s ease; max-width: calc(100vw - 32px); }
