:root {
  --text: #1d2228;
  --body: #3f4650;
  --muted: #5b6470;
  --faint: #6b747e;
  --card: #f5f6f7;
  --label: 140px;
  --plot: 72px;
  --radius: 20px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: #fff;
  color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
}
main { max-width: 1152px; margin: 0 auto; padding: 32px 16px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
button { font: inherit; color: inherit; }
button:focus-visible { outline: 2px solid #2f6db0; outline-offset: 2px; }


.intro { display: grid; gap: 6px; }
.title { margin: 0 4px; font-size: 32px; font-weight: 800; letter-spacing: -0.01em; }
.lede { margin: 0 4px 16px; max-width: 44em; font-size: 18px; line-height: 1.45; color: var(--body); }
.lede a { color: inherit; text-decoration-color: rgb(63 70 80 / 0.4); text-underline-offset: 3px; }
.lede a:hover { text-decoration-color: currentColor; }


.hero { position: relative; margin: 0; border-radius: var(--radius); overflow: hidden; background: #93b07c; }
#scene { display: block; width: 100%; height: auto; }
#scene .street { font: 600 30px/1 -apple-system, system-ui, sans-serif; fill: #fff; paint-order: stroke; stroke: rgb(0 0 0 / 0.35); stroke-width: 3px; letter-spacing: 0.5px; }
#scene .street-side { font-size: 26px; }
#scene .night, #scene .sky { transition: opacity 1s; }
.caption { margin: -8px 6px 0; font-size: 13px; color: var(--faint); }

.chip {
  --fill: #e6e9ec;
  position: absolute;
  transform: translate(-50%, calc(-100% - 9px));
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 7px 20px 8px;
  border: 2.5px solid #fff;
  border-radius: 13px;
  background: var(--fill);
  color: #4f5862;
  box-shadow: 0 4px 14px rgb(0 0 0 / 0.28);
  white-space: nowrap;
}
.chip::after {
  content: ""; position: absolute; left: 50%; bottom: -8px;
  width: 12px; height: 12px; margin-left: -8px;
  background: var(--fill);
  border-right: 2.5px solid #fff; border-bottom: 2.5px solid #fff;
  border-radius: 0 0 2px 0;
  transform: rotate(45deg);
}
.chip-name { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; line-height: 1.2; }
.chip-state { font-size: 21px; font-weight: 700; line-height: 1.15; color: #2d333a; }
.chip-for { font-size: 12px; font-weight: 600; line-height: 1.2; }
.chip.free { --fill: #6fdc94; color: rgb(10 61 31 / 0.72); }
.chip.free .chip-state { color: #0a3d1f; }
.chip.busy { --fill: #ff958c; color: rgb(92 15 11 / 0.7); }
.chip.busy .chip-state { color: #5c0f0b; }


.day { padding: 10px 24px 20px; border-radius: var(--radius); background: var(--card); }
.day-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.day-head h2 { margin: 0; font-size: 21px; font-weight: 700; }
.day-button {
  display: flex; align-items: center; gap: 8px; min-height: 44px; margin-left: -8px; padding: 0 8px;
  border: 0; border-radius: 10px; background: transparent; font-weight: inherit; cursor: pointer;
}
.day-button:hover { background: rgb(0 0 0 / 0.05); }
.day-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.updated { font-size: 14px; color: var(--faint); }

.rows { position: relative; padding-top: 22px; }
.row { display: grid; grid-template-columns: var(--label) minmax(0, 1fr); align-items: center; padding: 10px 0; }
.row + .row { border-top: 1px solid #e1e4e7; }
.row-name { font-size: 13px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
.plot { position: relative; height: var(--plot); }
.plot svg, .week-plot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.now-label { position: absolute; bottom: calc(100% + 6px); transform: translateX(-50%); font-size: 13px; font-weight: 600; color: var(--muted); }

.axis, .key { display: grid; grid-template-columns: var(--label) minmax(0, 1fr); }
.hours { position: relative; height: 22px; margin-top: 6px; }
.hours span { position: absolute; transform: translateX(-50%); font-size: 13px; color: var(--faint); }
.scrub-line { position: absolute; width: 0; border-left: 1.5px dashed #3f4a55; pointer-events: none; }
.hours .scrub-tip {
  position: absolute; z-index: 1; top: -3px; transform: translateX(-50%);
  padding: 2px 8px; border-radius: 8px; background: #1d2228; color: #fff;
  font-size: 13px; font-weight: 600; white-space: nowrap; pointer-events: none;
}

.key > div { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-top: 12px; font-size: 14px; color: var(--muted); }
.key > div > span { display: flex; align-items: center; gap: 8px; }
.key i { display: inline-block; width: 24px; height: 0; }
.key .seen { border-top: 2.5px solid #3f4a55; }
.key .typical { border-top: 2px dashed #8a949e; }
.key .no-history { color: var(--faint); }


.about { padding: 4px 4px 24px; }
.about h2 { margin: 8px 0 6px; font-size: 17px; }
.about p { margin: 0; max-width: 44em; font-size: 15px; line-height: 1.5; color: var(--body); }
.about .fine { margin-top: 14px; font-size: 13px; color: var(--faint); }
.about .fine + .fine { margin-top: 4px; }
.fine a { color: inherit; text-decoration-color: rgb(63 70 80 / 0.4); text-underline-offset: 3px; }
.fine a:hover { text-decoration-color: currentColor; }


dialog.week {
  width: min(760px, calc(100% - 32px)); max-height: calc(100% - 32px);
  padding: 0; border: 0; border-radius: 20px;
  background: #fff; color: var(--text);
  box-shadow: 0 24px 60px rgb(0 0 0 / 0.3);
}
dialog.week::backdrop { background: rgb(17 20 24 / 0.48); }
.week-sheet { display: flex; flex-direction: column; gap: 16px; padding: 22px 28px 24px; }
.grab { display: none; }
.week-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.week-head h2 { margin: 0; font-size: 22px; }
.week-head p { margin: 2px 0 0; font-size: 14px; color: var(--faint); }
.week-close { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 50%; background: #f1f2f4; cursor: pointer; }
.week-close svg { width: 18px; height: 18px; fill: none; stroke: #3f4650; stroke-width: 2.2; stroke-linecap: round; }

.week { --wk-day: 84px; --wk-court: 72px; }
.week-rows { position: relative; display: flex; flex-direction: column; }
.week-row {
  display: grid; grid-template-columns: var(--wk-day) var(--wk-court) minmax(0, 1fr); align-items: center; row-gap: 4px;
  padding: 8px 0 8px 6px;
  border-top: 1px solid #eceef0;
}
.week-row.today { box-shadow: inset 3px 0 #1d2228; }
.week-day { grid-row: span 2; display: flex; flex-direction: column; font-size: 13px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
.week-row.today .week-day { color: var(--text); }
.week-day small { font-size: 11px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--faint); }
.week-name { font-size: 12px; color: var(--faint); }
.week-plot { position: relative; display: block; height: 28px; }
.week-empty { grid-column: 2 / -1; grid-row: span 2; display: flex; align-items: center; min-height: 60px; font-size: 13px; color: var(--faint); }
.week-axis { display: grid; grid-template-columns: calc(6px + var(--wk-day) + var(--wk-court)) minmax(0, 1fr); border-top: 1px solid #eceef0; }
.week-axis .hours { margin-top: 6px; }
.week-summary { font-size: 14px; color: var(--muted); }

@media (max-width: 700px) {
  :root { --plot: 56px; --radius: 16px; }
  main { padding: 16px; gap: 10px; }
  .title { font-size: 26px; margin: 4px 2px 2px; }
  .lede { margin: 0 2px 16px; font-size: 16px; }
  .caption { margin-top: -4px; font-size: 12px; }
  .chip { padding: 5px 14px 6px; border-width: 2px; border-radius: 10px; transform: translate(-50%, calc(-100% - 7px)); }
  .chip::after { width: 10px; height: 10px; bottom: -7px; margin-left: -7px; border-right-width: 2px; border-bottom-width: 2px; }
  .chip-name { font-size: 10px; }
  .chip-state { font-size: 16px; }
  .chip-for { font-size: 10px; }
  .day { padding: 6px 16px 14px; }
  .day-head h2 { font-size: 18px; }
  .day-button svg { width: 16px; height: 16px; }
  .updated { font-size: 13px; }
  .rows { padding-top: 14px; }
  .row { grid-template-columns: minmax(0, 1fr); gap: 6px; padding: 8px 0 12px; }
  .row-name { font-size: 12px; }
  .now-label { font-size: 12px; bottom: calc(100% + 2px); }
  .axis, .key { grid-template-columns: minmax(0, 1fr); }
  .axis > span:first-child, .key > span:first-child { display: none; }
  .hours span { font-size: 12px; }
  .key > div { font-size: 13px; gap: 6px 16px; margin-top: 10px; }
  .about p { font-size: 14px; }

  dialog.week { width: 100%; max-width: 100%; max-height: 92vh; margin: auto 0 0; border-radius: 20px 20px 0 0; animation: sheet-up 0.25s ease-out; }
  .week-sheet { gap: 14px; padding: 8px 18px calc(24px + env(safe-area-inset-bottom)); }
  .grab { display: block; align-self: center; width: 40px; height: 5px; border-radius: 3px; background: #d5d9dd; }
  .week-head h2 { font-size: 20px; }
  .week-head p { font-size: 13px; }
  .week { --wk-day: 46px; --wk-court: 58px; }
  .week-row { padding: 6px 0 6px 6px; row-gap: 3px; }
  .week-day { font-size: 12px; }
  .week-day small { font-size: 10px; }
  .week-name { font-size: 11px; }
  .week-plot { height: 24px; }
  .hours .scrub-tip { font-size: 12px; }
}
@keyframes sheet-up { from { transform: translateY(100%); } }

@media (prefers-reduced-motion: reduce) {
  #scene .night, #scene .sky { transition: none; }
  dialog.week { animation: none; }
}
