/* ====== 云便签 note.csci.cc ======
   主题变量与 theday/nav-site 同一套色板，深浅色 + auto 三态 */

:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #eef1f6;
  --border: #dfe3ec;
  --text: #262b38;
  --text-2: #5a6172;
  --text-3: #868da0;
  --primary: #4f8cff;
  --danger: #e05252;
  --success: #2ba159;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 10px rgba(20, 30, 60, .07);
  --shadow-lg: 0 10px 40px rgba(20, 30, 60, .12);
}
[data-theme="dark"] {
  --bg: #14161f;
  --surface: #1e2230;
  --surface-2: #272c3d;
  --border: #363c52;
  --text: #e8eaed;
  --text-2: #a0a5b8;
  --text-3: #828799;
  --shadow: 0 2px 8px rgba(0,0,0,.3);
  --shadow-lg: 0 10px 40px rgba(0,0,0,.5);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    --bg: #14161f;
    --surface: #1e2230;
    --surface-2: #272c3d;
    --border: #363c52;
    --text: #e8eaed;
    --text-2: #a0a5b8;
    --text-3: #828799;
    --shadow: 0 2px 8px rgba(0,0,0,.3);
    --shadow-lg: 0 10px 40px rgba(0,0,0,.5);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, textarea { font-family: inherit; }
h1, h2, h3 { line-height: 1.35; }

/* ====== 顶栏 ====== */
.topbar {
  height: 54px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  gap: 10px;
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.brand .logo { font-size: 21px; text-decoration: none; flex: 0 0 auto; }
.brand .title {
  font-size: 16px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mini-badge {
  flex: 0 0 auto;
  font-size: 11px; padding: 1px 8px; border-radius: 9px;
  background: var(--surface-2); color: var(--text-2);
  white-space: nowrap;
}
.mini-badge.burn { background: #ffe8e8; color: var(--danger); }
[data-theme="dark"] .mini-badge.burn { background: #46262a; }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.save-state { font-size: 12px; color: var(--text-3); }

/* ====== 按钮 / 输入 ====== */
.btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 14px;
  transition: all .12s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary {
  background: var(--primary); border-color: var(--primary); color: #fff;
  font-weight: 500;
}
.btn-primary:hover { filter: brightness(1.06); color: #fff; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-icon { padding: 7px 10px; font-size: 16px; line-height: 1; }
.btn-danger {
  background: var(--danger); border-color: var(--danger); color: #fff;
  margin-top: 8px;
}
.btn-danger:hover { filter: brightness(1.06); color: #fff; }
.danger-text { color: var(--danger); }
.input {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 14px;
  min-width: 0;
}
.input:focus { outline: none; border-color: var(--primary); }
.form-error { color: var(--danger); font-size: 13px; margin: 6px 0; }

/* ====== 首页 ====== */
.home-main { flex: 1; width: 100%; max-width: 860px; margin: 0 auto; padding: 40px 18px 30px; }
.hero { text-align: center; margin-bottom: 34px; }
.hero h1 { font-size: 26px; margin: 0 0 10px; }
.hero-sub { color: var(--text-2); margin: 0 auto 24px; max-width: 560px; }
.open-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px;
  max-width: 620px;
  margin: 0 auto;
}
.open-prefix { color: var(--text-3); font-size: 14px; white-space: nowrap; flex: 0 0 auto; }
.open-box .input { flex: 1 1 auto; }
.open-box .btn-primary { flex: 0 0 auto; }
.open-box .btn-ghost { flex: 0 0 auto; }
.name-meta {
  max-width: 620px;
  margin: 8px auto 0;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}
.name-count {
  color: var(--text-3);
  font-size: 12px;
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
}
/* 名字接近 64 字上限时提醒，超过危险线变红 */
.name-count.warn { color: #c07f00; }
.name-count.over { color: var(--danger); }
.name-error { color: var(--danger); font-size: 13px; margin: 0; text-align: right; }

.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 30px;
}
.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.feature-card .f-ico { font-size: 24px; margin-bottom: 8px; }
.feature-card h3 { font-size: 15px; margin: 0 0 6px; }
.feature-card p { font-size: 13px; color: var(--text-2); margin: 0; }

.tips {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
}
.tips h2 { font-size: 15px; margin: 0 0 8px; }
.tips ul { margin: 0; padding-left: 18px; }
.tips li { font-size: 13px; color: var(--text-2); margin: 4px 0; }
.tips code {
  background: var(--surface-2);
  border-radius: 4px; padding: 1px 5px; font-size: 12px;
}

.footer {
  text-align: center;
  color: var(--text-3);
  font-size: 12px;
  padding: 18px 12px 22px;
}

/* ====== 便签页：锁定 ====== */
.lock-view, .gone-view {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 60px 18px;
}
.lock-card, .gone-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 26px;
  width: 100%;
  max-width: 380px;
  text-align: center;
}
.lock-ico, .gone-ico { font-size: 34px; }
.lock-card h2, .gone-card h2 { font-size: 18px; margin: 10px 0 6px; }
.lock-hint { color: var(--text-2); font-size: 14px; margin: 0 0 16px; }
.lock-card .input { width: 100%; margin-bottom: 10px; }
.burn-hint {
  color: var(--danger); font-size: 12px;
  margin: 12px 0 0;
  background: #fff5f5; border: 1px solid #ffd6d6;
  border-radius: var(--radius-sm); padding: 8px 10px;
}
[data-theme="dark"] .burn-hint { background: #3a2326; border-color: #5c3038; }

/* ====== 便签页：编辑器 ====== */
.edit-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  padding: 14px 16px 10px;
}
.burn-once {
  background: #fff5f5; border: 1px solid #ffd6d6;
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13px;
  margin-bottom: 10px;
}
[data-theme="dark"] .burn-once { background: #3a2326; border-color: #5c3038; }
.editor {
  flex: 1;
  width: 100%;
  min-height: 50vh;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  font-size: 15px;
  line-height: 1.7;
  resize: vertical;
}
.editor:focus { outline: none; border-color: var(--primary); }
.editor-foot {
  display: flex;
  justify-content: space-between;
  color: var(--text-3);
  font-size: 12px;
  padding: 6px 4px 0;
}
.quota-info { flex: 0 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ====== 设置弹层 ====== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(10, 14, 24, .45);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
  padding: 16px;
}
.modal-overlay.hidden { display: none; }
.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { margin: 0; font-size: 16px; }
.modal-body { padding: 14px 18px 18px; }
.field-label { font-size: 13px; color: var(--text-2); display: block; margin-bottom: 6px; }
.field-hint { font-size: 12px; color: var(--text-3); margin: 6px 0 10px; }
.pw-row { display: flex; gap: 8px; }
.pw-row .input { flex: 1 1 auto; }
.pw-row .btn { flex: 0 0 auto; }
.row-line { margin: 8px 0; }
.switch-line { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.switch-line input { width: 17px; height: 17px; accent-color: var(--primary); }
.modal-hr { border: none; border-top: 1px solid var(--border); margin: 14px 0; }

/* ====== 移动端 ====== */
@media (max-width: 700px) {
  .features { grid-template-columns: repeat(2, 1fr); }
  .home-main { padding: 26px 14px 20px; }
  .hero h1 { font-size: 21px; }
  .open-box { flex-wrap: wrap; }
  .open-prefix { width: 100%; }
  .open-box .input { flex: 1 1 100%; order: 2; }
  .open-box .btn-primary { order: 3; flex: 1 1 auto; }
  .open-box .btn-ghost { order: 4; }
}
@media (max-width: 430px) {
  .features { grid-template-columns: 1fr; }
  .topbar { padding: 0 12px; }
  .edit-view { padding: 10px 10px 8px; }
  .editor { padding: 12px; font-size: 15px; }
  .btn { padding: 8px 12px; font-size: 13px; }
}
