:root { color-scheme: light; }
html, body { margin: 0; background: #eef3fa; }
body { font-family: 'DM Sans', system-ui, sans-serif; padding: 12px; min-height: 100vh; box-sizing: border-box; }
/* Phones: the app fills the screen. Safari paints the status-bar/overscroll area with the page
   background, so the top half of the viewport is brand blue and the bottom half white. */
@media (max-width: 480px) {
  html { background: linear-gradient(to bottom, #004ee8 0 50%, #fff 50% 100%) fixed; }
  body { padding: 0; background: transparent; }
  .sw-blue { padding-top: calc(19px + env(safe-area-inset-top, 0px)); }
  .sw-content { padding-bottom: calc(17px + env(safe-area-inset-bottom, 0px)); }
}

.sw { --sw-accent: #004ee8; --sw-ink: #052255; --sw-sky: #aee9ff; --sw-row: 25px; --sw-gap: 4px; --sw-busy: #dce6f0; --sw-soft: #edf4ff;
  max-width: 460px; margin: 0 auto; color: var(--sw-ink); }
.sw * { box-sizing: border-box; }
.sw button, .sw input, .sw select { font: inherit; }
.sw button { cursor: pointer; }
.sw svg { width: 17px; height: 17px; flex-shrink: 0; }
.sw-app { border: 1px solid #d2dcec; border-radius: 10px; overflow: hidden; background: #fff; }
@media (max-width: 480px) { .sw-app { border: 0; border-radius: 0; } }

/* header */
.sw-blue { background: var(--sw-accent); color: #fff; padding: 19px 24px 16px; }
.sw-brand { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.sw-identity { display: grid; grid-template-columns: 25px auto; column-gap: 7px; align-items: start; min-width: 0; }
.sw-brandmark { width: 25px; height: 25px; }
.sw-wordmark { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.sw-logo { display: block; font-size: 21px; font-weight: 700; letter-spacing: -1px; line-height: 1.2; }
.sw-tagline { font-size: 11px; line-height: 1.2; color: #d5e7ff; }
.sw-intro { padding: 20px 0 19px; position: relative; isolation: isolate; }
.sw h1 { font-family: 'Barlow Condensed', 'Arial Narrow', sans-serif; font-weight: 800; font-size: 63px; line-height: .94; letter-spacing: -1.2px; margin: 0; position: relative; z-index: 1; }
.sw h1 span { color: var(--sw-sky); }
.sw-lapline { position: absolute; right: 10px; bottom: 25px; width: 10px; height: 60px; background: #ffffff26; transform: rotate(18deg); z-index: 0; }
.sw-lapline:before { content: ''; position: absolute; top: 0; left: -17px; width: 44px; height: 10px; background: #ffffff26; }

/* controls */
.sw-controls { color: var(--sw-ink); }
.sw-search { display: flex; align-items: center; gap: 9px; background: #fff; padding: 5px 6px 5px 13px; border: 2px solid #fff; }
.sw-search > svg { color: #526a88; }
.sw-location { width: 100%; min-width: 0; border: 0; background: #fff; color: var(--sw-ink); font-size: 15px; font-weight: 600; padding: 7px 0; outline: none; }
.sw-location::placeholder { color: #8396b3; font-weight: 500; }
.sw-near { border: 0; background: #dceeff; color: #063876; padding: 10px; display: flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.sw-near[aria-pressed="true"] { background: var(--sw-ink); color: #fff; }
.sw-near:disabled { opacity: .6; cursor: progress; }
.sw-datetime { display: grid; grid-template-columns: 1.2fr 1fr; gap: 8px; margin-top: 8px; }
.sw-date-wrap, .sw-time-wrap { display: flex; gap: 8px; align-items: center; min-width: 0; background: #fff; padding: 8px 11px; }
.sw-date-wrap > svg, .sw-time-wrap > svg { color: #526a88; }
.sw-date, .sw-time { min-width: 0; width: 100%; height: 30px; padding: 0; border: 0; color: var(--sw-ink); background: #fff; font-size: 13px; font-weight: 700; appearance: none; -webkit-appearance: none; outline: none; }
.sw-date::-webkit-calendar-picker-indicator { width: 11px; margin: 0; padding: 1px; }
.sw-time-wrap > svg.sw-chevron { width: 12px; }
.sw-feedback { position: absolute; width: 1px; height: 1px; padding: 0 !important; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

/* results */
.sw-content { padding: 22px 24px 17px; }
.sw-results-header { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-bottom: 14px; border-bottom: 2px solid var(--sw-ink); }
.sw h2 { font-size: 12px; letter-spacing: .5px; font-weight: 700; margin: 0; white-space: nowrap; }
.sw-legend { display: flex; gap: 11px; font-size: 11px; color: #465c7b; flex-shrink: 0; }
.sw-legend span { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.sw-legend b { width: 12px; height: 12px; display: grid; place-items: center; font-size: 11px; line-height: 1; }
.sw-key-free { background: var(--sw-accent); color: #fff; }
.sw-key-busy { background: repeating-linear-gradient(135deg, #d4dfed 0 2px, #edf1f7 2px 5px); color: #637592; }

.sw-pool { position: relative; padding: 21px 0 18px; border-bottom: 2px solid #dce5f0; }
.sw-pool:last-child { border-bottom: 0; padding-bottom: 8px; }
.sw-pool-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.sw-pool-head > div { min-width: 0; }
.sw h3 { font-size: 18px; letter-spacing: -.7px; font-weight: 700; margin: 0 0 5px; line-height: 1.2; }
.sw-meta { font-size: 11px; color: #566986; line-height: 1.5; }
.sw-count { display: block; min-width: 0; font-family: 'Barlow Condensed', sans-serif; font-size: 32px; font-weight: 700; line-height: 1; white-space: nowrap; letter-spacing: -.6px; text-align: right; color: var(--sw-accent); }
.sw-count[data-zero="true"] { color: #8396b3; }
.sw-count small { display: block; font-family: 'DM Sans', sans-serif; font-size: 10px; letter-spacing: .4px; font-weight: 600; color: #566986; margin-top: 3px; }

.sw-axis-head { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin: 13px 0 10px; font-size: 11px; color: #536d8c; }
.sw-axis-head span:first-child { font-weight: 600; }
.sw-matrix { display: grid; grid-template-columns: 26px minmax(0, 1fr) 26px; gap: var(--sw-gap); align-items: start; }
.sw-lane-labels, .sw-mstack { display: flex; flex-direction: column; gap: var(--sw-gap); }
.sw-lane-labels > span { height: var(--sw-row); display: flex; align-items: center; font-size: 12px; font-weight: 700; color: #526a88; }
.sw-gutter { display: flex; flex-direction: column; justify-content: flex-end; align-self: stretch; }
.sw-arrow { width: 24px; height: 31px; margin-top: 8px; padding: 0; border: 1.5px solid #c9d6e8; border-radius: 4px; background: #fff; color: var(--sw-ink); display: grid; place-items: center; }
.sw-arrow svg { width: 15px; height: 15px; }
.sw-arrow:hover:not(:disabled) { border-color: var(--sw-ink); }
.sw-arrow:disabled { opacity: .3; cursor: default; }
.sw-lane-labels .sw-arrow { align-self: flex-start; }
.sw-gutter .sw-arrow { align-self: flex-end; }
.sw-scroll { min-width: 0; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; scrollbar-width: none; -ms-overflow-style: none; padding: 4px 0; margin: -4px 0; cursor: grab; }
.sw-scroll::-webkit-scrollbar { display: none; }
.sw-scroll.is-dragging { scroll-snap-type: none; cursor: grabbing; user-select: none; }
.sw-track { display: flex; gap: var(--sw-gap); width: max-content; }
.sw-mcol { flex: 0 0 var(--sw-colw, 40px); min-width: 0; scroll-snap-align: start; }
.sw-mstack { position: relative; }
.sw-mcol[data-selected="true"] .sw-mstack:after { content: ''; position: absolute; inset: -3px 0; border: 2px solid var(--sw-ink); border-radius: 3px; pointer-events: none; z-index: 2; }
.sw-mcell { height: var(--sw-row); width: 100%; min-width: 0; display: grid; place-items: center; border: 0; padding: 0; color: #6b819b; font-size: 12px;
  background: repeating-linear-gradient(135deg, #d7e2ee 0 3px, #e2eaf3 3px 7px); }
.sw-mcell[data-state="free"] { background: var(--sw-accent); color: #fff; }
.sw-mcell[data-state="half"] { background: linear-gradient(90deg, var(--sw-accent) 50%, #e2eaf3 50%); color: #fff; }
.sw-mcell[data-state="half"][data-half="second"] { background: linear-gradient(90deg, #e2eaf3 50%, var(--sw-accent) 50%); }
.sw-mcell[data-state="closed"] { background: #f5f7fa; color: #b3bfd0; }
.sw-mcell[data-state="unknown"] { background: #f0f2f6; color: #b3bfd0; }
.sw-mcell > span { opacity: 0; }
.sw-mcol[data-selected="true"] .sw-mcell > span, .sw-mcell:focus-visible > span { opacity: 1; }
.sw-time-choice { position: relative; display: flex; justify-content: center; align-items: center; flex-direction: column; width: 100%; min-width: 0; height: 31px; margin-top: 8px; border: 0; background: transparent; color: #526a88; font-size: 11px; font-weight: 600; padding: 0; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sw-mcol[data-selected="true"] .sw-time-choice { color: var(--sw-accent); font-weight: 700; }

.sw-notes { margin: 10px 0 0; padding: 0; list-style: none; font-size: 11px; color: #566986; line-height: 1.45; }
.sw-notes li { padding-left: 12px; position: relative; }
.sw-notes li:before { content: '›'; position: absolute; left: 2px; color: var(--sw-accent); }
.sw-status { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 10px; font-size: 11px; color: #61758f; }
.sw-status .sw-dot { width: 7px; height: 7px; border-radius: 50%; background: #1fb26a; display: inline-block; margin-right: 5px; vertical-align: 1px; }
.sw-status[data-status="stale"] .sw-dot { background: #f2a900; }
.sw-status[data-status="error"] .sw-dot, .sw-status[data-status="unpublished"] .sw-dot { background: #e0483e; }
.sw-pool-links { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 5px; }
.sw-live { display: flex; flex-wrap: wrap; gap: 4px 0; font-size: 12px; font-weight: 600; color: #354f71; font-variant-numeric: tabular-nums; }
.sw-live span + span:before { content: '|'; margin: 0 7px; color: #c9d6e8; font-weight: 400; }
.sw-website { display: inline-flex; align-items: center; gap: 5px; color: var(--sw-accent); font-size: 12px; font-weight: 600; line-height: 1.3; text-decoration: none; padding: 5px 0; }
.sw-website:hover { text-decoration: underline; text-underline-offset: 3px; }
.sw-website svg { width: 15px; height: 15px; }
.sw-unavailable { margin-top: 12px; padding: 14px; background: #f5f8fc; border: 1px dashed #c9d6e8; font-size: 12px; color: #4a5f7f; line-height: 1.5; }
.sw-footer { font-size: 11px; letter-spacing: .6px; color: #5e7290; border-top: 2px solid var(--sw-ink); margin-top: 15px; padding-top: 14px; text-align: center; line-height: 1.6; }
.sw-empty { text-align: center; padding: 30px 15px; font-size: 13px; color: #4a5f7f; }

.sw-support { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 0; border-bottom: 2px solid #dce5f0; }
.sw-support p { margin: 0; font-size: 11px; line-height: 1.5; color: #61758f; }
.sw-support strong { display: block; font-size: 12px; font-weight: 500; color: #354f71; }
.sw-coffee { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 10px; border: 1px solid var(--sw-ink); background: var(--sw-ink); color: #fff; border-radius: 4px; font-size: 11px; font-weight: 700; white-space: nowrap; text-decoration: none; }
.sw-coffee svg { width: 14px; height: 14px; }

@media (max-width: 370px) {
  .sw-blue { padding: 17px 17px 15px; } .sw-content { padding: 20px 17px 16px; } .sw h1 { font-size: 56px; }
  .sw-near span { display: none; } .sw h3 { font-size: 16px; } .sw-date { font-size: 12px; }
  .sw-logo { font-size: 18px; } .sw-brandmark { width: 21px; height: 21px; } .sw-identity { grid-template-columns: 21px auto; }
  .sw-results-header h2 { font-size: 11px; letter-spacing: .3px; } .sw-legend { gap: 8px; }
}
@media (pointer: coarse) {
  .sw-location, .sw-date, .sw-time { font-size: 16px; }
  .sw-date-wrap > svg { display: none; }
  .sw { --sw-row: 36px; }
  .sw-time-choice, .sw-website, .sw-coffee, .sw-arrow { min-height: 44px; }
  .sw-scroll { cursor: default; }
}
