:root {
  --bg: #0e1013;
  --bg-soft: #16191e;
  --bg-raise: #1d2127;
  --line: #262b33;
  --text: #e8eaee;
  --text-dim: #9aa2ae;
  --accent: #4c8dff;
  --radius: 10px;
  --sidebar-w: 216px;
  --topbar-h: 74px;
  --cell-w: 160px;
  --row-h: 200px;
  --side-margin: 48px;      /* 时间轴左右留白，也是传送带的裁切边界 */
  --line-w: 2px;            /* 时间轴线条粗细（设置里可调） */
  --dot-size: 12px;         /* 圆点大小（设置里可调） */
  --font: "Segoe UI", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

/* hidden 属性必须永远生效，否则 flex/grid 规则会把它覆盖掉 */
[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  overflow: hidden;
}

button { font-family: inherit; }

.app { display: flex; height: 100vh; }

/* ---------- 左侧年月索引 ---------- */

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--bg-soft);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px 14px;
}

.brand-mark {
  width: 30px; height: 30px;
  border-radius: 9px;
  background: linear-gradient(140deg, #4c8dff, #8a5cff);
  display: grid; place-items: center;
  font-weight: 700;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text span { color: var(--text-dim); font-size: 11px; }

.year-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 8px 16px;
  min-height: 0;
}

.year-block { margin-bottom: 4px; }

.year-head {
  display: flex; align-items: baseline; gap: 8px;
  padding: 8px 10px;
  cursor: pointer;
  border-radius: 8px;
  color: var(--text);
  font-weight: 600;
  font-size: 15px;
}

.year-head:hover { background: var(--bg-raise); }
.year-head .count { color: var(--text-dim); font-size: 11px; font-weight: 400; margin-left: auto; }
.year-head .caret { color: var(--text-dim); font-size: 10px; transition: transform .15s; }
.year-block.collapsed .caret { transform: rotate(-90deg); }
.year-block.collapsed .month-list { display: none; }

.month-list { list-style: none; margin: 0; padding: 0 0 4px 6px; }

.month-item {
  display: flex; align-items: baseline; gap: 8px;
  padding: 5px 10px;
  border-radius: 7px;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 12.5px;
  border-left: 2px solid transparent;
}

.month-item:hover { background: var(--bg-raise); color: var(--text); }
.month-item.active { color: var(--text); background: var(--bg-raise); border-left-color: var(--accent); }
.month-item .count { margin-left: auto; font-size: 11px; opacity: .7; }

.sidebar-foot {
  border-top: 1px solid var(--line);
  padding: 12px 16px 8px;
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.6;
  word-break: break-all;
}

.ghost-btn {
  margin: 0 12px 12px;
  padding: 7px 10px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
}

.ghost-btn:hover { background: var(--bg-raise); color: var(--text); }

.sidebar-share {
  margin: 0 12px 10px;
  padding: 9px 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.7;
  word-break: break-all;
}

.sidebar-share strong { color: var(--text); font-weight: 600; }
.sidebar-share .url {
  display: block;
  color: var(--accent);
  margin-top: 2px;
  user-select: all;
}

/* ---------- 主区域 ---------- */

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  background: var(--bg-blur, rgba(14, 16, 19, .86));
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.topbar h1 { margin: 0; font-size: 19px; }
.topbar p { margin: 3px 0 0; color: var(--text-dim); font-size: 12px; }
.topbar-actions { display: flex; gap: 8px; }

.btn {
  background: var(--bg-raise);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}

.btn:hover { background: var(--hover, #262b33); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { background: #3d7ce8; }
.btn:disabled { opacity: .5; cursor: default; }

.zoom {
  display: flex;
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.zoom button {
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 7px 12px;
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
}

.zoom button:hover { background: var(--hover, #262b33); color: var(--text); }
.zoom button.on { background: var(--accent); color: #fff; font-weight: 600; }

/* 右上角的小组件：在一起多少天 */
.together {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--bg-raise);
  border: 1px solid var(--line);
  white-space: nowrap;
  font-size: 12.5px;
}

.together .names { color: var(--text-dim); }
.together .days { color: var(--text); }
.together .days b {
  color: var(--accent);
  font-size: 15px;
  font-weight: 700;
  margin: 0 2px;
}

.progress {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
  font-size: 12px;
  color: var(--text-dim);
}

.progress-bar { flex: 1; height: 4px; background: var(--bg-raise); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--accent); transition: width .25s; }
.progress-text { min-width: 260px; text-align: right; }

/* ---------- 横向时间轴 ---------- */

.htl {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  cursor: grab;
}

/* 固定的三条轨道：卡片在它上面滑，轨道本身不动 */
.htl-rails {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  will-change: transform;
  overflow: hidden;   /* 别让圈外的轨道把时间轴撑出横向滚动区 */
}

/* 裁到两处拐弯线之间：圈外的卡片完全裁掉，两侧留干净背景 */
.htl-conveyor {
  clip-path: inset(0 var(--side-margin, 48px) 0 var(--side-margin, 48px));
}

.htl-rails i {
  position: absolute;
  left: 0;
  right: 0;
  height: var(--line-w, 2px);
  background: var(--axis-line, var(--line));
}

.htl-rails i.vert {
  left: auto;
  right: auto;
  width: var(--line-w, 2px);
  height: auto;
}

/* 传送带层：卡片沿蛇形路线流动，轨道层固定不动 */
.htl-conveyor {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

/* 优先级要压过 .moment.compact 的 height:100%（那是给网格布局用的） */
.htl-conveyor .moment.conveyed {
  position: absolute;
  left: 0;
  top: 0;
  height: var(--row-h, 200px);
  pointer-events: auto;
  will-change: transform;
}

.moment.conveyed .moment-card { cursor: pointer; }

.htl.dragging { cursor: grabbing; user-select: none; }

.bucket-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 11px 13px 7px;
}

.bucket-head strong { font-size: 13.5px; }
.bucket-head span { font-size: 11.5px; color: var(--text-dim); white-space: nowrap; }

.htl-track {
  position: relative;
  display: grid;
  grid-auto-flow: column;
  align-content: center;   /* 竖直居中，别让卡片都挤在顶部 */
  align-items: start;
  gap: 18px;
  min-height: 100%;
  padding: 24px 48px;
  width: max-content;
}

.htl-sentinel { width: 1px; flex: 0 0 1px; align-self: stretch; }

.htl-year {
  flex: 0 0 auto;
  align-self: flex-start;
  margin-top: calc(var(--axis-y, 56px) - 34px);
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--bg-raise);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  position: relative;
}

.moment {
  position: relative;
  flex: 0 0 auto;
  width: 244px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* 每条自己画一段横轴，左右各伸出一个间隙，连起来就是整条线。
   这样不用管整行被垂直居中到哪儿，线永远穿过圆点。 */
.moment::before {
  content: "";
  position: absolute;
  left: -18px;
  right: -18px;
  top: calc(var(--axis-y, 56px) - var(--line-w, 2px));
  height: var(--line-w, 2px);
  background: var(--axis-line, var(--line));
}

.moment-date {
  height: var(--axis-y, 56px);
  display: flex;
  align-items: center;
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
  cursor: pointer;
}

.moment-date:hover { color: var(--text); text-decoration: underline; }

.moment-dot {
  width: var(--dot-size, 12px);
  height: var(--dot-size, 12px);
  border-radius: 50%;
  background: var(--dot-color, var(--accent));
  /* 外圈光晕跟着点色走 */
  box-shadow: 0 0 0 calc(var(--dot-size, 12px) / 3)
    color-mix(in srgb, var(--dot-color, var(--accent)) 22%, transparent);
  /* 让点的中心永远落在横轴上（轴在 --axis-y 上方 1px） */
  margin-top: calc(var(--dot-size, 12px) / -2 - 1px);
  flex: 0 0 auto;
}

.moment-card {
  margin-top: 14px;
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color .15s, transform .15s;
}

.moment-card:hover { border-color: var(--line-strong, #39414d); transform: translateY(-2px); }
.moment-card.empty-text { border-style: dashed; }

.moment-text {
  margin: 0;
  padding: 12px 13px;
  font-size: 13px;
  line-height: 1.65;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 190px;
  overflow: hidden;
}

.moment-text:empty { display: none; }

.moment-photos {
  display: grid;
  gap: 2px;
  grid-template-columns: 1fr;
}

.moment-photos.many { grid-template-columns: 1fr 1fr; }

.moment-photos img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  background: var(--bg-raise);
  cursor: zoom-in;
}

.moment-photos.many img { aspect-ratio: 1; }

.moment-more {
  padding: 4px 13px 10px;
  font-size: 11px;
  color: var(--text-dim);
}

.moment-hint {
  padding: 10px 13px;
  font-size: 12px;
  color: var(--text-dim);
}

/* ---------- 蛇形布局（日粒度）：三行，左上 → 右下 ---------- */

.htl-track.snake {
  display: flex;
  align-items: center;
  /* 带间距 = 列间距：整条轴就是均匀的格子，一格一格滑才对得齐 */
  gap: var(--col-gap, 8px);
  height: auto;
  min-height: 0;
  padding: 18px 40px;
}

.htl.snake {
  display: flex;
  align-items: center;
}

.htl-band {
  display: grid;
  /* 行高默认 200px，窗口不够高时自动缩，免得第三行被裁掉 */
  grid-template-rows: repeat(3, min(var(--row-h, 200px), calc((100vh - 156px) / 3)));
  --row-gap: 12px;
  gap: var(--row-gap) var(--col-gap, 8px);
  flex: 0 0 auto;
  height: auto;
  min-height: 0;
}

.moment.compact {
  --axis-y: 40px;          /* 线上方留给日期的高度 */
  width: var(--cell-w, 200px);
  height: 100%;
  min-height: 0;
  align-items: stretch;
}

/* 行内那条横轴和圆点保留：日期在线上方，卡片在线的下面 */
.moment.compact .moment-date {
  height: var(--axis-y);
  margin-bottom: 0;
  align-items: flex-end;
  padding-bottom: 7px;
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 横轴改由固定的 .htl-rails 画，卡片自己不再画横线 */
.moment.compact::before { display: none; }

/* 圆点居中，横轴正好穿过它 */
.moment.compact .moment-dot { align-self: center; }

/* 拐弯：一小段竖线，把上一行的轨道和下一行的轨道连起来，随卡片一起滑动 */
.moment.compact.turn-right::after,
.moment.compact.turn-left::after {
  content: "";
  position: absolute;
  top: calc(var(--axis-y) - 1px);
  width: 2px;
  height: calc(100% + var(--row-gap, 12px));
  background: var(--line);
}

.moment.compact.turn-right::after { left: calc(50% + var(--col-gap, 8px) / 2 - 1px); }
.moment.compact.turn-left::after { right: calc(50% + var(--col-gap, 8px) / 2 - 1px); }

.moment.compact .moment-card {
  /* 点变大时把卡片往回拉，卡片顶部始终在轴下方同一位置 */
  margin-top: calc(20px - var(--dot-size, 12px) / 2);
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.moment.compact .moment-text {
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.45;
  max-height: 46px;
}

.moment.compact .moment-photos {
  flex: 1;
  min-height: 0;
  grid-auto-rows: 1fr;
}

.moment.compact .moment-photos img {
  height: 100%;
  aspect-ratio: auto;
}

.moment.compact .moment-more,
.moment.compact .moment-hint { padding: 6px 10px; font-size: 11px; }

@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

.sentinel { height: 1px; }

.empty {
  max-width: 520px;
  margin: 60px auto;
  padding: 28px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 14px;
  text-align: center;
}

.empty h2 { margin: 0 0 12px; font-size: 17px; }
.empty p { color: var(--text-dim); line-height: 1.7; font-size: 13px; }
.empty .path {
  font-family: Consolas, monospace;
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  color: var(--text);
  word-break: break-all;
  user-select: all;
  margin-bottom: 14px;
}

.empty .btn { margin-bottom: 16px; }

/* ---------- 大图查看 ---------- */

.viewer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  background: var(--scrim-strong, rgba(6, 7, 9, .97));
}

.viewer-stage {
  flex: 1;
  min-width: 0;
  display: grid;
  place-items: center;
  padding: 34px;
}

.viewer-stage img {
  max-width: 100%;
  max-height: calc(100vh - 68px);
  border-radius: 6px;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
  object-fit: contain;
}

.viewer-info {
  width: 280px;
  flex: 0 0 280px;
  border-left: 1px solid var(--line);
  background: var(--bg-soft);
  padding: 56px 20px 20px;
  overflow-y: auto;
  font-size: 12.5px;
  line-height: 1.8;
}

.viewer-info h3 { margin: 0 0 4px; font-size: 15px; }
.viewer-info .time { color: var(--text-dim); margin-bottom: 14px; }
.viewer-info .dim { color: var(--text-dim); }
.viewer-info dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; margin: 0 0 14px; }
.viewer-info dt { color: var(--text-dim); }
.viewer-info dd { margin: 0; word-break: break-all; }
.viewer-info .tags { display: flex; flex-wrap: wrap; gap: 6px; }

.viewer-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.viewer-info .tag {
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 11.5px;
}

.viewer-close, .viewer-nav {
  position: absolute;
  background: rgba(255,255,255,.08);
  border: none;
  color: #fff;
  cursor: pointer;
  border-radius: 50%;
  transition: background .15s;
}

.viewer-close:hover, .viewer-nav:hover { background: rgba(255,255,255,.2); }

.viewer-close { top: 16px; right: 300px; width: 34px; height: 34px; font-size: 15px; }
.viewer-nav { top: 50%; transform: translateY(-50%); width: 44px; height: 44px; font-size: 26px; padding-bottom: 4px; }
.viewer-nav.prev { left: 18px; }
.viewer-nav.next { right: 300px; }

/* ---------- 候选区（挑选导入） ---------- */

/* ---------- 登录 ---------- */

.gate {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  background: var(--bg);
}

.gate-card {
  width: 340px;
  padding: 28px 26px 24px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 14px;
  text-align: center;
}

.gate-mark { margin: 0 auto 14px; width: 40px; height: 40px; font-size: 18px; }
.gate-card h2 { margin: 0 0 8px; font-size: 17px; }
.gate-card p { margin: 0 0 16px; color: var(--text-dim); font-size: 12.5px; line-height: 1.7; }

.gate-card input {
  width: 100%;
  margin-bottom: 10px;
  padding: 10px 12px;
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}

.gate-card input:focus { outline: none; border-color: var(--accent); }
.gate-submit { width: 100%; margin-top: 4px; padding: 10px; }
.gate-error { min-height: 18px; color: #ff7a7a; font-size: 12px; }

.picker {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
}

.picker-title h2 { margin: 0; font-size: 17px; }
.picker-title p { margin: 4px 0 0; color: var(--text-dim); font-size: 12px; }
.picker-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.picker-body { flex: 1; overflow-y: auto; padding: 16px 24px 48px; }

.picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 8px;
}

.pick {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-raise);
  cursor: pointer;
  outline: 2px solid transparent;
  outline-offset: -2px;
  transition: outline-color .12s;
}

.pick img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity .2s, transform .2s;
}

.pick img.loaded { opacity: 1; }
.pick:hover img { transform: scale(1.05); }

.pick .check {
  position: absolute;
  top: 7px; right: 7px;
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.85);
  background: rgba(0,0,0,.4);
  display: grid;
  place-items: center;
  font-size: 12px;
  color: transparent;
}

.pick.selected { outline-color: var(--accent); }
.pick.selected .check { background: var(--accent); border-color: var(--accent); color: #fff; }
.pick.selected img { transform: scale(.94); }

.picker-note {
  margin: 40px auto;
  max-width: 460px;
  text-align: center;
  color: var(--text-dim);
  line-height: 1.8;
  font-size: 13px;
}

.picker-note strong { color: var(--text); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2c323b; border-radius: 6px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #3a424e; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 手机 / 窄屏 ---------- */

/* ---------- 写条目 ---------- */

.editor {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  background: var(--scrim, rgba(6, 7, 9, .74));
}

.editor-card {
  width: min(560px, calc(100vw - 28px));
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: 18px 20px 20px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.editor-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.editor-head h2 { margin: 0; font-size: 16px; }

.editor-field {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 12.5px;
  color: var(--text-dim);
}

.editor-field input {
  flex: 1;
  padding: 8px 10px;
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
}

#editor-text {
  width: 100%;
  padding: 11px 12px;
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.7;
  resize: vertical;
}

.editor-field input:focus, #editor-text:focus { outline: none; border-color: var(--accent); }

.editor-photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  gap: 6px;
  margin: 12px 0;
}

.editor-photos .thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-raise);
}

.editor-photos .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.editor-photos .thumb.pending { border: 1px dashed var(--accent); }

.editor-photos .thumb .tag {
  position: absolute;
  left: 4px; bottom: 4px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .62);
  color: #fff;
  font-size: 10px;
}

.editor-photos .thumb button {
  position: absolute;
  top: 4px; right: 4px;
  width: 20px; height: 20px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, .62);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}

.editor-actions { display: flex; gap: 8px; margin-top: 4px; }
.editor-foot { margin-top: 16px; display: flex; justify-content: flex-end; }

.btn.danger { color: #ff8f8f; border-color: #4a2a2a; }
.btn.danger:hover { background: #3a2020; }
.btn.danger.confirming {
  background: #c0392b;
  border-color: #c0392b;
  color: #fff;
  font-weight: 600;
}

/* ---------- 设置 ---------- */

.settings {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  background: var(--scrim, rgba(6, 7, 9, .74));
}

.settings-card {
  width: min(460px, calc(100vw - 28px));
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: 18px 20px 22px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.settings-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.settings-head h2 { margin: 0; font-size: 16px; }

.settings-block { border-top: 1px solid var(--line); padding: 14px 0 4px; margin-top: 12px; }
.settings-block h3 { margin: 0 0 10px; font-size: 13px; color: var(--text-dim); font-weight: 600; }

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  margin-bottom: 10px;
}

.settings-path {
  margin: 0 0 10px;
  padding: 8px 10px;
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: Consolas, monospace;
  font-size: 11.5px;
  color: var(--text-dim);
  word-break: break-all;
  user-select: all;
}

.settings-share { font-size: 12.5px; line-height: 1.8; color: var(--text-dim); }
.settings-share .url { display: block; color: var(--accent); user-select: all; }
.settings-share strong { color: var(--text); }
.settings-share .ghost-btn { margin: 8px 0 0; }

#bg-color {
  width: 46px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-raise);
  cursor: pointer;
}

.swatches { display: flex; flex-wrap: wrap; gap: 8px; }

.swatches button {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--line);
  cursor: pointer;
}

.swatches button:hover { border-color: var(--accent); }

#line-width {
  flex: 1;
  max-width: 180px;
  accent-color: var(--accent);
}

.settings-row input[type="text"],
.settings-row input[type="date"] {
  flex: 1;
  min-width: 0;
  padding: 7px 10px;
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
}

.settings-row input:focus { outline: none; border-color: var(--accent); }

.settings-note {
  margin: 0 0 8px;
  font-size: 12.5px;
  color: var(--text-dim);
  line-height: 1.7;
}

.settings-value {
  min-width: 38px;
  text-align: right;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 760px) {
  :root { --cell-w: 116px; --row-h: 150px; }

  .sidebar { display: none; }

  .topbar { padding: 10px 14px; gap: 10px; }
  .topbar h1 { font-size: 17px; }
  .topbar p { font-size: 11.5px; }
  .topbar-actions { width: 100%; }
  .btn { padding: 7px 11px; font-size: 12.5px; }

  .timeline { padding: 6px 12px 40px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 4px; }

  .viewer-stage { padding: 14px; }
  .viewer-info { display: none; }
  .viewer-close { right: 14px; }
  .viewer-nav.next { right: 14px; }

  .picker-head { padding: 10px 14px; gap: 10px; }
  .picker-actions { width: 100%; }
  .picker-body { padding: 12px 14px 40px; }
  .picker-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 5px; }

  .gate-card { width: min(340px, calc(100vw - 32px)); }

  .htl-track { gap: 12px; padding: 0 16px 24px; }
  .moment { width: 216px; }
  .moment-text { max-height: 140px; }
}
