:root {
  font-family: "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  color: #222;
  background: #fff;
  --paper: #fff;
  --ink: #252525;
  --line: #ddd;
  --mute: #616161;
}
* { box-sizing: border-box; }
body, h1, h2, h3, p, ol { margin: 0; }
button, input, textarea, select { font: inherit; }
button, a { color: inherit; touch-action: manipulation; }
button { cursor: pointer; border: 0; background: none; }
a { text-decoration: none; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid currentColor; outline-offset: 3px;
}
button:active, a.action:active { transform: translateY(1px); }
.icon { width: 1.12em; height: 1.12em; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.paper { width: min(100%, 490px); min-height: 100vh; margin: auto; padding: 22px 4% 36px; }
.intro { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 8px; align-items: center; }
.meta { color: var(--mute); font-size: 1.05rem; line-height: 1.4; }
h1 { grid-column: 1 / -1; font-size: 2.2rem; line-height: 1.18; letter-spacing: -.04em; }
.week { position: sticky; top: 0; z-index: 2; background: white; padding: 5px 0; display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); justify-items: center; margin: 27px -5px 30px; }
.date { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 9px; position: relative; width: min(100%,47px); min-height: 88px; padding: 16px 0 18px; border-radius: 32px; color: #686868; }
.date strong { font: inherit; font-variant-numeric: tabular-nums; }
.date span { font-size: .95rem; }
.date[aria-pressed=true] { color: #fff; background: #292929; }
.date[aria-pressed=true]::after { content: ""; position: absolute; bottom: 13px; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
ol { padding: 0; list-style: none; }
.stop { display: grid; grid-template-columns: 2.6rem minmax(0,1fr); column-gap: 10px; }
.rail { position: relative; text-align: center; }
.rail::before { content: ""; position: absolute; top: 4px; left: 50%; transform: translateX(-50%); width: 13px; height: 13px; border: 1.5px solid #474747; border-radius: 50%; background: #fff; }
.rail.reached::before { background: #292929; }
.rail.current::before { box-shadow: inset 0 0 0 2px #fff, 0 0 0 3px #ddd; }
.rail.current .time { color: #171717; font-weight: 750; }
.rail-track { position: absolute; top: 3.35rem; bottom: 6px; left: 50%; width: 3px; transform: translateX(-50%); border-radius: 4px; background: #dfdfdf; overflow: hidden; }
.stop:last-child .rail-track { display: none; }
.rail-fill { display: block; position: relative; width: 100%; height: calc(var(--elapsed, 0) * 100%); border-radius: inherit; background: #333; }
.rail.current .rail-fill::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(180deg, transparent 30%, #aaa 48%, transparent 65%); background-size: 100% 220%; animation: rail-flow 2.4s linear infinite; }
@keyframes rail-flow { from { background-position: 0 100%; } to { background-position: 0 -100%; } }
@media (prefers-reduced-motion: reduce) { .rail.current .rail-fill::after { animation: none; background: none; } }
.time { display: block; margin-top: 28px; font-size: .9rem; font-weight: 550; color: #545454; font-variant-numeric: tabular-nums; }
.card { position: relative; isolation: isolate; min-width: 0; padding: 4px 18px 14px; margin: 0 0 18px; overflow-wrap: anywhere; }
.card.feature { padding-top: 19px; border-radius: 25px; background: #292929; color: #fff; overflow: hidden; margin-bottom: 29px; }
.feature::before { content: ""; position: absolute; z-index: -1; inset: 0; background: url("assets/contour.png") center right / 82% 88% no-repeat; mask-image: linear-gradient(105deg, transparent 20%, #000 82%); opacity: .83; }
.card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.card-title { min-width: 0; display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 8px; }
.card-edit { flex: none; min-height: 44px; min-width: 44px; margin-block: -6px; padding: 4px; font-size: .94rem; text-decoration: underline; text-underline-offset: 3px; }
#timeline, .card, .card button { scroll-margin-top: 106px; }
.card-title h3 { font-size: 1.5rem; line-height: 1.3; font-weight: 660; letter-spacing: -.025em; }
.card-title span { white-space: nowrap; color: var(--mute); font-size: .94rem; }
.sub { margin-top: 8px; font-size: 1rem; line-height: 1.45; color: #4c4c4c; }
.desc { margin-top: 4px; color: var(--mute); font-size: 1rem; line-height: 1.52; }
.feature .card-title span, .feature .desc { color: #d7d7d7; }
.feature .sub { color: #f4f4f4; }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.action { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid #cecece; border-radius: 10px; min-height: 44px; padding: 8px 12px; font-weight: 580; line-height: 1.3; text-align: center; }
.action.primary { color: #fff; background: var(--ink); border-color: var(--ink); }
.feature .action { border-color: #7f7f7f; color: #fff; }
.feature .primary { border-color: #fff; background: #fff; color: #252525; }
.tools { display: flex; align-items: center; gap: 5px; }
.tools button { min-height: 44px; min-width: 46px; padding: 5px 8px; border-radius: 14px; background: #f2f2f2; font-size: .95rem; font-weight: 550; }
.tools button[aria-pressed=true] { color: #fff; background: var(--ink); }
.sr { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; }
.large { font-size: 19px; }
@media (min-width: 490px) { .paper { padding-inline: 20px; } }
@media (max-width: 360px) { .paper { padding-inline: 10px; } .stop { column-gap: 5px; } .card { padding-inline: 14px; } }

dialog { border: 1px solid var(--line); border-radius: 20px; color: var(--ink); background: #fff; width: min(92vw,490px); max-height: 86dvh; padding: 0; box-shadow: 0 20px 72px #0003; }
dialog::backdrop { background: #0007; }
body:has(dialog[open]) { overflow: hidden; }
.sheet-inner { padding: 22px; }
.sheet-heading, .info { display: flex; align-items: center; gap: 10px; }
.sheet-heading { justify-content: space-between; margin-bottom: 17px; }
.sheet-heading h2 { font-size: 1.5rem; }
.close { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: #eee; }
.info { line-height: 1.5; margin: 8px 0 12px; }
.map-frame { width: 100%; border: 1px solid var(--line); border-radius: 10px; background: #eee; }
.map-frame { height: clamp(270px, 45dvh, 400px); }
.sheet-actions { display: grid; gap: 8px; margin-top: 16px; }
.sheet-note { font-size: 1rem; line-height: 1.6; color: var(--mute); margin: 9px 0; }
.form-grid, .form-grid label { display: grid; gap: 12px; }
.form-grid label { gap: 6px; font-weight: 600; }
.form-grid input, .form-grid textarea, .form-grid select { width: 100%; border: 1px solid #a2a2a2; border-radius: 8px; padding: 10px; background: white; color: var(--ink); font-size: 1rem; }
.category-field { padding-bottom: 14px; border-bottom: 1px solid var(--line); }
@media (max-width: 500px) {
  dialog { width: 100%; max-width: 100%; max-height: 88dvh; margin: auto auto 0; border-radius: 20px 20px 0 0; }
  .sheet-inner { padding: 18px 18px max(20px,env(safe-area-inset-bottom)); }
}

.video-preview { position: relative; isolation: isolate; overflow: hidden; aspect-ratio: 16/9; margin-top: 12px; border-radius: 12px; background: #161616; color: white; }
.video-preview > img, .video-preview > iframe, .video-trigger { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-preview > img { object-fit: cover; }
.video-preview > iframe { pointer-events: none; }
.video-trigger { padding: 0; display: grid; place-items: center; }
.video-trigger:focus-visible { outline-offset: -4px; }
.play-mark { width: 46px; height: 46px; display: grid; place-items: center; padding-left: 3px; background: #171717c9; color: white; border: 1px solid #fffa; border-radius: 50%; }
.video-label { position: absolute; left: 8px; bottom: 8px; padding: 4px 9px; border-radius: 6px; font-size: .9rem; color: white; background: #131313db; }
dialog:has(.video-player) { width: min(96vw, 770px); max-width: 96vw; margin: auto; border-radius: 18px; }
.video-stage {
  position: relative;
  width: min(100%, max(180px, calc((100dvh - 14rem) * 1.77778)));
  margin-inline: auto;
  padding-bottom: 35px;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
}
.video-stage::before { content: ""; display: block; aspect-ratio: 16 / 9; }
.video-player { position: absolute; inset: 0; display: block; width: 100%; height: 100%; border: 0; }
.video-original { display: inline-flex; align-items: center; min-height: 44px; margin-top: 5px; text-decoration: underline; text-underline-offset: 3px; }

.form-grid fieldset { border: 0; padding: 0; margin: 0; min-width: 0; display: grid; gap: 12px; }
.form-grid fieldset[hidden] { display: none; }
.travel-card { align-self: start; padding: 17px; border: 1px solid #ccc; border-radius: 18px; background: white; }
.route { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px; align-items: center; margin-top: 18px; }
.route small { display: block; color: var(--mute); font-size: .9rem; margin-bottom: 3px; }
.route h3 { font-size: 1.22rem; line-height: 1.4; }
.route-arrow { font-size: 1.35rem; }
.departure { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 1em; margin: 12px 0 16px; color: var(--mute); }
.departure strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.deadline { border-radius: 11px; background: var(--ink); color: white; padding: 12px 14px; }
.deadline [data-countdown] > span, .deadline strong { display: block; }
.clock > span { display: inline-block; }
.deadline strong { margin: 4px 0; font-size: 1.6rem; line-height: 1.28; font-variant-numeric: tabular-nums; }
.deadline p { color: #e3e3e3; line-height: 1.5; }

[hidden] { display: none !important; }
.delete-stop { min-height: 46px; border: 1px solid #c7a9a9; border-radius: 10px; color: #942f2f; font-weight: 600; }
.empty-day { padding: 24px 0; text-align: center; color: var(--mute); }
#share-status textarea { display: block; width: 100%; }

.address-field, .address-map, .address-map details[open] { display: grid; gap: 8px; min-width: 0; }
.map-open { justify-self: start; }
.address-map { padding: 10px; border: 1px solid var(--line); border-radius: 10px; }
.map-canvas { height: clamp(220px, 34dvh, 320px); width: 100%; }
.picker-tools { display: flex; flex-wrap: wrap; gap: 6px; }
.address-map [hidden] { display: none; }
.address-map summary { padding-block: 10px; }
.map-results { display: grid; }
.map-results button { text-align: left; padding: 10px 4px; min-height: 44px; border-bottom: 1px solid var(--line); }
.map-status, .date-correction { color: var(--mute); line-height: 1.5; }
.date-correction .action { margin-block: 4px; }
