:root {
  --bg: #090c0f;
  --bg-deep: #06080a;
  --surface: #12171c;
  --surface-strong: #171d23;
  --surface-hover: #1b242b;
  --line: #303941;
  --line-soft: #222a31;
  --text: #f5f7f8;
  --muted: #a9b1b8;
  --quiet: #747f88;
  --cyan: #4bd8f4;
  --cyan-strong: #61e1fa;
  --cyan-soft: rgba(75, 216, 244, 0.12);
  --green: #8be35d;
  --green-soft: rgba(139, 227, 93, 0.12);
  --red: #ff6969;
  --amber: #f6bd5c;
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.32);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Atkinson Hyperlegible", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  background: var(--bg);
  color-scheme: dark;
}

body {
  min-width: 320px;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.52;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
}

button:not(:disabled),
a {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.58;
}

svg {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

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

:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 3px;
}

.app {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background:
    radial-gradient(circle at 70% -20%, rgba(75, 216, 244, 0.04), transparent 34%),
    var(--bg);
}

.app-header {
  position: sticky;
  z-index: 20;
  top: 0;
  min-height: 72px;
  display: grid;
  grid-template-columns: 330px 1fr auto;
  align-items: stretch;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(9, 12, 15, 0.96);
  backdrop-filter: blur(16px);
}

.brand {
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 26px;
  background: transparent;
  color: var(--text);
  font-size: 1.38rem;
  font-weight: 760;
  letter-spacing: -0.025em;
  text-align: left;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 38px;
  border: 1px solid rgba(75, 216, 244, 0.55);
  border-radius: 11px;
  background: var(--cyan-soft);
  color: var(--cyan);
  font-size: 0.94rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.top-nav {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.nav-button {
  position: relative;
  min-width: 110px;
  min-height: 72px;
  padding: 0 20px;
  background: transparent;
  color: var(--muted);
  font-weight: 680;
}

.nav-button::after {
  position: absolute;
  right: 20px;
  bottom: 0;
  left: 20px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: transparent;
  content: "";
}

.nav-button:hover {
  color: var(--text);
}

.nav-button.active {
  color: var(--cyan);
}

.nav-button.active::after {
  background: var(--cyan);
}

.header-state {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 24px;
}

.save-indicator {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--green);
  font-size: 0.92rem;
  font-weight: 660;
  white-space: nowrap;
}

.status-check {
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 22px;
  border: 2px solid currentColor;
  border-radius: 50%;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1;
}

.icon-button {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  flex: 0 0 48px;
  border: 1px solid transparent;
  border-radius: 13px;
  background: transparent;
  color: var(--muted);
}

.icon-button svg {
  width: 24px;
  height: 24px;
}

.icon-button:hover {
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
}

.app-body {
  min-height: 0;
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
}

.library-pane {
  min-height: 0;
  padding: 28px 20px;
  overflow: auto;
  border-right: 1px solid var(--line-soft);
  background: rgba(6, 8, 10, 0.45);
}

.library-head,
.section-head,
.capture-heading,
.result-head,
.settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.library-head {
  margin-bottom: 18px;
}

.library-head h2,
.section-head h2 {
  margin: 0;
  font-size: 1.45rem;
  letter-spacing: -0.025em;
}

.library-head p {
  margin: 2px 0 0;
  color: var(--quiet);
  font-size: 0.86rem;
}

.small-button,
.primary-small,
.text-button {
  min-height: 44px;
  border-radius: var(--radius-sm);
  font-weight: 720;
}

.small-button {
  padding: 0 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
}

.small-button:hover {
  border-color: #4c5964;
  background: var(--surface-hover);
}

.primary-small {
  padding: 0 18px;
  background: var(--cyan);
  color: #061014;
}

.text-button {
  padding: 0 10px;
  background: transparent;
  color: var(--cyan);
}

.text-button:hover {
  color: var(--cyan-strong);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.search-box {
  height: 52px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
}

.search-box:focus-within {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(75, 216, 244, 0.12);
}

.search-box svg {
  width: 21px;
  height: 21px;
  flex: 0 0 21px;
  color: var(--muted);
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 1rem;
}

.search-box input::placeholder,
.thought-field textarea::placeholder {
  color: #76808a;
  opacity: 1;
}

.thought-list {
  display: grid;
  gap: 10px;
}

.thought-row {
  width: 100%;
  min-height: 88px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(18, 23, 28, 0.7);
  color: var(--text);
  text-align: left;
}

.thought-row:hover,
.thought-row.selected {
  border-color: rgba(75, 216, 244, 0.72);
  background: var(--cyan-soft);
}

.thought-row-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid #68737d;
  border-radius: 50%;
  color: var(--muted);
}

.thought-row-icon svg {
  width: 21px;
  height: 21px;
}

.thought-row-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.thought-row-title {
  display: -webkit-box;
  overflow: hidden;
  font-size: 0.98rem;
  font-weight: 720;
  line-height: 1.3;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.thought-row-status {
  overflow: hidden;
  color: var(--green);
  font-size: 0.8rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thought-row-status.waiting {
  color: var(--amber);
}

.thought-row-status.error {
  color: var(--red);
}

.thought-row-time {
  color: var(--quiet);
  font-size: 0.74rem;
  white-space: nowrap;
}

.library-empty,
.latest-empty {
  display: grid;
  gap: 4px;
  padding: 26px 18px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--quiet);
  text-align: center;
}

.library-empty strong {
  color: var(--muted);
}

.capture-main {
  min-width: 0;
  min-height: 0;
  overflow: auto;
}

.capture-section {
  width: min(1040px, 100%);
  margin: 0 auto;
  padding: 38px 42px 80px;
}

.capture-heading {
  align-items: flex-end;
  margin-bottom: 22px;
}

.capture-heading h1 {
  margin: 0;
  font-size: clamp(2.4rem, 5vw, 4rem);
  line-height: 1.02;
  letter-spacing: -0.055em;
}

.capture-heading p {
  max-width: 700px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 1rem;
}

.capture-card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, #151b20, #101419);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset;
}

.capture-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.capture-action {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 13px;
  border: 2px solid var(--cyan);
  border-radius: 14px;
  background: rgba(8, 13, 17, 0.54);
  color: var(--cyan);
  font-size: 1.18rem;
  font-weight: 780;
}

.capture-action svg {
  width: 31px;
  height: 31px;
  stroke-width: 2;
}

.capture-action:hover {
  background: rgba(75, 216, 244, 0.1);
}

.capture-action.recording {
  border-color: var(--red);
  background: rgba(255, 105, 105, 0.08);
  color: var(--red);
}

.recording-strip {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 2px 0 14px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 105, 105, 0.35);
  border-radius: 12px;
  background: rgba(255, 105, 105, 0.07);
  color: var(--text);
}

.recording-strip[hidden] {
  display: none;
}

.recording-dot {
  width: 11px;
  height: 11px;
  flex: 0 0 11px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 5px rgba(255, 105, 105, 0.12);
  animation: record-pulse 1.4s ease-in-out infinite;
}

#recordingTimer {
  color: var(--red);
  font-variant-numeric: tabular-nums;
  font-weight: 760;
}

#recordingDurability {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.82rem;
}

.thought-field {
  display: block;
}

.thought-field textarea {
  width: 100%;
  min-height: 164px;
  resize: vertical;
  padding: 18px 20px;
  border: 1px solid #69747d;
  border-radius: 14px;
  outline: 0;
  background: rgba(5, 8, 10, 0.42);
  color: var(--text);
  font-size: 1.22rem;
  line-height: 1.55;
}

.thought-field textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(75, 216, 244, 0.11);
}

.attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.attachment-list:empty {
  display: none;
}

.attachment {
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(9, 12, 15, 0.65);
}

.attachment img {
  width: 46px;
  height: 46px;
  border-radius: 9px;
  object-fit: cover;
}

.attachment-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--cyan-soft);
  color: var(--cyan);
}

.attachment-icon svg {
  width: 23px;
  height: 23px;
}

.attachment-copy {
  min-width: 0;
  display: grid;
  gap: 1px;
  font-size: 0.82rem;
}

.attachment-copy strong {
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-copy span {
  color: var(--muted);
}

.attachment-remove {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 1.25rem;
}

.attachment-remove:hover {
  background: rgba(255, 105, 105, 0.09);
  color: var(--red);
}

.durability-note {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  color: var(--text);
  font-size: 0.92rem;
}

.durability-note.saving {
  color: var(--amber);
}

.durability-note.saving .status-check {
  color: var(--amber);
}

.durability-note.error {
  color: var(--red);
}

.durability-note.error .status-check {
  color: var(--red);
}

.forge-button {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 18px;
  padding: 0 26px;
  border-radius: 14px;
  background: var(--cyan);
  color: #051014;
  font-size: 1.22rem;
  font-weight: 840;
  box-shadow: 0 8px 25px rgba(75, 216, 244, 0.12);
}

.forge-button svg {
  width: 23px;
  height: 23px;
}

.forge-button:hover {
  background: var(--cyan-strong);
  transform: translateY(-1px);
}

.latest-section {
  margin-top: 32px;
}

.section-head {
  margin-bottom: 12px;
}

.latest-card {
  width: 100%;
  min-height: 92px;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  align-items: center;
  gap: 15px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-align: left;
}

.latest-card:hover {
  border-color: rgba(75, 216, 244, 0.7);
  background: var(--surface-hover);
}

.latest-card-icon {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border: 1px solid #78838c;
  border-radius: 50%;
  color: var(--muted);
}

.latest-card-icon svg {
  width: 24px;
  height: 24px;
}

.latest-card-title {
  display: block;
  font-size: 1.06rem;
  font-weight: 760;
  line-height: 1.3;
}

.latest-card-status {
  display: block;
  margin-top: 3px;
  color: var(--green);
  font-size: 0.86rem;
  font-weight: 680;
}

.latest-card-open {
  color: var(--cyan);
  font-weight: 730;
}

.result-card {
  margin-top: 28px;
  padding: 28px;
  border-top: 1px solid var(--line);
  background: transparent;
}

.result-card[hidden] {
  display: none;
}

.result-head {
  align-items: flex-start;
}

.result-state {
  color: var(--green);
  font-size: 0.86rem;
  font-weight: 700;
}

.result-head h2 {
  margin: 5px 0 0;
  font-size: clamp(1.8rem, 4vw, 2.55rem);
  line-height: 1.12;
  letter-spacing: -0.04em;
}

.result-summary {
  max-width: 850px;
  margin: 18px 0 24px;
  color: #d5dade;
  font-size: 1.04rem;
}

.result-section {
  margin-top: 22px;
}

.result-section h3 {
  margin: 0 0 10px;
  font-size: 1.18rem;
}

.result-section ol {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 28px;
}

.result-section li {
  padding-left: 7px;
  color: #e0e4e7;
}

.useful-links {
  display: grid;
  gap: 8px;
}

.useful-link {
  min-height: 62px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  text-decoration: none;
}

.useful-link:hover {
  border-color: var(--cyan);
  background: var(--cyan-soft);
}

.useful-link > svg {
  width: 23px;
  height: 23px;
  color: var(--cyan);
}

.useful-link-copy {
  min-width: 0;
}

.useful-link-title {
  display: block;
  overflow: hidden;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.useful-link-url {
  display: block;
  overflow: hidden;
  color: var(--cyan);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.doc-button {
  min-height: 54px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 22px;
  border-radius: 12px;
  background: var(--cyan);
  color: #061014;
  font-weight: 820;
}

.doc-button svg {
  width: 23px;
  height: 23px;
}

.bottom-nav {
  display: none;
}

.modal,
.busy-overlay {
  position: fixed;
  z-index: 60;
  inset: 0;
  display: none;
}

.modal.open,
.busy-overlay.open {
  display: grid;
}

.modal {
  place-items: stretch end;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(5px);
}

.settings-panel {
  position: relative;
  width: min(500px, 100%);
  height: 100%;
  padding: 28px;
  overflow: auto;
  border-left: 1px solid var(--line);
  background: #0e1216;
  box-shadow: var(--shadow);
}

.settings-head {
  align-items: flex-start;
  margin-bottom: 28px;
}

.settings-head h2 {
  margin: 0;
  font-size: 1.8rem;
}

.settings-head p {
  margin: 5px 0 0;
  color: var(--muted);
}

.settings-group {
  display: grid;
  gap: 15px;
  margin-top: 14px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.settings-group.compact {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.88rem;
}

.settings-group.compact a {
  color: var(--cyan);
}

.settings-copy h3 {
  margin: 0;
  font-size: 1.12rem;
}

.settings-copy p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.settings-status {
  color: var(--green);
  font-size: 0.88rem;
  font-weight: 660;
}

.busy-overlay {
  place-items: center;
  padding: 24px;
  background: rgba(4, 6, 8, 0.78);
  backdrop-filter: blur(7px);
}

.busy-card {
  width: min(390px, 100%);
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
}

.busy-card strong {
  font-size: 1.2rem;
}

.busy-card span:last-child {
  color: var(--muted);
  font-size: 0.92rem;
}

.spinner {
  width: 38px;
  height: 38px;
  border: 4px solid var(--line);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.toast {
  position: fixed;
  z-index: 90;
  right: 22px;
  bottom: 22px;
  max-width: min(430px, calc(100vw - 32px));
  padding: 13px 17px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #182028;
  color: var(--text);
  box-shadow: var(--shadow);
  font-weight: 660;
  opacity: 0;
  pointer-events: none;
  transform: translateY(15px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.error {
  border-color: rgba(255, 105, 105, 0.62);
  color: #ffd8d8;
}

.toast.success {
  border-color: rgba(139, 227, 93, 0.48);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes record-pulse {
  50% { box-shadow: 0 0 0 9px rgba(255, 105, 105, 0.04); }
}

@media (min-width: 1200px) {
  .capture-section {
    padding-right: 56px;
    padding-left: 56px;
  }
}

@media (min-width: 761px) {
  .app[data-view="library"] .app-body {
    display: block;
  }

  .app[data-view="library"] .library-pane {
    width: min(760px, 100%);
    min-height: calc(100dvh - 72px);
    margin: 0 auto;
    border-right: 0;
  }

  .app[data-view="library"] .capture-main {
    display: none;
  }
}

@media (max-width: 980px) {
  .app-header {
    grid-template-columns: 280px 1fr auto;
  }

  .app-body {
    grid-template-columns: 280px minmax(0, 1fr);
  }

  .capture-section {
    padding: 32px 28px 76px;
  }

  .header-state {
    padding: 0 16px;
  }

  #headerSaveText {
    display: none;
  }
}

@media (max-width: 760px) {
  body {
    font-size: 16px;
  }

  .app {
    display: block;
    padding-bottom: calc(72px + env(safe-area-inset-bottom));
  }

  .app-header {
    min-height: 66px;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .brand {
    min-width: 0;
    min-height: 66px;
    padding: 0 16px;
    font-size: 1.28rem;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
  }

  .top-nav,
  .desktop-new {
    display: none;
  }

  .header-state {
    gap: 8px;
    padding: 0 10px 0 0;
  }

  .save-indicator {
    max-width: 38px;
  }

  .status-check {
    width: 21px;
    height: 21px;
    flex-basis: 21px;
  }

  .icon-button {
    width: 46px;
    height: 46px;
    flex-basis: 46px;
  }

  .app-body {
    display: block;
  }

  .library-pane {
    display: none;
    min-height: calc(100dvh - 138px);
    padding: 21px 16px 30px;
    border-right: 0;
  }

  .app[data-view="library"] .library-pane {
    display: block;
  }

  .app[data-view="library"] .capture-main {
    display: none;
  }

  .capture-main {
    overflow: visible;
  }

  .capture-section {
    padding: 22px 16px 48px;
  }

  .capture-heading {
    margin-bottom: 14px;
  }

  .capture-heading h1 {
    font-size: clamp(2.25rem, 11vw, 3.25rem);
  }

  .capture-heading p {
    display: none;
  }

  .capture-card {
    padding: 14px;
    border-radius: 18px;
  }

  .capture-actions {
    gap: 10px;
    margin-bottom: 11px;
  }

  .capture-action {
    min-height: 82px;
    flex-direction: column;
    gap: 4px;
    border-radius: 13px;
    font-size: 1.05rem;
  }

  .capture-action svg {
    width: 30px;
    height: 30px;
  }

  .recording-strip {
    min-height: 46px;
    margin-bottom: 10px;
  }

  #recordingDurability {
    display: none;
  }

  .thought-field textarea {
    min-height: 128px;
    padding: 15px 16px;
    font-size: 1.07rem;
    line-height: 1.48;
  }

  .durability-note {
    align-items: flex-start;
    min-height: 40px;
    margin-top: 10px;
    font-size: 0.83rem;
    line-height: 1.4;
  }

  .durability-note .status-check {
    margin-top: 1px;
  }

  .forge-button {
    width: 100%;
    min-height: 58px;
    margin-top: 13px;
    font-size: 1.08rem;
  }

  .latest-section {
    margin-top: 22px;
  }

  .section-head {
    margin-bottom: 9px;
  }

  .section-head h2 {
    font-size: 1.35rem;
  }

  .latest-card {
    min-height: 82px;
    grid-template-columns: 46px minmax(0, 1fr) auto;
    gap: 10px;
    padding: 11px 12px;
  }

  .latest-card-icon {
    width: 44px;
    height: 44px;
  }

  .latest-card-open {
    font-size: 0.9rem;
  }

  .latest-empty {
    padding: 16px;
    font-size: 0.88rem;
  }

  .result-card {
    margin: 22px -2px 0;
    padding: 24px 2px 8px;
  }

  .result-head h2 {
    font-size: 1.82rem;
  }

  .result-summary {
    font-size: 0.98rem;
  }

  .useful-link {
    grid-template-columns: 28px minmax(0, 1fr) 20px;
  }

  .doc-button {
    width: 100%;
    justify-content: center;
  }

  .bottom-nav {
    position: fixed;
    z-index: 40;
    right: 0;
    bottom: 0;
    left: 0;
    height: calc(70px + env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    padding: 0 20px env(safe-area-inset-bottom);
    border-top: 1px solid var(--line);
    background: rgba(9, 12, 15, 0.97);
    backdrop-filter: blur(18px);
  }

  .bottom-nav-button {
    position: relative;
    min-height: 68px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: transparent;
    color: var(--muted);
    font-weight: 720;
  }

  .bottom-nav-button::before {
    position: absolute;
    top: 0;
    left: 18%;
    width: 64%;
    height: 3px;
    border-radius: 0 0 3px 3px;
    background: transparent;
    content: "";
  }

  .bottom-nav-button svg {
    width: 25px;
    height: 25px;
  }

  .bottom-nav-button.active {
    color: var(--cyan);
  }

  .bottom-nav-button.active::before {
    background: var(--cyan);
  }

  .settings-panel {
    width: 100%;
    height: min(88dvh, 740px);
    align-self: end;
    padding: 22px 18px calc(24px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    border-left: 0;
    border-radius: 22px 22px 0 0;
  }

  .settings-head h2 {
    font-size: 1.55rem;
  }

  .settings-group {
    padding: 17px;
  }

  .toast {
    right: 16px;
    bottom: calc(84px + env(safe-area-inset-bottom));
    left: 16px;
    max-width: none;
  }
}

@media (max-width: 390px) and (max-height: 850px) {
  .capture-section {
    padding-top: 15px;
  }

  .capture-heading h1 {
    font-size: 2.12rem;
  }

  .capture-actions {
    margin-bottom: 9px;
  }

  .capture-action {
    min-height: 72px;
  }

  .thought-field textarea {
    min-height: 112px;
  }

  .durability-note {
    font-size: 0.78rem;
  }

  .forge-button {
    min-height: 54px;
  }

  .latest-section {
    margin-top: 16px;
  }
}

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