/* ============================================================
   此刻 · NOW — Design System
   内容是主角，UI 是环境。
   ============================================================ */

:root {
  --bg: #FAFAF9;
  --fg: #18181B;
  --sec: #71717A;
  --ter: #A1A1AA;
  --div: #E4E4E7;
  --sub: #F4F4F5;
  --acc: #6366F1;          /* 只用于「当前正在发生的事情」 */

  --r-btn: 8px;
  --r-dialog: 12px;
  --r-float: 10px;

  --shadow-float: 0 8px 30px rgba(0, 0, 0, .08);
}

/* Life Mode：整体对比度下降，背景略微变暖，Accent 降低 */
body[data-mode="evening"] {
  --bg: #F8F5F1;
  --fg: #27272A;
  --sec: #7A7468;
  --ter: #ACA599;
  --acc: #A5A8F0;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "Segoe UI", "PingFang SC", "Microsoft YaHei", Inter, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color .6s ease, color .6s ease;
}

button { font-family: inherit; }

::selection { background: rgba(99, 99, 241, .16); }

/* ---------- 布局：内容垂直中心 ≈ 46% viewport ---------- */

#stage {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 0 24px 9vh;   /* 光学中心略上移 */
}

.page { width: 100%; }
.page.center { max-width: 640px; text-align: center; }
.page.list { max-width: 720px; margin: 0 auto; padding: 72px 48px 120px; }

.rise { animation: rise .24s ease-out both; }
.rise.slow { animation-duration: .6s; }
@keyframes rise {
  from { opacity: .5; transform: translateY(8px); }
  to   { opacity: 1;  transform: none; }
}

/* ---------- Typography ---------- */

.clock-xl { font-size: 48px; font-weight: 400; font-variant-numeric: tabular-nums; }

.status {
  font-size: 14px; font-weight: 500; color: var(--sec);
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.status .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--acc);
  transition: background-color .6s ease;
}
.status.dim { color: var(--ter); }

.kicker { font-size: 15px; color: var(--sec); }
.hero  { font-size: 36px; font-weight: 500; letter-spacing: .2px; margin: 10px 0 0; }
.task-title { font-size: 36px; font-weight: 500; letter-spacing: .2px; margin: 14px 0 0; }
.subtitle { font-size: 17px; color: var(--sec); margin-top: 8px; }
.hint2 { font-size: 15px; color: var(--sec); margin-top: 16px; }
.hint2 .linkish, .linkish { color: var(--sec); cursor: pointer; }
.linkish:hover { color: var(--fg); text-decoration: underline; text-underline-offset: 3px; }

.timer {
  font-size: 48px; font-weight: 400;
  font-variant-numeric: tabular-nums;
  margin: 30px 0 0; cursor: default;
}
.timer.dim { color: var(--ter); }
.focus-hint { font-size: 13px; color: var(--ter); height: 18px; margin-top: 6px; }

.duration { font-size: 22px; color: var(--sec); font-variant-numeric: tabular-nums; margin-top: 14px; }

.stat-line { font-size: 17px; color: var(--sec); line-height: 2; }
.stat-line b { color: var(--fg); font-weight: 500; font-variant-numeric: tabular-nums; }
.unfin { font-size: 15px; color: var(--ter); line-height: 1.9; }

.done-mark {
  width: 44px; height: 44px; border: 1.5px solid var(--div); border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 20px; color: var(--fg); margin-bottom: 20px;
}

.kbd-hint { font-size: 13px; color: var(--ter); margin-top: 64px; letter-spacing: .3px; }
.kbd-hint kbd {
  font-family: inherit; font-size: 12px;
  border: 1px solid var(--div); border-radius: 4px; padding: 1px 5px; margin: 0 2px;
}
.kbd-hint kbd[data-action] { cursor: pointer; }
.kbd-hint kbd[data-action]:hover { background: var(--sub); color: var(--fg); }

/* ---------- Buttons：只有三种 ---------- */

.btn {
  height: 44px; padding: 0 20px;
  border: none; border-radius: var(--r-btn);
  font-size: 15px; font-weight: 500; cursor: pointer;
  transition: background-color .15s ease, color .15s ease, opacity .15s ease;
}
.btn.primary { background: var(--fg); color: #fff; }
.btn.primary:hover { opacity: .85; }
.btn.secondary { background: var(--sub); color: var(--fg); }
.btn.secondary:hover { background: #EBEBED; }
body[data-mode="evening"] .btn.secondary:hover { background: #EFEAE3; }
.btn.ghost { background: transparent; color: var(--sec); height: 38px; }
.btn.ghost:hover { background: var(--sub); color: var(--fg); }

.btn-row { display: flex; gap: 12px; justify-content: center; align-items: stretch; margin-top: 34px; }
.btn-row .btn.ghost { height: 44px; }

.more {
  background: none; border: none; cursor: pointer;
  font-size: 15px; color: var(--ter); letter-spacing: 2px;
  margin-top: 20px; padding: 4px 10px; border-radius: 6px;
}
.more:hover { color: var(--sec); background: var(--sub); }

/* ---------- Focus 的过程记录 ---------- */

.logs { margin-top: 40px; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.log-line { font-size: 14px; color: var(--ter); }
.log-line .log-t { margin-right: 10px; font-variant-numeric: tabular-nums; }

/* ---------- 侧边导航：默认完全隐藏，靠近左边缘出现 ---------- */

#edge { position: fixed; left: 0; top: 0; bottom: 0; width: 20px; z-index: 39; }

#sidebar {
  position: fixed; left: 0; top: 0; bottom: 0; width: 56px; z-index: 40;
  display: flex; flex-direction: column; justify-content: space-between; align-items: center;
  padding: 22px 0;
  opacity: 0; transform: translateX(-6px); pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
body.sidebar-open #sidebar { opacity: 1; transform: none; pointer-events: auto; }

.side-nav { display: flex; flex-direction: column; gap: 6px; }

.nav-item {
  background: none; border: none; cursor: pointer;
  font-size: 11px; font-weight: 500; letter-spacing: 1.4px;
  color: var(--ter); padding: 10px 9px; border-radius: 6px;
  transition: color .15s ease, background-color .15s ease;
}
.nav-item:hover { color: var(--fg); background: var(--sub); }
.nav-item.active { color: var(--fg); }
.nav-item.active::after {
  content: ""; display: block; width: 4px; height: 4px; border-radius: 50%;
  background: var(--acc); margin: 5px auto 0;
}

#topbar {
  display: none; justify-content: center; align-items: center; gap: 26px;
  padding: 16px 16px 0;
}
#topbar button {
  background: none; border: none; cursor: pointer;
  font-size: 12px; font-weight: 500; letter-spacing: 1.4px; color: var(--ter);
  padding: 6px 8px; border-radius: 6px;
}
#topbar button:hover { color: var(--fg); }
#topbar button.active { color: var(--fg); }

@media (max-width: 768px) {
  #sidebar, #edge { display: none; }
  #topbar { display: flex; }
  .page.list { padding: 40px 24px 96px; }
}

/* ---------- 列表页（Later / History / Replay） ---------- */

.page-label { font-size: 22px; font-weight: 500; margin: 0 0 28px; }
.page-label .sub-label { font-size: 14px; font-weight: 400; color: var(--ter); margin-left: 12px; }

.day-h { font-size: 14px; font-weight: 500; color: var(--sec); margin: 36px 0 14px; }
.day-h:first-of-type { margin-top: 0; }

.tl { display: flex; flex-direction: column; gap: 10px; }
.tl-row { display: flex; gap: 20px; font-size: 15px; align-items: baseline; }
.tl-t { color: var(--ter); width: 44px; flex: none; font-variant-numeric: tabular-nums; }
.tl-x { color: var(--fg); }
.tl-row.dim .tl-x { color: var(--sec); }
.tl-row.task { cursor: pointer; padding: 4px 10px; margin: 0 -10px; border-radius: 8px; transition: background-color .12s ease; }
.tl-row.task:hover { background: var(--sub); }
.tl-d { color: var(--ter); font-size: 13px; margin-left: 10px; font-variant-numeric: tabular-nums; }
.tl-note { color: var(--ter); font-size: 14px; padding: 6px 0 0 64px; }

.group { margin-bottom: 30px; }
.group-h {
  font-size: 14px; font-weight: 500; color: var(--sec);
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px;
}
.tiny-add {
  background: none; border: none; cursor: pointer;
  font-size: 13px; color: var(--ter); padding: 3px 8px; border-radius: 6px;
  opacity: 0; transition: opacity .12s ease, color .12s ease;
}
.group:hover .tiny-add { opacity: 1; }
.tiny-add:hover { color: var(--fg); background: var(--sub); }

.l-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 12px; margin: 0 -12px; border-radius: var(--r-btn); font-size: 16px;
}
.l-item:hover { background: var(--sub); }
.l-acts { display: flex; gap: 2px; opacity: 0; transition: opacity .12s ease; }
.l-item:hover .l-acts { opacity: 1; }
.l-acts button {
  background: none; border: none; cursor: pointer;
  font-size: 14px; color: var(--sec); padding: 3px 8px; border-radius: 6px;
}
.l-acts button:hover { color: var(--fg); background: #EBEBED; }

.inline-add { margin-top: 4px; }
.inline-add input {
  width: 100%; border: none; outline: none; background: none;
  font-size: 16px; font-family: inherit; color: var(--fg);
  padding: 9px 12px; margin: 0 -12px; border-radius: var(--r-btn);
}
.inline-add input:focus { background: #fff; box-shadow: var(--shadow-float); }

.back-link {
  background: none; border: none; cursor: pointer;
  font-size: 14px; color: var(--ter); padding: 4px 0; margin-bottom: 22px;
}
.back-link:hover { color: var(--fg); }

.rep-dur { font-size: 15px; color: var(--sec); margin: -20px 0 26px; font-variant-numeric: tabular-nums; }

/* ---------- 浮层：唯一的阴影出现的地方 ---------- */

.sheet-back { position: fixed; inset: 0; z-index: 50; }
.sheet {
  position: fixed; left: 50%; top: 38%; transform: translate(-50%, -50%);
  z-index: 51; min-width: 260px; max-width: min(440px, calc(100vw - 48px));
  background: #fff; border: 1px solid var(--div); border-radius: var(--r-dialog);
  box-shadow: var(--shadow-float); padding: 8px;
  animation: sheetIn .18s ease-out both;
}
@keyframes sheetIn {
  from { opacity: 0; transform: translate(-50%, calc(-50% + 6px)); }
  to   { opacity: 1; transform: translate(-50%, -50%); }
}

.m-item {
  display: block; width: 100%; text-align: left;
  background: none; border: none; cursor: pointer;
  font-size: 15px; color: var(--fg); padding: 10px 14px; border-radius: var(--r-btn);
}
.m-item:hover, .m-item.hot { background: var(--sub); }
.m-item .m-k { float: right; color: var(--ter); font-size: 13px; margin-left: 24px; }
.m-sep { height: 1px; background: var(--div); margin: 6px 10px; }

.sheet .field input {
  width: 100%; border: none; outline: none;
  font-size: 16px; font-family: inherit; color: var(--fg);
  padding: 12px 14px 4px; background: none;
}

.chips { display: flex; gap: 8px; flex-wrap: wrap; padding: 10px 14px 12px; }
.chip {
  background: var(--sub); color: var(--sec); border: none; cursor: pointer;
  font-size: 13px; padding: 6px 12px; border-radius: 999px;
  transition: background-color .15s ease, color .15s ease;
}
.chip:hover { color: var(--fg); }
.chip.on { background: var(--fg); color: #fff; }

.pal-in {
  width: 100%; border: none; outline: none; border-bottom: 1px solid var(--div);
  font-size: 16px; font-family: inherit; padding: 12px 14px; border-radius: var(--r-dialog) var(--r-dialog) 0 0;
  background: none; color: var(--fg);
}
.pal-list { max-height: 300px; overflow: auto; padding-top: 6px; }

.set-h { font-size: 13px; font-weight: 500; color: var(--sec); padding: 10px 14px 6px; }
.set-row { display: flex; gap: 8px; padding: 0 14px 8px; }
.kbd-row { display: flex; justify-content: space-between; font-size: 14px; color: var(--sec); padding: 5px 14px; }
.kbd-row kbd {
  font-family: inherit; font-size: 12px; color: var(--ter);
  border: 1px solid var(--div); border-radius: 4px; padding: 1px 6px;
}
.kbd-row.act { cursor: pointer; }
.kbd-row.act:hover { background: var(--sub); }
.kbd-row.off { opacity: .4; }

/* ---------- 记录一下：底部输入 ---------- */

#log-bar {
  position: fixed; left: 50%; bottom: 72px; transform: translateX(-50%);
  width: min(640px, calc(100vw - 96px)); z-index: 45;
  animation: logIn .2s ease-out both;
}
@keyframes logIn {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}
#log-bar input {
  width: 100%; height: 44px;
  border: 1px solid var(--div); border-radius: var(--r-float);
  background: #fff; box-shadow: var(--shadow-float);
  padding: 0 18px; font-size: 16px; font-family: inherit; outline: none; color: var(--fg);
}

/* ---------- Toast / 演示时钟 ---------- */

#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  z-index: 60; font-size: 14px; color: var(--sec);
  background: var(--sub); border-radius: var(--r-btn); padding: 8px 16px;
  opacity: 0; pointer-events: none; transition: opacity .3s ease;
}
#toast.show { opacity: 1; }

#speed-chip {
  position: fixed; right: 14px; bottom: 12px; z-index: 40;
  background: none; border: 1px solid var(--div); border-radius: 6px;
  font-size: 12px; color: var(--ter); padding: 3px 8px; cursor: pointer;
}
#speed-chip:hover { color: var(--sec); }

/* ICP 备案号(工信部要求展示,链接到备案系统) */
#icp {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 10px;
  z-index: 40; font-size: 12px; line-height: 1;
}
#icp a { color: var(--ter); text-decoration: none; }
#icp a:hover { color: var(--sec); }
