/* 星伴 v2 公共样式（默认浅色） */
:root {
  --bg: #f8f4ef;
  --bg2: #fcf8f2;
  --panel: #fefcf8;
  --text: #3a3c45;
  --text-dim: #8b909a;
  --accent: #f0a3c0;
  --accent2: #b18cff;
  --border: #eee8de;
  --danger: #ff6b6b;
  --ok: #5ccb8a;
  --glow: #fde8ef;
}

body.dark {
  --bg: #0f1117;
  --bg2: #1a1d27;
  --panel: #1f2330;
  --text: #e8eaf0;
  --text-dim: #9aa0b0;
  --border: #2a2f3d;
  --glow: #2a1b33;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button { cursor: pointer; font-family: inherit; }
input, textarea { font-family: inherit; }
a { color: var(--accent); text-decoration: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; padding: 11px 18px;
  border: none; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff; font-size: 15px; font-weight: 600;
  transition: transform .06s, opacity .2s;
}
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.secondary { background: var(--panel); color: var(--text); border: 1px solid var(--border); }
.btn.danger { background: var(--danger); }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 6px; }
.field input {
  width: 100%; padding: 11px 14px;
  background: var(--bg2); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  font-size: 15px; outline: none;
}
.field input:focus { border-color: var(--accent); }
.field .hint { font-size: 12px; color: var(--text-dim); margin-top: 4px; }

/* 带眼睛按钮的输入框（密码可见切换） */
.input-wrap { position: relative; }
.input-wrap input { padding-right: 42px; }
.eye-btn {
  position: absolute; right: 6px; top: 50%;
  transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  font-size: 18px; color: var(--text-dim); padding: 4px; line-height: 1;
}
.eye-btn:hover { color: var(--text); }

.error { color: var(--danger); font-size: 13px; min-height: 18px; margin-top: 6px; }
.ok { color: var(--ok); font-size: 13px; min-height: 18px; margin-top: 6px; }

.auth-wrap {
  min-height: 100dvh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 18px; padding: 24px;
  background: radial-gradient(circle at 50% 0%, var(--glow) 0%, var(--bg) 60%);
}

.logo { font-size: 30px; font-weight: 800; letter-spacing: 2px; }

.auth-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 24px;
  width: 100%; max-width: 400px;
}
.auth-card h2 { margin-bottom: 20px; font-size: 20px; }

.switch { text-align: center; margin-top: 16px; font-size: 14px; color: var(--text-dim); }
.switch a { cursor: pointer; font-weight: 600; }

.admin-link { font-size: 13px; color: var(--text-dim); }

.agree { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-dim); margin: 12px 0; }
.agree input { accent-color: var(--accent); }

/* 弹窗 */
#overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 40; display: none;
}
#overlay.show { display: block; }

.modal {
  position: fixed; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px; width: calc(100% - 40px); max-width: 400px;
  z-index: 50; display: none;
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.modal.show { display: block; }
.modal h3 { margin-bottom: 16px; }

/* 提示 toast */
#toast {
  position: fixed; left: 50%; bottom: 90px;
  transform: translateX(-50%);
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 18px; border-radius: 20px;
  font-size: 14px; z-index: 60;
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
#toast.show { opacity: 1; }

/* 开关 */
.toggle {
  width: 44px; height: 24px; border-radius: 12px;
  background: var(--border); position: relative;
  transition: background .2s; flex-shrink: 0; cursor: pointer;
}
.toggle::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff; transition: transform .2s;
}
.toggle.on { background: var(--accent); }
.toggle.on::after { transform: translateX(20px); }

.switch-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0;
}
.switch-row .label { font-size: 15px; }
.switch-row .sub { font-size: 12px; color: var(--text-dim); }

/* 列表项（日记/收藏） */
.list-panel { max-height: 60vh; overflow-y: auto; margin-top: 8px; }
.list-item {
  padding: 12px; border-radius: 12px;
  background: var(--bg2); border: 1px solid var(--border);
  margin-bottom: 10px; font-size: 14px; word-break: break-word;
}
.list-item .meta {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; color: var(--text-dim); margin-bottom: 6px;
}
.list-item .meta .actions button {
  background: none; border: none; color: var(--text-dim);
  font-size: 14px; cursor: pointer; padding: 2px 6px; border-radius: 6px;
}
.list-item .meta .actions button:hover { color: var(--danger); }
.list-empty { text-align: center; color: var(--text-dim); padding: 30px 0; font-size: 14px; }
