:root {
  color-scheme: dark;
  --bg: #06100e;
  --panel: rgba(12, 27, 23, 0.92);
  --panel-soft: rgba(19, 38, 32, 0.72);
  --ink: #f5f1e8;
  --muted: #a8b7b0;
  --line: rgba(208, 226, 216, 0.13);
  --green: #82e6aa;
  --green-deep: #226a47;
  --gold: #e9c785;
  --danger: #ff8e7e;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--bg); }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 12%, rgba(45, 132, 91, 0.18), transparent 29rem),
    radial-gradient(circle at 90% 85%, rgba(190, 137, 62, 0.10), transparent 30rem),
    linear-gradient(150deg, #071410 0%, #08100f 46%, #0b1512 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.23;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140' viewBox='0 0 140 140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.12'/%3E%3C/svg%3E");
}

button, textarea, input { font: inherit; }
button { color: inherit; }

.app-shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 22px 0 70px; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 58px; }

.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid rgba(130,230,170,.65); border-radius: 50%; color: var(--green); font-weight: 800; box-shadow: inset 0 0 20px rgba(130,230,170,.08); }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 16px; letter-spacing: .12em; }
.brand small { margin-top: 3px; color: #74867d; font-size: 9px; letter-spacing: .24em; }

.top-actions { display: flex; gap: 10px; }
.quiet-button { border: 1px solid var(--line); border-radius: 99px; padding: 9px 13px; background: rgba(8,22,18,.58); cursor: pointer; font-size: 12px; }
.quiet-button:hover { border-color: rgba(130,230,170,.45); }
.status-dot { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 12px var(--green); }
.quiet-button[aria-pressed="false"] .status-dot { background: #6f7974; box-shadow: none; }

.intro { width: min(790px, 100%); margin: 0 auto 36px; text-align: center; }
.eyebrow { margin: 0 0 14px; color: var(--green); font-size: 11px; font-weight: 800; letter-spacing: .24em; text-transform: uppercase; }
.intro h1 { margin: 0; font-family: "Songti SC", "STSong", serif; font-size: clamp(38px, 6vw, 68px); font-weight: 500; line-height: 1.08; letter-spacing: -.04em; }
.intro > p:not(.eyebrow) { max-width: 650px; margin: 22px auto 0; color: var(--muted); font-size: 15px; line-height: 1.9; }

.stage-track { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 33px auto 0; color: #708078; font-size: 11px; letter-spacing: .08em; }
.stage-track span { position: relative; padding-top: 15px; }
.stage-track span::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: #1a3029; }
.stage-track .active { color: var(--green); }
.stage-track .active::before { background: var(--green); box-shadow: 0 0 12px rgba(130,230,170,.5); }

.conversation-card { position: relative; width: min(900px, 100%); margin: 0 auto; border: 1px solid var(--line); border-radius: 25px; padding: 25px; overflow: hidden; background: linear-gradient(150deg, rgba(15,32,27,.94), rgba(7,18,15,.96)); box-shadow: 0 30px 90px rgba(0,0,0,.34); }
.conversation-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 1px; background: linear-gradient(90deg, transparent, rgba(130,230,170,.62), transparent); }

.conversation-head { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.conversation-head h2 { margin: 8px 0 0; font-family: "Songti SC", serif; font-size: 23px; font-weight: 500; }
.live-badge { color: var(--green); font-size: 10px; letter-spacing: .16em; }
.live-badge i { display: inline-block; width: 6px; height: 6px; margin-right: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px var(--green); }
.save-state { color: #708078; font-size: 11px; }

.messages { display: flex; flex-direction: column; gap: 18px; min-height: 250px; max-height: min(48vh, 520px); padding: 27px 4px; overflow-y: auto; scrollbar-color: #29463b transparent; }
.message { display: flex; gap: 12px; align-items: flex-start; max-width: 86%; animation: appear .28s ease both; }
.message.user { align-self: flex-end; flex-direction: row-reverse; }
.avatar { flex: 0 0 auto; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; border: 1px solid rgba(130,230,170,.34); color: var(--green); background: #0d211b; font-size: 12px; font-weight: 800; }
.user .avatar { border-color: rgba(233,199,133,.35); color: var(--gold); background: #292116; }
.bubble { padding: 14px 16px; border: 1px solid rgba(201,225,214,.1); border-radius: 5px 17px 17px 17px; color: #e9eee9; background: rgba(26,47,39,.82); font-size: 15px; line-height: 1.8; white-space: pre-wrap; }
.user .bubble { border-radius: 17px 5px 17px 17px; color: #fff8e9; background: rgba(62,51,31,.67); }
.message-meta { margin-top: 6px; color: #5f7168; font-size: 9px; }
.user .message-meta { text-align: right; }

.working { display: flex; align-items: center; gap: 5px; padding: 0 10px 20px; color: var(--muted); }
.working[hidden] { display: none; }
.working span { width: 5px; height: 5px; border-radius: 50%; background: var(--green); animation: bounce 1s infinite alternate; }
.working span:nth-child(2) { animation-delay: .16s; }
.working span:nth-child(3) { animation-delay: .32s; }
.working p { margin: 0 0 0 7px; font-size: 12px; }

.composer { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding-top: 17px; border-top: 1px solid var(--line); }
.composer textarea { width: 100%; min-height: 58px; resize: vertical; border: 1px solid var(--line); border-radius: 15px; outline: none; padding: 15px 16px; color: var(--ink); background: rgba(4,13,11,.62); line-height: 1.55; }
.composer textarea:focus { border-color: rgba(130,230,170,.55); box-shadow: 0 0 0 3px rgba(130,230,170,.08); }
.send-button { min-width: 104px; border: 0; border-radius: 15px; cursor: pointer; background: var(--green); color: #082016; font-weight: 800; }
.send-button b { margin-left: 6px; font-size: 18px; }
.send-button:disabled, .mic-button:disabled { opacity: .45; cursor: not-allowed; }

.voice-zone { display: grid; grid-template-columns: 1fr auto 54px; align-items: center; gap: 24px; margin-top: 18px; padding: 22px 26px; border: 1px solid rgba(130,230,170,.18); border-radius: 19px; background: linear-gradient(110deg, rgba(22,52,41,.7), rgba(9,25,20,.63)); }
.voice-copy strong, .voice-copy span { display: block; }
.voice-copy strong { font-family: "Songti SC", serif; font-size: 20px; font-weight: 500; }
.voice-copy span { margin-top: 7px; color: #85968d; font-size: 11px; }
.voice-copy .local-save { color: #62bb87; font-size: 10px; }
.mic-button { position: relative; display: grid; place-items: center; width: 70px; height: 70px; border: 1px solid rgba(130,230,170,.5); border-radius: 50%; cursor: pointer; color: #071b12; background: var(--green); box-shadow: 0 0 0 9px rgba(130,230,170,.06), 0 12px 35px rgba(36,120,76,.25); }
.mic-button svg { position: relative; z-index: 2; width: 28px; fill: currentColor; }
.mic-button.recording { color: #fff; border-color: var(--danger); background: #d94e43; box-shadow: 0 0 0 9px rgba(255,96,80,.08), 0 12px 35px rgba(170,46,37,.25); }
.pulse { position: absolute; inset: -1px; border: 1px solid currentColor; border-radius: 50%; opacity: 0; }
.recording .pulse { animation: pulse 1.8s infinite; }
.recording .pulse-two { animation-delay: .8s; }
.timer { color: var(--green); font-variant-numeric: tabular-nums; font-size: 13px; letter-spacing: .08em; }

.principles { display: flex; justify-content: center; gap: 28px; margin: 22px auto 0; color: #63766c; font-size: 10px; letter-spacing: .18em; }
.principles span::before { content: "◇"; margin-right: 8px; color: var(--green); }

.access-dialog,
.transcript-dialog { border: 1px solid rgba(130,230,170,.23); border-radius: 22px; padding: 0; color: var(--ink); background: #0c1c17; box-shadow: 0 40px 100px rgba(0,0,0,.66); }
.access-dialog { width: min(420px, calc(100% - 36px)); }
.transcript-dialog { width: min(680px, calc(100% - 36px)); }
.access-dialog::backdrop,
.transcript-dialog::backdrop { background: rgba(1,8,6,.82); backdrop-filter: blur(7px); }
.access-dialog form,
.transcript-dialog form { padding: 30px; }
.access-dialog h2,
.transcript-dialog h2 { margin: 0; font-family: "Songti SC", serif; font-size: 28px; font-weight: 500; }
.access-dialog form > p:not(.eyebrow):not(.form-error),
.transcript-dialog form > p:not(.eyebrow):not(.recognition-reference) { color: var(--muted); line-height: 1.7; }
.access-dialog label span,
.transcript-dialog label span { display: block; margin-bottom: 8px; color: #91a298; font-size: 12px; }
.access-dialog input,
.transcript-dialog textarea { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px; outline: none; color: var(--ink); background: #07120f; }
.transcript-dialog textarea { resize: vertical; line-height: 1.7; }
.transcript-dialog textarea:focus { border-color: rgba(130,230,170,.55); box-shadow: 0 0 0 3px rgba(130,230,170,.08); }
.primary-button { width: 100%; border: 0; border-radius: 12px; padding: 13px; cursor: pointer; color: #092016; background: var(--green); font-weight: 800; }
.secondary-button { border: 1px solid var(--line); border-radius: 12px; padding: 13px 18px; cursor: pointer; color: var(--ink); background: #12251f; font-weight: 700; }
.transcript-actions { display: grid; grid-template-columns: auto 1fr; gap: 10px; margin-top: 18px; }
.recognition-reference { margin: 12px 0 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; color: #82958b; background: rgba(5,16,13,.5); font-size: 11px; line-height: 1.6; }
.form-error { min-height: 18px; color: var(--danger); font-size: 12px; }
.toast { position: fixed; left: 50%; bottom: 25px; z-index: 20; transform: translate(-50%, 20px); max-width: min(520px, calc(100% - 32px)); border: 1px solid var(--line); border-radius: 99px; padding: 11px 18px; opacity: 0; pointer-events: none; color: var(--ink); background: #142820; box-shadow: 0 18px 40px rgba(0,0,0,.3); transition: .25s ease; font-size: 12px; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { border-color: rgba(255,142,126,.42); color: #ffd2ca; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@keyframes appear { from { opacity: 0; transform: translateY(7px); } }
@keyframes bounce { to { transform: translateY(-4px); opacity: .4; } }
@keyframes pulse { 0% { transform: scale(1); opacity: .6; } 100% { transform: scale(1.8); opacity: 0; } }

@media (max-width: 720px) {
  .app-shell { width: min(100% - 22px, 1180px); padding-top: 13px; }
  .topbar { margin-bottom: 38px; }
  .top-actions { gap: 6px; }
  .quiet-button { padding: 8px 10px; }
  .quiet-button .status-dot + * { display: none; }
  .intro h1 { font-size: 42px; }
  .conversation-card { padding: 17px; border-radius: 20px; }
  .message { max-width: 96%; }
  .bubble { font-size: 14px; }
  .voice-zone { grid-template-columns: 1fr auto; gap: 15px; padding: 18px; }
  .voice-copy { grid-column: 1 / -1; text-align: center; }
  .mic-button { justify-self: end; }
  .timer { justify-self: start; }
  .send-button { min-width: 76px; }
  .principles { gap: 13px; letter-spacing: .06em; }
  .transcript-actions { grid-template-columns: 1fr; }
}
