:root {
  --bg: #0f1722; --panel: #16202e; --line: #263447; --text: #e8eef6; --muted: #8fa1b7;
  --open: #19e36b; --closed: #ff3b4e; --pending: #ffb020; --accent: #4db5ff;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overscroll-behavior: none; -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; background: var(--bg); color: var(--text);
  font: 14px/1.45 system-ui, "Segoe UI", sans-serif; }
#app { display: flex; height: 100%; height: 100dvh; }
a { color: var(--accent); }
.muted { color: var(--muted); font-size: 12px; }

#side { width: 340px; flex: none; background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0; }
#side header { padding: 14px 16px 8px; }
h1 { margin: 0 0 2px; font-size: 18px; }
.tabs { margin-bottom: 12px; }
.resort-select { width: 100%; appearance: none; -webkit-appearance: none; cursor: pointer;
  background: #223248 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23e8eef6' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 14px center;
  color: #fff; border: 1px solid #3a5273; border-radius: 10px; padding: 10px 38px 10px 14px; font: inherit; font-size: 16px; font-weight: 600; }
.resort-select option, .resort-select optgroup { background: #16202e; color: #e8eef6; font-weight: 400; }
.diff.Park, .diff.Halfpipe { color: #ff9b3d; }
.diff.BlueBlackSquare { color: #7fb4ff; }
.diff.PurpleStar { color: #c58bff; }
#stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 6px 16px 10px; }
.stat { background: #1c293a; border-radius: 8px; padding: 8px 10px; }
.stat b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 11px; }
.note { margin: 0 16px 10px; padding: 8px 10px; background: #1c293a; border-left: 3px solid var(--accent);
  border-radius: 4px; font-size: 12px; color: #c9d6e6; }
.note.warn { border-left-color: var(--pending); }
#controls, #edit { padding: 0 16px 10px; border-bottom: 1px solid var(--line); }
#edit { padding-top: 10px; font-size: 12px; background: #2a2413; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chip { border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: 999px;
  padding: 4px 10px; font: inherit; font-size: 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.chip.on { background: #223248; color: var(--text); border-color: #3a5273; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.dot.open, .ln.open { background: var(--open); }
.dot.closed, .ln.closed { background: var(--closed); }
.dot.pending, .ln.pending { background: var(--pending); }
#search { width: 100%; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line);
  background: #0f1722; color: var(--text); font: inherit; }

#list { flex: 1; overflow-y: auto; min-height: 0; }
.area h2 { margin: 0; padding: 8px 16px; font-size: 12px; letter-spacing: .04em; color: var(--muted);
  background: #121b28; position: sticky; top: 0; display: flex; justify-content: space-between; cursor: pointer; z-index: 1; }
.area.collapsed .row { display: none; }
.row { display: flex; align-items: center; gap: 8px; padding: 6px 16px; cursor: pointer; border-bottom: 1px solid #1b2636; }
.row:hover, .row.hl { background: #1e2c40; }
.row.sel { background: #25405f; }
.row .nm { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .tag { font-size: 11px; color: var(--muted); flex: none; }
.row.nomap .nm { color: var(--muted); }
.diff { width: 16px; text-align: center; flex: none; font-size: 12px; }
.diff.GreenCircle { color: #3ecf5a; } .diff.BlueSquare { color: #4a9bff; }
.diff.BlackDiamond, .diff.DoubleBlackDiamond { color: #dfe6ee; letter-spacing: -3px; }
.diff.lift { color: #ff8a8a; }
.f .wait { pointer-events: none; }
.f .wait rect { fill: #0c121b; stroke-width: 1.5; }
.f .wait text { fill: #fff; font: 600 11.5px system-ui, "Segoe UI", sans-serif; }
.f .wait.w0 rect { stroke: var(--open); } .f .wait.w1 rect { stroke: var(--pending); } .f .wait.w2 rect { stroke: var(--closed); }
.f.closed .wait, .f.pending .wait { display: none; }
.row .star { flex: none; border: 0; background: transparent; color: #55677f; font-size: 17px; line-height: 1; padding: 2px 0 2px 4px; cursor: pointer; }
.row .star.on { color: #ffd76a; }
.row .star:hover { color: #ffe9a8; }
#alerts { background: var(--panel); color: var(--text); border: 1px solid #3a5273; border-radius: 12px; padding: 18px 20px;
  width: min(440px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow-y: auto; font: inherit; }
#alerts::backdrop { background: rgba(0,0,0,.55); }
#alerts h3 { margin: 0 0 6px; font-size: 17px; } #alerts p { margin: 0 0 8px; }
#alerts ol { margin: 0 0 12px; padding-left: 20px; } #alerts li { margin-bottom: 8px; }
#alerts .trow { display: flex; gap: 6px; margin: 6px 0 4px; }
#a-topic { flex: 1; min-width: 0; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: #0f1722; color: var(--text);
  font: 16px ui-monospace, Consolas, monospace; }
#alerts .note { margin: 0 0 10px; }
#a-list h4 { margin: 10px 0 2px; font-size: 12px; letter-spacing: .04em; color: var(--muted); text-transform: uppercase; }
.arow { display: flex; justify-content: space-between; align-items: center; padding: 3px 0; border-bottom: 1px solid #1b2636; }
.arow button { border: 0; background: transparent; color: var(--muted); font-size: 18px; cursor: pointer; padding: 0 6px; }
.abtns { margin: 14px 0 0; justify-content: flex-end; }
.chip .diff { width: auto; }
#fcount { margin-top: 6px; }
.area.changes h2 { color: #ffe9a8; background: #2a2413; }
.area.changes { border-bottom: 1px solid var(--line); }
.area.collapsed .chinfo { display: none; }
.chinfo { padding: 8px 16px; }
.row.changed .tag { color: #ffd76a; font-weight: 600; }
.row .new { flex: none; font-size: 9.5px; font-weight: 700; letter-spacing: .05em; color: #10161f; background: #ffd76a;
  border-radius: 4px; padding: 1px 5px; }
#tip .chg { margin-top: 3px; color: #ffd76a; }
.f .halo { fill: none; stroke: #fff36b; stroke-width: calc(34px * var(--s, 1)); stroke-linecap: round; stroke-linejoin: round;
  animation: halo 1.6s ease-in-out infinite; pointer-events: none; }
.f .halo.dot { fill: #fff36b; stroke: none; }
@keyframes halo { 0%, 100% { opacity: .15; } 50% { opacity: .8; } }
@media (prefers-reduced-motion: reduce) { .f .halo { animation: none; opacity: .6; } }
.ln.fresh { background: #fff36b; box-shadow: 0 0 6px #fff36b; }
#side footer { padding: 10px 16px; border-top: 1px solid var(--line); }

#stage { flex: 1; position: relative; overflow: hidden; background: #0a1019; touch-action: none; cursor: grab; }
#stage.drag { cursor: grabbing; }
#canvas { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
#map { display: block; user-select: none; -webkit-user-drag: none; }
#map.dim { filter: saturate(.45) brightness(.82); }
#overlay { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }

.f .case { fill: none; stroke: #fff; stroke-linecap: round; stroke-linejoin: round; opacity: .95; }
.f .ink { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.f .hit { fill: none; stroke: transparent; stroke-width: calc(34px * var(--s, 1)); stroke-linecap: round; pointer-events: stroke; cursor: pointer; }
.f.trail .case { stroke-width: calc(15px * var(--s, 1)); } .f.trail .ink { stroke-width: calc(9px * var(--s, 1)); }
.f.lift .case { stroke: #10161f; stroke-width: calc(15px * var(--s, 1)); } .f.lift .ink { stroke-width: calc(8px * var(--s, 1)); stroke-dasharray: calc(20px * var(--s, 1)) calc(12px * var(--s, 1)); stroke-linecap: butt; }
.f .end { stroke: #10161f; stroke-width: calc(4px * var(--s, 1)); }
.f .blob { fill-opacity: .28; stroke: none; pointer-events: all; cursor: pointer; }
.f .pin { stroke: #fff; stroke-width: calc(5px * var(--s, 1)); pointer-events: all; cursor: pointer; }
.f.open .ink { stroke: var(--open); } .f.open .blob, .f.open .pin, .f.open .end { fill: var(--open); }
.f.closed .ink { stroke: var(--closed); } .f.closed .blob, .f.closed .pin, .f.closed .end { fill: var(--closed); }
.f.pending .ink { stroke: var(--pending); } .f.pending .blob, .f.pending .pin, .f.pending .end { fill: var(--pending); }
.f.closed { opacity: .82; }
.f.hl .case, .f.sel .case { stroke: #ffe94d; stroke-width: calc(24px * var(--s, 1)); opacity: 1; }
.f.hl .pin, .f.sel .pin { stroke: #ffe94d; stroke-width: calc(9px * var(--s, 1)); }
.f.hl, .f.sel { opacity: 1; }
.f.hidden { display: none; }
.vert { fill: #ffe94d; stroke: #000; stroke-width: 2; }

#tip { position: absolute; pointer-events: none; background: rgba(12, 18, 27, .95); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; font-size: 12px; max-width: 240px; z-index: 5; box-shadow: 0 6px 20px rgba(0,0,0,.4); }
#tip b { font-size: 14px; display: block; }
#tip .st { font-weight: 600; }
#tip .st.open { color: var(--open); } #tip .st.closed { color: var(--closed); } #tip .st.pending { color: var(--pending); }

#zoom { position: absolute; right: 14px; top: 14px; display: flex; flex-direction: column; gap: 6px; }
#zoom button { width: 38px; height: 38px; border-radius: 8px; border: 1px solid var(--line);
  background: rgba(22, 32, 46, .92); color: var(--text); font-size: 20px; cursor: pointer; }
#mbar, #backdrop, #close-side { display: none; }
#legend { position: absolute; left: 14px; bottom: 14px; background: rgba(22, 32, 46, .92); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 12px; display: flex; gap: 14px; font-size: 12px; flex-wrap: wrap; }
#legend span { display: inline-flex; align-items: center; gap: 6px; }
.ln { width: 22px; height: 5px; border-radius: 3px; display: inline-block; }
.ln.lift { background: repeating-linear-gradient(90deg, #cfd8e3 0 7px, transparent 7px 11px); }

@media (max-width: 760px) {
  /* list becomes a slide-in drawer */
  #side { position: absolute; z-index: 20; height: 100%; width: min(360px, 90vw); transform: translateX(-102%);
    transition: transform .22s ease; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
  #app.side-open #side { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.6); }
  #app.side-open #backdrop { display: block; position: absolute; inset: 0; z-index: 15; background: rgba(0,0,0,.45); }
  #side header { position: relative; padding-right: 52px; }
  #side header .tabs { display: none; }
  #close-side { display: block; position: absolute; right: 8px; top: 8px; width: 40px; height: 40px; border: 0; border-radius: 8px;
    background: transparent; color: var(--muted); font-size: 26px; line-height: 1; cursor: pointer; }
  .row { padding: 11px 16px; }
  .row .star { font-size: 21px; padding: 3px 0 3px 10px; }
  .chip { padding: 7px 12px; font-size: 13px; }
  #search { padding: 10px 12px; font-size: 16px; } /* 16px stops iOS from zooming the page on focus */

  /* top bar over the map: menu button, resort tabs, one-line summary */
  #mbar { display: block; position: absolute; z-index: 6; left: 0; right: 0; top: 0;
    padding: calc(8px + env(safe-area-inset-top)) calc(8px + env(safe-area-inset-right)) 6px calc(8px + env(safe-area-inset-left));
    background: linear-gradient(rgba(10,16,25,.92), rgba(10,16,25,.75) 75%, rgba(10,16,25,0)); }
  .mrow { display: flex; gap: 8px; align-items: stretch; }
  #mbar .tabs { flex: 1; margin: 0; }
  #mbar .resort-select { height: 100%; background-color: rgba(34,50,72,.97); }
  #toggle-side { width: 46px; flex: none; border-radius: 10px; border: 1px solid var(--line);
    background: rgba(22,32,46,.95); color: var(--text); font-size: 20px; cursor: pointer; }
  /* the filters are tall on a phone: scroll the whole drawer instead of squeezing the list */
  #side { overflow-y: auto; -webkit-overflow-scrolling: touch; }
  #side > * { flex: none; }
  #list { overflow: visible; }
  #msum { cursor: pointer; margin-top: 6px; padding: 0 4px 6px; font-size: 12.5px; color: #dbe5f0; text-align: center; font-variant-numeric: tabular-nums;
    text-shadow: 0 1px 3px #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  #zoom { top: auto; right: calc(10px + env(safe-area-inset-right)); bottom: calc(56px + env(safe-area-inset-bottom)); }
  #zoom button { width: 44px; height: 44px; }
  #legend { left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); justify-content: center; gap: 10px;
    padding: 6px 8px; font-size: 11.5px; flex-wrap: nowrap; white-space: nowrap; }
  .ln { width: 14px; }
  #tip { font-size: 13px; max-width: 70vw; }
}

/* single-resort site: title where the resort picker would be */
#side .tabs:has(.resort-title) { display: none; }
.resort-title { height: 100%; display: flex; align-items: center; padding: 10px 14px; border-radius: 10px; border: 1px solid #3a5273;
  background: rgba(34,50,72,.97); color: #fff; font-size: 16px; font-weight: 600; }
