:root {
  --page-bg: #f5f5f7;
  --surface: #ffffff;
  --surface-muted: #f2f2f4;
  --text-primary: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #a1a1a6;
  --divider: rgba(0, 0, 0, 0.08);
  --divider-strong: rgba(0, 0, 0, 0.14);
  --primary: #1d1d1f;
  --primary-hover: #343437;
  --danger: #b42318;
  --danger-soft: #fff1f0;
  --success: #3f7d58;
  --processing: #7c6846;
  --radius-large: 12px;
  --radius-medium: 8px;
  --radius-small: 6px;
  --shadow-soft: 0 18px 54px rgba(0, 0, 0, 0.07);
  --transition: 200ms ease;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--page-bg);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC",
    "Helvetica Neue", Arial, sans-serif;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--page-bg);
  overflow-x: hidden;
}

button,
input,
select,
textarea {
  border: 0;
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

button,
input,
select,
textarea,
label[for] {
  transition:
    border-color var(--transition),
    background-color var(--transition),
    color var(--transition),
    box-shadow var(--transition),
    opacity var(--transition),
    transform var(--transition);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
label[for]:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(29, 29, 31, 0.18);
  outline-offset: 3px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  border: 0;
  clip: rect(0, 0, 0, 0);
  overflow: hidden;
  white-space: nowrap;
}

.app-shell {
  min-height: 100vh;
}

.eyebrow {
  margin-bottom: 10px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
}

.primary-button {
  min-height: 46px;
  border-radius: var(--radius-medium);
  background: var(--primary);
  color: #ffffff;
  font-weight: 600;
  padding: 0 22px;
}

.primary-button:hover {
  background: var(--primary-hover);
}

.primary-button:active {
  transform: scale(0.985);
}

.utility-button,
.text-button,
.back-button,
.settings-button {
  min-height: 40px;
  border-radius: var(--radius-medium);
  background: transparent;
  color: var(--text-secondary);
  font-weight: 500;
  padding: 0 12px;
}

.utility-button:hover,
.back-button:hover,
.settings-button:hover {
  background: var(--surface-muted);
  color: var(--text-primary);
}

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

.danger-button,
.note-delete-button {
  min-height: 38px;
  border-radius: var(--radius-medium);
  background: transparent;
  color: var(--danger);
  font-weight: 500;
  padding: 0 12px;
}

.danger-button:hover,
.note-delete-button:hover {
  background: var(--danger-soft);
}

.feedback-text,
.error-text {
  min-height: 20px;
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}

.feedback-text {
  color: var(--text-secondary);
}

.error-text {
  color: var(--danger);
  overflow-wrap: anywhere;
}

/* Login */
.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
}

.login-card {
  width: min(420px, 100%);
  border: 1px solid var(--divider);
  border-radius: var(--radius-large);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  display: grid;
  gap: 24px;
  padding: 42px;
}

.login-brand,
.brand-mark {
  background: var(--primary);
  color: #ffffff;
  display: inline-grid;
  place-items: center;
  font-family: "Songti SC", "STSong", serif;
  font-weight: 700;
}

.login-brand {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-medium);
  font-size: 22px;
}

.login-heading h1 {
  margin-bottom: 8px;
  font-size: 32px;
  line-height: 1.2;
}

.login-heading p:last-child {
  margin-bottom: 0;
  color: var(--text-secondary);
  line-height: 1.6;
}

.login-field {
  color: var(--text-secondary);
  display: grid;
  gap: 9px;
  font-size: 13px;
  font-weight: 600;
}

.login-field input {
  width: 100%;
  min-height: 48px;
  border: 1px solid transparent;
  border-radius: var(--radius-medium);
  background: var(--surface-muted);
  padding: 0 14px;
}

.login-field input:focus {
  border-color: var(--divider-strong);
  background: var(--surface);
  outline: 0;
}

.login-button {
  width: 100%;
}

/* Application frame */
.workspace {
  position: relative;
  width: min(1320px, calc(100% - 32px));
  height: calc(100vh - 32px);
  min-height: 680px;
  margin: 16px auto;
  border: 1px solid var(--divider-strong);
  border-radius: var(--radius-large);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.site-header {
  position: relative;
  z-index: 20;
  height: 64px;
  border-bottom: 1px solid var(--divider);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px 0 24px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-small);
  font-size: 14px;
}

.brand-block h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: 0;
}

.header-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.study-link {
  min-height: 40px;
  border-radius: var(--radius-medium);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 500;
  padding: 0 12px;
  text-decoration: none;
}

.study-link:hover {
  background: var(--surface-muted);
  color: var(--text-primary);
}

.study-link-icon {
  position: relative;
  width: 16px;
  height: 18px;
  border: 1.5px solid currentColor;
  border-radius: 2px 4px 4px 2px;
}

.study-link-icon::before {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 3px;
  width: 1px;
  background: currentColor;
  content: "";
}

.settings-button {
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.settings-icon {
  position: relative;
  width: 17px;
  height: 17px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
}

.settings-icon::before {
  position: absolute;
  inset: 4px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  content: "";
}

.settings-label {
  font-size: 13px;
}

.topbar-actions {
  position: absolute;
  z-index: 30;
  top: 54px;
  right: 18px;
  width: 286px;
  border: 1px solid var(--divider-strong);
  border-radius: var(--radius-large);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  display: none;
  gap: 14px;
  padding: 16px;
}

.workspace.settings-open .topbar-actions {
  display: grid;
}

.model-selector {
  color: var(--text-secondary);
  display: grid;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
}

.model-selector select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--divider);
  border-radius: var(--radius-medium);
  background: var(--surface-muted);
  color: var(--text-primary);
  font-size: 14px;
  padding: 0 34px 0 12px;
}

.model-test-button {
  min-height: 40px;
  border: 1px solid var(--divider);
  border-radius: var(--radius-medium);
  background: var(--surface);
  color: var(--accent);
  font-size: 13px;
  font-weight: 650;
}

.model-test-button:hover {
  background: var(--surface-muted);
}

.model-test-button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.model-test-status {
  min-height: 16px;
  margin: -6px 0 0;
  color: var(--accent);
  font-size: 12px;
  line-height: 1.5;
}

.model-test-status.error {
  color: var(--danger);
}

.topbar-actions .text-button {
  min-height: 44px;
  background: var(--surface-muted);
}

.app-body {
  height: calc(100% - 64px);
  min-height: 0;
  display: grid;
  grid-template-columns: 304px minmax(0, 1fr);
}

/* Record library */
.history-panel {
  min-width: 0;
  min-height: 0;
  border-right: 1px solid var(--divider);
  background: #fafafa;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.sidebar-tools {
  border-bottom: 1px solid var(--divider);
  display: grid;
  gap: 12px;
  padding: 20px;
}

.new-note-button {
  width: 100%;
  min-height: 48px;
  border-radius: var(--radius-medium);
  background: var(--primary);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 600;
}

.new-note-button:hover {
  background: var(--primary-hover);
}

.compose-icon {
  position: relative;
  width: 16px;
  height: 16px;
  border-bottom: 1.5px solid currentColor;
}

.compose-icon::before {
  position: absolute;
  top: 1px;
  left: 7px;
  width: 2px;
  height: 12px;
  background: currentColor;
  content: "";
  transform: rotate(42deg);
  transform-origin: center;
}

.sidebar-actions {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
}

.sidebar-actions .utility-button {
  min-height: 34px;
  font-size: 12px;
  padding: 0 9px;
}

.notes-list {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.note-group {
  border-bottom: 1px solid var(--divider);
}

.note-group:last-child {
  border-bottom: 0;
}

.note-group-heading {
  min-height: 42px;
  color: var(--text-secondary);
  display: flex;
  align-items: end;
  justify-content: space-between;
  padding: 0 20px 10px;
  font-size: 12px;
  font-weight: 600;
}

.note-group-heading span:last-child {
  color: var(--text-tertiary);
  font-weight: 500;
}

.note-item {
  position: relative;
  min-height: 80px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  transition: background-color var(--transition);
}

.note-item:hover,
.note-item.active {
  background: #eeeeef;
}

.note-item.active::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 3px;
  background: var(--text-primary);
  content: "";
}

.note-open-button {
  min-width: 0;
  min-height: 80px;
  border-radius: 0;
  background: transparent;
  color: var(--text-primary);
  display: grid;
  align-content: center;
  gap: 7px;
  padding: 14px 10px 14px 20px;
  text-align: left;
}

.note-item-heading {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.note-item-heading strong {
  min-width: 0;
  flex: 1;
  font-size: 15px;
  font-weight: 620;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-meta,
.note-preview {
  color: var(--text-secondary);
  font-size: 12px;
}

.note-preview {
  display: none;
}

.status {
  flex: 0 0 auto;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 550;
  line-height: 1;
  white-space: nowrap;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status.completed {
  color: var(--success);
}

.status.failed {
  color: var(--danger);
}

.status.processing {
  color: var(--processing);
}

.note-delete-button {
  width: 44px;
  align-self: center;
  font-size: 0;
  opacity: 0;
  padding: 0;
}

.note-delete-button::before {
  font-size: 11px;
  content: "删除";
}

.note-item:hover .note-delete-button,
.note-item:focus-within .note-delete-button {
  opacity: 1;
}

/* Main work area */
.main-panel {
  min-width: 0;
  min-height: 0;
  background: var(--surface);
  overflow: hidden;
}

.composer-view,
.detail-panel {
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
}

.composer-view {
  display: none;
  align-content: start;
  padding: 50px clamp(36px, 7vw, 88px) 72px;
}

.workspace.compose-open .composer-view {
  display: grid;
}

.workspace.compose-open .detail-panel {
  display: none;
}

.composer-header,
.voice-composer,
.composer-divider,
.text-note-form {
  width: min(760px, 100%);
  margin-right: auto;
  margin-left: auto;
}

.composer-header {
  margin-bottom: 34px;
}

.composer-header h2 {
  margin-bottom: 10px;
  font-family: "Songti SC", "STSong", serif;
  font-size: 42px;
  font-weight: 500;
  line-height: 1.2;
}

.composer-header > p:last-child {
  margin-bottom: 0;
  color: var(--text-secondary);
  font-size: 16px;
  line-height: 1.7;
}

.composer-header .back-button {
  display: none;
}

.voice-composer {
  display: grid;
  justify-items: center;
  padding: 20px 0 12px;
}

.record-box {
  display: grid;
  justify-items: center;
  gap: 14px;
}

.record-button {
  position: relative;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12);
  display: grid;
  place-items: center;
}

.record-button:hover {
  background: var(--primary-hover);
  transform: scale(1.025);
}

.record-button:active {
  transform: scale(0.98);
}

.record-button.is-recording {
  background: #3b2b2a;
}

.record-button.is-recording::after {
  position: absolute;
  inset: -8px;
  border: 1px solid rgba(180, 35, 24, 0.35);
  border-radius: 50%;
  animation: record-pulse 1.8s ease-out infinite;
  content: "";
}

.microphone-icon {
  position: relative;
  width: 32px;
  height: 42px;
}

.microphone-capsule {
  position: absolute;
  top: 0;
  left: 9px;
  width: 14px;
  height: 27px;
  border: 2px solid #ffffff;
  border-radius: 10px;
}

.microphone-icon::before {
  position: absolute;
  top: 12px;
  left: 4px;
  width: 24px;
  height: 20px;
  border-right: 2px solid #ffffff;
  border-bottom: 2px solid #ffffff;
  border-left: 2px solid #ffffff;
  border-radius: 0 0 14px 14px;
  content: "";
}

.microphone-icon::after {
  position: absolute;
  bottom: 0;
  left: 8px;
  width: 16px;
  height: 2px;
  background: #ffffff;
  content: "";
}

.record-feedback {
  min-height: 42px;
  color: var(--text-secondary);
  display: grid;
  justify-items: center;
  gap: 4px;
  font-size: 13px;
  line-height: 1.45;
}

.record-feedback strong {
  font-weight: 500;
}

.record-timer {
  color: var(--danger);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.upload-box {
  max-width: 620px;
  margin: 16px auto 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 10px;
}

input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.file-picker,
.upload-submit-button {
  min-height: 42px;
  border: 1px solid var(--divider-strong);
  border-radius: var(--radius-medium);
  background: transparent;
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 550;
  padding: 0 14px;
}

.file-picker {
  cursor: pointer;
}

.file-picker:hover,
.upload-submit-button:hover {
  background: var(--surface-muted);
}

.upload-symbol {
  font-size: 18px;
  line-height: 1;
}

.upload-submit-button {
  display: none;
}

.upload-box.has-file .upload-submit-button {
  display: inline-flex;
}

.file-picker-meta {
  width: 100%;
  color: var(--text-tertiary);
  font-size: 11px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  text-align: center;
}

.voice-composer > .feedback-text {
  text-align: center;
}

.composer-divider {
  position: relative;
  height: 62px;
  display: grid;
  place-items: center;
}

.composer-divider::before {
  position: absolute;
  right: 0;
  left: 0;
  height: 1px;
  background: var(--divider);
  content: "";
}

.composer-divider span {
  position: relative;
  z-index: 1;
  background: var(--surface);
  color: var(--text-tertiary);
  font-size: 12px;
  padding: 0 12px;
}

@keyframes record-pulse {
  0% {
    opacity: 0.7;
    transform: scale(0.92);
  }
  100% {
    opacity: 0;
    transform: scale(1.18);
  }
}

.text-note-form {
  display: grid;
  gap: 20px;
}

.write-heading h2 {
  margin-bottom: 0;
  font-size: 25px;
  font-weight: 650;
  line-height: 1.25;
}

.write-field {
  color: var(--text-secondary);
  display: grid;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
}

.write-field input,
.write-field textarea,
.edit-textarea {
  width: 100%;
  border: 1px solid transparent;
  border-radius: var(--radius-medium);
  background: var(--surface-muted);
  color: var(--text-primary);
  font-size: 16px;
  line-height: 1.75;
  padding: 14px 16px;
  resize: vertical;
}

.write-field input {
  min-height: 50px;
}

.write-field textarea {
  min-height: 190px;
}

.write-field input:focus,
.write-field textarea:focus,
.edit-textarea:focus {
  border-color: var(--divider-strong);
  background: var(--surface);
  box-shadow: 0 0 0 4px rgba(29, 29, 31, 0.04);
  outline: 0;
}

.write-footer {
  display: flex;
  align-items: center;
  gap: 16px;
}

.write-footer .feedback-text {
  flex: 1;
}

/* Reading detail */
.detail-panel {
  padding: 54px clamp(40px, 7vw, 92px) 72px;
}

.detail-empty-state {
  height: 100%;
}

.empty-state {
  color: var(--text-tertiary);
  display: grid;
  place-items: center;
  gap: 14px;
  padding: 28px 20px;
  text-align: center;
}

.empty-state p {
  margin: 0;
}

.empty-state-mark {
  position: relative;
  width: 34px;
  height: 42px;
  border: 1px solid var(--divider-strong);
  border-radius: 3px;
}

.empty-state-mark::before,
.empty-state-mark::after {
  position: absolute;
  right: 7px;
  left: 7px;
  height: 1px;
  background: var(--divider-strong);
  content: "";
}

.empty-state-mark::before {
  top: 11px;
}

.empty-state-mark::after {
  top: 21px;
}

.detail-header,
.detail-tabs,
.detail-tab-panel,
.detail-panel > audio,
.detail-panel > .audio-note,
.detail-panel > .error-text {
  width: min(860px, 100%);
  margin-right: auto;
  margin-left: auto;
}

.detail-header {
  margin-bottom: 32px;
}

.detail-title-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 16px;
}

.detail-title-copy h2 {
  margin-bottom: 10px;
  font-family: "Songti SC", "STSong", serif;
  font-size: 42px;
  font-weight: 500;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.detail-meta-row {
  color: var(--text-secondary);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.model-badge {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.4;
}

.detail-actions {
  position: relative;
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.detail-menu {
  position: relative;
}

.detail-menu summary {
  width: 44px;
  min-height: 40px;
  border: 1px solid var(--divider-strong);
  border-radius: var(--radius-medium);
  color: var(--text-secondary);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 18px;
  line-height: 1;
  list-style: none;
}

.detail-menu summary::-webkit-details-marker {
  display: none;
}

.detail-menu[open] summary,
.detail-menu summary:hover {
  background: var(--surface-muted);
  color: var(--text-primary);
}

.detail-menu-popover {
  position: absolute;
  z-index: 10;
  top: 46px;
  right: 0;
  width: 174px;
  border: 1px solid var(--divider-strong);
  border-radius: var(--radius-medium);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  display: grid;
  overflow: hidden;
  padding: 5px;
}

.detail-menu-popover button {
  width: 100%;
  min-height: 40px;
  border-radius: var(--radius-small);
  text-align: left;
}

.back-button {
  display: none;
}

.audio-note {
  margin-top: -18px;
  margin-bottom: 20px;
  color: var(--text-tertiary);
  font-size: 12px;
  line-height: 1.5;
}

audio {
  display: block;
  height: 40px;
  margin-bottom: 16px;
}

.detail-tabs {
  border-bottom: 1px solid var(--divider);
  display: flex;
  gap: 26px;
  margin-bottom: 38px;
}

.detail-tab {
  position: relative;
  min-height: 48px;
  border-radius: 0;
  background: transparent;
  color: var(--text-secondary);
  flex: 0 0 auto;
  font-size: 14px;
  font-weight: 580;
  padding: 0 4px;
}

.detail-tab:hover,
.detail-tab.active {
  color: var(--text-primary);
}

.detail-tab.active::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  background: var(--text-primary);
  content: "";
}

.detail-tab-panel {
  min-width: 0;
}

.result-section {
  width: min(760px, 100%);
  display: grid;
  gap: 18px;
}

.result-section-title,
.edit-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.result-section-title {
  min-height: 34px;
  justify-content: space-between;
}

.result-section h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
}

.small-button {
  min-height: 34px;
  font-size: 12px;
}

.text-block {
  margin: 0;
  color: #2c2c2e;
  font-size: 17px;
  font-weight: 400;
  line-height: 2;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.edit-textarea {
  min-height: 340px;
  font-size: 17px;
  white-space: pre-wrap;
}

.edit-actions {
  justify-content: flex-end;
}

.mobile-bottom-nav {
  display: none;
}

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

@media (max-width: 900px) and (min-width: 768px) {
  .workspace {
    width: calc(100% - 20px);
    height: calc(100vh - 20px);
    margin: 10px;
  }

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

  .detail-panel,
  .composer-view {
    padding-right: 36px;
    padding-left: 36px;
  }

  .detail-title-copy h2,
  .composer-header h2 {
    font-size: 34px;
  }
}

/* Mobile application */
@media (max-width: 767px) {
  body {
    background: var(--surface);
  }

  .workspace {
    width: 100%;
    height: auto;
    min-height: 100svh;
    margin: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
  }

  .site-header {
    position: sticky;
    top: 0;
    height: 64px;
    padding: 0 16px 0 20px;
  }

  .brand-mark {
    display: none;
  }

  .brand-block h1 {
    font-size: 20px;
  }

  .settings-label {
    display: none;
  }

  .header-links {
    gap: 0;
  }

  .study-link {
    min-height: 44px;
    padding: 0 10px;
  }

  .study-link-icon {
    display: none;
  }

  .topbar-actions {
    position: fixed;
    top: 56px;
    right: 16px;
    width: min(290px, calc(100vw - 32px));
  }

  .app-body {
    height: auto;
    display: block;
  }

  .history-panel {
    min-height: calc(100svh - 64px);
    border-right: 0;
    background: var(--surface);
    padding-bottom: calc(88px + env(safe-area-inset-bottom));
  }

  .sidebar-tools {
    min-height: 58px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 8px 16px;
  }

  .new-note-button {
    display: none;
  }

  .sidebar-actions .utility-button {
    min-height: 44px;
    padding: 0 12px;
  }

  .note-group-heading {
    min-height: 50px;
    align-items: center;
    padding: 8px 20px 0;
    font-size: 14px;
  }

  .note-item {
    min-height: 82px;
    margin: 0 12px;
    border-bottom: 1px solid var(--divider);
    border-radius: var(--radius-medium);
  }

  .note-item.active,
  .note-item:hover {
    background: var(--surface-muted);
  }

  .note-item.active::before {
    display: none;
  }

  .note-open-button {
    min-height: 82px;
    padding: 14px 8px 14px 12px;
  }

  .note-item-heading strong {
    font-size: 16px;
  }

  .note-item-heading::after {
    color: var(--text-tertiary);
    content: "›";
    font-size: 24px;
    font-weight: 300;
    line-height: 1;
  }

  .note-delete-button {
    display: none;
  }

  .main-panel {
    min-height: calc(100svh - 64px);
    display: none;
    overflow: visible;
  }

  .workspace.compose-open .history-panel,
  .workspace.detail-open .history-panel {
    display: none;
  }

  .workspace.compose-open .main-panel,
  .workspace.detail-open .main-panel {
    display: block;
  }

  .composer-view,
  .detail-panel {
    height: auto;
    min-height: calc(100svh - 64px);
    overflow: visible;
  }

  .composer-view {
    padding: 24px 20px calc(104px + env(safe-area-inset-bottom));
  }

  .composer-header {
    margin-bottom: 26px;
  }

  .composer-header .back-button {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    margin: -8px 0 14px -12px;
  }

  .composer-header h2 {
    font-size: 34px;
  }

  .composer-header > p:last-child {
    font-size: 15px;
  }

  .voice-composer {
    padding-top: 22px;
  }

  .record-button {
    width: 100px;
    height: 100px;
  }

  .file-picker,
  .upload-submit-button {
    min-height: 44px;
  }

  .workspace.compose-record .text-note-form,
  .workspace.compose-record .composer-divider {
    display: none;
  }

  .workspace.compose-text .voice-composer,
  .workspace.compose-text .composer-divider {
    display: none;
  }

  .text-note-form {
    gap: 18px;
  }

  .write-heading h2 {
    font-size: 26px;
  }

  .write-field input,
  .write-field textarea,
  .edit-textarea,
  .login-field input {
    font-size: 16px;
  }

  .write-field textarea {
    min-height: 42vh;
  }

  .write-footer {
    align-items: stretch;
    display: grid;
    gap: 10px;
  }

  .write-footer .primary-button {
    width: 100%;
    min-height: 48px;
  }

  .detail-panel {
    display: none;
    padding: 18px 20px 48px;
  }

  .workspace.detail-open .composer-view {
    display: none;
  }

  .workspace.detail-open .detail-panel {
    display: block;
  }

  .detail-header {
    margin-bottom: 24px;
  }

  .detail-title-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
  }

  .back-button {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    grid-column: 1 / -1;
    justify-self: start;
    margin-left: -12px;
  }

  .detail-title-copy h2 {
    font-size: 31px;
  }

  .detail-menu summary {
    min-height: 44px;
  }

  .detail-tabs {
    gap: 22px;
    margin-bottom: 26px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .detail-tabs::-webkit-scrollbar {
    display: none;
  }

  .detail-tab {
    min-height: 44px;
  }

  .text-block {
    font-size: 16px;
    line-height: 1.9;
  }

  .edit-textarea {
    min-height: 48vh;
  }

  .mobile-bottom-nav {
    position: fixed;
    z-index: 18;
    right: 0;
    bottom: 0;
    left: 0;
    height: calc(72px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--divider);
    background: rgba(255, 255, 255, 0.96);
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    align-items: start;
    padding: 7px 28px env(safe-area-inset-bottom);
  }

  .workspace.detail-open .mobile-bottom-nav {
    display: none;
  }

  .mobile-nav-button {
    min-width: 56px;
    min-height: 56px;
    border-radius: var(--radius-medium);
    background: transparent;
    color: var(--text-tertiary);
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 4px;
    font-size: 10px;
    justify-self: center;
  }

  .mobile-nav-button.active {
    color: var(--text-primary);
  }

  .list-icon {
    position: relative;
    width: 17px;
    height: 18px;
    border: 1.5px solid currentColor;
    border-radius: 3px;
  }

  .list-icon::before,
  .list-icon::after {
    position: absolute;
    right: 4px;
    left: 4px;
    height: 1px;
    background: currentColor;
    content: "";
  }

  .list-icon::before {
    top: 5px;
  }

  .list-icon::after {
    top: 10px;
  }

  .text-icon {
    width: 20px;
    height: 20px;
    border: 1.5px solid currentColor;
    border-radius: 3px;
    display: grid;
    place-items: center;
    font-size: 10px;
    font-weight: 650;
  }

  .mobile-record-button {
    width: 58px;
    height: 58px;
    margin-top: -18px;
    border: 4px solid var(--surface);
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 7px 20px rgba(0, 0, 0, 0.18);
    display: grid;
    place-items: center;
    justify-self: center;
  }

  .mobile-record-button.is-recording {
    background: #3b2b2a;
  }

  .microphone-icon.small {
    width: 22px;
    height: 29px;
    transform: scale(0.72);
  }

  .login-card {
    padding: 32px 24px;
  }
}

@media (max-width: 390px) {
  .site-header {
    padding-right: 12px;
    padding-left: 16px;
  }

  .sidebar-tools {
    padding-right: 12px;
    padding-left: 12px;
  }

  .composer-view,
  .detail-panel {
    padding-right: 18px;
    padding-left: 18px;
  }

  .mobile-bottom-nav {
    padding-right: 20px;
    padding-left: 20px;
  }
}
