/* RED PROTOCOL · 手机版共用样式（Apple 优先，可长期使用） */
:root {
  --shell-max: 500px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --pad-x: 16px;
  --gap: 10px;
  --touch: 48px;
  --input-fs: 16px;
  --master-bar-h: 68px;
  --task-min-h: 50px;
  --task-check: 38px;
  --cd-wheel-item: 44px;
  --cd-wheel-rows: 5;
  --page-dots-h: 22px;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", sans-serif;
  background: #000;
  color: #e5e5e5;
  min-height: 100dvh;
  padding: calc(var(--safe-t) + 8px) var(--safe-r) calc(var(--safe-b) + 12px) var(--safe-l);
  display: flex;
  justify-content: center;
}
body::before {
  content: "";
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(ellipse 80% 45% at 50% 0%, rgba(185,28,28,.12), transparent 55%),
    repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(127,29,29,.03) 2px, rgba(127,29,29,.03) 4px);
}
.phone-shell {
  width: 100%;
  max-width: min(var(--shell-max), 100%);
  height: calc(100dvh - var(--safe-t) - var(--safe-b) - 16px);
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
  background: #050505;
}
.page {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 8px var(--pad-x) 0;
}

.swiper-viewport {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  width: 100%;
  touch-action: none;
}
.swiper-track {
  display: flex;
  height: 100%;
  will-change: transform;
}
.swiper-panel {
  flex: 0 0 100%;
  width: 100%;
  min-width: 100%;
  height: 100%;
  overflow: hidden;
  touch-action: none;
  padding-bottom: 8px;
  box-sizing: border-box;
}
#panel-progress {
  display: flex;
  flex-direction: column;
}
#panel-progress #dash {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y pinch-zoom;
}
#panel-progress .chart,
#panel-progress .chart canvas {
  pointer-events: none;
  touch-action: none;
}
#panel-tasks,
#panel-advisor,
#panel-chats {
  display: flex;
  flex-direction: column;
}
#panel-tasks {
  overflow: hidden;
}
#panel-advisor {
  overflow: hidden;
}
#panel-tasks .card-master { flex-shrink: 0; margin-bottom: var(--gap); }
#panel-tasks #edit-master-note {
  min-height: 44px;
  max-height: 56px;
}
#panel-tasks .card-subtasks {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: min(52vh, 420px);
  margin-bottom: 0;
  overflow: hidden;
}
#panel-tasks .card-subtasks .card-head { flex-shrink: 0; }
#panel-tasks .task-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(140px, 1fr) auto;
  overflow: hidden;
}
#panel-tasks .time-row,
#panel-tasks .tone-zones,
#panel-tasks .add-row { flex-shrink: 0; }
.time-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 8px 12px 6px;
}
.time-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 92px;
  padding: 8px;
  border-radius: 14px;
  border: 1px solid rgba(64,64,64,.5);
  background: rgba(0,0,0,.32);
  cursor: pointer;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.22s, background 0.22s, box-shadow 0.22s, transform 0.15s;
}
.time-tile:active { transform: scale(0.96); }
.time-tile.on {
  border-color: rgba(220,38,38,.6);
  background: rgba(127,29,29,.14);
  box-shadow: inset 0 0 0 1px rgba(239,68,68,.18), 0 0 20px rgba(220,38,38,.12);
}
.time-vis {
  width: 76px;
  height: 76px;
  display: block;
  pointer-events: none;
}
.time-vis-clock {
  width: min(88px, 100%);
  height: auto;
  max-height: 52px;
}
.time-tile-countdown {
  min-height: 92px;
}
.time-tile.on .time-vis #cal-grid-dots { opacity: 0.12; }
.time-tile-countdown.on .time-vis #cd-bar-fill { opacity: 1; }
.tone-zones {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 0 12px 8px;
}
.tone-zone {
  min-height: 20px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px dashed rgba(64,64,64,.45);
  display: flex;
  align-items: center;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.tone-swatch {
  display: block;
  width: 100%;
  height: 5px;
  border-radius: 3px;
}
.red-zone .tone-swatch {
  background: linear-gradient(90deg, #450a0a, #ef4444 55%, #450a0a);
  box-shadow: 0 0 8px rgba(220, 38, 38, 0.35);
}
.white-zone .tone-swatch {
  background: linear-gradient(90deg, #404040, #e5e5e5 55%, #404040);
  box-shadow: 0 0 6px rgba(212, 212, 212, 0.2);
}
.tone-zone.red-zone.is-over {
  border-color: rgba(220,38,38,.65);
  background: rgba(127,29,29,.18);
  color: #fca5a5;
  box-shadow: inset 0 0 0 1px rgba(239,68,68,.2);
}
.tone-zone.white-zone.is-over {
  border-color: rgba(212,212,212,.55);
  background: rgba(255,255,255,.08);
  color: #e5e5e5;
}
#panel-tasks .task-grid {
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y pinch-zoom;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 12px;
}

#panel-advisor {
  overflow: hidden;
}
#panel-chats {
  overflow: hidden;
}
#panel-chats .chats-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin-bottom: 0;
}
#panel-chats .chats-card .card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding-bottom: 10px;
  gap: 8px;
}
.chat-mgr-section { flex-shrink: 0; }
.chat-mgr-label {
  font-size: 9px;
  letter-spacing: 0.12em;
  color: #737373;
  margin-bottom: 6px;
}
.chat-mgr-masters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.chat-mgr-master {
  text-align: left;
  min-height: 68px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(64,64,64,.55);
  background: rgba(255,255,255,.02);
  color: inherit;
  font-family: inherit;
  cursor: pointer;
}
.chat-mgr-master.on {
  border-color: rgba(220,38,38,.65);
  background: rgba(127,29,29,.16);
  box-shadow: inset 3px 0 0 #ef4444;
}
.chat-mgr-master-name {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #f5f5f5;
  margin-bottom: 3px;
}
.chat-mgr-master-preview {
  display: block;
  font-size: 11px;
  color: #a3a3a3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 2px;
}
.chat-mgr-master-meta {
  display: block;
  font-size: 9px;
  color: #737373;
}
.chat-mgr-master.on .chat-mgr-master-meta { color: #ef4444; }
.chat-mgr-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  padding-top: 4px;
  border-top: 1px solid rgba(64,64,64,.35);
}
.chat-mgr-clear {
  min-height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid rgba(127,29,29,.45);
  background: rgba(127,29,29,.12);
  color: #fca5a5;
  font-size: 12px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}
.chat-mgr-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 8px;
  touch-action: pan-y;
}
.chat-mgr-empty {
  margin: 0;
  padding: 20px 8px;
  text-align: center;
  color: #737373;
  font-size: 13px;
}
.chat-mgr-row {
  display: grid;
  grid-template-columns: 1fr 34px;
  gap: 6px;
  align-items: start;
}
.chat-mgr-row-main {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(64,64,64,.45);
  background: rgba(0,0,0,.28);
}
.chat-mgr-row.is-advisor .chat-mgr-row-main {
  border-color: rgba(127,29,29,.4);
  background: rgba(127,29,29,.1);
}
.chat-mgr-row-who {
  font-size: 9px;
  letter-spacing: 0.1em;
  color: #737373;
  margin-right: 8px;
}
.chat-mgr-row.is-advisor .chat-mgr-row-who { color: #ef4444; }
.chat-mgr-row-time {
  font-size: 9px;
  color: #525252;
}
.chat-mgr-row-text {
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.45;
  color: #e5e5e5;
}
.chat-mgr-row-del {
  min-height: 34px;
  border: 1px solid rgba(64,64,64,.55);
  border-radius: 8px;
  background: rgba(0,0,0,.35);
  color: #737373;
  font-size: 16px;
  cursor: pointer;
  font-family: inherit;
}

/* 页码指示 · 四页滑动 */
.page-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 4px 0 2px;
  min-height: var(--page-dots-h);
  flex-shrink: 0;
}
.page-dots span {
  width: 18px;
  height: 3px;
  border-radius: 999px;
  background: rgba(82,82,82,.55);
  transition: width 0.25s, background 0.25s;
}
.page-dots span.on {
  width: 28px;
  background: linear-gradient(90deg, #7f1d1d, #ef4444);
  box-shadow: 0 0 8px rgba(220,38,38,.35);
}

/* 顾问页 · 游戏式对话 */
#panel-advisor .advisor-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin-bottom: 0;
}
#panel-advisor .advisor-card .card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0;
}
.advisor-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 10px 12px 12px;
  gap: 10px;
}
.advisor-hero {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-shrink: 0;
  padding: 4px 2px 0;
}
.advisor-portrait-wrap {
  position: relative;
  width: 120px;
  flex-shrink: 0;
}
.advisor-portrait-glow {
  position: absolute;
  inset: -8px -4px -4px;
  background: radial-gradient(ellipse at 50% 70%, rgba(220,38,38,.22), transparent 68%);
  pointer-events: none;
}
.advisor-portrait-frame {
  position: relative;
  padding: 6px;
  border-radius: 14px;
  border: 2px solid rgba(127,29,29,.55);
  background: linear-gradient(165deg, #1a1a1a, #050505);
  box-shadow: inset 0 0 0 1px rgba(239,68,68,.12), 0 8px 24px rgba(0,0,0,.45);
  clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 8px, 100% calc(100% - 8px), calc(100% - 8px) 100%, 8px 100%, 0 calc(100% - 8px), 0 8px);
}
.advisor-portrait {
  display: block;
  width: 100%;
  height: 132px;
  object-fit: cover;
  object-position: center 10%;
  border-radius: 8px;
  filter: contrast(1.04) saturate(1);
  image-rendering: -webkit-optimize-contrast;
}
.advisor-meta {
  flex: 1;
  min-width: 0;
  padding-bottom: 6px;
}
.advisor-role {
  font-size: 9px;
  letter-spacing: 0.16em;
  color: #737373;
  margin-bottom: 4px;
}
.advisor-name {
  font-size: 18px;
  font-weight: 800;
  color: #fecaca;
  letter-spacing: 0.06em;
}
.advisor-log {
  flex: 1;
  min-height: 72px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 2px;
  touch-action: pan-y pinch-zoom;
}
.advisor-bubble {
  max-width: 92%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(64,64,64,.45);
  background: rgba(0,0,0,.35);
  animation: advisorBubbleIn 0.28s cubic-bezier(.25,.8,.25,1) both;
}
@keyframes advisorBubbleIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.advisor-dialog-text {
  margin: 0;
  font-size: var(--input-fs);
  line-height: 1.55;
  color: #f5f5f5;
  min-height: 2.8em;
  transition: opacity 0.22s ease, transform 0.28s cubic-bezier(.25,.8,.25,1);
}
.advisor-dialog.is-updating .advisor-dialog-text {
  opacity: 0;
  transform: translateY(8px);
}
.advisor-bubble.is-advisor {
  align-self: flex-start;
  border-color: rgba(127,29,29,.45);
  background: rgba(127,29,29,.12);
}
.advisor-bubble.is-user {
  align-self: flex-end;
  border-color: rgba(82,82,82,.55);
  background: rgba(255,255,255,.05);
}
.advisor-bubble-who {
  display: block;
  font-size: 9px;
  letter-spacing: 0.12em;
  color: #737373;
  margin-bottom: 4px;
}
.advisor-bubble.is-advisor .advisor-bubble-who { color: #ef4444; }
.advisor-bubble p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: #e5e5e5;
}
.advisor-dialog {
  flex-shrink: 0;
  position: relative;
  padding: 12px 14px 14px;
  border-radius: 12px;
  border: 1px solid rgba(127,29,29,.55);
  background: linear-gradient(180deg, rgba(20,20,20,.98), rgba(5,5,5,.98));
  box-shadow: inset 0 0 0 1px rgba(239,68,68,.1), 0 4px 20px rgba(0,0,0,.35);
  clip-path: polygon(10px 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 0 100%, 0 10px);
}
.advisor-dialog::before {
  content: '';
  position: absolute;
  left: 28px;
  top: -8px;
  width: 14px;
  height: 14px;
  background: rgba(20,20,20,.98);
  border-left: 1px solid rgba(127,29,29,.55);
  border-top: 1px solid rgba(127,29,29,.55);
  transform: rotate(45deg);
}
.advisor-dialog-name {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: #ef4444;
  margin-bottom: 8px;
}
.advisor-compose {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  flex-shrink: 0;
}
.advisor-input {
  min-height: 44px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid rgba(64,64,64,.55);
  background: rgba(0,0,0,.45);
  color: #fafafa;
  font-size: var(--input-fs);
  font-family: inherit;
  outline: none;
}
.advisor-input:focus {
  border-color: rgba(220,38,38,.6);
  box-shadow: 0 0 0 3px rgba(220,38,38,.12);
}
.advisor-send {
  min-height: 44px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid rgba(127,29,29,.55);
  background: rgba(127,29,29,.28);
  color: #fecaca;
  font-size: var(--input-fs);
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}

/* 底部 · 一排可按压 Logo 气泡（点选切换 · 多了可横滑） */
.logo-dock {
  padding: 6px 0 4px;
  border-top: 1px solid rgba(127,29,29,.28);
  background: linear-gradient(180deg, transparent, rgba(5,5,5,.85) 40%);
  flex-shrink: 0;
}
.logo-strip {
  display: flex;
  flex-wrap: nowrap;
  gap: 14px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  padding: 6px var(--pad-x) 4px;
  touch-action: pan-x;
  scrollbar-width: none;
}
.logo-strip::-webkit-scrollbar { display: none; }
.logo-bubble {
  flex: 0 0 52px;
  width: 52px;
  height: 52px;
  border: none;
  border-radius: 50%;
  padding: 0;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  scroll-snap-align: center;
  transform: scale(1);
  will-change: transform;
}
.logo-bubble img {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 50%;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  opacity: 0.45;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,.5));
  transition: opacity 0.2s ease, filter 0.2s ease, transform 0.2s ease;
}
.logo-bubble.on img {
  opacity: 1;
  filter: drop-shadow(0 3px 12px rgba(220,38,38,.45)) drop-shadow(0 0 12px rgba(239,68,68,.3));
}
.logo-bubble.on {
  transform: scale(1.06);
}
.logo-bubble.is-down {
  transform: scale(0.86);
  transition: transform 0.07s cubic-bezier(0.4, 0, 0.9, 0.6);
}
.logo-bubble.on.is-down {
  transform: scale(0.92);
}
.logo-bubble.is-down img {
  opacity: 0.85;
}
.logo-bubble.is-bounce {
  animation: logoSpring 0.62s cubic-bezier(0.34, 1.65, 0.54, 1);
}
@keyframes logoSpring {
  0%   { transform: scale(0.86); }
  38%  { transform: scale(1.12); }
  58%  { transform: scale(0.94); }
  76%  { transform: scale(1.05); }
  100% { transform: scale(1.06); }
}
.logo-bubble.is-bounce:not(.on) {
  animation-name: logoSpringOff;
}
@keyframes logoSpringOff {
  0%   { transform: scale(0.86); }
  38%  { transform: scale(1.08); }
  58%  { transform: scale(0.94); }
  100% { transform: scale(1); }
}

.card {
  background: linear-gradient(165deg, rgba(18,18,18,.98), rgba(4,4,4,1));
  border: 1px solid rgba(127,29,29,.5);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: var(--gap);
  box-shadow: 0 8px 28px rgba(0,0,0,.5);
}
.card-head {
  padding: 8px 12px 0;
  font-size: 9px; font-weight: 600; color: #a3a3a3;
  letter-spacing: 0.1em; text-transform: uppercase;
}
.card-head::before { content: "// "; color: #dc2626; }
.card-body { padding: 10px 12px 12px; }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
  margin-bottom: var(--gap);
}
.grid-2 > .card { min-width: 0; margin-bottom: 0; }

.field {
  width: 100%;
  border: 1px solid rgba(64,64,64,.55);
  border-radius: 10px;
  background: rgba(0,0,0,.35);
  color: #fafafa;
  font-size: var(--input-fs);
  font-family: inherit;
  padding: 10px 12px;
  outline: none;
}
.field:focus {
  border-color: rgba(220,38,38,.65);
  box-shadow: 0 0 0 3px rgba(220,38,38,.12);
}
.field::placeholder { color: #525252; }

.tip {
  margin: 0 12px 12px;
  padding: 10px 12px;
  border: 1px dashed rgba(127,29,29,.35);
  border-radius: 10px;
  font-size: 11px;
  color: #737373;
  line-height: 1.5;
  background: rgba(127,29,29,.06);
}
.tip strong { color: #fca5a5; }
.tip a { color: #fca5a5; }

.empty {
  padding: 24px 16px;
  text-align: center;
  color: #737373;
  font-size: 13px;
  line-height: 1.5;
}
.empty a { color: #fca5a5; }

.home-indicator {
  width: 134px; height: 5px;
  background: rgba(250,250,250,.22);
  border-radius: 999px;
  margin: 8px auto calc(4px + var(--safe-b));
}

/* 日历 · 倒计时弹层 */
body.sheet-open,
body.alarm-open { overflow: hidden; }
.time-sheet {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(0,0,0,.72);
  padding: var(--safe-t) max(var(--safe-r), var(--pad-x)) max(var(--safe-b), 8px) max(var(--safe-l), var(--pad-x));
}
.time-sheet[hidden] { display: none; }
.time-sheet-panel {
  width: 100%;
  max-width: min(var(--shell-max), calc(100vw - 2 * var(--pad-x) - var(--safe-l) - var(--safe-r)));
  min-width: 0;
  overflow: hidden;
  background: linear-gradient(165deg, #141414, #050505);
  border: 1px solid rgba(127,29,29,.55);
  border-radius: 16px 16px 12px 12px;
  padding: 16px 14px calc(12px + var(--safe-b));
  box-shadow: 0 -8px 40px rgba(0,0,0,.6);
  animation: sheetUp 0.32s cubic-bezier(0.34, 1.2, 0.64, 1);
  transform: translateY(calc(-1 * var(--kb-lift, 0px)));
  transition: transform 0.18s ease;
  max-height: min(92dvh, calc(100dvh - var(--safe-t) - var(--safe-b) - 24px));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
body.keyboard-open .task-sheet-viz,
body.keyboard-open .task-sheet-fields,
body.keyboard-open .task-sheet-actions {
  display: none;
}
body.keyboard-open .task-sheet-panel {
  padding-top: 12px;
}
body.keyboard-open .task-sheet-input {
  min-height: 52px;
}
@keyframes sheetUp {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.time-sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px; font-size: 16px; font-weight: 700; color: #fafafa;
}
.time-sheet-title {
  font-size: 10px; letter-spacing: 0.12em; color: #a3a3a3;
  margin-bottom: 14px;
}
.time-sheet-title::before { content: ""; color: #dc2626; }
.sheet-nav {
  width: 40px; height: 40px; border-radius: 10px;
  border: 1px solid rgba(64,64,64,.55); background: rgba(0,0,0,.35);
  color: #fca5a5; font-size: 22px; cursor: pointer;
}
.cal-weekdays {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 3px; margin-bottom: 6px;
}
.cal-weekdays span {
  text-align: center; font-size: 10px; color: #525252; padding: 4px 0;
}
.cal-grid {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 3px; margin-bottom: 14px;
}
.cal-day {
  aspect-ratio: 1; min-width: 0;
  border: none; border-radius: 8px;
  background: rgba(255,255,255,.03); color: #e5e5e5;
  font-size: clamp(11px, 3.2vw, var(--input-fs)); font-weight: 600; cursor: pointer;
}
.cal-day.off { color: #404040; background: transparent; }
.cal-day.today { box-shadow: inset 0 0 0 1px rgba(239,68,68,.45); }
.cal-day.sel {
  background: linear-gradient(145deg, #ef4444, #7f1d1d);
  color: #fff; box-shadow: 0 4px 12px rgba(220,38,38,.35);
}
.time-sheet-foot {
  display: flex; gap: 8px; justify-content: flex-end;
}
.time-sheet-foot-wrap {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}
.time-sheet-foot-wrap > .time-sheet-foot {
  justify-content: flex-end;
  flex-wrap: wrap;
}
.time-sheet-foot-wrap > .time-sheet-foot .sheet-btn {
  flex: 1 1 calc(50% - 4px);
  min-width: 0;
  padding: 0 10px;
  font-size: clamp(12px, 3.2vw, var(--input-fs));
}
#cd-test-alarm {
  width: 100%;
  border-color: rgba(220, 38, 38, 0.45);
  color: #fca5a5;
}
.sheet-btn {
  min-height: 44px; padding: 0 18px; border-radius: 10px;
  border: 1px solid rgba(127,29,29,.5); background: rgba(127,29,29,.25);
  color: #fecaca; font-size: var(--input-fs); font-weight: 600; cursor: pointer;
}
.sheet-btn.ghost {
  background: transparent; border-color: rgba(64,64,64,.55); color: #a3a3a3;
}
.cd-fields {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px;
  margin-bottom: 16px;
}
.cd-wheel-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.cd-wheel-label {
  font-size: 10px;
  color: #737373;
  letter-spacing: 0.1em;
  text-align: center;
}
.cd-wheel {
  position: relative;
  height: calc(var(--cd-wheel-item) * var(--cd-wheel-rows));
  border-radius: 12px;
  border: 1px solid rgba(64,64,64,.55);
  background: rgba(0,0,0,.45);
  overflow: hidden;
}
.cd-wheel-frame {
  position: absolute;
  left: 6px; right: 6px;
  top: 50%;
  height: var(--cd-wheel-item);
  transform: translateY(-50%);
  border-radius: 8px;
  border: 1px solid rgba(220,38,38,.35);
  background: rgba(127,29,29,.12);
  box-shadow: inset 0 0 12px rgba(220,38,38,.08);
  pointer-events: none;
  z-index: 1;
}
.cd-wheel-scroll {
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  scrollbar-width: none;
  mask-image: linear-gradient(180deg, transparent, #000 28%, #000 72%, transparent);
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 28%, #000 72%, transparent);
}
.cd-wheel-scroll::-webkit-scrollbar { display: none; }
.cd-wheel-scroll::before,
.cd-wheel-scroll::after {
  content: '';
  display: block;
  height: calc((var(--cd-wheel-rows) - 1) * var(--cd-wheel-item) / 2);
}
.cd-wheel-item {
  height: var(--cd-wheel-item);
  display: flex;
  align-items: center;
  justify-content: center;
  scroll-snap-align: center;
  font-size: 20px;
  font-weight: 700;
  font-family: ui-monospace, Consolas, monospace;
  color: #525252;
  transition: color 0.15s, transform 0.15s, opacity 0.15s;
  user-select: none;
}
.cd-wheel-item.is-active {
  color: #fecaca;
  transform: scale(1.06);
}
.cd-wheel-item.is-near {
  color: #a3a3a3;
}

/* 倒计时 · 闹钟全屏提醒 */
.alarm-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--safe-t) var(--safe-r) var(--safe-b) var(--safe-l);
  background: rgba(0, 0, 0, 0.88);
  animation: alarmBg 0.4s ease;
}
.alarm-overlay[hidden] { display: none; }
@keyframes alarmBg {
  from { background: rgba(0, 0, 0, 0.4); }
  to { background: rgba(0, 0, 0, 0.88); }
}
.alarm-panel {
  position: relative;
  width: 100%;
  max-width: min(var(--shell-max), 100%);
  padding: 32px 24px 28px;
  border-radius: 20px;
  border: 1px solid rgba(220, 38, 38, 0.65);
  background: linear-gradient(165deg, #1a0505, #050505);
  box-shadow: 0 0 60px rgba(220, 38, 38, 0.35);
  text-align: center;
  animation: alarmShake 0.5s ease-in-out infinite alternate;
}
@keyframes alarmShake {
  from { transform: scale(1); box-shadow: 0 0 40px rgba(220, 38, 38, 0.25); }
  to { transform: scale(1.02); box-shadow: 0 0 70px rgba(220, 38, 38, 0.45); }
}
.alarm-ring {
  position: absolute;
  inset: -20px;
  border-radius: 28px;
  border: 2px solid rgba(239, 68, 68, 0.35);
  animation: alarmPulse 1.2s ease-out infinite;
  pointer-events: none;
}
@keyframes alarmPulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  100% { transform: scale(1.08); opacity: 0; }
}
.alarm-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 12px;
  animation: alarmSpin 2s linear infinite;
}
@keyframes alarmSpin {
  0%, 100% { transform: rotate(-8deg); }
  50% { transform: rotate(8deg); }
}
.alarm-eyebrow {
  font-size: 9px;
  letter-spacing: 0.22em;
  color: #ef4444;
  margin-bottom: 8px;
}
.alarm-title {
  font-size: 22px;
  font-weight: 800;
  color: #fafafa;
  margin: 0 0 8px;
}
.alarm-sub {
  font-size: 14px;
  color: #a3a3a3;
  margin: 0 0 24px;
  line-height: 1.45;
}
.alarm-dismiss {
  width: 100%;
  min-height: 52px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(145deg, #ef4444, #991b1b);
  color: #fff;
  font-size: var(--input-fs);
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(220, 38, 38, 0.4);
}
.alarm-dismiss:active { transform: scale(0.98); }
.time-tile-countdown.alarm-flash {
  animation: tileFlash 0.6s ease-in-out infinite alternate;
}
@keyframes tileFlash {
  from { box-shadow: inset 0 0 0 1px rgba(239, 68, 68, 0.2), 0 0 8px rgba(220, 38, 38, 0.2); }
  to { box-shadow: inset 0 0 0 2px rgba(239, 68, 68, 0.6), 0 0 24px rgba(220, 38, 38, 0.55); }
}

/* 子任务 · ECharts 弹层 */
.task-sheet-panel { padding-top: 14px; }
.task-sheet-viz {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}
.task-sheet-sector-wrap {
  position: relative;
  height: 88px;
  border-radius: 12px;
  border: 1px solid rgba(64,64,64,.45);
  background: rgba(0,0,0,.35);
  overflow: hidden;
}
.task-sheet-sector { width: 100%; height: 100%; }
.task-sheet-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}
.task-field-label {
  display: block;
  font-size: 9px;
  letter-spacing: 0.12em;
  color: #737373;
  margin-bottom: 6px;
}
.task-pri-btns {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}
.task-pri-btn {
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid rgba(64,64,64,.55);
  background: rgba(0,0,0,.35);
  color: #a3a3a3;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}
.task-pri-btn.red-slot.on {
  border-color: rgba(220,38,38,.6);
  background: rgba(127,29,29,.25);
  color: #fecaca;
  box-shadow: 0 0 12px rgba(220,38,38,.2);
}
.task-pri-btn.white-slot.on {
  border-color: rgba(212,212,212,.5);
  background: rgba(255,255,255,.1);
  color: #fafafa;
}
.task-due-field { display: block; }
.task-due-input {
  width: 100%;
  min-height: 48px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid rgba(64,64,64,.55);
  background: rgba(0,0,0,.4);
  color: #fafafa;
  font-size: var(--input-fs);
  font-family: inherit;
  outline: none;
  color-scheme: dark;
}
.task-due-input:focus {
  border-color: rgba(220,38,38,.6);
  box-shadow: 0 0 0 3px rgba(220,38,38,.12);
}
.task-sheet-viz-label {
  position: absolute;
  left: 0; right: 0; bottom: 4px;
  text-align: center;
  font-size: 8px;
  letter-spacing: 0.14em;
  color: #525252;
  pointer-events: none;
}
.task-sheet-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 4px 0;
}
.task-sheet-slot {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.16em;
}
.task-sheet-slot.red-slot { color: #ef4444; }
.task-sheet-slot.white-slot { color: #d4d4d4; }
.task-sheet-idx {
  font-size: 22px;
  font-weight: 800;
  color: #fafafa;
  letter-spacing: 0.06em;
}
.task-sheet-input {
  width: 100%;
  min-height: 88px;
  max-height: 140px;
  padding: 12px 14px;
  margin-bottom: 10px;
  border-radius: 12px;
  border: 1px solid rgba(64,64,64,.55);
  background: rgba(0,0,0,.45);
  color: #fafafa;
  font-size: var(--input-fs);
  font-weight: 600;
  line-height: 1.5;
  font-family: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
  resize: vertical;
  outline: none;
}
.task-sheet-input:focus {
  border-color: rgba(220,38,38,.6);
  box-shadow: 0 0 0 3px rgba(220,38,38,.12);
}
.task-sheet-input::placeholder { color: #525252; font-weight: 500; }
.task-sheet-actions { margin-bottom: 14px; }
.task-sheet-done {
  min-height: 44px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid rgba(64,64,64,.55);
  background: rgba(0,0,0,.35);
  color: #a3a3a3;
  font-size: var(--input-fs);
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}
.task-sheet-done.red-slot.on {
  border-color: rgba(220,38,38,.55);
  background: rgba(127,29,29,.2);
  color: #fecaca;
}
.task-sheet-done.white-slot.on {
  border-color: rgba(212,212,212,.45);
  background: rgba(255,255,255,.08);
  color: #fafafa;
}
.task-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
}
.task-inline-input {
  width: 100%;
  min-height: 28px;
  border: none;
  border-bottom: 1px solid rgba(220,38,38,.55);
  background: rgba(127,29,29,.08);
  color: #fafafa;
  font-size: var(--input-fs);
  font-weight: 600;
  font-family: inherit;
  outline: none;
  padding: 2px 4px;
}
.task-grip {
  width: 26px;
  align-self: stretch;
  border: none;
  background: transparent;
  color: #525252;
  font-size: 14px;
  cursor: grab;
  touch-action: none;
}
.task-grip:active { color: #ef4444; }
.task.is-dragging { opacity: 0.55; }
.task.drop-before { box-shadow: inset 0 3px 0 #ef4444; }
.task.drop-after { box-shadow: inset 0 -3px 0 #ef4444; }
.task-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.task-tag {
  font-size: 9px;
  letter-spacing: 0.06em;
  padding: 1px 6px;
  border-radius: 6px;
  border: 1px solid rgba(127,29,29,.35);
  color: #fca5a5;
  background: rgba(127,29,29,.12);
}
.task.white-slot .task-tag {
  border-color: rgba(115,115,115,.35);
  color: #d4d4d4;
  background: rgba(255,255,255,.06);
}
.task-text .task-label {
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  word-break: break-word;
}
