@import url("https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600&family=Outfit:wght@400;500;600&display=swap");

:root {
  --ink: #292622;
  --muted: #7c756c;
  --paper: #f4eee5;
  --cream: #fcf8f2;
  --berry: #9b5360;
  --berry-dark: #75404a;
  --sage: #77867a;
  --line: rgba(48, 42, 37, .13);
  --shadow: 0 24px 75px rgba(70, 54, 43, .13);
}

* { box-sizing: border-box; }
html { color: var(--ink); background: var(--paper); font-family: "Outfit", "PingFang SC", sans-serif; }
body {
  height: 100vh;
  height: 100dvh;
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 12% 8%, rgba(255,255,255,.86), transparent 31%),
    linear-gradient(145deg, #f5efe7 0%, #ece2d6 100%);
}
button, textarea { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }

.aurora { position: fixed; z-index: 0; border-radius: 50%; pointer-events: none; filter: blur(2px); }
.aurora-one { top: -230px; right: -170px; width: 520px; height: 520px; background: rgba(155,83,96,.07); }
.aurora-two { bottom: -240px; left: -190px; width: 470px; height: 470px; background: rgba(119,134,122,.08); }

.app-shell { position: relative; z-index: 1; display: flex; width: min(100%, 780px); height: 100%; margin: 0 auto; padding: 0 24px; flex-direction: column; overflow: hidden; }
.topbar { display: flex; flex: 0 0 76px; align-items: center; justify-content: space-between; height: 76px; }
.icon-button, .wordmark, .dialog-close { border: 0; background: transparent; cursor: pointer; }
.icon-button { display: grid; width: 40px; height: 40px; place-items: center; border: 1px solid var(--line); border-radius: 50%; }
.wordmark { display: flex; gap: 9px; align-items: center; font-size: 14px; font-weight: 600; letter-spacing: .03em; }
.brand-mark { display: grid; width: 29px; height: 29px; place-items: center; border-radius: 50%; background: var(--ink); color: var(--paper); transform: rotate(-22deg); }

.conversation-shell { min-height: 0; padding: 20px 4px 145px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: rgba(48,42,37,.16) transparent; }
.conversation-shell::-webkit-scrollbar { width: 5px; }
.conversation-shell::-webkit-scrollbar-thumb { border-radius: 99px; background: rgba(48,42,37,.16); }
.latest-card-area { margin: 2px 0 46px; }
.latest-card-label { margin: 0 0 12px; color: var(--muted); font-size: 9px; letter-spacing: .2em; text-align: center; }
.latest-card {
  display: flex;
  justify-content: space-between;
  width: 100%;
  padding: 18px 20px;
  border: 1px solid rgba(255,255,255,.68);
  border-radius: 21px;
  background: rgba(252,248,242,.63);
  box-shadow: 0 14px 42px rgba(65,50,40,.08);
  text-align: left;
  cursor: pointer;
}
.latest-card span:first-child { min-width: 0; }
.latest-card small, .latest-card strong, .latest-card em { display: block; }
.latest-card small { margin-bottom: 7px; color: var(--berry); font-size: 10px; letter-spacing: .15em; text-transform: uppercase; }
.latest-card strong { overflow: hidden; font-family: "Noto Serif SC", serif; font-size: 16px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.latest-card em { margin-top: 5px; overflow: hidden; color: var(--muted); font-family: "Noto Serif SC", serif; font-size: 12px; font-style: normal; text-overflow: ellipsis; white-space: nowrap; }
.latest-arrow { align-self: center; color: var(--berry); font-size: 18px; }
.dashed-divider { display: flex; align-items: center; gap: 13px; margin-top: 27px; color: var(--muted); font-size: 9px; letter-spacing: .2em; }
.dashed-divider::before, .dashed-divider::after { content: ""; flex: 1; border-top: 1px dashed rgba(54,47,41,.22); }

.conversation-heading { max-width: 560px; margin: 0 auto 38px; text-align: center; }
.eyebrow { margin: 0 0 12px; color: var(--berry); font-size: 10px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; }
h1, h2 { margin: 0; font-family: "Noto Serif SC", serif; font-weight: 500; }
.conversation-heading h1 { font-size: clamp(36px, 7vw, 53px); line-height: 1.3; letter-spacing: -.05em; }
.conversation-heading h1 em { color: var(--berry); font-style: normal; }
.conversation-heading > p:last-child { margin: 17px auto 0; color: var(--muted); font-family: "Noto Serif SC", serif; font-size: 14px; line-height: 1.9; }
.conversation-heading.compact { margin-bottom: 25px; text-align: left; }
.conversation-heading.compact h1 { font-size: 28px; letter-spacing: -.02em; }
.conversation-heading.compact > p:last-child { margin-top: 8px; }
.title-row { display: flex; align-items: flex-start; justify-content: center; gap: 14px; }
.compact .title-row { justify-content: space-between; }
.dream-tools { display: flex; flex: 0 0 auto; gap: 5px; }
.dream-tools button { padding: 7px 9px; border: 0; border-radius: 9px; background: rgba(252,248,242,.56); color: var(--muted); font-size: 11px; cursor: pointer; }
.dream-tools .delete-tool { color: #9a5c5c; }

.message-list { display: grid; gap: 14px; padding: 0 0 18px; }
.message-row { display: flex; }
.message-row.user { justify-content: flex-end; }
.message-row.assistant, .message-row.notice { justify-content: flex-start; }
.message {
  width: fit-content;
  max-width: 76%;
  padding: 10px 14px;
  border-radius: 17px;
  white-space: pre-wrap;
  font-family: "Noto Serif SC", serif;
  font-size: 14px;
  line-height: 1.65;
}
.message-row.user .message { border-bottom-right-radius: 6px; background: var(--ink); color: var(--cream); }
.message-row.assistant .message { border: 1px solid var(--line); border-bottom-left-radius: 6px; background: rgba(252,248,242,.75); white-space: normal; }
.message-row.assistant .message p { margin: 0 0 10px; }
.message-row.assistant .message p:last-child { margin-bottom: 0; }
.message-row.assistant .message h3,
.message-row.assistant .message h4,
.message-row.assistant .message h5 { margin: 14px 0 7px; color: var(--berry-dark); font-size: 1em; font-weight: 600; }
.message-row.assistant .message h3:first-child,
.message-row.assistant .message h4:first-child,
.message-row.assistant .message h5:first-child { margin-top: 0; }
.message-row.assistant .message ul,
.message-row.assistant .message ol { margin: 7px 0 11px; padding-left: 1.4em; }
.message-row.assistant .message li { margin: 4px 0; }
.message-row.assistant .message blockquote { margin: 10px 0; padding-left: 11px; border-left: 2px solid rgba(155,83,96,.35); color: var(--muted); }
.message-row.assistant .message code { padding: 1px 5px; border-radius: 5px; background: rgba(48,42,37,.07); font-family: ui-monospace, monospace; font-size: .9em; }
.message-row.assistant .message a { color: var(--berry-dark); text-decoration-color: rgba(117,64,74,.35); }
.message-row.notice .message { padding: 11px 15px; border: 1px dashed rgba(155,83,96,.28); background: rgba(155,83,96,.05); color: var(--berry-dark); font-family: inherit; font-size: 12px; }
.message.loading { color: var(--muted); }
.audio-player { display: flex; gap: 8px; align-items: center; min-width: 160px; margin-bottom: 7px; }
.audio-play { display: grid; flex: 0 0 31px; width: 31px; height: 31px; place-items: center; border: 1px solid rgba(255,255,255,.35); border-radius: 50%; background: transparent; color: inherit; cursor: pointer; }
.audio-line { display: flex; flex: 1; align-items: center; gap: 3px; }
.audio-line i { width: 2px; height: 9px; border-radius: 4px; background: currentColor; opacity: .55; }
.audio-line i:nth-child(2n) { height: 17px; }
.audio-line i:nth-child(3n) { height: 12px; }
.audio-duration { font-family: "Outfit", sans-serif; font-size: 11px; opacity: .7; }

.record-actions { display: flex; flex-wrap: wrap; gap: 9px; margin: 5px 0 18px; padding-left: 2px; }
.interpretation-status { margin: -4px 0 18px; }
.chip { padding: 10px 15px; border: 1px solid var(--line); border-radius: 99px; background: rgba(252,248,242,.75); cursor: pointer; }
.chip.secondary { color: var(--muted); }
.chip.accent { border-color: rgba(155,83,96,.28); background: rgba(155,83,96,.1); color: var(--berry-dark); }
.start-new-after-draft { display: block; margin: 28px auto 0; padding: 11px 17px; border: 1px dashed var(--line); border-radius: 99px; background: transparent; color: var(--muted); cursor: pointer; }

.composer-wrap { position: fixed; z-index: 5; right: 0; bottom: max(16px, env(safe-area-inset-bottom)); left: 0; width: min(calc(100% - 32px), 740px); margin: auto; }
.composer {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 9px;
  border: 1px solid rgba(48,42,37,.14);
  border-radius: 25px;
  background: rgba(252,248,242,.94);
  box-shadow: 0 17px 55px rgba(55,43,35,.18);
  backdrop-filter: blur(18px);
}
.text-composer textarea { flex: 1 1 auto; width: 100%; min-width: 0; min-height: 44px; max-height: 150px; padding: 11px 9px; resize: none; border: 0; outline: 0; background: transparent; color: var(--ink); font-family: "Noto Serif SC", serif; font-size: 14px; line-height: 1.55; }
.composer-icon, .send-button, .voice-control { border: 0; cursor: pointer; }
.composer-icon, .send-button { display: grid; flex: 0 0 42px; width: 42px; height: 42px; place-items: center; border-radius: 50%; }
.composer-icon { background: transparent; color: var(--muted); }
.send-button { background: var(--ink); color: white; font-size: 18px; }
.microphone-icon { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.voice-tip { position: absolute; right: 47px; bottom: 68px; padding: 8px 11px; border-radius: 10px; background: var(--ink); color: white; font-size: 11px; opacity: 0; pointer-events: none; transform: translateY(5px); transition: .2s ease; }
.voice-tip::after { content: ""; position: absolute; right: 17px; bottom: -5px; width: 10px; height: 10px; background: var(--ink); transform: rotate(45deg); }
.voice-tip.show { opacity: 1; transform: translateY(0); }

.voice-composer { align-items: center; }
.voice-status { display: flex; flex: 1; align-items: center; justify-content: center; min-width: 0; gap: 10px; color: var(--muted); }
.voice-status strong { font-size: 12px; font-weight: 500; }
.voice-wave { display: flex; align-items: center; height: 25px; gap: 3px; }
.voice-wave i { width: 2px; height: 7px; border-radius: 4px; background: var(--berry); }
.voice-composer.recording .voice-wave i { animation: wave .7s ease-in-out infinite alternate; }
.voice-composer.recording .voice-wave i:nth-child(2n) { animation-delay: -.25s; }
.voice-composer.recording .voice-wave i:nth-child(3n) { animation-delay: -.45s; }
@keyframes wave { to { height: 23px; } }
.voice-control { flex: 0 0 auto; padding: 12px 15px; border-radius: 99px; background: var(--berry); color: white; }
.voice-composer.recording .voice-control { background: var(--ink); }

.sidebar { position: fixed; z-index: 30; top: 0; bottom: 0; left: 0; display: flex; width: min(86vw, 330px); padding: 24px 18px; flex-direction: column; background: #ece3d8; box-shadow: 18px 0 60px rgba(50,40,33,.2); transform: translateX(-105%); transition: transform .3s ease; }
.sidebar.open { transform: translateX(0); }
.sidebar-scrim { position: fixed; z-index: 29; inset: 0; border: 0; background: rgba(41,35,30,.35); opacity: 0; pointer-events: none; transition: opacity .3s; }
.sidebar-scrim.open { opacity: 1; pointer-events: auto; }
.sidebar-head { display: flex; align-items: center; gap: 9px; margin-bottom: 27px; }
.sidebar-head strong { flex: 1; font-size: 14px; }
.sidebar-close { border: 0; font-size: 21px; }
.new-dream-button { display: flex; gap: 9px; align-items: center; padding: 13px 15px; border: 1px solid var(--line); border-radius: 15px; background: rgba(252,248,242,.55); cursor: pointer; }
.new-dream-button span { color: var(--berry); font-size: 18px; }
.nav-section { margin-top: 27px; }
.nav-section-title { display: flex; justify-content: space-between; width: 100%; padding: 7px 3px; border: 0; background: transparent; font-size: 12px; font-weight: 600; cursor: pointer; }
.nav-count { color: var(--muted); font-weight: 400; }
.nav-list { display: grid; gap: 5px; margin-top: 8px; }
.nav-item { width: 100%; padding: 10px 11px; overflow: hidden; border: 0; border-radius: 11px; background: transparent; color: var(--muted); text-align: left; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.nav-item:hover, .nav-item.active { background: rgba(252,248,242,.55); color: var(--ink); }
.install-entry, .privacy-entry { padding: 13px; border: 0; background: transparent; color: var(--muted); text-align: left; cursor: pointer; }
.install-entry { margin-top: auto; border-top: 1px solid var(--line); color: var(--berry-dark); }

dialog { width: min(calc(100% - 34px), 520px); padding: 32px; border: 0; border-radius: 27px; background: var(--cream); box-shadow: 0 30px 95px rgba(38,31,26,.27); }
dialog::backdrop { background: rgba(38,31,26,.42); backdrop-filter: blur(4px); }
dialog h2 { font-size: 27px; }
dialog > p:not(.eyebrow) { color: var(--muted); font-size: 13px; line-height: 1.7; }
.dialog-close { position: absolute; top: 16px; right: 19px; color: var(--muted); font-size: 23px; }
.transcript-dialog textarea { width: 100%; margin-top: 13px; padding: 16px; resize: vertical; border: 1px solid var(--line); border-radius: 17px; outline: none; background: #f7f1e9; font-family: "Noto Serif SC", serif; line-height: 1.8; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.quiet-button, .primary-button { padding: 12px 17px; border: 0; border-radius: 13px; cursor: pointer; }
.quiet-button { background: transparent; color: var(--muted); }
.primary-button { background: var(--ink); color: white; }
.primary-button.wide { width: 100%; margin-top: 22px; }
.privacy-points { margin-top: 22px; }
.privacy-points p { margin: 0; padding: 11px 0; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 13px; line-height: 1.7; }
.privacy-points strong { color: var(--ink); }
.toast { position: fixed; z-index: 50; bottom: 100px; left: 50%; max-width: calc(100% - 40px); padding: 11px 17px; border-radius: 99px; background: var(--ink); color: white; font-size: 12px; opacity: 0; pointer-events: none; transform: translate(-50%, 10px); transition: .22s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 560px) {
  .app-shell { padding-right: 16px; padding-left: 16px; }
  .topbar { height: 68px; }
  .conversation-shell { padding-top: 12px; }
  .latest-card-area { margin-bottom: 37px; }
  .conversation-heading h1 { font-size: 38px; }
  .message { max-width: 84%; }
  .composer-wrap { width: calc(100% - 22px); }
  .voice-status { gap: 7px; font-size: 12px; }
  .voice-control { padding-right: 12px; padding-left: 12px; font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
