/* =========================================================
   300大作战 · 活动档期 — iOS 风格
   Dark first (:root), light via html.light
   ========================================================= */

:root {
  /* iOS system colors (dark) */
  --ios-blue: #0a84ff;
  --ios-green: #30d158;
  --ios-red: #ff453a;
  --ios-orange: #ff9f0a;
  --ios-yellow: #ffd60a;
  --ios-purple: #bf5af2;
  --ios-teal: #64d2ff;
  --ios-indigo: #5e5ce6;
  --ios-pink: #ff375f;
  --ios-gray: #98989d;
  --ios-gray2: #636366;

  /* backgrounds */
  --ios-bg: #000000;
  --ios-bg2: #1c1c1e;
  --ios-bg3: #2c2c2e;
  --ios-bg4: #3a3a3c;
  --ios-sep: #38383a;
  --ios-frost: rgba(22, 22, 24, 0.72);
  --ios-frost-strong: rgba(22, 22, 24, 0.88);

  --ios-label: #ffffff;
  --ios-secondary: rgba(235, 235, 245, 0.6);
  --ios-tertiary: rgba(235, 235, 245, 0.3);
  --ios-fill: rgba(120, 120, 128, 0.2);

  --ac: var(--ios-blue);
  --radius-card: 20px;
  --radius-cell: 14px;
  --inset: 16px;
}

html.light {
  --ios-blue: #007aff;
  --ios-green: #34c759;
  --ios-red: #ff3b30;
  --ios-orange: #ff9500;
  --ios-yellow: #ffcc00;
  --ios-purple: #af52de;
  --ios-teal: #5ac8fa;
  --ios-indigo: #5856d6;
  --ios-pink: #ff2d55;
  --ios-gray: #8e8e93;
  --ios-gray2: #aeaeb2;

  --ios-bg: #f2f2f7;
  --ios-bg2: #ffffff;
  --ios-bg3: #e5e5ea;
  --ios-bg4: #d1d1d6;
  --ios-sep: #c6c6c8;
  --ios-frost: rgba(255, 255, 255, 0.72);
  --ios-frost-strong: rgba(255, 255, 255, 0.9);

  --ios-label: #000000;
  --ios-secondary: rgba(60, 60, 67, 0.6);
  --ios-tertiary: rgba(60, 60, 67, 0.3);
  --ios-fill: rgba(120, 120, 128, 0.12);
}

/* ---- accent color keyed by data color ---- */
.ac-blue { --ac: var(--ios-blue); }
.ac-green { --ac: var(--ios-green); }
.ac-red { --ac: var(--ios-red); }
.ac-orange { --ac: var(--ios-orange); }
.ac-yellow { --ac: var(--ios-yellow); }
.ac-purple { --ac: var(--ios-purple); }
.ac-teal { --ac: var(--ios-teal); }
.ac-indigo { --ac: var(--ios-indigo); }
.ac-pink { --ac: var(--ios-pink); }
.ac-gray { --ac: var(--ios-gray); }

/* =========================================================
   Page shell
   ========================================================= */
.sched-body {
  background: var(--ios-bg);
  color: var(--ios-label);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  padding-bottom: 40px;
}

.sched-mono { font-family: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace; }

/* iOS grouped section background: cards on bg */
.sched-main { max-width: 760px; margin: 0 auto; padding: 0 var(--inset); }

/* =========================================================
   Frosted Large Title header
   ========================================================= */
.sched-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--ios-frost);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 0.5px solid var(--ios-sep);
}
.sched-header-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 18px var(--inset) 12px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}
.sched-title {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.4px;
  line-height: 1.1;
}
.sched-subtitle { font-size: 13px; color: var(--ios-secondary); margin-top: 3px; }
.sched-header-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

/* iOS pill buttons */
.sched-pill {
  -webkit-appearance: none;
  appearance: none;
  border: 0.5px solid var(--ios-sep);
  background: var(--ios-fill);
  color: var(--ios-label);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.15s ease, opacity 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.sched-pill:active { transform: scale(0.94); }
.sched-pill.is-on {
  background: var(--ac, var(--ios-blue));
  color: #fff;
  border-color: transparent;
}

/* segmented control */
.sched-seg {
  display: flex;
  background: var(--ios-bg3);
  border-radius: 9px;
  padding: 2px;
  width: fit-content;
}
.sched-seg button {
  -webkit-appearance: none;
  appearance: none;
  border: none;
  background: transparent;
  color: var(--ios-secondary);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 16px;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.2, 0, 0, 1);
}
.sched-seg button.on { background: var(--ios-bg2); color: var(--ios-label); box-shadow: 0 1px 3px rgba(0,0,0,0.18); }

/* =========================================================
   NOW widget card
   ========================================================= */
.sched-now {
  margin: 18px 0 6px;
}
.sched-now-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-card);
  background: var(--ios-bg2);
  border: 0.5px solid var(--ios-sep);
  padding: 20px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.sched-now-card:active { transform: scale(0.985); }
.sched-now-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 90% at 100% 0%, color-mix(in srgb, var(--ac) 22%, transparent), transparent 60%),
    radial-gradient(90% 70% at 0% 100%, color-mix(in srgb, var(--ac) 12%, transparent), transparent 55%);
  pointer-events: none;
}
.sched-now-top { position: relative; display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.sched-now-badge {
  font-size: 12px; font-weight: 700; letter-spacing: 0.5px;
  color: var(--ac);
  text-transform: uppercase;
}
.sched-now-status { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--ac); }
.sched-now-name { position: relative; font-size: 26px; font-weight: 700; letter-spacing: -0.4px; line-height: 1.2; }
.sched-now-count { position: relative; display: flex; align-items: baseline; gap: 8px; margin-top: 14px; }
.sched-now-num {
  font-family: ui-monospace, "SF Mono", "Cascadia Code", monospace;
  font-size: 52px; font-weight: 700; line-height: 1;
  color: var(--ac);
  font-variant-numeric: tabular-nums;
}
.sched-now-unit { font-size: 15px; font-weight: 600; color: var(--ios-secondary); }
.sched-now-range { position: relative; margin-top: 12px; font-size: 13px; color: var(--ios-secondary); }
.sched-progress { position: relative; height: 6px; background: var(--ios-bg3); border-radius: 999px; margin-top: 14px; overflow: hidden; }
.sched-progress-bar { height: 100%; border-radius: 999px; background: var(--ac); width: 0%; transition: width 0.8s cubic-bezier(0.2, 0, 0, 1); }

/* =========================================================
   Capsule rows
   ========================================================= */
.sched-capsules { margin: 20px 0 4px; }
.sched-capsule-label {
  font-size: 13px; font-weight: 600; color: var(--ios-secondary);
  text-transform: uppercase; letter-spacing: 0.3px;
  padding: 0 4px; margin-bottom: 10px;
  display: flex; align-items: center; gap: 6px;
}
.sched-capsule-label::after { content: ''; flex: 1; height: 0.5px; background: var(--ios-sep); margin-left: 8px; }
.sched-scroll { display: flex; gap: 8px; overflow-x: auto; padding: 2px 4px 8px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.sched-scroll::-webkit-scrollbar { display: none; }
.sched-capsule {
  flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--ios-bg2);
  border: 0.5px solid var(--ios-sep);
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
  -webkit-tap-highlight-color: transparent;
}
.sched-capsule:active { transform: scale(0.95); }
.sched-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ac); flex-shrink: 0; }
.sched-capsule em { font-style: normal; font-size: 11px; color: var(--ios-secondary); }

/* =========================================================
   Vertical spine timeline
   ========================================================= */
.sched-spine { position: relative; margin: 26px 0 10px; }
.sched-spine::before {
  content: '';
  position: absolute;
  left: 7px; top: 0; bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, transparent, var(--ios-bg4) 4%, var(--ios-bg4) 96%, transparent);
  border-radius: 2px;
}
.sched-spine-now {
  position: absolute;
  left: 0; right: 0;
  height: 0;
  border-top: 2px solid var(--ios-red);
  opacity: 0.9;
  z-index: 2;
  pointer-events: none;
}
.sched-spine-now::before {
  content: '';
  position: absolute;
  left: 0; top: -5px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--ios-red);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ios-red) 25%, transparent);
}
.sched-spine-now-label {
  position: absolute;
  left: 18px; top: -11px;
  font-size: 11px; font-weight: 700;
  color: var(--ios-red);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.sched-item {
  position: relative;
  padding: 0 0 14px 34px;
}
.sched-item-dot {
  position: absolute;
  left: 2px; top: 20px;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--ios-bg);
  border: 3px solid var(--ac);
  z-index: 1;
}
.sched-item.is-ended { opacity: 0.55; }
.sched-item.is-ended .sched-item-dot { border-color: var(--ios-gray2); }
.sched-card {
  background: var(--ios-bg2);
  border: 0.5px solid var(--ios-sep);
  border-radius: var(--radius-card);
  padding: 16px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}
.sched-card:active { transform: scale(0.985); }
.sched-card-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.sched-card-name { font-size: 17px; font-weight: 600; letter-spacing: -0.2px; }
.sched-card-meta { margin-top: 4px; font-size: 13px; color: var(--ios-secondary); }
.sched-card-badges { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.sched-kind {
  font-size: 11px; font-weight: 700;
  color: var(--ac);
  background: color-mix(in srgb, var(--ac) 15%, transparent);
  border-radius: 6px;
  padding: 3px 7px;
}
.sched-status {
  font-size: 11px; font-weight: 700;
  border-radius: 999px;
  padding: 3px 8px;
}
.sched-status.s-active { color: var(--ios-green); background: color-mix(in srgb, var(--ios-green) 15%, transparent); }
.sched-status.s-upcoming { color: var(--ios-blue); background: color-mix(in srgb, var(--ios-blue) 15%, transparent); }
.sched-status.s-ended { color: var(--ios-gray); background: var(--ios-fill); }
.sched-card-children { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.sched-child-chip {
  font-size: 12px;
  color: var(--ios-secondary);
  background: var(--ios-fill);
  border-radius: 7px;
  padding: 5px 9px;
}

/* =========================================================
   Accordion sections (历史/常驻)
   ========================================================= */
.sched-section { margin: 26px 0 6px; }
.sched-section-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 4px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.sched-section-title { font-size: 20px; font-weight: 700; letter-spacing: -0.3px; }
.sched-section-count { font-size: 13px; color: var(--ios-secondary); font-weight: 500; }
.sched-chevron { margin-left: auto; font-size: 14px; color: var(--ios-secondary); transition: transform 0.25s cubic-bezier(0.2, 0, 0, 1); }
.sched-section.open .sched-chevron { transform: rotate(180deg); }
.sched-group-list { overflow: hidden; }
.sched-group-list > .sched-cell:first-child { border-radius: var(--radius-card) var(--radius-card) 0 0; }
.sched-group-list > .sched-cell:last-child { border-radius: 0 0 var(--radius-card) var(--radius-card); }

/* iOS grouped cells */
.sched-cell {
  background: var(--ios-bg2);
  border-bottom: 0.5px solid var(--ios-sep);
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  font-size: 15px;
}
.sched-cell:last-child { border-bottom: none; }
.sched-cell-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ac); flex-shrink: 0; }
.sched-cell-name { font-weight: 500; }
.sched-cell-date { margin-left: auto; font-size: 13px; color: var(--ios-secondary); white-space: nowrap; flex-shrink: 0; }
.sched-month-head {
  font-size: 12px; font-weight: 700; color: var(--ios-secondary);
  text-transform: uppercase; letter-spacing: 0.5px;
  padding: 14px 4px 8px;
}
.sched-load-more {
  width: 100%;
  -webkit-appearance: none; appearance: none;
  border: none; background: var(--ios-bg2); color: var(--ios-blue);
  font-size: 15px; font-weight: 600;
  padding: 14px;
  cursor: pointer;
  border-radius: 0 0 var(--radius-card) var(--radius-card);
  border-top: 0.5px solid var(--ios-sep);
}

/* empty states */
.sched-empty {
  text-align: center; color: var(--ios-secondary);
  font-size: 14px; padding: 40px 16px;
}

/* =========================================================
   Bottom sheet
   ========================================================= */
.sched-sheet-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.35);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 60;
}
.sched-sheet-overlay.show { opacity: 1; pointer-events: auto; }
.sched-sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 61;
  background: var(--ios-bg2);
  border-radius: 20px 20px 0 0;
  padding: 8px 0 28px;
  transform: translateY(105%);
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
  max-height: 75vh;
  display: flex; flex-direction: column;
  will-change: transform;
}
.sched-sheet.open { transform: translateY(0); }
.sched-grabber {
  width: 36px; height: 5px;
  border-radius: 3px;
  background: var(--ios-bg4);
  margin: 6px auto 4px;
  flex-shrink: 0;
}
.sched-sheet-body { overflow-y: auto; padding: 6px var(--inset) 16px; -webkit-overflow-scrolling: touch; }
.sched-sheet-title { font-size: 24px; font-weight: 700; letter-spacing: -0.3px; }
.sched-sheet-meta { margin-top: 6px; display: flex; align-items: center; gap: 8px; }
.sched-sheet-dates { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.sched-sheet-date-row { display: flex; align-items: center; gap: 12px; }
.sched-sheet-date-label { width: 44px; font-size: 13px; color: var(--ios-secondary); flex-shrink: 0; }
.sched-sheet-date-val { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 15px; font-variant-numeric: tabular-nums; }
.sched-sheet-children-title { font-size: 13px; font-weight: 600; color: var(--ios-secondary); text-transform: uppercase; letter-spacing: 0.3px; margin: 20px 0 8px; }
.sched-sheet-child {
  background: var(--ios-fill);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
}
.sched-sheet-child-name { font-size: 15px; font-weight: 500; }
.sched-sheet-child-date { font-size: 12px; color: var(--ios-secondary); margin-top: 3px; }

/* =========================================================
   Reveal animation (scroll-driven feel)
   ========================================================= */
.sched-item { opacity: 0; transform: translateY(14px); }
.sched-item.reveal { animation: schedIn 0.5s cubic-bezier(0.2, 0, 0, 1) forwards; }
@keyframes schedIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .sched-item { opacity: 1; transform: none; animation: none !important; }
}

/* intro pop for NOW number */
@keyframes countPop { 0% { transform: scale(0.9); } 60% { transform: scale(1.08); } 100% { transform: scale(1); } }
.count-pop { animation: countPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); display: inline-block; }

/* mobile tightening */
@media (max-width: 480px) {
  .sched-title { font-size: 30px; }
  .sched-now-name { font-size: 22px; }
  .sched-now-num { font-size: 44px; }
}
