:root {
  color-scheme: light dark;
  --page: #f8f6fc;
  --surface: #fff;
  --surface-soft: #f8f6fc;
  --hero: #efe8fb;
  --hero-line: #e3d6f5;
  --ink: #271d36;
  --muted: #62576f;
  --faint: #766987;
  --line: #e8e1ef;
  --accent: #6440a7;
  --accent-hover: #51328d;
  --accent-soft: #efe7fc;
  --on-accent: #fff;
  --font-ui: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", Consolas, monospace;
  --r-outer: 24px;
  --r-control: 12px;
  --r-inner: 8px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #171321;
    --surface: #211a2c;
    --surface-soft: #271f35;
    --hero: #2b2040;
    --hero-line: #493664;
    --ink: #f4edfc;
    --muted: #c7b9d4;
    --faint: #b4a0c5;
    --line: #3c304c;
    --accent: #d3b6ff;
    --accent-hover: #e5d3ff;
    --accent-soft: #392750;
    --on-accent: #251638;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 0; scroll-padding-top: 16px; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 400 15px/1.55 var(--font-ui);
  -webkit-text-size-adjust: 100%;
}
button, input { font: inherit; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, p, ol { margin: 0; }
ol { padding: 0; list-style: none; }
button, a, input { -webkit-tap-highlight-color: transparent; }
:where(button, a, input):focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.shell { width: min(1060px, calc(100% - 64px)); margin-inline: auto; }
.site-header { border-bottom: 1px solid var(--line); }
.header-inner { display: flex; min-height: 72px; align-items: center; justify-content: space-between; gap: 12px; }
.site-logo { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font-size: 17px; font-weight: 730; letter-spacing: -.025em; }
.logo-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  flex: none;
  border-radius: var(--r-control);
  background: var(--accent);
  color: var(--on-accent);
}
.header-link { display: inline-flex; align-items: center; gap: 5px; min-height: 44px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.header-link:hover, .footer a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

.icon {
  display: inline-block;
  flex: none;
  width: 20px;
  height: 20px;
  background: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}
.i-calendar-blank { --icon: url("/icons/calendar-blank.svg"); }
.i-calendar-plus { --icon: url("/icons/calendar-plus.svg"); }
.i-arrow-right { --icon: url("/icons/arrow-right.svg"); }
.i-arrow-up-right { --icon: url("/icons/arrow-up-right.svg"); }
.i-caret-right { --icon: url("/icons/caret-right.svg"); }
.i-link-simple { --icon: url("/icons/link-simple.svg"); }
.i-qr-code { --icon: url("/icons/qr-code.svg"); }
.i-copy-simple { --icon: url("/icons/copy-simple.svg"); }
.i-device-mobile { --icon: url("/icons/device-mobile.svg"); }
.i-download-simple { --icon: url("/icons/download-simple.svg"); }
.i-apple-logo { --icon: url("/icons/apple-logo.svg"); }
.i-x { --icon: url("/icons/x.svg"); }
.header-link .icon { width: 15px; height: 15px; }

.hero {
  display: grid;
  grid-template-columns: 1fr minmax(0, .96fr);
  align-items: center;
  gap: 28px;
  min-height: 202px;
  margin-top: 34px;
  padding: 30px 34px;
  border: 1px solid var(--hero-line);
  border-radius: var(--r-outer);
  background: var(--hero);
}
.hero-date { display: block; color: var(--muted); font-size: 14px; font-weight: 560; }
.hero h1 { margin-top: 4px; font-size: clamp(26px, 3.25vw, 44px); font-weight: 720; line-height: 1.23; letter-spacing: -.045em; overflow-wrap: anywhere; }
.hero .week-value { margin-inline-start: .21em; color: var(--accent); }
.hero-content p { margin-top: 9px; color: var(--muted); font-size: 14px; }
.week-strip { min-width: 0; padding: 14px; border: 1px solid var(--hero-line); border-radius: var(--r-control); background: var(--surface); }
.week-strip-heading { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 0 4px 8px; font-size: 13px; }
.week-strip-heading span:first-child { font-weight: 680; }
.week-strip-heading span:last-child { color: var(--muted); }
.week-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.week-day {
  display: grid;
  justify-items: center;
  gap: 1px;
  min-width: 0;
  padding: 6px 1px;
  border-radius: var(--r-control);
  font-size: 12px;
  color: var(--muted);
}
.week-day time { color: var(--ink); font-size: 17px; font-weight: 630; font-variant-numeric: tabular-nums; }
.week-day.today { background: var(--accent); color: var(--on-accent); }
.week-day.today time { color: inherit; }

.content-grid { display: grid; grid-template-columns: minmax(0, 1.53fr) minmax(0, 1fr); align-items: start; gap: 18px; margin-top: 18px; }
.card { min-width: 0; padding: 25px; border: 1px solid var(--line); border-radius: var(--r-outer); background: var(--surface); }
.card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.card h2, dialog h2 { font-size: 21px; font-weight: 700; line-height: 1.3; letter-spacing: -.025em; }
.card-header p { margin-top: 4px; color: var(--muted); font-size: 13px; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: var(--r-control);
  font-size: 14px;
  font-weight: 620;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s;
}
.button .icon { width: 18px; height: 18px; }
.button-primary { background: var(--accent); color: var(--on-accent); }
.button-primary:hover { background: var(--accent-hover); }
.button-secondary { border-color: var(--line); background: var(--surface); color: var(--accent); }
.button-secondary:hover, .button-text:hover { border-color: var(--hero-line); background: var(--accent-soft); }
.button-text { background: transparent; color: var(--accent); }

.frequency { margin-top: 23px; }
.field-label { display: block; margin-bottom: 7px; font-size: 13px; font-weight: 650; }
.segments { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding: 3px; border: 1px solid var(--line); border-radius: var(--r-control); background: var(--surface-soft); }
.segments a {
  display: grid;
  min-height: 44px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: var(--r-inner);
  font-size: 14px;
  font-weight: 620;
  color: var(--muted);
}
.segments a:hover { color: var(--accent); }
.segments a[aria-current] { border-color: var(--hero-line); background: var(--accent-soft); color: var(--accent); }
.mode-description, .download-note { margin-top: 7px; font-size: 12px; color: var(--muted); }
.feed-group { margin-top: 17px; }
.feed-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.feed-input { display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 46px; padding-inline: 11px; border: 1px solid var(--line); border-radius: var(--r-control); background: var(--surface-soft); }
.feed-input:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.feed-input .icon { width: 16px; height: 16px; color: var(--faint); }
.feed-input input { width: 100%; min-width: 0; padding: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font: 400 12px/1.5 var(--font-mono); text-overflow: ellipsis; }

.platforms { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; margin-top: 20px; }
.platform {
  display: flex;
  width: 100%;
  min-width: 0;
  min-height: 58px;
  align-items: center;
  gap: 9px;
  padding: 6px 5px;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.platform:hover { background: var(--surface-soft); }
.platform-name { display: grid; min-width: 0; flex: 1; line-height: 1.28; }
.platform-name strong { font-size: 13px; font-weight: 650; }
.platform-name small { color: var(--muted); font-size: 11px; margin-top: 3px; }
.platform-icon { display: grid; place-items: center; width: 31px; height: 31px; flex: none; border-radius: var(--r-inner); background: var(--surface-soft); color: var(--accent); }
.platform-icon .icon { width: 19px; height: 19px; }
.brand-icon { display: block; object-fit: contain; }
.platform > .icon { width: 14px; height: 14px; color: var(--faint); }

.preview .card-header > .icon { color: var(--accent); margin: 2px 0 0; }
.preview-body { margin-top: 17px; }
.preview-event { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 13px 0; border-top: 1px solid var(--line); }
.preview-event:last-child { border-bottom: 1px solid var(--line); }
.event-date, .event-title { display: grid; gap: 2px; min-width: 0; }
.event-title { justify-items: end; text-align: right; }
.event-date time, .event-title strong { font-size: 14px; font-weight: 660; }
.event-title strong { color: var(--accent); }
.event-date span, .event-title span { color: var(--muted); font-size: 12px; }
.empty-preview { padding: 15px 0; border-block: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.download-link { display: flex; align-items: center; gap: 8px; min-height: 44px; margin-top: 8px; color: var(--accent); font-size: 13px; font-weight: 650; }
.download-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.download-link .icon { width: 17px; height: 17px; }
.download-link .icon:last-child { margin-inline-start: auto; }
.download-note { margin-top: 0; }

.footer { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 2px 16px; margin-top: 17px; padding-bottom: 20px; color: var(--muted); font-size: 12px; }
.footer span:last-child { display: flex; gap: 17px; }
.footer a { display: grid; min-height: 44px; place-items: center; }

dialog {
  position: fixed;
  max-width: min(450px, calc(100% - 32px));
  max-height: min(90dvh, 100% - 32px);
  padding: 21px;
  border: 1px solid var(--line);
  border-radius: var(--r-outer);
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 18px 62px #140d2b35;
}
dialog::backdrop { background: #160d2e78; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.icon-button { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: var(--r-control); background: var(--surface-soft); color: var(--muted); cursor: pointer; }
.icon-button:hover { background: var(--accent-soft); color: var(--accent); }
.dialog-copy { margin-top: 8px; font-size: 14px; color: var(--muted); }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.qr-frame { display: grid; width: fit-content; max-width: 100%; margin: 15px auto; padding: 7px; border: 1px solid var(--line); border-radius: var(--r-control); background: #fff; }
.qr-frame img { display: block; width: min(184px, 100%); height: auto; }
.qr-apple { display: flex; width: 100%; }
.toast:empty { visibility: hidden; }
.toast {
  position: fixed;
  z-index: 1;
  inset: auto auto 24px 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 9px 15px;
  border-radius: var(--r-control);
  background: var(--ink);
  color: var(--surface);
  font-size: 13px;
  pointer-events: none;
}
dialog .toast { position: static; transform: none; margin-top: 12px; }
dialog .toast:empty { position: absolute; }

@media (max-width: 779px) {
  .shell { width: calc(100% - 40px); }
  .hero { gap: 16px; padding: 24px; }
  .content-grid { gap: 14px; }
  .card { padding: 19px; }
}
@media (max-width: 660px) {
  .header-inner { min-height: 61px; }
  .hero { grid-template-columns: minmax(0, 1fr); align-items: start; gap: 17px; margin-top: 20px; padding: 21px; }
  .hero h1 { font-size: clamp(27px, 7.6vw, 36px); }
  .hero-content p { margin-top: 5px; }
  .week-strip { padding: 10px; }
  .content-grid { grid-template-columns: minmax(0, 1fr); margin-top: 14px; }
  .card { padding: 19px; }
  .footer { padding-bottom: 12px; }
}
@media (max-width: 380px) {
  .platforms { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 360px) {
  .shell { width: calc(100% - 28px); }
  .hero, .card { padding: 15px; }
  .card h2 { font-size: 19px; }
  .button { padding-inline: 9px; gap: 5px; }
  .platform { gap: 6px; padding-inline: 2px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
