/* 索引云 · 闹钟小程序专用样式
   基础组件（卡片 / 按钮 / 表单 / 弹窗）复用 assets/style.css */

/* ============================ 嵌进「小程序中心」的浮动窗口时 ============================ */
/* 窗口标题栏已经写了程序名，页面自己的品牌名和底部说明就收起来，只留下视图导航 */
.embed .topbar .brand,
.embed .embed-hide,
.embed .foot { display: none !important; }
.embed .navlinks { margin-left: 0; }

/* ============================ 大时钟 ============================ */
.clock-card {
  position: relative;   /* 「夜间模式」入口按钮要绝对定位在右上角 */
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 24px 22px;
  margin-bottom: 16px;
  text-align: center;
}
.clock-time {
  font-size: 58px;
  font-weight: 300;
  letter-spacing: 2px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.clock-time .sec { font-size: 22px; color: var(--text-3); margin-left: 4px; letter-spacing: 0; }
.clock-date { font-size: 14px; color: var(--text-2); margin-top: 6px; }
.clock-next {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 14px;
  color: var(--text-2);
}
.clock-next b { color: var(--brand); font-size: 16px; }

/* ============================ 闹钟列表 ============================ */
.alarm-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.alarm-row:last-child { border-bottom: none; }
.alarm-row.off { opacity: .5; }
.alarm-time {
  font-size: 32px;
  font-weight: 300;
  letter-spacing: 1px;
  font-variant-numeric: tabular-nums;
  min-width: 118px;
}
.alarm-meta { flex: 1; min-width: 0; }
.alarm-meta .lab { font-size: 15px; font-weight: 500; }
.alarm-meta .rp { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* 开关 */
.switch {
  position: relative;
  width: 44px; height: 24px;
  border-radius: 999px;
  background: var(--line-strong);
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s;
  border: none;
  padding: 0;
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform .15s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.switch.on { background: var(--brand); }
.switch.on::after { transform: translateX(20px); }

/* ============================ 响铃全屏 ============================ */
.ring-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: linear-gradient(160deg, #eef6ff 0%, #ffffff 45%, #fff4ec 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  animation: ringIn .25s ease-out;
}
@keyframes ringIn { from { opacity: 0; } to { opacity: 1; } }

.ring-box { text-align: center; max-width: 460px; width: 100%; }
.ring-bell {
  font-size: 60px;
  display: inline-block;
  animation: bellShake 1.1s infinite;
}
@keyframes bellShake {
  0%, 60%, 100% { transform: rotate(0); }
  70% { transform: rotate(-13deg); }
  80% { transform: rotate(11deg); }
  90% { transform: rotate(-7deg); }
}
.ring-time {
  font-size: 66px;
  font-weight: 300;
  letter-spacing: 2px;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.ring-label { font-size: 20px; font-weight: 600; color: var(--brand); margin-top: 6px; }
.ring-note { font-size: 14px; color: var(--text-3); margin-top: 8px; }
.ring-actions { margin-top: 32px; display: flex; flex-direction: column; gap: 10px; }
.ring-actions .btn { width: 100%; }

/* ============================ 清单覆盖层 ============================ */
.list-overlay {
  position: fixed; inset: 0; z-index: 290;
  background: rgba(29, 33, 41, .45);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  overflow-y: auto;
}
.list-box {
  background: var(--surface);
  border-radius: var(--radius);
  width: 100%; max-width: 480px;
  max-height: 88vh;
  display: flex; flex-direction: column;
  box-shadow: 0 16px 44px rgba(0,0,0,.22);
  animation: listIn .28s cubic-bezier(.2,.9,.3,1.1);
}
@keyframes listIn { from { opacity: 0; transform: translateY(16px) scale(.97); } to { opacity: 1; transform: none; } }
.list-head {
  padding: 22px 24px 14px;
  border-bottom: 1px solid var(--line);
}
.list-head h2 { font-size: 19px; margin: 0 0 4px; font-weight: 600; }
.list-head p { margin: 0; font-size: 13px; color: var(--text-3); }
.list-body { padding: 8px 24px; overflow-y: auto; flex: 1; }
.list-foot {
  padding: 14px 24px 18px;
  border-top: 1px solid var(--line);
  display: flex; gap: 10px; flex-wrap: wrap;
}
.list-foot .btn { flex: 1; min-width: 120px; }

/* 清单条目 */
.todo {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}
.todo:last-child { border-bottom: none; }
.todo.done .todo-text { color: var(--text-3); text-decoration: line-through; }
.check {
  width: 22px; height: 22px; flex-shrink: 0;
  border: 1.5px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: transparent;
  font-size: 13px;
  margin-top: 2px;
  padding: 0;
}
.check:hover { border-color: var(--brand); }
.check.on { background: var(--ok); border-color: var(--ok); color: #fff; }
.todo-main { flex: 1; min-width: 0; }
.todo-text { font-size: 15px; line-height: 1.5; word-break: break-word; }
.todo-note { font-size: 12px; color: var(--text-3); margin-top: 2px; white-space: pre-wrap; }
.todo-time {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--brand);
  background: var(--brand-soft);
  border-radius: 999px;
  padding: 2px 9px;
  flex-shrink: 0;
  margin-top: 1px;
}
.todo-ops { display: flex; gap: 4px; flex-shrink: 0; }
.icon-btn {
  border: none; background: transparent;
  color: var(--text-3);
  cursor: pointer;
  font-size: 13px;
  padding: 2px 6px;
  border-radius: 6px;
  font-family: inherit;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* 清单编辑行 */
.item-edit {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin: 10px 0;
}
.item-edit .row { margin-bottom: 10px; }
.item-edit label.field { margin-bottom: 10px; }

/* 进度条 */
.done-bar { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin-top: 10px; }
.done-fill { height: 100%; background: var(--ok); border-radius: 999px; transition: width .3s; }

/* 使用提示 */
.tips { margin: 0; padding-left: 20px; font-size: 14px; line-height: 2; }
.tips li { margin-bottom: 2px; }
.warn-card {
  border-color: var(--warn) !important;
  background: var(--warn-soft) !important;
}
.warn-card h2 { color: #8a5406; }

@media (max-width: 640px) {
  .clock-time { font-size: 44px; }
  .alarm-time { font-size: 26px; min-width: 92px; }
  .ring-time { font-size: 52px; }
  .ring-bell { font-size: 48px; }
  .list-box { max-height: 92vh; }
  .list-body { padding: 6px 16px; }
  .list-head, .list-foot { padding-left: 16px; padding-right: 16px; }
}

/* ============================ 夜间模式 ============================
   一块黑幕 + 粗体大字时钟。颜色由「设置 → 闹钟」决定，
   JS 把选中的值写成 --nm-bg / --nm-fg 两个行内变量，这里只管排版。
   ⚠️ 层级(270) 故意比响铃(300)、清单(290) 低：
      真到点响铃了，还是要让响铃界面盖上来。 */
:root {
  --nm-bg: #000000;
  --nm-fg: #ffffff;
}

/* 闹钟卡片右上角的入口 */
.night-btn {
  position: absolute;
  top: 12px; right: 12px;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 11px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  transition: background var(--dur-2) var(--ease), color var(--dur-2) var(--ease),
              border-color var(--dur-2) var(--ease), transform var(--dur-1) var(--ease);
}
.night-btn:hover { background: var(--brand-soft); color: var(--brand); border-color: var(--brand); }
.night-btn:active { transform: scale(.95); }

.night-mode {
  position: fixed;
  left: 0; top: 0;
  /* 用 100vw/100vh 而不是 inset:0 —— 这样能把右侧滚动条那一条也盖住，
     不会在黑幕边上留一条亮边。 */
  width: 100vw; height: 100vh;
  z-index: 270;
  background: var(--nm-bg);
  color: var(--nm-fg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2.2vh;
  padding: 5vh 4vw;
  user-select: none;
  -webkit-user-select: none;
  overflow: hidden;
  /* 淡入淡出，别"啪"一下闪到眼睛 */
  opacity: 0;
  visibility: hidden;
  /* 退出的一瞬间就要「让路」：淡出还要 0.55s，那段时间不能还挡着点击 */
  pointer-events: none;
  transition: opacity .55s var(--ease), visibility 0s linear .55s;
}
.night-mode.on {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity .55s var(--ease), visibility 0s;
  /* 只有开着的这段时间才藏光标 —— 退出时还在淡出，那会儿光标得马上回来，
     不然用户一动鼠标发现"指针没了"会更慌 */
  cursor: none;
}

/* 夜间模式开着时把页面滚动锁掉：一是免得多出一条滚动条破坏整块黑幕，
   二是反正这时候任何输入都会退出，也不需要滚动。 */
html.nm-lock,
html.nm-lock body { overflow: hidden; }

.nm-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.4vh;
  max-width: 100%;
}

.nm-clock {
  display: flex;
  align-items: baseline;
  justify-content: center;
  flex-wrap: wrap;
  /* 数字等宽：秒在跳的时候整串时间不会左右抖 */
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  line-height: 1;
  /* ⚠️ 字号统一挂在**这一层**，里面所有元素都用 em 跟着它缩放。
     （em 是「相对自己的 font-size」的：如果挂在 .nm-hm 上，
      旁边的秒和 AM/PM 是同辈，不会跟着变。）
     具体值由 JS 按「设置里的时间字号 + 不能溢出屏幕」算好写成 --nm-time；
     这里的 clamp 只是 JS 还没跑起来时的兜底。 */
  font-size: var(--nm-time, clamp(72px, 19vw, 260px));
}
.nm-hm {
  font-size: 1em;
  font-weight: 800;
  letter-spacing: .01em;
  /* 粗体大字在暗底上会显得发虚，给它一点点柔和的外发光，边缘更利落 */
  text-shadow: 0 0 42px rgba(255, 255, 255, .10);
}
.nm-tail {
  display: inline-flex;
  align-items: baseline;
  gap: .1em;
  margin-left: .12em;
  font-size: 1em;
}
.nm-sec {
  font-size: .26em;
  font-weight: 700;
  opacity: .62;
}
.nm-mer {
  font-size: .12em;
  font-weight: 700;
  opacity: .55;
  letter-spacing: .08em;
}
/* 24 小时制时 AM/PM 是空的，别留一段空隙 */
.nm-mer:empty { display: none; }

.nm-date {
  font-size: clamp(16px, 2.3vw, 32px);
  font-weight: 600;
  opacity: .88;
  letter-spacing: .04em;
}
.nm-next {
  font-size: clamp(14px, 1.85vw, 26px);
  font-weight: 500;
  opacity: .62;
  letter-spacing: .02em;
  text-align: center;
}
.nm-next b { font-weight: 800; opacity: .95; }

/* 底部那行小提示：只在刚进来时露一下，然后自己淡掉 */
.nm-hint {
  position: absolute;
  left: 0; right: 0; bottom: 3.4vh;
  text-align: center;
  font-size: 13px;
  letter-spacing: .06em;
  color: var(--nm-fg);
  opacity: 0;
  transition: opacity .6s var(--ease);
}
.nm-hint.show { opacity: .3; }

/* 小屏（手机）上把秒和提示收一收，别挤在一起 */
@media (max-width: 640px) {
  .nm-inner { gap: 1vh; }
  .nm-hint { font-size: 11.5px; bottom: 2.4vh; }
}

/* 用户关掉了动效 → 别做淡入淡出，直接出现/消失 */
@media (prefers-reduced-motion: reduce) {
  .night-mode, .night-mode.on { transition: none; }
  .nm-hint { transition: none; }
}

/* ==================== 「全都做完了」的鼓励动画 ====================
 * 2026-10-19 加：某一份清单**最后一件**被勾上时放一下，撒彩色小方块 + 一句鼓励。
 * ⚠️ 层级要压过清单覆盖层（那边是 300），所以给 400。
 * ⚠️ 纯 CSS 动效，不引库；`prefers-reduced-motion` 下 JS 干脆不撒花（只留文字）。 */
.cheer {
  position: fixed; inset: 0; z-index: 400;
  pointer-events: none;            /* 只是个装饰，别挡着点 */
}
.cheer-txt {
  position: absolute; left: 50%; top: 42%;
  transform: translate(-50%, -50%) scale(.8);
  padding: 14px 26px; border-radius: 16px;
  background: var(--surface, #fff);
  box-shadow: 0 10px 34px rgba(16, 24, 40, .18);
  font-size: 20px; font-weight: 700; color: var(--text, #161a20);
  text-align: center; white-space: nowrap;
  animation: cheerPop .42s cubic-bezier(.34, 1.56, .64, 1) forwards;
}
.cheer-txt span {
  display: block; margin-top: 4px;
  font-size: 12.5px; font-weight: 400; color: var(--text-3, #8b95a3);
}
.cheer-bit {
  position: absolute; top: -16px;
  width: 9px; height: 13px; border-radius: 2px;
  animation: cheerFall 1.05s ease-in forwards;
}
@keyframes cheerPop {
  to { transform: translate(-50%, -50%) scale(1); }
}
@keyframes cheerFall {
  to { transform: translate(var(--dx, 0), 88vh) rotate(var(--rot, 360deg)); opacity: .15; }
}
@media (prefers-reduced-motion: reduce) {
  .cheer-txt { animation: none; transform: translate(-50%, -50%); }
  .cheer-bit { display: none; }
}
