:root {
  --paper: #f3f0e4;
  --paper-deep: #e8e3d2;
  --surface: #fffdf5;
  --ink: #1e2923;
  --ink-soft: #5e675f;
  --line: #d5d1c2;
  --lime: #d9f65f;
  --lime-deep: #bddf34;
  --coral: #f45b48;
  --coral-dark: #d83d2b;
  --white: #fffef8;
  --danger: #b22f25;
  --shadow: 0 22px 65px rgba(55, 65, 43, 0.13);
  --serif: "Literata", Georgia, serif;
  --sans: "Manrope", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}

button, input, textarea { font: inherit; }
button { color: inherit; }
button, a { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button:not(:disabled), a { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--coral);
  outline-offset: 3px;
}

[hidden] { display: none !important; }

.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;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 12px;
  left: 12px;
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--white);
  transform: translateY(-150%);
  transition: transform 180ms ease-out;
}
.skip-link:focus { transform: translateY(0); }

.app-shell {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  min-height: 100dvh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  padding: 34px 22px 24px;
  border-right: 1px solid var(--line);
  background: rgba(243, 240, 228, 0.96);
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-weight: 800;
  line-height: 1.03;
  letter-spacing: -0.035em;
  text-decoration: none;
}

.brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 42px;
  height: 42px;
  border-radius: 12px 12px 12px 3px;
  background: var(--ink);
  box-shadow: 4px 4px 0 var(--lime);
}
.brand-mark i { width: 3px; height: 13px; border-radius: 3px; background: var(--lime); }
.brand-mark i:nth-child(2) { height: 22px; }
.brand-mark i:nth-child(3) { height: 8px; }

.main-nav { display: grid; gap: 8px; margin-top: 74px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 700;
  text-align: left;
  text-decoration: none;
  transition: background 180ms ease, color 180ms ease, transform 180ms ease;
}
.nav-item svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-item:hover { background: rgba(255,255,255,.52); color: var(--ink); transform: translateY(-1px); }
.nav-item.is-active { background: var(--ink); color: var(--white); }

.sidebar-foot { margin-top: auto; }
.privacy-note {
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}
.privacy-note svg { width: 20px; fill: none; stroke: var(--ink); stroke-width: 1.7; }
.privacy-note p { margin: 8px 0 0; color: var(--ink-soft); font-size: 11px; line-height: 1.55; }
.privacy-note strong { color: var(--ink); font-size: 12px; }
.connection { display: flex; align-items: center; gap: 7px; margin: 18px 4px 0; color: var(--ink-soft); font-size: 11px; font-weight: 700; }
.connection > span { width: 7px; height: 7px; border-radius: 50%; background: #6ca735; box-shadow: 0 0 0 4px rgba(108,167,53,.12); }
.connection.is-offline > span { background: var(--coral); box-shadow: 0 0 0 4px rgba(244,91,72,.12); }

.mobile-header, .mobile-nav { display: none; }
main { min-width: 0; }
.view { display: none; min-height: 100dvh; }
.view.is-active { display: block; }

.record-layout {
  display: grid;
  grid-template-columns: minmax(390px, 1.2fr) minmax(350px, 440px) minmax(220px, .65fr);
  min-height: 100dvh;
}

.record-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 64px clamp(28px, 3.2vw, 58px);
  border-right: 1px solid var(--line);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.eyebrow-line { width: 26px; height: 2px; background: var(--coral); }
.record-copy h1 {
  max-width: 680px;
  margin: 32px 0 28px;
  font: 650 clamp(44px, 4vw, 68px)/.98 var(--serif);
  letter-spacing: -.055em;
}
.record-copy h1 em { position: relative; font-style: italic; font-weight: 500; white-space: nowrap; }
.record-copy h1 em::after {
  content: "";
  position: absolute;
  z-index: -1;
  left: -3%;
  bottom: .03em;
  width: 106%;
  height: .24em;
  border-radius: 2px;
  background: var(--lime);
  transform: rotate(-1deg);
}
.record-copy > p { max-width: 545px; margin: 0; color: var(--ink-soft); font-size: clamp(16px, 1.25vw, 20px); line-height: 1.7; }
.trust-row { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 38px; }
.trust-row span { display: flex; align-items: center; gap: 6px; color: var(--ink); font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.trust-row svg { width: 16px; fill: none; stroke: #70812e; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

.recorder-column {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 44px clamp(24px, 3vw, 44px);
  background-color: var(--surface);
  background-image: linear-gradient(var(--line) 1px, transparent 1px);
  background-size: 100% 34px;
}
.recorder-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 590px;
  padding: 58px 30px;
  border: 1px solid var(--ink);
  border-radius: 180px 180px 26px 26px;
  background: var(--paper);
  box-shadow: var(--shadow), 0 8px 0 var(--ink);
  overflow: hidden;
}
.top-rule, .stage-caption {
  position: absolute;
  inset-inline: 30px;
  display: flex;
  justify-content: space-between;
  color: var(--ink-soft);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.top-rule { top: 36px; inset-inline: clamp(64px, 18%, 88px); padding-bottom: 11px; border-bottom: 1px solid var(--line); }
.stage-caption { bottom: 22px; padding-top: 11px; border-top: 1px solid var(--line); }

.sound-field {
  position: absolute;
  top: 106px;
  display: flex;
  align-items: center;
  gap: 4px;
  width: 72%;
  height: 68px;
  opacity: .65;
}
.sound-field span {
  flex: 1;
  height: var(--h);
  min-width: 2px;
  border-radius: 4px;
  background: var(--ink);
  transform-origin: center;
}
.is-recording .sound-field span { animation: wave 720ms ease-in-out infinite alternate; }
.is-recording .sound-field span:nth-child(3n) { animation-delay: -240ms; }
.is-recording .sound-field span:nth-child(4n) { animation-delay: -420ms; }
@keyframes wave { to { transform: scaleY(.28); opacity: .45; } }

.record-button {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 19px;
  margin-top: 48px;
  border: 0;
  background: transparent;
}
.record-button-core {
  display: grid;
  place-items: center;
  width: 142px;
  height: 142px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 0 9px 0 var(--coral-dark), 0 12px 0 var(--ink);
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}
.record-button-core::before { content: ""; position: absolute; width: 118px; height: 118px; border: 1px dashed rgba(255,255,255,.58); border-radius: 50%; }
.record-button-core span { width: 28px; height: 28px; border-radius: 50%; background: var(--white); }
.record-button:hover .record-button-core { transform: translateY(-3px); box-shadow: 0 12px 0 var(--coral-dark), 0 15px 0 var(--ink); }
.record-button:active .record-button-core { transform: translateY(7px); box-shadow: 0 2px 0 var(--coral-dark), 0 4px 0 var(--ink); }
.record-button-label { font-size: 13px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.is-recording .record-button-core { background: var(--ink); box-shadow: 0 9px 0 #111813, 0 12px 0 var(--coral); }
.is-recording .record-button-core span { border-radius: 5px; background: var(--coral); }
.is-recording .record-button-label::before { content: "Остановить запись"; }
.is-recording .record-button-label { font-size: 0; }
.is-recording .record-button-label::before { font-size: 13px; }
.record-time { margin-top: 18px; font: 600 28px/1 var(--serif); font-variant-numeric: tabular-nums; letter-spacing: -.04em; }
.record-hint { max-width: 230px; margin: 12px 0 0; color: var(--ink-soft); font-size: 12px; text-align: center; }

.process-state, .error-state {
  position: absolute;
  z-index: 4;
  inset: 90px 24px 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  padding: 28px;
  border-radius: 110px 110px 15px 15px;
  background: var(--paper);
  text-align: left;
}
.process-state small { display: block; margin-top: 3px; color: var(--ink-soft); font-size: 11px; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--coral); border-radius: 50%; animation: spin 750ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-state { align-items: flex-start; padding-top: 105px; background: #fff3ea; }
.error-state svg { flex: 0 0 auto; width: 30px; fill: none; stroke: var(--danger); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.error-state p { max-width: 260px; margin: 6px 0 18px; color: var(--ink-soft); font-size: 12px; }
.error-state button { min-height: 42px; padding: 0 18px; border: 1px solid var(--ink); border-radius: 8px; background: var(--surface); font-weight: 700; }

.record-aside { display: flex; flex-direction: column; justify-content: center; padding: 54px clamp(24px, 3vw, 48px); }
.aside-heading { display: flex; justify-content: space-between; padding-bottom: 13px; border-bottom: 1px solid var(--ink); font-size: 10px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.steps { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.steps li { display: grid; grid-template-columns: 35px 1fr; gap: 14px; padding: 24px 0; border-bottom: 1px solid var(--line); }
.steps li > span { color: var(--coral); font: 650 13px var(--serif); }
.steps strong { font: 650 18px var(--serif); }
.steps p { margin: 5px 0 0; color: var(--ink-soft); font-size: 12px; line-height: 1.55; }
.recent-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-height: 154px;
  margin-top: 30px;
  padding: 22px 48px 22px 22px;
  border: 1px solid var(--ink);
  border-radius: 14px;
  background: var(--lime);
  text-align: left;
  box-shadow: 5px 5px 0 var(--ink);
  transition: transform 180ms ease, box-shadow 180ms ease;
}
.recent-card:hover { transform: translateY(-2px); box-shadow: 7px 7px 0 var(--ink); }
.recent-card .recent-label { margin-bottom: auto; font-size: 9px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.recent-card strong { margin: 15px 0 4px; font: 650 18px/1.2 var(--serif); }
.recent-card > span:last-of-type { color: #48501f; font-size: 10px; font-weight: 700; }
.recent-card svg { position: absolute; right: 19px; bottom: 20px; width: 22px; fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.note-shell, .history-shell { width: min(980px, calc(100% - 80px)); margin: 0 auto; padding: 40px 0 100px; }
.note-topbar { display: flex; align-items: center; justify-content: space-between; padding-bottom: 32px; border-bottom: 1px solid var(--line); }
.text-button, .icon-text-button, .chat-cta, .icon-button { min-height: 44px; border: 0; border-radius: 10px; background: transparent; color: inherit; font-size: 13px; font-weight: 700; text-decoration: none; }
.text-button, .icon-text-button { display: inline-flex; align-items: center; gap: 8px; padding: 0 10px; }
.text-button svg, .icon-text-button svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.text-button:hover, .icon-text-button:hover { background: rgba(255,255,255,.55); }
.note-actions { display: flex; align-items: center; gap: 10px; }
.chat-cta { display: inline-flex; align-items: center; gap: 9px; padding: 0 18px; border: 1px solid var(--ink); background: var(--ink); color: var(--white); box-shadow: 3px 3px 0 var(--lime); transition: transform 180ms ease; }
.chat-cta:hover { transform: translateY(-2px); }
.chat-cta svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.note-header { max-width: 780px; padding: 76px 0 45px; }
.note-kicker { display: inline-block; padding: 7px 11px; border-radius: 5px; background: var(--lime); font-size: 10px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; transform: rotate(-1deg); }
.note-header h1 { margin: 25px 0 22px; font: 650 clamp(40px, 5.2vw, 68px)/1.03 var(--serif); letter-spacing: -.05em; }
.note-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 11px; color: var(--ink-soft); font-size: 12px; font-weight: 600; }
.note-meta i { width: 3px; height: 3px; border-radius: 50%; background: var(--coral); }
.note-tabs { display: flex; gap: 28px; border-bottom: 1px solid var(--line); }
.note-tabs button { position: relative; min-height: 52px; padding: 0; border: 0; background: transparent; color: var(--ink-soft); font-size: 13px; font-weight: 700; }
.note-tabs button.is-active { color: var(--ink); }
.note-tabs button.is-active::after { content: ""; position: absolute; right: 0; bottom: -1px; left: 0; height: 3px; background: var(--coral); }
.markdown-content { max-width: 760px; padding: 50px 0; font-size: 17px; line-height: 1.8; }
.markdown-content h1, .markdown-content h2, .markdown-content h3 { font-family: var(--serif); line-height: 1.2; letter-spacing: -.025em; }
.markdown-content h1 { margin: 0 0 30px; font-size: 38px; }
.markdown-content h2 { margin: 48px 0 18px; font-size: 28px; }
.markdown-content h3 { margin: 34px 0 14px; font-size: 21px; }
.markdown-content p { margin: 0 0 17px; color: #3c473f; }
.markdown-content ul { margin: 12px 0 26px; padding: 0; list-style: none; }
.markdown-content li { position: relative; margin: 10px 0; padding-left: 28px; }
.markdown-content li::before { content: ""; position: absolute; top: .68em; left: 4px; width: 8px; height: 8px; border: 1px solid var(--ink); background: var(--lime); transform: rotate(45deg); }
.markdown-content strong { padding: 0 2px; background: linear-gradient(transparent 55%, var(--lime) 55%); }
.markdown-content code { padding: 2px 6px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); font-size: .9em; }
.markdown-content blockquote { margin: 30px 0; padding: 22px 28px; border-left: 4px solid var(--coral); background: var(--surface); font: 500 19px/1.65 var(--serif); }

.history-header { display: flex; align-items: end; justify-content: space-between; gap: 28px; padding: 40px 0 48px; }
.history-header h1 { margin: 16px 0 0; font: 650 clamp(44px, 6vw, 76px)/1 var(--serif); letter-spacing: -.055em; }
.search-field { display: flex; align-items: center; width: min(310px, 100%); min-height: 50px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.search-field:focus-within { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(30,41,35,.1); }
.search-field svg { flex: 0 0 auto; width: 19px; fill: none; stroke: var(--ink-soft); stroke-width: 1.8; stroke-linecap: round; }
.search-field input { width: 100%; min-height: 46px; padding: 0 10px; border: 0; outline: 0; background: transparent; color: var(--ink); }
.history-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.history-card { position: relative; min-height: 240px; padding: 26px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 1px 0 rgba(30,41,35,.06); transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease; }
.history-card:hover { transform: translateY(-3px); border-color: var(--ink); box-shadow: 7px 7px 0 var(--paper-deep); }
.history-card-main { display: flex; flex-direction: column; align-items: flex-start; width: 100%; height: 100%; padding: 0; border: 0; background: transparent; text-align: left; }
.history-card-top { display: flex; align-items: center; justify-content: space-between; width: 100%; color: var(--ink-soft); font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.history-card-index { display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid var(--ink); border-radius: 50%; color: var(--ink); }
.history-card h2 { max-width: 90%; margin: 34px 0 18px; font: 650 28px/1.16 var(--serif); letter-spacing: -.03em; }
.history-card-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: auto; }
.history-card-tags span { padding: 5px 8px; border-radius: 5px; background: var(--paper); color: var(--ink-soft); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.delete-button { position: absolute; right: 16px; bottom: 15px; display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 10px; background: transparent; color: var(--ink-soft); opacity: 0; transition: opacity 180ms ease, background 180ms ease, color 180ms ease; }
.history-card:hover .delete-button, .delete-button:focus-visible { opacity: 1; }
.delete-button:hover { background: #fde8e2; color: var(--danger); }
.delete-button svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.history-card.is-pressing { border-color: var(--coral); transform: scale(.985); }
.history-tip { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 35px 0 0; color: var(--ink-soft); font-size: 11px; }
.history-tip svg { width: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.empty-state { display: grid; place-items: center; min-height: 430px; text-align: center; }
.empty-state h2 { margin: 24px 0 5px; font: 650 34px var(--serif); }
.empty-state p { margin: 0 0 22px; color: var(--ink-soft); }
.empty-art { display: flex; align-items: end; gap: 7px; height: 64px; }
.empty-art i { width: 10px; height: 32px; border: 1px solid var(--ink); border-radius: 8px; background: var(--lime); }
.empty-art i:nth-child(2) { height: 62px; background: var(--coral); }
.empty-art i:nth-child(3) { height: 45px; }

.chat-backdrop { position: fixed; z-index: 90; inset: 0; background: rgba(20,28,23,.48); }
.chat-panel {
  position: fixed;
  z-index: 100;
  top: 0;
  right: 0;
  display: grid;
  grid-template-rows: auto auto 1fr auto auto;
  width: min(480px, 100%);
  height: 100dvh;
  border-left: 1px solid var(--ink);
  background: var(--surface);
  box-shadow: -24px 0 70px rgba(30,41,35,.18);
  transform: translateX(102%);
  transition: transform 260ms cubic-bezier(.2,.75,.25,1);
  overscroll-behavior: contain;
}
.chat-panel.is-open { transform: translateX(0); }
.chat-panel > header { display: flex; align-items: center; justify-content: space-between; padding: 24px; border-bottom: 1px solid var(--line); }
.chat-panel > header > div { display: flex; align-items: center; gap: 12px; }
.chat-panel header span { color: var(--ink-soft); font-size: 9px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.chat-panel h2 { margin: 2px 0 0; font: 650 20px var(--serif); }
.chat-orbit { position: relative; display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid var(--ink); border-radius: 50%; background: var(--lime); }
.chat-orbit::before { content: ""; width: 14px; height: 14px; border-radius: 50%; background: var(--ink); }
.chat-orbit i { position: absolute; width: 52px; height: 20px; border: 1px solid var(--ink); border-radius: 50%; transform: rotate(-30deg); }
.icon-button { display: grid; place-items: center; width: 44px; padding: 0; }
.icon-button:hover { background: var(--paper); }
.icon-button svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.chat-context { display: flex; align-items: center; gap: 10px; margin: 16px 24px 0; padding: 10px 13px; border-radius: 8px; background: var(--paper); font-size: 11px; }
.chat-context span { color: var(--ink-soft); }
.chat-context strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-messages { overflow-y: auto; padding: 24px; }
.message { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 18px; }
.message-avatar { flex: 0 0 auto; display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid var(--ink); border-radius: 50%; background: var(--lime); font-size: 9px; font-weight: 800; }
.message p { max-width: 82%; margin: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 4px 14px 14px; background: var(--white); font-size: 13px; line-height: 1.6; }
.message.user { justify-content: flex-end; }
.message.user p { border-color: var(--ink); border-radius: 14px 4px 14px 14px; background: var(--ink); color: var(--white); }
.message.is-loading p::after { content: ""; display: inline-block; width: 15px; height: 6px; margin-left: 6px; border-bottom: 2px dotted var(--ink-soft); animation: blink 900ms steps(2) infinite; }
@keyframes blink { 50% { opacity: .2; } }
.suggestions { display: flex; gap: 8px; overflow-x: auto; padding: 8px 24px 14px; scrollbar-width: none; }
.suggestions button { flex: 0 0 auto; min-height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 18px; background: var(--paper); font-size: 10px; font-weight: 700; }
.suggestions button:hover { border-color: var(--ink); }
.chat-form { display: grid; grid-template-columns: 1fr 46px; gap: 9px; padding: 14px 24px 24px; border-top: 1px solid var(--line); }
.chat-form textarea { min-height: 48px; max-height: 130px; padding: 12px 14px; resize: none; border: 1px solid var(--line); border-radius: 12px; background: var(--white); color: var(--ink); outline: 0; }
.chat-form textarea:focus { border-color: var(--ink); }
.chat-form button { display: grid; place-items: center; width: 46px; height: 46px; border: 1px solid var(--ink); border-radius: 12px; background: var(--coral); color: var(--ink); }
.chat-form button:disabled { opacity: .45; cursor: wait; }
.chat-form svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.toast { position: fixed; z-index: 200; right: 24px; bottom: 24px; max-width: 360px; padding: 14px 18px; border: 1px solid var(--ink); border-radius: 10px; background: var(--ink); color: var(--white); box-shadow: 5px 5px 0 var(--lime); font-size: 12px; font-weight: 700; }

h1, h2, h3 { text-wrap: balance; }

@media (max-width: 1180px) {
  .app-shell { grid-template-columns: 92px minmax(0, 1fr); }
  .sidebar { align-items: center; padding-inline: 14px; }
  .sidebar .brand > span:last-child, .sidebar .nav-item span, .privacy-note, .sidebar .connection { display: none; }
  .main-nav { width: 100%; }
  .nav-item { justify-content: center; padding: 0; }
  .record-layout { grid-template-columns: minmax(320px, 1fr) minmax(340px, 460px); }
  .record-aside { display: none; }
}

@media (max-width: 820px) {
  body { padding-bottom: calc(78px + env(safe-area-inset-bottom)); }
  .app-shell { display: block; }
  .sidebar { display: none; }
  .mobile-header { position: sticky; z-index: 30; top: 0; display: flex; align-items: center; justify-content: space-between; height: 66px; padding: 0 18px; border-bottom: 1px solid var(--line); background: rgba(243,240,228,.96); backdrop-filter: blur(8px); }
  .mobile-header .brand { font-size: 13px; }
  .mobile-header .brand-mark { width: 34px; height: 34px; border-radius: 9px 9px 9px 2px; box-shadow: 3px 3px 0 var(--lime); }
  .mobile-header .connection { margin: 0; }
  .mobile-nav { position: fixed; z-index: 40; right: 0; bottom: 0; left: 0; display: grid; grid-template-columns: repeat(2, 1fr); align-items: end; height: calc(72px + env(safe-area-inset-bottom)); padding: 7px 24px calc(7px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface); }
  .mobile-nav .nav-item { flex-direction: column; gap: 2px; min-height: 54px; font-size: 9px; }
  .mobile-nav .nav-item.is-active { background: transparent; color: var(--coral-dark); }
  .mobile-nav .nav-item svg { width: 22px; }
  .record-layout { display: block; }
  .record-copy { display: block; padding: 46px 22px 30px; border-right: 0; }
  .record-copy h1 { margin: 23px 0 20px; font-size: clamp(44px, 13vw, 68px); }
  .record-copy > p { font-size: 16px; line-height: 1.6; }
  .trust-row { gap: 10px 16px; margin-top: 25px; }
  .recorder-column { min-height: 620px; padding: 25px 22px 44px; background-size: 100% 30px; }
  .recorder-stage { min-height: 540px; border-radius: 150px 150px 22px 22px; box-shadow: 0 6px 0 var(--ink); }
  .record-button-core { width: 126px; height: 126px; }
  .record-button-core::before { width: 104px; height: 104px; }
  .note-shell, .history-shell { width: calc(100% - 36px); padding-top: 20px; }
  .note-topbar { padding-bottom: 18px; }
  .icon-text-button span { display: none; }
  .note-header { padding: 50px 0 35px; }
  .note-header h1 { font-size: clamp(38px, 10.5vw, 58px); }
  .markdown-content { padding: 36px 0; font-size: 16px; }
  .markdown-content h2 { font-size: 25px; }
  .history-header { align-items: stretch; flex-direction: column; padding: 34px 0; }
  .search-field { width: 100%; }
  .history-grid { grid-template-columns: 1fr; }
  .delete-button { opacity: 1; }
  .history-tip { display: none; }
  .toast { right: 16px; bottom: calc(92px + env(safe-area-inset-bottom)); left: 16px; }
}

@media (max-width: 430px) {
  .record-copy h1 { font-size: 45px; }
  .record-copy h1 em { white-space: normal; }
  .record-copy > p { color: #4d574f; }
  .trust-row span { font-size: 9px; }
  .recorder-column { min-height: 570px; padding-inline: 15px; }
  .recorder-stage { min-height: 505px; padding-inline: 20px; }
  .sound-field { top: 102px; }
  .stage-caption { inset-inline: 22px; }
  .record-button { margin-top: 44px; }
  .note-actions { gap: 2px; }
  .chat-cta { padding-inline: 13px; }
  .note-meta i { display: none; }
  .note-meta { align-items: flex-start; flex-direction: column; gap: 3px; }
  .history-card { min-height: 220px; padding: 22px; }
  .history-card h2 { font-size: 25px; }
  .chat-panel > header, .chat-messages { padding-inline: 18px; }
  .chat-context { margin-inline: 18px; }
  .suggestions { padding-inline: 18px; }
  .chat-form { padding-inline: 18px; }
}

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