:root {
  --navy-1: #10203a;
  --navy-2: #060d1c;
  --panel: #142949;
  --panel-2: #1c3966;
  --gold: #d4a24e;
  --gold-light: #f2cf8a;
  --gold-deep: #a8721f;
  --cream: #f3ead2;
  --muted: #8998b4;
  --border-gold: rgba(212, 162, 78, 0.25);
  --error: #e2574c;
  color-scheme: dark;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  background: linear-gradient(180deg, var(--navy-1) 0%, var(--navy-2) 340px, var(--navy-2) 100%);
  min-height: 100vh;
  color: var(--cream);
}

button {
  font-family: inherit;
  cursor: pointer;
}

.btn {
  border: 1px solid var(--border-gold);
  background: var(--panel-2);
  color: var(--cream);
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 14px;
}

.btn-gold {
  background: linear-gradient(180deg, var(--gold-light), var(--gold));
  color: var(--navy-2);
  border: none;
  font-weight: 600;
  text-decoration: none;
  display: inline-block;
}

.btn-danger {
  background: var(--error);
  color: var(--cream);
  border: none;
  font-weight: 600;
}

.btn-block {
  display: block;
  width: 100%;
  text-align: center;
}

.btn-icon {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 16px;
  padding: 6px 8px;
  border-radius: 8px;
}

.btn-icon:hover {
  color: var(--gold-light);
}

.btn-icon.active {
  color: var(--gold);
  text-shadow: 0 0 8px rgba(212, 162, 78, 0.5);
}

/* --- 登录页 --- */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  text-align: center;
  max-width: 320px;
}

.login-icon {
  width: 88px;
  height: 88px;
  border-radius: 20px;
  margin-bottom: 16px;
}

.login-card h1 {
  color: var(--gold-light);
  margin: 0 0 4px;
}

.login-sub {
  color: var(--muted);
  margin: 0 0 24px;
  font-size: 14px;
}

/* --- 主应用 --- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 16px 12px;
}

.app-header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-header .logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
}

.app-header h1 {
  font-size: 19px;
  margin: 0;
  font-weight: 600;
  color: var(--gold-light);
  letter-spacing: 0.02em;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-gold);
}

.search-bar {
  padding: 0 16px 12px;
}

.search-bar input {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--border-gold);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--cream);
  font-size: 15px;
}

.search-bar input::placeholder {
  color: var(--muted);
}

.app-body {
  display: flex;
  flex-direction: column;
  padding: 0 16px 24px;
  gap: 12px;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.folder-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
  padding: 4px 2px;
}

.folder-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.folder-item {
  flex: 0 0 auto;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border-gold);
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.folder-item.active {
  background: linear-gradient(180deg, var(--gold-light), var(--gold));
  color: var(--navy-2);
  font-weight: 600;
  border-color: transparent;
}

.note-list-panel {
  flex: 1;
}

.note-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.note-card {
  background: var(--panel);
  border: 1px solid var(--border-gold);
  border-radius: 12px;
  padding: 14px 16px;
}

.note-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--cream);
  margin: 0 0 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.note-card-snippet {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.note-card-meta {
  font-size: 12px;
  color: var(--gold-deep);
}

.empty-hint {
  text-align: center;
  color: var(--muted);
  margin-top: 40px;
  font-size: 14px;
}

/* --- 笔记编辑器 --- */
.editor-screen {
  position: fixed;
  inset: 0;
  background: var(--navy-2);
  display: flex;
  flex-direction: column;
  z-index: 20;
}

.editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--border-gold);
}

.editor-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.folder-select {
  background: var(--panel);
  color: var(--cream);
  border: 1px solid var(--border-gold);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 13px;
  max-width: 120px;
}

.editor-title {
  border: none;
  background: none;
  color: var(--gold-light);
  font-size: 20px;
  font-weight: 600;
  padding: 16px 16px 8px;
  outline: none;
}

.editor-blocks {
  flex: 1;
  overflow-y: auto;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.block-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.block-textarea {
  flex: 1;
  border: none;
  background: none;
  color: var(--cream);
  font-size: 16px;
  line-height: 1.6;
  padding: 4px 0;
  outline: none;
  resize: none;
  font-family: inherit;
  overflow: hidden;
}

.block-checkbox {
  margin-top: 12px;
  width: 18px;
  height: 18px;
  accent-color: var(--gold);
  flex-shrink: 0;
}

.block-checklist-input {
  flex: 1;
  border: none;
  background: none;
  color: var(--cream);
  font-size: 16px;
  padding: 8px 0;
  outline: none;
  font-family: inherit;
}

.block-row:has(.block-checkbox:checked) .block-checklist-input,
.block-checklist-input.checked {
  color: var(--muted);
  text-decoration: line-through;
}

.block-remove {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 18px;
  padding: 4px 6px;
  margin-top: 4px;
  border-radius: 6px;
  flex-shrink: 0;
}

.block-remove:hover {
  color: var(--error);
}

.editor-toolbar {
  display: flex;
  gap: 8px;
  padding: 8px 16px;
  border-top: 1px solid var(--border-gold);
}

.toolbar-btn {
  background: var(--panel-2);
  border: 1px solid var(--border-gold);
  color: var(--cream);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
}

.toolbar-btn:hover {
  border-color: var(--gold);
}

.mic-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--gold-light), var(--gold-deep));
  box-shadow: 0 6px 16px rgba(168, 114, 31, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  flex-shrink: 0;
  margin-left: auto;
}

.mic-btn:active {
  transform: scale(0.94);
}

.mic-btn.recording {
  background: linear-gradient(135deg, #e2574c, #c0392b);
  animation: pulse 1.4s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(226, 87, 76, 0.45); }
  70% { box-shadow: 0 0 0 12px rgba(226, 87, 76, 0); }
  100% { box-shadow: 0 0 0 0 rgba(226, 87, 76, 0); }
}

.mic-icon {
  width: 12px;
  height: 16px;
  border: 2px solid #060d1c;
  border-radius: 7px;
  position: relative;
  display: block;
}

.mic-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -7px;
  transform: translateX(-50%);
  width: 16px;
  height: 7px;
  border: 2px solid #060d1c;
  border-top: none;
  border-radius: 0 0 9px 9px;
}

.voice-status {
  text-align: center;
  color: var(--gold-light);
  font-size: 13px;
  padding: 4px 16px;
  margin: 0;
}

.saved-hint {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 8px;
  margin: 0;
  min-height: 28px;
}

/* --- 弹层 --- */
.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 8, 16, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
  padding: 24px;
}

.dialog {
  background: var(--panel);
  border: 1px solid var(--border-gold);
  border-radius: 14px;
  padding: 20px;
  width: 100%;
  max-width: 320px;
}

.dialog h3 {
  margin: 0 0 12px;
  color: var(--gold-light);
  font-size: 16px;
}

.dialog input {
  width: 100%;
  background: var(--navy-1);
  border: 1px solid var(--border-gold);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--cream);
  font-size: 14px;
  margin-bottom: 16px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.dialog-error {
  color: var(--error);
  font-size: 13px;
  margin: -8px 0 12px;
}

/* --- 桌面端两栏布局 --- */
@media (min-width: 720px) {
  .app-body {
    flex-direction: row;
  }

  .sidebar {
    flex: 0 0 200px;
  }

  .folder-list {
    flex-direction: column;
    overflow-x: visible;
  }

  .folder-item {
    white-space: normal;
  }
}
