
* { margin:0; padding:0; box-sizing:border-box; -webkit-tap-highlight-color:transparent; }

:root {
  --bg:     #ffffff;
  --bg2:    #f7f7f7;
  --bg3:    #efefef;
  --card:   #ffffff;
  --text:   #111111;
  --text2:  #555555;
  --text3:  #aaaaaa;
  --sep:    #e8e8e8;
  --black:  #111111;
  --radius: 14px;
  --serif:  'EB Garamond', Georgia, 'Noto Serif SC', serif;
  --sans:   -apple-system, 'Helvetica Neue', sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:    #0a0a0a;
    --bg2:   #141414;
    --bg3:   #1e1e1e;
    --card:  #141414;
    --text:  #f0f0f0;
    --text2: #888888;
    --text3: #444444;
    --sep:   #252525;
    --black: #f0f0f0;
  }
}

body {
  font-family: var(--serif);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: 86px;
  -webkit-font-smoothing: antialiased;
}

/* ── 顶部 ── */
.nav {
  background: var(--bg);
  position: sticky; top: 0; z-index: 100;
  padding: 18px 20px 12px;
  border-bottom: 1px solid var(--sep);
}

.nav-en {
  font-size: 10px;
  font-family: var(--sans);
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--text3);
  text-align: center;
  margin-bottom: 2px;
}

.nav-zh {
  font-size: 24px;
  font-weight: 400;
  font-style: italic;
  text-align: center;
  letter-spacing: 0.5px;
  line-height: 1;
}

.nav-date {
  font-size: 11px;
  font-family: var(--sans);
  color: var(--text3);
  text-align: center;
  margin-top: 4px;
  letter-spacing: 0.3px;
}

/* ── 底部标签 ── */
.tabbar {
  position: fixed; bottom:0; left:0; right:0;
  background: var(--bg);
  border-top: 1px solid var(--sep);
  display: flex;
  padding: 10px 0 26px;
  z-index: 100;
}

.tab {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; gap: 3px; cursor: pointer;
  transition: opacity 0.1s;
}
.tab:active { opacity: 0.3; }
.tab-zh { font-size: 11px; color: var(--text3); }
.tab-en { font-size: 8px; font-family: var(--sans); color: var(--text3); letter-spacing: 1px; text-transform: uppercase; }
.tab.active .tab-zh,
.tab.active .tab-en { color: var(--text); }

/* ── 页面 ── */
.page { display: none; padding: 20px 16px; }
.page.active { display: block; }
#pageLetterChat.active {
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 86px;
  z-index: 10;
  background: var(--bg);
  padding: 0;
}
#pageLetterChat .chat-nav {
  flex-shrink: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--sep);
  padding: 16px 20px 12px;
  display: flex;
  align-items: center;
}
#pageLetterChat #letterChatList {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
}
#pageLetterChat .chat-input-bar {
  flex-shrink: 0;
  background: var(--bg);
  border-top: 1px solid var(--sep);
  padding: 10px 16px 24px;
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

/* ── 分组 ── */
.section { margin-bottom: 32px; }

.section-head {
  display: flex; align-items: baseline;
  justify-content: space-between;
  padding: 0 2px 10px;
  border-bottom: 1px solid var(--sep);
  margin-bottom: 1px;
}

.section-zh { font-size: 14px; font-weight: 500; letter-spacing: 0.2px; }
.section-en { font-size: 10px; font-family: var(--sans); color: var(--text3); letter-spacing: 1px; text-transform: uppercase; }
.section-n  { font-size: 12px; font-family: var(--sans); color: var(--text3); }

/* ── 列表行 ── */
.card-group { background: var(--card); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--sep); }

.row {
  display: flex; align-items: center;
  padding: 13px 16px; gap: 12px;
  border-bottom: 1px solid var(--sep);
  cursor: pointer; transition: background 0.1s;
}
.row:last-child { border-bottom: none; }
.row:active { background: var(--bg2); }

.row-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.row-main { flex: 1; min-width: 0; }

.row-title {
  font-size: 15px;
  line-height: 1.4;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  letter-spacing: 0.1px;
}

.row-sub {
  font-size: 12px; font-family: var(--sans);
  color: var(--text3); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.row-right { font-size: 13px; font-family: var(--sans); color: var(--text3); flex-shrink: 0; }
.chevron   { font-size: 18px; color: var(--text3); flex-shrink: 0; font-weight: 200; }

/* ── 搜索 ── */
.search {
  background: var(--bg2);
  border-radius: 10px;
  display: flex; align-items: center;
  padding: 9px 13px; gap: 8px;
  margin-bottom: 20px;
  border: 1px solid var(--sep);
}
.search input {
  flex: 1; border: none; outline: none;
  font-size: 15px; font-family: var(--serif);
  background: transparent; color: var(--text);
  font-style: italic;
}
.search input::placeholder { color: var(--text3); }

/* ── 标签 ── */
.pill {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 4px;
  font-size: 10px; font-family: var(--sans);
  font-weight: 500; letter-spacing: 0.3px;
  text-transform: uppercase;
  border: 1px solid var(--sep);
  color: var(--text2); background: var(--bg2);
}

/* ── 详情 ── */
.back {
  font-size: 15px; font-family: var(--sans);
  color: var(--text2); cursor: pointer;
  display: inline-flex; align-items: center; gap: 3px;
  margin-bottom: 18px;
  letter-spacing: -0.2px;
}

.d-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px; margin-bottom: 10px;
  border: 1px solid var(--sep);
}

.d-content {
  font-size: 16px; line-height: 1.75;
  letter-spacing: 0.1px; white-space: pre-wrap;
}

.d-footer {
  margin-top: 14px; padding-top: 14px;
  border-top: 1px solid var(--sep);
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
}

.d-time { font-size: 11px; font-family: var(--sans); color: var(--text3); }

/* ── 和弦 ── */
.chord-card {
  border-radius: var(--radius); padding: 20px;
  margin-bottom: 10px;
  background: var(--text);
  color: var(--bg);
}

.chord-line {
  font-size: 19px; font-style: italic;
  letter-spacing: 2px; line-height: 1.4;
  font-weight: 300;
}

.chord-ctx {
  font-size: 13px; margin-top: 10px;
  line-height: 1.6;
  opacity: 0.5;
}

/* ── 情感坐标 ── */
.coord-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.coord-cell {
  background: var(--bg2);
  border-radius: 10px; padding: 12px;
  border: 1px solid var(--sep);
}

.coord-label {
  font-size: 10px; font-family: var(--sans);
  color: var(--text3); letter-spacing: 0.5px;
  text-transform: uppercase; margin-bottom: 4px;
}

.coord-value {
  font-size: 28px; font-weight: 300;
  letter-spacing: -2px; line-height: 1;
}

/* ── 图表 ── */
.chart-card {
  background: var(--card); border-radius: var(--radius);
  padding: 18px; margin-bottom: 20px;
  border: 1px solid var(--sep);
}

.chart-label { font-size: 11px; font-family: var(--sans); color: var(--text3); letter-spacing: 1px; text-transform: uppercase; margin-bottom: 14px; }
.chart-legend { display: flex; gap: 14px; margin-top: 10px; }
.legend-dot { display: inline-block; width: 5px; height: 5px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }
.legend-text { font-size: 11px; font-family: var(--sans); color: var(--text3); }

/* ── 표单 ── */
.f-label { font-size: 11px; font-family: var(--sans); color: var(--text3); letter-spacing: 0.8px; text-transform: uppercase; margin-bottom: 7px; display: block; }
.f-group { margin-bottom: 14px; }

textarea, input[type="text"], input[type="url"], input[type="password"] {
  width: 100%; background: var(--card);
  border: 1px solid var(--sep); border-radius: 10px;
  padding: 11px 14px; font-size: 15px;
  font-family: var(--serif); color: var(--text);
  outline: none; resize: vertical; -webkit-appearance: none;
  transition: border-color 0.15s;
}
textarea:focus, input:focus { border-color: var(--text2); }
textarea { min-height: 110px; }

/* ── 버튼 ── */
.btn {
  width: 100%; padding: 13px; border-radius: 10px;
  font-size: 16px; font-family: var(--serif);
  cursor: pointer; transition: opacity 0.1s;
  letter-spacing: 0.2px;
}
.btn:active { opacity: 0.5; }

.btn-primary {
  background: var(--text);
  color: var(--bg);
  border: none;
}

.btn-danger {
  background: transparent;
  color: #ff3b30;
  border: 1px solid rgba(255,59,48,0.3);
}

.btn-ghost {
  background: transparent;
  color: var(--text2);
  border: 1px solid var(--sep);
}

/* ── 空状态 ── */
.empty { text-align: center; padding: 56px 16px; color: var(--text3); }
.empty-en { font-size: 11px; font-family: var(--sans); letter-spacing: 2px; text-transform: uppercase; margin-bottom: 8px; }
.empty-zh { font-size: 16px; font-style: italic; }
.loading { text-align: center; padding: 48px; color: var(--text3); font-style: italic; font-size: 15px; }

/* ── 配置 ── */
.config-page {
  position: fixed; inset: 0; background: var(--bg); z-index: 200;
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 28px;
}
.cfg-en { font-size: 10px; font-family: var(--sans); letter-spacing: 3px; text-transform: uppercase; color: var(--text3); margin-bottom: 4px; }
.cfg-title { font-size: 36px; font-style: italic; font-weight: 400; letter-spacing: 0.5px; margin-bottom: 8px; }
.cfg-sub { font-size: 14px; color: var(--text3); text-align: center; margin-bottom: 36px; line-height: 1.6; font-family: var(--sans); }

/* ── 통지 ── */
.toast {
  position: fixed; top: 64px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg);
  padding: 9px 20px; border-radius: 20px;
  font-size: 13px; font-family: var(--sans);
  z-index: 300; opacity: 0; transition: opacity 0.2s;
  pointer-events: none; white-space: nowrap; letter-spacing: 0.1px;
}
.toast.show { opacity: 1; }

/* ── 구분선 ── */
.divider {
  height: 1px; background: var(--sep); margin: 16px 0;
}



#lockScreen {
  position: fixed;
  inset: 0;
  background: var(--bg, #fff);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
}

.lock-title {
  font-size: 13px;
  font-family: -apple-system, system-ui;
  color: #888;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.lock-dots {
  display: flex;
  gap: 16px;
}

.lock-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid #333;
  background: transparent;
  transition: background 0.15s;
}

.lock-dot.filled { background: #333; border-color: #333; }
.lock-dot.error { border-color: #ff3b30; background: #ff3b30; }

.lock-pad {
  display: grid;
  grid-template-columns: repeat(3, 72px);
  gap: 12px;
}

.lock-key {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(0,0,0,0.06);
  border: none;
  font-size: 26px;
  font-weight: 300;
  font-family: -apple-system, system-ui;
  color: #111;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: background 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.lock-key:active { background: rgba(0,0,0,0.15); }
.lock-key.wide { border-radius: 36px; font-size: 15px; }
.lock-key.del { font-size: 20px; }

.lock-error-msg {
  font-size: 13px;
  font-family: -apple-system, system-ui;
  color: #ff3b30;
  height: 18px;
  transition: opacity 0.3s;
}
