:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #1f2328;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --danger: #dc2626;
  --ok: #16a34a;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0, 0, 0, .07), 0 8px 24px rgba(0, 0, 0, .05);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111418;
    --card: #1a1f26;
    --text: #e6e8eb;
    --muted: #9aa3ad;
    --border: #2b323b;
    --accent: #3b82f6;
    --accent-hover: #60a5fa;
    --shadow: 0 1px 3px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .3);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
}

a { color: var(--accent); text-decoration: none; }

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--card);
}

.topbar .brand { font-weight: 700; color: var(--text); }
.topbar .path { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .status { margin-left: auto; font-size: 13px; color: var(--muted); white-space: nowrap; }
.topbar .status.saved { color: var(--ok); }
.topbar .status.error { color: var(--danger); }

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 20px;
}

.hero { text-align: center; margin: 48px 0 40px; }
.hero h1 { font-size: 32px; margin: 0 0 8px; }
.hero p { color: var(--muted); margin: 0; }

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 640px) { .split { grid-template-columns: 1fr; } }

.module {
  display: block;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 36px 28px;
  text-align: center;
  color: var(--text);
  transition: transform .15s, border-color .15s;
}

.module:hover { transform: translateY(-3px); border-color: var(--accent); }
.module .icon { font-size: 44px; }
.module h2 { margin: 14px 0 6px; }
.module p { color: var(--muted); margin: 0; font-size: 14px; line-height: 1.6; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  max-width: 560px;
  margin: 0 auto;
}

.card h2 { margin-top: 0; }

label { display: block; font-size: 14px; color: var(--muted); margin: 16px 0 6px; }

input[type="text"], input[type="password"] {
  width: 100%;
  padding: 10px 12px;
  font-size: 15px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
}

input:focus { outline: 2px solid var(--accent); border-color: transparent; }

.btn {
  display: inline-block;
  padding: 10px 20px;
  font-size: 15px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: background .15s;
}

.btn:hover { background: var(--accent-hover); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.secondary { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn.danger { background: var(--danger); }
.btn-row { display: flex; gap: 12px; margin-top: 20px; flex-wrap: wrap; }

.hint { font-size: 13px; color: var(--muted); margin-top: 8px; }
.msg { margin-top: 14px; font-size: 14px; }
.msg.error { color: var(--danger); }
.msg.ok { color: var(--ok); }

/* 笔记编辑器:占满整个视口 */
.editor-wrap { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }

#editor {
  flex: 1;
  width: 100%;
  border: none;
  resize: none;
  padding: 20px;
  font-size: 15px;
  line-height: 1.7;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  background: var(--bg);
  color: var(--text);
}

#editor:focus { outline: none; }

/* 文件上传 */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

.dropzone.dragover { border-color: var(--accent); background: rgba(37, 99, 235, .06); }
.dropzone .filename { color: var(--text); font-weight: 600; word-break: break-all; }

.progress { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; margin-top: 16px; display: none; }
.progress .bar { height: 100%; width: 0; background: var(--accent); transition: width .2s; }

.result-link {
  display: block;
  margin-top: 12px;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: ui-monospace, Consolas, monospace;
  word-break: break-all;
}

.file-info { display: flex; flex-direction: column; gap: 4px; margin: 16px 0; }
.file-info .name { font-size: 18px; font-weight: 600; word-break: break-all; }
.file-info .meta { color: var(--muted); font-size: 14px; }

details { margin-top: 24px; }
summary { cursor: pointer; color: var(--muted); font-size: 14px; }
