/* Window Seat – user-facing app. Light, rounded, one orange accent. Technical view lives in lab.html / css/lab.css. */
:root {
  --bg: #F4F1EC; --card: #FFFFFF; --ink: #1B1D22; --muted: #6E6A64; --line: #E6E1DA;
  --orange: #FF6A1A; --orange-ink: #B84300;
  --sky: #BFDDF6; --sky-line: #7FB2DE; --seat: #EFECE7; --seat-wall: #D8D3CC;
  --shade: #F3EDE6; --shade-grip: #D3C7BA;
  --rowh: 40px;
  font-family: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 16px; line-height: 1.4; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- Seat map screen ---------- */
.map-screen { max-width: 420px; margin: 0 auto; padding: 20px 16px 48px; }
.eyebrow { margin: 0 0 6px; font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--orange-ink); }
h1 { margin: 0; font-size: 30px; line-height: 1.1; letter-spacing: -.02em; }
.sub { margin: 4px 0 0; color: var(--muted); font-size: 16px; }
.flight { margin: 14px 0 0; padding: 10px 14px; background: var(--card); border-radius: 16px; font-size: 13px; color: var(--muted); }
.verdict { margin: 8px 0 0; padding: 12px 14px; background: var(--card); border-radius: 16px; font-size: 14px; line-height: 1.45; color: var(--ink); }
.verdict b { font-weight: 650; }
.verdict .other { display: block; margin-top: 4px; font-size: 13px; color: var(--muted); }
.verdict .more { display: inline-block; margin-top: 8px; font-size: 13px; font-weight: 650; color: var(--orange-ink); text-decoration: none; }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 16px 0 0; padding: 0; font-size: 12.5px; color: var(--muted); }
.legend li { display: flex; align-items: center; gap: 6px; }
.sw { width: 15px; height: 15px; border-radius: 5px; display: inline-block; background: var(--seat); }
.sw.aligned { background: var(--sky); }
.sw.partial { background: linear-gradient(to bottom, var(--sky) 50%, var(--seat-wall) 50%); }
.sw.wall { background: var(--seat-wall); }
.sw.pn { width: 7px; height: 15px; border-radius: 4px; background: #9CCBF1; border: 1px solid var(--sky-line); }
.estimated { margin: 10px 0 18px; font-size: 12.5px; color: var(--muted); }
.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; background: #FFE7D8; color: var(--orange-ink); font-weight: 700; font-size: 11px; letter-spacing: .03em; text-transform: uppercase; }

.plane { width: min(100%, 344px); margin: 0 auto; padding: 0 10px 8px; background: var(--card); border-radius: 172px 172px 44px 44px / 210px 210px 44px 44px; box-shadow: 0 1px 0 #fff inset, 0 10px 30px rgba(60, 45, 25, .08); }
.nose { height: 118px; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 14px; }
.nose span { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: #A29C93; }
.cols, .row { display: grid; grid-template-columns: 14px repeat(3, minmax(0, 1fr)) 30px repeat(3, minmax(0, 1fr)) 14px; column-gap: 5px; align-items: center; }
.cols { position: sticky; top: 0; z-index: 3; padding: 6px 0; background: rgba(255, 255, 255, .92); backdrop-filter: blur(6px); font-size: 11px; font-weight: 700; color: #A29C93; text-align: center; }
.rows { position: relative; }
.row { height: var(--rowh); }
.rn { text-align: center; font-size: 11px; color: #A29C93; font-variant-numeric: tabular-nums; line-height: 1; }
.rn small { display: block; font-size: 7.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--orange-ink); margin-top: 1px; }
.seat { position: relative; height: 32px; border: 0; border-radius: 10px 10px 7px 7px; background: var(--seat); cursor: pointer; padding: 0; transition: transform .15s ease, box-shadow .15s ease; -webkit-tap-highlight-color: transparent; }
.seat.nowin { cursor: default; }
.seat.win.aligned { background: var(--sky); }
.seat.win.partial.ahead { background: linear-gradient(to bottom, var(--sky) 50%, var(--seat-wall) 50%); }
.seat.win.partial.behind { background: linear-gradient(to top, var(--sky) 50%, var(--seat-wall) 50%); }
.seat.win.wall { background: var(--seat-wall); }
.seat.win:hover { transform: scale(1.08); box-shadow: 0 3px 10px rgba(60, 45, 25, .18); }
.seat.win:active { transform: scale(.94); }
.seat.selected, .seat.kept { background: var(--orange) !important; box-shadow: 0 4px 12px rgba(255, 106, 26, .4); }
.seat.kept::after { content: "✓"; color: #fff; font-weight: 800; font-size: 15px; }
.strip { position: absolute; top: 0; bottom: 0; width: 7px; pointer-events: none; }
.strip.left { left: 3px; } .strip.right { right: 3px; }
.strip .pane { position: absolute; left: 0; width: 7px; height: 16px; border-radius: 4px; background: #9CCBF1; border: 1px solid var(--sky-line); top: calc((var(--u) + .5) * var(--rowh) - 8px); }
.tail { height: 20px; }
.foot { margin: 18px 4px 0; font-size: 12px; color: var(--muted); text-align: center; }
.foot a { color: inherit; }
.toast { position: fixed; left: 50%; bottom: 22px; z-index: 15; width: max-content; text-align: center; transform: translate(-50%, 30px); max-width: min(92vw, 380px); padding: 12px 18px; border-radius: 18px; background: var(--ink); color: #fff; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Window view screen ---------- */
.view-screen { position: fixed; inset: 0; z-index: 20; display: none; background: var(--bg); padding: 10px 16px calc(14px + env(safe-area-inset-bottom)); overflow-y: auto; --ox: 50%; --oy: 50%; }
.app[data-screen="view"] .view-screen { display: flex; }
.view-empty { display: none; }
.view { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 460px; margin: 0 auto; min-height: 100%; }
.view-head { display: flex; align-items: center; gap: 12px; min-height: 48px; }
.back { flex: none; width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--card); display: grid; place-items: center; cursor: pointer; box-shadow: 0 2px 8px rgba(60, 45, 25, .08); }
.view-head h2 { margin: 0; font-size: 18px; letter-spacing: -.01em; }
.view-head p { margin: 0; font-size: 13px; color: var(--muted); }

.stage { position: relative; flex: 1 1 0; min-height: 250px; border-radius: 30px; overflow: hidden; background: #D9DEE6; touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab;
  --cm: 8px; --lx: 0; --ly: 0; --shade: 0; --night: 0; --dark: 0; --warm: 0; }
.cabin-wall { position: absolute; inset: -14px; transform: translate(calc(var(--lx) * -11px), calc(var(--ly) * -6px)); transition: transform .22s ease-out; }
.panel { position: absolute; inset: 0; }
.panel svg, .panel img { width: 100%; height: 100%; display: block; object-fit: cover; }
.panel::after, .frame::before { content: ""; position: absolute; inset: 0; background: rgb(18 24 52 / calc(var(--night) * .5)); transition: background .4s; pointer-events: none; border-radius: inherit; }
.porthole { position: absolute; left: calc(50% + var(--dx) * var(--cm)); top: 50%; width: calc(31 * var(--cm)); height: calc(42 * var(--cm)); transform: translate(-50%, -51%); }
.frame { position: relative; width: 100%; height: 100%; padding: calc(4 * var(--cm)); border-radius: 44% / 33%; background: linear-gradient(160deg, #F7F9FB, #DDE2EA 70%, #CDD4DE); box-shadow: 0 2px 0 rgba(255, 255, 255, .9) inset, 0 -4px 10px rgba(60, 70, 90, .12) inset, 0 10px 26px rgba(40, 50, 70, .22), 0 0 0 1px rgba(120, 130, 150, .18); }
.opening { position: relative; width: 100%; height: 100%; border-radius: 42% / 29%; overflow: hidden; background: #1a2030; isolation: isolate; }
.scene { position: absolute; left: -24%; top: -13%; width: 148%; height: 126%; opacity: 0; transition: opacity .7s ease, transform .22s ease-out; transform: translate(calc(var(--wsx, 0%) + var(--lx) * -9%), calc(var(--ly) * -5%)); }
.scene.on { opacity: 1; }
.scene svg, .scene img { width: 100%; height: 100%; display: block; object-fit: cover; }
.tint { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(rgb(255 150 60 / var(--warm)), rgb(255 190 120 / calc(var(--warm) * .5))); mix-blend-mode: soft-light; transition: background .4s; }
.tint::after { content: ""; position: absolute; inset: 0; background: rgb(8 12 36 / var(--dark)); transition: background .4s; }
.glass { position: absolute; inset: 0; pointer-events: none; border-radius: inherit; background: linear-gradient(118deg, rgba(255, 255, 255, .2) 0 14%, rgba(255, 255, 255, 0) 30%); box-shadow: inset 0 0 0 calc(.55 * var(--cm)) rgba(28, 34, 50, .55), inset 0 10px 22px rgba(0, 0, 0, .28); z-index: 3; }
.shade { position: absolute; left: 0; right: 0; top: 0; height: calc(6% + var(--shade) * 94%); background: linear-gradient(var(--shade-bg, #F3EDE6), #EDE5DC); box-shadow: 0 6px 16px rgba(0, 0, 0, .28); z-index: 2; cursor: ns-resize; }
.stage:not(.dragging-shade) .shade { transition: height .18s ease-out; }
.grip { position: absolute; left: 50%; bottom: max(5px, calc(.6 * var(--cm))); width: 36%; height: max(6px, calc(.8 * var(--cm))); transform: translateX(-50%); border-radius: 99px; background: var(--shade-grip); box-shadow: 0 1px 0 rgba(255, 255, 255, .8); }
.grip:focus-visible { outline: 3px solid var(--orange); outline-offset: 3px; }
.stage[data-category="wall"] .shade { display: none; }
.chip { position: absolute; left: 12px; top: 12px; margin: 0; padding: 5px 11px; border-radius: 999px; background: rgba(255, 255, 255, .88); backdrop-filter: blur(8px); font-size: 12px; color: var(--muted); z-index: 5; pointer-events: none; }
.chip b { color: var(--orange-ink); }
.caption { position: absolute; left: 12px; right: 12px; bottom: 12px; margin: 0; padding: 10px 14px; border-radius: 16px; background: rgba(27, 29, 34, .84); color: #fff; font-size: 13.5px; line-height: 1.35; z-index: 5; pointer-events: none; }

.card { background: var(--card); border-radius: 30px; padding: 18px 20px 14px; box-shadow: 0 10px 30px rgba(60, 45, 25, .07); }
.now { display: flex; align-items: baseline; gap: 10px; }
.time { margin: 0; font-size: 36px; font-weight: 750; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.phase { margin: 0; font-size: 13px; font-weight: 700; color: var(--orange-ink); }
.headline { margin: 10px 0 2px; font-size: 20px; line-height: 1.2; letter-spacing: -.01em; }
.detail { margin: 0; font-size: 14px; color: var(--muted); min-height: 2.8em; }

.timeline { margin-top: 8px; }
#slider { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 28px; margin: 0; background: transparent; cursor: pointer; --p: 0; }
#slider::-webkit-slider-runnable-track { height: 6px; border-radius: 99px; background: linear-gradient(to right, var(--ink) calc(14px + (100% - 28px) * var(--p)), var(--line) 0); }
#slider::-moz-range-track { height: 6px; border-radius: 99px; background: linear-gradient(to right, var(--ink) calc(14px + (100% - 28px) * var(--p)), var(--line) 0); }
#slider::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 28px; margin-top: -11px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 0 0 2px var(--ink) inset, 0 3px 8px rgba(0, 0, 0, .25); }
#slider::-moz-range-thumb { width: 28px; height: 28px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 0 0 2px var(--ink) inset, 0 3px 8px rgba(0, 0, 0, .25); }
#slider:focus-visible { outline: none; }
#slider:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px var(--orange) inset, 0 0 0 4px rgba(255, 106, 26, .3); }
#slider:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 3px var(--orange) inset, 0 0 0 4px rgba(255, 106, 26, .3); }
.ticks { position: relative; height: 26px; margin: 0 14px; }
.tick { position: absolute; left: calc(100% * var(--p)); top: 0; transform: translateX(var(--tx, -50%)); padding: 8px 2px 2px; border: 0; background: none; font-size: 11px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tick::before { content: ""; position: absolute; top: 0; left: calc(var(--tx, -50%) * -1); width: 2px; height: 6px; margin-left: -1px; border-radius: 1px; background: #B9B2A8; }
.tick:hover { color: var(--ink); }
.ends { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; font-weight: 650; font-variant-numeric: tabular-nums; }
.route-note { font-weight: 400; font-size: 11px; color: #A29C93; }

.keep { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; height: 56px; margin-top: 14px; border: 0; border-radius: 999px; background: var(--ink); color: #fff; font-size: 17px; font-weight: 650; cursor: pointer; transition: background .25s ease; -webkit-tap-highlight-color: transparent; }
.keep .price { opacity: .65; font-weight: 500; }
.keep.is-kept { background: var(--orange); }
.keep:active { transform: scale(.96); }
.keep.spring { animation: spring .45s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes spring { from { transform: scale(.96); } to { transform: scale(1); } }
.keep:focus-visible { outline-color: var(--orange); }

.report { margin-top: 10px; font-size: 13px; color: var(--muted); text-align: center; }
.report summary { cursor: pointer; padding: 4px; text-decoration: underline; text-decoration-color: #CFC8BE; text-underline-offset: 3px; list-style: none; }
.report summary::-webkit-details-marker { display: none; }
.report-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 8px; }
.report-btns button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 8px 12px; font-size: 13px; cursor: pointer; }
.report-btns button:hover { border-color: var(--ink); }
.report-msg { margin: 8px 0 0; font-size: 12px; }

/* "Into the seat": the view grows out of the tapped seat. */
.view-screen.entering { animation: into .6s cubic-bezier(.2, .8, .2, 1) both; }
.view-screen.entering .stage { animation: settle .7s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes into { from { clip-path: circle(0 at var(--ox) var(--oy)); } to { clip-path: circle(150% at var(--ox) var(--oy)); } }
@keyframes settle { from { transform: scale(1.12); } to { transform: scale(1); } }


/* ---------- Live window view (engine canvas) ---------- */
.live, .mirror { position: absolute; left: -12%; top: -8%; width: 124%; height: 116%; display: block; transition: filter .45s ease, transform .6s ease; }
.live canvas { width: 100%; height: 100%; display: block; object-fit: cover; }
.mirror { object-fit: cover; }
.stage.blurring .live, .stage.blurring .mirror { filter: blur(16px) brightness(1.06) saturate(1.1); transform: scale(1.08); }
.stage.loading .live::after { content: ""; position: absolute; inset: 0; background: linear-gradient(#9EC5E8, #DCE9F3 55%, #C9C3B5); }

/* ---------- Highlight stages ---------- */
.stages-nav { display: grid; grid-template-columns: 36px minmax(0, 1fr) 36px; align-items: center; gap: 6px; margin-top: 12px; }
.stages-nav .nav { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: #fff; font-size: 20px; line-height: 1; cursor: pointer; color: var(--ink); }
.stages-nav .nav:disabled { opacity: .35; cursor: default; }
.stages { list-style: none; margin: 0; padding: 2px; display: flex; gap: 6px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.stages::-webkit-scrollbar { display: none; }
.stages button { scroll-snap-align: center; display: grid; gap: 1px; min-width: 92px; max-width: 150px; padding: 7px 11px; border-radius: 16px; border: 1px solid var(--line); background: #fff; text-align: left; cursor: pointer; color: var(--ink); }
.stages button b { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 650; }
.stages button span { font-size: 13px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stages button[aria-current="step"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.stages button[aria-current="step"] b { color: rgba(255, 255, 255, .7); }
.between { margin: 8px 2px 0; font-size: 12.5px; color: var(--muted); min-height: 1.3em; }

/* ---------- Into the seat: the map zooms into the tapped seat, then the window opens ---------- */
.map-screen.zooming { overflow: clip; }
.app[data-screen="view"] .map-screen.zooming .plane { animation: none; visibility: hidden; }
.map-screen.zooming .plane { transform-origin: var(--zx, 50%) var(--zy, 50%); animation: zoomseat .42s cubic-bezier(.5, 0, .75, 0) forwards; }
@keyframes zoomseat { to { transform: scale(5); opacity: 0; filter: blur(3px); } }
@media (prefers-reduced-motion: reduce) {
  .map-screen.zooming .plane { animation: none; }
  .live, .mirror { transition: opacity .2s ease; }
  .stage.blurring .live, .stage.blurring .mirror { filter: none; transform: none; opacity: .4; }
}

/* ---------- Wide screens: seat map and window view side by side ---------- */
@media (min-width: 900px) {
  .app { display: grid; grid-template-columns: minmax(360px, 420px) 440px; justify-content: center; align-items: start; gap: 56px; padding: 28px 32px; }
  .map-screen { margin: 0; padding: 12px 0 48px; width: 100%; }
  .view-screen, .app[data-screen="view"] .view-screen { position: sticky; top: 24px; inset: auto; top: 24px; display: flex; height: min(900px, calc(100vh - 48px)); padding: 16px; border-radius: 46px; background: #FBF9F6; box-shadow: 0 0 0 1px var(--line), 0 30px 70px rgba(60, 45, 25, .14); overflow: hidden auto; }
  .view { min-height: 100%; }
  .back { display: none; }
  .view-head { padding-left: 8px; }
  .view-empty:not([hidden]) { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; width: 100%; text-align: center; color: var(--muted); font-size: 18px; font-weight: 650; }
  .view-empty small { font-weight: 400; font-size: 14px; }
  .empty-window { width: 150px; height: 204px; padding: 20px; border-radius: 44% / 33%; background: linear-gradient(160deg, #F7F9FB, #DDE2EA); box-shadow: 0 10px 26px rgba(40, 50, 70, .16), 0 0 0 1px rgba(120, 130, 150, .18); }
  .empty-window span { display: block; width: 100%; height: 100%; border-radius: 42% / 29%; background: linear-gradient(#8FC4EE, #DCEDF8 60%, #F7E6CF); box-shadow: inset 0 0 0 4px rgba(28, 34, 50, .5); }
  .toast { left: calc(50% - 248px); }
}
@media (max-height: 700px) and (max-width: 899px) {
  .time { font-size: 30px; } .headline { font-size: 18px; margin-top: 6px; } .keep { height: 50px; margin-top: 10px; } .card { padding: 14px 18px 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .view-screen.entering, .view-screen.entering .stage, .keep.spring { animation: none; }
  .cabin-wall, .scene, .shade, .seat { transition: none !important; }
}

/* Link to "Did you see it?" (report.html) under the view card */
.seen-link { display: block; text-align: center; margin-top: 12px; font-size: 14px; font-weight: 650; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
/* Share button (window view, Which side?): quiet, pill-shaped. */
.share-btn { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); color: var(--ink); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.share-btn:hover { border-color: var(--muted); }
.share-btn:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }
