/* Soft paper UI over the map, after Meadowvale (meadowvale-city.vercel.app):
   translucent cream cards, thin warm borders, soft shadows, dark ink buttons. */
:root {
  --cream: rgba(248, 243, 231, 0.92);
  --paper: #F8F3E7;
  --paper-2: #EEE5D1;
  --ink: #4A3F35;
  --muted: #8A7A67;
  --saffron: #D9873E;
  --saffron-dark: #A9622A;
  --rani: #C9506A;
  --barn: #D9675F;
  --meadow: #6F9A52;
  --teal: #4F8A88;
  --green: #4A3F35;
  --line: rgba(92, 70, 44, 0.16);
  --display: "Fredoka", "Nunito", ui-rounded, system-ui, sans-serif;
  --body: "Nunito", ui-rounded, system-ui, sans-serif;
  --shadow: 0 8px 24px -10px rgba(80, 58, 28, 0.35);
  --shadow-float: 0 10px 28px -10px rgba(80, 58, 28, 0.4);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #B4D4E0; color: var(--ink); font-family: var(--body); font-size: 14px; }
canvas#map { position: fixed; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; }
canvas#map:active { cursor: grabbing; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:focus-visible { outline: 2px solid var(--barn); outline-offset: 2px; }
code { background: var(--paper-2); padding: 0 6px; border-radius: 6px; font-family: inherit; font-weight: 800; color: var(--ink); }
a { color: var(--barn); font-weight: 800; text-decoration: none; cursor: pointer; }
b, strong { font-weight: 800; }

/* camera feel: tilt-shift blur at the top and bottom, film grain, a soft vignette */
.tilt { position: fixed; left: 0; right: 0; pointer-events: none; z-index: 1; -webkit-backdrop-filter: blur(2.6px) saturate(1.06); backdrop-filter: blur(2.6px) saturate(1.06); }
.tilt.top { top: 0; height: 30%; -webkit-mask-image: linear-gradient(#000 0%, rgba(0,0,0,.55) 45%, transparent 100%); mask-image: linear-gradient(#000 0%, rgba(0,0,0,.55) 45%, transparent 100%); }
.tilt.bot { bottom: 0; height: 28%; -webkit-mask-image: linear-gradient(to top, #000 0%, rgba(0,0,0,.55) 45%, transparent 100%); mask-image: linear-gradient(to top, #000 0%, rgba(0,0,0,.55) 45%, transparent 100%); }
#grain { position: fixed; inset: 0; pointer-events: none; z-index: 2; opacity: .5; mix-blend-mode: multiply; }
#vig { position: fixed; inset: 0; pointer-events: none; z-index: 2; background: radial-gradient(ellipse at 50% 45%, transparent 60%, rgba(90, 70, 40, .16) 100%); }

.panel { background: var(--cream); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-float); }
.muted { color: var(--muted); }
.small { font-size: 13px; line-height: 1.6; }
.pad { padding: 0 14px; }
.x { position: absolute; top: 8px; right: 10px; background: none; border: 0; font-size: 24px; line-height: 1; color: var(--muted); }
.btn { border: 1px solid var(--line); background: rgba(255, 255, 255, .6); color: var(--ink); border-radius: 12px; padding: 8px 14px; font-weight: 800; }
.btn:hover { background: #fff; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--paper); font-weight: 800; box-shadow: none; }
.btn.primary:hover { background: #5A4D41; }
.btn.primary:active { transform: translateY(1px); }
.btn.block { display: block; text-align: center; margin-top: 10px; }

/* loading */
#loading { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center; background: #F2EADC; transition: opacity .6s; }
#loading .logo { font-size: 64px; filter: saturate(.75); }
#loading h1 { margin: 6px 0 2px; font-family: var(--display); font-size: 40px; font-weight: 600; color: var(--ink); }
#loading p { font-weight: 800; color: var(--ink); }
#loading .bar { width: min(400px, 60vw); height: 12px; background: #E2D9C2; border-radius: 99px; overflow: hidden; margin-top: 10px; }
#loading .bar i { display: block; height: 100%; width: 40%; background: #C9B98F; border-radius: 99px; animation: load 1.4s infinite ease-in-out; }
@keyframes load { 0% { margin-left: -40%; } 100% { margin-left: 100%; } }
body.ready #loading { opacity: 0; pointer-events: none; }

/* top */
#topbar { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); padding: 8px 20px 9px; text-align: center; z-index: 5; min-width: 230px; }
#topbar .brand { font-family: var(--display); font-weight: 600; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); line-height: 1.3; }
#topbar .cols { display: flex; align-items: center; gap: 14px; margin-top: 3px; white-space: nowrap; font-variant-numeric: tabular-nums; }
#topbar .col { display: grid; text-align: left; line-height: 1.35; font-size: 13px; font-weight: 800; color: var(--muted); }
#topbar .col .wx, #topbar .col .big { color: var(--ink); }
#topbar .col .big { font-family: var(--display); font-weight: 600; font-size: 17px; }
#topbar .homes b { color: var(--barn); }
#topbar .vr { width: 1px; height: 30px; background: var(--line); }
.pill { position: fixed; z-index: 5; background: var(--cream); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); color: var(--ink); border: 1px solid var(--line); border-radius: 14px; padding: 7px 12px; font-weight: 800; font-size: 13px; box-shadow: var(--shadow); transition: transform .12s, background .12s; }
.pill:hover, .pill:focus-visible { background: var(--paper); transform: translateY(-1px); }
#live-btn { top: auto; bottom: 18px; left: 12px; font-size: 13px; display: flex; align-items: center; gap: 6px; }
#live-btn .chev { color: var(--muted); font-size: 12px; }
#where { top: 12px; left: 12px; font-size: 12px; color: var(--muted); padding: 5px 11px; max-width: 46vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#where span { color: var(--ink); }
#event { position: fixed; top: 92px; left: 50%; transform: translateX(-50%); z-index: 5; display: flex; align-items: center; gap: 12px; padding: 8px 40px 8px 18px; font-weight: 800; font-size: 14px; max-width: calc(100% - 32px); animation: rise .4s ease-out; }
#event[hidden] { display: none; }
#event .btn.primary { padding: 6px 14px; border-radius: 10px; white-space: nowrap; }
#event .x { top: 50%; transform: translateY(-50%); font-size: 20px; }
#event-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@keyframes rise { from { opacity: 0; transform: translate(-50%, -6px); } to { opacity: 1; transform: translate(-50%, 0); } }
.live-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #E8473A; box-shadow: 0 0 0 3px rgba(232, 71, 58, .2); margin-right: 3px; animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.top-right { position: fixed; top: 12px; right: 12px; display: flex; gap: 8px; z-index: 5; }
.top-right .pill { position: static; }
.pill.round { width: 38px; padding: 7px 0; }
#beta-badge { position: fixed; top: 48px; left: 12px; z-index: 4; background: var(--cream); color: var(--muted); font-family: var(--display); font-weight: 600; font-size: 10px; letter-spacing: .16em; padding: 3px 10px; border: 1px solid var(--line); border-radius: 99px; }
#beta-badge.demo::after { content: " · demo data"; font-weight: 500; }

/* search */
#search { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 16px; width: min(560px, calc(100% - 32px)); z-index: 6; background: var(--cream); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-float); }
#search input { flex: 1; border: 0; background: none; outline: none; font-size: 16px; font-weight: 700; min-width: 0; padding: 8px 0; color: var(--ink); }
#search input::placeholder { color: var(--muted); }
#search .btn.primary { border-radius: 12px; padding: 9px 20px; }

/* zoom */
#zoom { position: fixed; right: 12px; bottom: 84px; display: flex; flex-direction: column; gap: 6px; z-index: 5; }
#zoom button { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--cream); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); color: var(--ink); font-size: 18px; font-weight: 800; box-shadow: var(--shadow); }
#zoom button:active { transform: translateY(1px); }
#view { position: fixed; right: 58px; bottom: 84px; display: flex; flex-direction: column; gap: 6px; z-index: 5; }
#view button { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--cream); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); color: var(--ink); font-size: 18px; font-weight: 800; box-shadow: var(--shadow); }
#view button:active { transform: translateY(1px); }
#view button.on { background: var(--ink); color: var(--paper); }
#compass { display: inline-block; font-size: 14px; color: #D9675F; transition: none; }

/* side panels */
.side { position: fixed; top: 84px; left: 12px; width: 320px; max-height: calc(100% - 170px); display: none; flex-direction: column; z-index: 7; padding-bottom: 8px; background: rgba(248, 243, 231, 0.96); }
.side.right { left: auto; right: 12px; }
.side.open { display: flex; }
.panel-head { display: flex; align-items: baseline; gap: 8px; padding: 12px 40px 6px 14px; font-family: var(--display); font-weight: 600; font-size: 18px; }
.panel-head .muted { font-family: var(--body); font-weight: 700; font-size: 13px; }
#f-q { margin: 4px 12px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, .7); outline: none; font-weight: 700; }
.filters { display: flex; gap: 6px; margin: 4px 12px; }
.filters select { flex: 1; min-width: 0; padding: 6px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, .7); font-size: 13px; font-weight: 700; }
#list { overflow-y: auto; margin-top: 6px; flex: 1; }
.item { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; border: 0; border-top: 1px solid var(--line); background: none; padding: 7px 14px; font-weight: 700; }
.item:hover { background: var(--paper-2); }
.item small { display: block; color: var(--muted); font-size: 12px; line-height: 1.2; }
.dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.pager { display: flex; justify-content: center; align-items: center; gap: 14px; padding-top: 6px; font-size: 13px; font-weight: 700; }
.pager button { border: 1px solid var(--line); background: rgba(255, 255, 255, .7); border-radius: 8px; width: 32px; }
.war-row { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; border-top: 1px solid var(--line); background: none; padding: 8px 14px; text-align: left; }
.war-row:hover { background: var(--paper-2); }
.rank { width: 22px; text-align: center; font-weight: 800; }
.war-name { flex: 1; position: relative; font-weight: 800; }
.war-name i { position: absolute; left: 0; bottom: -3px; height: 4px; background: var(--meadow); border-radius: 4px; }

/* card */
.card { position: fixed; top: 84px; right: 12px; width: 360px; max-height: calc(100% - 170px); overflow-y: auto; padding: 16px 18px 18px; z-index: 8; display: none; background: rgba(248, 243, 231, 0.97); }
.card.open { display: block; }
.who { position: relative; display: flex; gap: 12px; align-items: center; margin-right: 26px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.avatar { width: 56px; height: 56px; border-radius: 14px; color: #fff; display: flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 600; font-size: 24px; flex: none; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .12); }
.eyebrow { font-size: 11px; letter-spacing: .08em; font-weight: 800; color: var(--muted); text-transform: uppercase; line-height: 1.3; }
.handle { font-family: var(--display); font-weight: 600; font-size: 21px; overflow-wrap: anywhere; line-height: 1.15; }
.status { color: var(--barn); font-weight: 800; font-size: 14px; }
.stamp { position: absolute; right: -20px; bottom: -13px; border: 2px solid var(--barn); color: var(--barn); border-radius: 6px; padding: 0 8px; font-size: 12px; font-weight: 800; letter-spacing: 1.5px; text-transform: uppercase; transform: rotate(-7deg); opacity: .8; background: rgba(248, 243, 231, .8); }
.title { font-family: var(--display); font-weight: 600; font-size: 19px; margin-right: 24px; line-height: 1.3; }
.rows { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 14px 0 4px; }
.row { display: flex; flex-direction: column; min-width: 0; padding: 7px 10px; background: rgba(255, 255, 255, .55); border: 1px solid var(--line); border-radius: 10px; font-size: 14px; }
.row span { color: var(--muted); font-size: 12px; font-weight: 700; line-height: 1.3; }
.row b { font-weight: 800; line-height: 1.35; }
.row .line-chip { color: #fff; font-size: 12px; }
.good { color: var(--meadow); }
.sub { margin-top: 14px; font-weight: 800; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { border: 1px solid var(--line); background: rgba(255, 255, 255, .6); border-radius: 99px; padding: 3px 10px; font-size: 13px; font-weight: 700; color: var(--ink); }
.actions { display: flex; gap: 8px; margin-top: 14px; }
.actions .btn { flex: 1; }
.note { background: rgba(255, 255, 255, .55); border: 1px dashed rgba(92, 70, 44, .3); border-radius: 12px; padding: 8px 10px; font-size: 13px; margin-top: 10px; }
.tolet-head { display: inline-block; background: var(--barn); color: #fff; font-weight: 800; padding: 2px 12px; border-radius: 8px; margin-bottom: 6px; }
.card ul { padding-left: 18px; font-size: 14px; }
.card p { font-size: 14px; }
.bar { height: 6px; background: var(--paper-2); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.bar i { display: block; height: 100%; background: var(--meadow); border-radius: 99px; }

/* help */
#help { position: fixed; inset: 0; background: rgba(74, 63, 53, 0.35); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); display: none; align-items: center; justify-content: center; z-index: 20; padding: 16px; }
#help.open { display: flex; }
.modal { position: relative; max-width: 480px; width: 100%; max-height: 90%; overflow-y: auto; padding: 20px 22px; background: rgba(248, 243, 231, 0.98); }
.modal h2 { margin: 0 24px 8px 0; font-family: var(--display); font-weight: 600; font-size: 22px; color: var(--ink); line-height: 1.3; }
.modal h3 { margin: 14px 0 2px; font-size: 16px; font-weight: 800; }
.modal ol { padding-left: 20px; margin: 0; }
.modal li { margin: 4px 0; }

/* right-side note */
.card .actions { flex-wrap: wrap; }
.card .actions .btn { flex: 1 1 40%; text-align: center; }
.follow-line { display: block; text-align: center; margin-top: 12px; font-size: 13px; }
.card .handle small { font-family: var(--body); font-size: 13px; font-weight: 700; }
.card .lines { margin: 8px 0 2px; }
.card .row b { word-break: break-word; }
.card .row a { cursor: pointer; }
.perks { margin: 4px 0 0; padding-left: 18px; font-size: 14px; }

/* metro + tour lists */
.line-head { display: flex; align-items: center; gap: 8px; padding: 8px 14px 4px; font-weight: 800; border-top: 1px solid var(--line); }
.line-head i { width: 26px; height: 6px; border-radius: 4px; }
.stop { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 4px 14px 4px 22px; text-align: left; font-weight: 700; font-size: 14px; }
.stop:hover, .tour-row:hover { background: var(--paper-2); }
.stop .dots { display: flex; gap: 3px; }
.stop .dots b { width: 10px; height: 10px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.12); }
.tour-row { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; border-top: 1px solid var(--line); background: none; padding: 8px 14px; text-align: left; font-weight: 700; }
.tour-row .num { width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: var(--paper); font-weight: 800; display: flex; align-items: center; justify-content: center; flex: none; }
.tour-row small { display: block; color: var(--muted); font-size: 12px; line-height: 1.2; }
.line-chip { display: inline-block; color: #fff; font-weight: 800; font-size: 12px; padding: 2px 10px; border-radius: 99px; margin: 2px 4px 2px 0; }

/* join */
.cta { position: fixed; bottom: 86px; left: 50%; transform: translateX(-50%); z-index: 6; border: 0; background: var(--barn); color: #fff; font-family: var(--display); font-weight: 600; font-size: 18px; padding: 10px 26px; border-radius: 16px; box-shadow: 0 10px 24px -8px rgba(160, 70, 60, .55); white-space: nowrap; animation: nudge 2.6s infinite; }
.cta:hover { background: #CF5B53; }
.cta:active { transform: translateX(-50%) translateY(1px); }
@keyframes nudge { 0%, 85%, 100% { transform: translateX(-50%) scale(1); } 92% { transform: translateX(-50%) scale(1.04); } }
.join-hero { font-size: 46px; text-align: center; line-height: 1; filter: saturate(.8); }
.modal h2 { text-align: center; margin-right: 0; }
.modal > .muted { text-align: center; margin-top: 0; }
.free { background: rgba(217, 103, 95, .12); color: var(--barn); padding: 0 8px; border-radius: 8px; white-space: nowrap; }
.steps { display: grid; gap: 10px; margin: 14px 0; }
.step { display: flex; gap: 10px; align-items: flex-start; background: rgba(255, 255, 255, .55); border: 1px solid var(--line); border-radius: 12px; padding: 10px; font-size: 14px; line-height: 1.4; }
.step > span { flex: none; min-width: 32px; height: 32px; padding: 0 4px; border-radius: 10px; background: var(--ink); color: var(--paper); font-weight: 800; font-size: 15px; display: flex; align-items: center; justify-content: center; }
.btn.big { font-size: 17px; padding: 11px; }
details { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 8px; }
summary { font-weight: 800; cursor: pointer; }
.plot-head { display: inline-block; background: var(--paper-2); color: var(--ink); font-weight: 800; padding: 2px 12px; border-radius: 8px; border: 1px dashed rgba(92, 70, 44, .35); margin-bottom: 6px; }

#toast { position: fixed; bottom: 140px; left: 50%; transform: translate(-50%, 20px); background: var(--ink); color: var(--paper); padding: 8px 16px; border-radius: 12px; font-weight: 700; opacity: 0; transition: .25s; z-index: 30; pointer-events: none; max-width: calc(100% - 32px); text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* phone */
@media (max-width: 720px) {
  #topbar { top: 58px; padding: 5px 14px 6px; min-width: 0; }
  #topbar .col .big { font-size: 15px; }
  #event { top: 132px; font-size: 13px; }
  #live-btn { bottom: 140px; }
  #where { max-width: 40vw; }
  #topbar .stats { font-size: 12px; gap: 8px; }
  #beta-badge { top: 48px; }
  .side, .card { top: auto; bottom: 0; left: 0; right: 0; width: 100%; max-height: 66%; border-radius: 20px 20px 0 0; border-bottom: 0; }
  .side { padding-bottom: 14px; }
  .card { padding-bottom: 24px; }
  #zoom { bottom: 80px; }
  #view { bottom: 80px; }
  .side.right { left: 0; right: 0; }
  .pill .lbl { display: none; }
  .top-right { gap: 6px; }
  .top-right .pill { padding: 7px 10px; }
  .tilt.top { height: 18%; }
  .tilt.bot { height: 16%; }
}
@media (prefers-reduced-motion: reduce) { .cta { animation: none; } }

/* ?reel: only the map (and its film look) for screen-recording reels */
body.reel > :not(#map):not(.tilt):not(#grain):not(#vig) { display: none !important; }
