:root {
  --ink: #17231e;
  --muted: #69756f;
  --paper: #f4f7f4;
  --card: rgba(255, 255, 255, .86);
  --line: rgba(32, 59, 47, .13);
  --forest: #174f3a;
  --mint: #43b98a;
  --lime: #bce873;
  --orange: #f39a58;
  --red: #c94c4c;
  --shadow: 0 24px 70px rgba(37, 67, 53, .11);
  --radius: 26px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
.hidden { display: none !important; }

.ambient { position: fixed; pointer-events: none; filter: blur(1px); z-index: -1; border-radius: 50%; }
.ambient-a { width: 520px; height: 520px; top: -220px; right: -120px; background: radial-gradient(circle, rgba(188,232,115,.34), transparent 68%); }
.ambient-b { width: 620px; height: 620px; left: -260px; bottom: -260px; background: radial-gradient(circle, rgba(67,185,138,.2), transparent 68%); }

.login-view { min-height: 100vh; display: grid; place-items: center; padding: 32px; }
.login-card {
  width: min(460px, 100%); padding: 54px 50px 42px; border: 1px solid rgba(255,255,255,.9);
  border-radius: 32px; background: rgba(255,255,255,.82); box-shadow: var(--shadow);
  backdrop-filter: blur(22px); text-align: center;
}
.brand-mark { width: 66px; height: 66px; margin: 0 auto 24px; border-radius: 22px; display: flex; align-items: center; justify-content: center; gap: 4px; background: var(--forest); box-shadow: 0 16px 34px rgba(23,79,58,.25); }
.brand-mark span { display: block; width: 5px; border-radius: 5px; background: var(--lime); animation: pulse 1.8s ease-in-out infinite; }
.brand-mark span:nth-child(1) { height: 18px; }
.brand-mark span:nth-child(2) { height: 35px; animation-delay: .18s; }
.brand-mark span:nth-child(3) { height: 24px; animation-delay: .36s; }
.brand-mark.small { width: 44px; height: 44px; margin: 0; border-radius: 14px; gap: 3px; box-shadow: none; }
.brand-mark.small span { width: 3px; }
.brand-mark.small span:nth-child(1) { height: 12px; }.brand-mark.small span:nth-child(2) { height: 23px; }.brand-mark.small span:nth-child(3) { height: 16px; }
@keyframes pulse { 0%,100% { transform: scaleY(.65); opacity:.8 } 50% { transform: scaleY(1); opacity:1 } }
.eyebrow { margin: 0 0 9px; color: var(--forest); font-size: 11px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; }
.login-card h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(33px, 6vw, 46px); letter-spacing: -.04em; }
.login-copy { margin: 14px auto 34px; color: var(--muted); line-height: 1.7; }
.login-card > label { display: block; margin-bottom: 9px; text-align: left; font-size: 13px; font-weight: 700; }
.login-row { display: grid; grid-template-columns: 1fr auto; gap: 9px; }
input, textarea, select {
  width: 100%; border: 1px solid var(--line); border-radius: 13px; background: rgba(248,251,248,.9);
  color: var(--ink); outline: none; transition: border .2s, box-shadow .2s, background .2s;
}
input, select { height: 46px; padding: 0 13px; }
textarea { padding: 13px; resize: vertical; line-height: 1.65; }
input:focus, textarea:focus, select:focus { border-color: var(--mint); background: white; box-shadow: 0 0 0 4px rgba(67,185,138,.12); }
.button { border: 0; border-radius: 13px; cursor: pointer; font-weight: 750; transition: transform .18s, box-shadow .18s, opacity .18s; }
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .48; cursor: not-allowed; transform: none; }
.button.primary { padding: 0 22px; color: white; background: var(--forest); box-shadow: 0 10px 22px rgba(23,79,58,.18); }
.button.ghost { padding: 10px 15px; color: var(--forest); background: rgba(255,255,255,.8); border: 1px solid var(--line); }
.button.danger { width: 100%; padding: 12px; color: var(--red); background: #fff4f2; border: 1px solid rgba(201,76,76,.2); }
.small-button { font-size: 12px; }
.form-error { min-height: 20px; margin: 9px 0 0; color: var(--red); font-size: 13px; }
.secure-note { margin: 20px 0 0; color: #89938e; font-size: 11px; }
.secure-note i { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: var(--mint); }

.app-shell { min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 20; height: 72px; display: flex; align-items: center; justify-content: space-between; padding: 0 max(24px, calc((100vw - 1240px)/2)); background: rgba(244,247,244,.82); border-bottom: 1px solid rgba(32,59,47,.08); backdrop-filter: blur(18px); }
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand strong, .brand small { display: block; }.brand strong { font-family: Georgia, serif; font-size: 19px; }.brand small { margin-top: 1px; color: var(--muted); font-size: 9px; letter-spacing: .16em; text-transform: uppercase; }
.topbar-meta { display: flex; align-items: center; gap: 10px; }
.model-badge { padding: 8px 12px; color: var(--forest); background: rgba(188,232,115,.3); border: 1px solid rgba(23,79,58,.1); border-radius: 999px; font-size: 11px; font-weight: 800; }
main { width: min(1240px, calc(100% - 48px)); margin: 0 auto; padding: 52px 0 32px; }
.hero { min-height: 225px; display: grid; grid-template-columns: 1fr 310px; align-items: center; gap: 50px; padding: 24px 6px 46px; }
.hero h1 { max-width: 760px; margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(43px, 6vw, 76px); line-height: 1.04; letter-spacing: -.055em; }
.hero > div > p:last-child { max-width: 670px; margin: 21px 0 0; color: var(--muted); line-height: 1.85; }
.wave-orbit { width: 250px; height: 180px; justify-self: end; display: grid; place-items: center; border-radius: 50%; background: radial-gradient(circle, rgba(188,232,115,.48), rgba(67,185,138,.08) 52%, transparent 70%); }
.wave-bars { height: 70px; display: flex; align-items: center; gap: 7px; }
.wave-bars i, .live-wave i { display: block; width: 7px; border-radius: 9px; background: var(--forest); animation: waveform 1.4s ease-in-out infinite; }
.wave-bars i:nth-child(1),.wave-bars i:nth-child(9){height:20px}.wave-bars i:nth-child(2),.wave-bars i:nth-child(8){height:34px}.wave-bars i:nth-child(3),.wave-bars i:nth-child(7){height:52px}.wave-bars i:nth-child(4),.wave-bars i:nth-child(6){height:66px}.wave-bars i:nth-child(5){height:42px}
.wave-bars i:nth-child(2n) { animation-delay: -.45s; }.wave-bars i:nth-child(3n) { animation-delay: -.8s; }
@keyframes waveform { 0%,100% { transform: scaleY(.45); opacity:.48 } 50% { transform:scaleY(1); opacity:1 } }

.usage-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.metric-card { min-width: 0; padding: 20px 22px; border-radius: 20px; background: rgba(255,255,255,.74); border: 1px solid rgba(255,255,255,.9); box-shadow: 0 10px 36px rgba(37,67,53,.06); }
.metric-card.accent { background: linear-gradient(135deg, #e3f5d1, #f5f9ec); }.metric-card.dark { color: white; background: var(--forest); border-color: transparent; }
.metric-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 11px; }.dark .metric-head { color: rgba(255,255,255,.66); }.metric-head b { font-size: 8px; letter-spacing: .13em; }
.metric-card > strong { display: block; margin: 9px 0 8px; overflow: hidden; text-overflow: ellipsis; font-family: Georgia, serif; font-size: 30px; letter-spacing: -.04em; }
.metric-card > p { margin: 0; display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 10px; }.dark > p { color: rgba(255,255,255,.66); }

.workspace-grid { display: grid; grid-template-columns: minmax(0, 1.52fr) minmax(360px, .82fr); gap: 18px; align-items: start; }
.panel { border: 1px solid rgba(255,255,255,.92); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); backdrop-filter: blur(16px); }
.composer-panel, .output-panel { padding: 28px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 25px; }
.panel-heading h2 { margin: 0; font-family: Georgia, serif; font-size: 28px; letter-spacing: -.035em; }
.mode-switch { display: flex; gap: 3px; padding: 4px; border-radius: 12px; background: #edf2ed; }
.mode-button { padding: 8px 12px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; cursor: pointer; font-size: 12px; font-weight: 800; }
.mode-button.active { color: white; background: var(--forest); box-shadow: 0 5px 12px rgba(23,79,58,.18); }
.field { display: grid; gap: 7px; color: #4d5b54; font-size: 12px; font-weight: 700; }
.compact-field { margin-bottom: 16px; }.text-field { margin-bottom: 18px; }
.field-label-row { display: flex; justify-content: space-between; gap: 12px; }.field-label-row span { color: #8b958f; font-size: 10px; font-weight: 500; }
#textInput { min-height: 230px; font-size: 14px; }
.tag-bar { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag-chip { padding: 5px 8px; border: 1px solid rgba(23,79,58,.11); border-radius: 999px; color: var(--forest); background: rgba(188,232,115,.18); cursor: pointer; font: 650 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.options-grid, .director-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.speaker-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.speaker-card { min-width: 0; margin: 0; padding: 15px; border: 1px solid var(--line); border-radius: 16px; background: rgba(244,247,244,.62); }
.speaker-card legend { padding: 0 6px; color: var(--forest); font-size: 11px; font-weight: 850; }.speaker-card .field + .field { margin-top: 10px; }
.director-panel { margin-top: 18px; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.director-panel summary { list-style: none; display: flex; justify-content: space-between; gap: 12px; padding: 15px 16px; cursor: pointer; font-size: 12px; font-weight: 800; }.director-panel summary::-webkit-details-marker { display:none; }.director-panel summary small { color: var(--muted); font-weight: 500; }
.director-grid { padding: 0 16px 16px; }.span-two { grid-column: 1/-1; }
.toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.toggle { position: relative; display: grid; grid-template-columns: 36px 1fr; grid-template-rows: auto auto; column-gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 15px; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; pointer-events:none; }.toggle > span { grid-row: 1/3; align-self: center; width: 36px; height: 21px; border-radius: 999px; background: #cbd3ce; transition: background .2s; }.toggle > span::after { content:""; display:block; width:15px; height:15px; margin:3px; border-radius:50%; background:white; box-shadow:0 2px 5px rgba(0,0,0,.16); transition: transform .2s; }.toggle input:checked + span { background: var(--mint); }.toggle input:checked + span::after { transform: translateX(15px); }
.toggle b { font-size: 11px; }.toggle small { color: var(--muted); font-size: 9px; }
.submit-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 22px; }.submit-row p { margin:0; color:var(--muted); font-size:10px; line-height:1.5; }
.button.generate { min-width: 158px; min-height: 48px; display:flex; align-items:center; justify-content:center; gap:10px; padding: 0 22px; color:white; background:var(--forest); box-shadow:0 14px 28px rgba(23,79,58,.22); }
.button-wave { height: 17px; display:flex; align-items:center; gap:2px; }.button-wave i { display:block; width:2px; border-radius:2px; background:var(--lime); }.button-wave i:nth-child(1){height:8px}.button-wave i:nth-child(2){height:16px}.button-wave i:nth-child(3){height:11px}

.output-panel { position: sticky; top: 90px; overflow: hidden; }
.status-pill { padding: 7px 10px; border-radius: 999px; font-size: 9px; font-weight: 850; letter-spacing:.08em; }.status-pill.idle { color:var(--muted); background:#edf1ed; }.status-pill.running { color:#82500b; background:#fff0cb; }.status-pill.success { color:#176541; background:#dff5e8; }.status-pill.failed { color:var(--red); background:#ffe8e3; }
.empty-output { min-height: 380px; display:grid; place-items:center; align-content:center; text-align:center; padding:30px; border:1px dashed rgba(23,79,58,.16); border-radius:20px; background:linear-gradient(150deg, rgba(188,232,115,.12), rgba(255,255,255,.2)); }
.empty-disc { width:100px; height:100px; display:grid; place-items:center; border:18px solid #e6eee8; border-radius:50%; background:var(--forest); box-shadow:0 18px 35px rgba(23,79,58,.18); }.empty-disc span { width:34px; height:34px; display:grid; place-items:center; padding-left:3px; border-radius:50%; color:var(--forest); background:var(--lime); font-size:13px; }
.empty-output h3 { margin:22px 0 6px; font-family:Georgia,serif; font-size:20px; }.empty-output p { max-width:285px; margin:0; color:var(--muted); font-size:11px; line-height:1.7; }
.cover-art { min-height:185px; display:flex; flex-direction:column; justify-content:space-between; padding:22px; border-radius:20px; color:white; background:radial-gradient(circle at 80% 20%, rgba(188,232,115,.5), transparent 38%), linear-gradient(145deg,#174f3a,#0e2e23); overflow:hidden; }
.cover-copy span { display:block; margin-bottom:7px; color:var(--lime); font-size:9px; font-weight:850; letter-spacing:.14em; }.cover-copy strong { display:block; max-width:90%; font-family:Georgia,serif; font-size:26px; line-height:1.14; }
.live-wave { height:35px; display:flex; align-items:end; gap:5px; }.live-wave i { width:4px; height:20px; background:var(--lime); animation-play-state:paused; }.live-wave.active i { animation-play-state:running; }.live-wave i:nth-child(2n){height:30px;animation-delay:-.4s}.live-wave i:nth-child(3n){height:14px;animation-delay:-.75s}
.output-stage { margin:16px 0 7px; color:var(--muted); font-size:11px; }.progress-track { height:5px; border-radius:5px; background:#e7ece8; overflow:hidden; }.progress-track span { display:block; width:0; height:100%; border-radius:inherit; background:linear-gradient(90deg,var(--mint),var(--lime)); transition:width .35s; }
#audioPlayer { width:100%; height:48px; margin-top:15px; }
.run-metrics { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-top:15px; }.run-metrics div { padding:11px; border-radius:12px; background:#f3f6f3; }.run-metrics span,.run-metrics strong { display:block; }.run-metrics span { color:var(--muted); font-size:9px; }.run-metrics strong { margin-top:4px; font-size:13px; }
.download-row { display:grid; grid-template-columns:repeat(4,1fr); gap:6px; margin-top:12px; }.download-row a { padding:9px 4px; border:1px solid var(--line); border-radius:10px; color:var(--forest); background:white; cursor:pointer; text-align:center; text-decoration:none; font-size:9px; font-weight:850; }
.price-note { display:flex; justify-content:space-between; gap:10px; margin-top:17px; padding-top:14px; border-top:1px solid var(--line); color:var(--muted); font-size:9px; }.price-note p { margin:0; text-align:right; }

.history-panel { margin-top:18px; padding:28px; }.history-heading { align-items:center; }.history-meta { display:flex; align-items:center; gap:10px; color:var(--muted); font-size:11px; }
.history-list { display:grid; gap:8px; }.history-item { display:grid; grid-template-columns:minmax(180px,1.7fr) 90px 95px 100px 86px auto; align-items:center; gap:14px; padding:14px 15px; border:1px solid rgba(32,59,47,.09); border-radius:15px; background:rgba(250,252,250,.75); transition:border .18s, transform .18s, background .18s; }.history-item:hover { transform:translateY(-1px); border-color:rgba(67,185,138,.36); background:white; }
.history-title { min-width:0; }.history-title strong,.history-title span { display:block; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }.history-title strong { font-size:12px; }.history-title span { margin-top:4px; color:var(--muted); font-size:9px; }
.history-cell span,.history-cell strong { display:block; }.history-cell span { color:#8a958f; font-size:8px; text-transform:uppercase; letter-spacing:.08em; }.history-cell strong { margin-top:4px; font-size:11px; }.history-actions { display:flex; gap:5px; justify-content:flex-end; }.icon-button { width:31px; height:31px; border:1px solid var(--line); border-radius:9px; color:var(--forest); background:white; cursor:pointer; }.icon-button.delete { color:var(--red); }
.history-status { display:inline-flex; padding:5px 7px; border-radius:999px; font-size:8px; font-weight:850; }.history-status.SUCCEEDED { color:#176541;background:#dff5e8 }.history-status.RUNNING,.history-status.QUEUED { color:#82500b;background:#fff0cb }.history-status.FAILED,.history-status.CANCELLED { color:var(--red);background:#ffe8e3 }
.empty-history { padding:45px; color:var(--muted); text-align:center; font-size:12px; }
footer { display:flex; justify-content:space-between; gap:20px; padding:30px 4px 0; color:#8b958f; font-size:9px; letter-spacing:.04em; }
.toast { position:fixed; z-index:50; left:50%; bottom:28px; transform:translate(-50%,20px); padding:11px 16px; border-radius:12px; color:white; background:#183128; box-shadow:0 12px 30px rgba(0,0,0,.2); opacity:0; pointer-events:none; transition:.25s; font-size:12px; }.toast.show { opacity:1; transform:translate(-50%,0); }

@media (max-width: 1000px) {
  .usage-grid { grid-template-columns:1fr 1fr; }.workspace-grid { grid-template-columns:1fr; }.output-panel { position:static; }.hero { grid-template-columns:1fr 210px; }
}
@media (max-width: 680px) {
  main { width:min(100% - 24px,1240px); padding-top:30px; }.topbar { padding:0 14px; }.model-badge { display:none; }
  .hero { grid-template-columns:1fr; padding-bottom:28px; }.wave-orbit { display:none; }.hero h1 { font-size:44px; }
  .usage-grid { grid-template-columns:1fr 1fr; gap:8px; }.metric-card { padding:16px; }.metric-card > strong { font-size:24px; }.metric-card > p { display:block; }.metric-card > p span { display:block; margin-top:3px; }
  .composer-panel,.output-panel,.history-panel { padding:20px; border-radius:21px; }.panel-heading { flex-direction:column; }.mode-switch { width:100%; }.mode-button { flex:1; }
  .options-grid,.speaker-grid,.director-grid,.toggles { grid-template-columns:1fr; }.span-two { grid-column:auto; }.submit-row { align-items:stretch; flex-direction:column; }.button.generate { width:100%; }
  .history-item { grid-template-columns:1fr 80px auto; }.history-item .history-cell:nth-of-type(3),.history-item .history-cell:nth-of-type(4) { display:none; }
  .login-card { padding:42px 24px 34px; }.login-row { grid-template-columns:1fr; }.button.primary { min-height:46px; }
  footer { flex-direction:column; }
}

