/* theCougs.com: Go Cougs map
   TheCougs design system (design/tokens.json): cream ground, WSU crimson and gray,
   near-black keylines. Ultra for headlines (24px and up), Source Sans 3 for the rest.
   No wheat or yellow anywhere. "Sticker" style (3px keyline + hard shadow) is only
   for the Go Cougs! button and featured cards. */

:root {
  --cream: #f8f4e8;
  --white: #ffffff;
  --ink: #1c1c1c;
  --muted: #4d4d4d;
  --crimson: #a60f2d;
  --red: #ca1237;              /* crimson hover */
  --line: #b3b3b3;             /* card edges */
  --control: #808080;          /* input + control borders */
  --dark-muted: #d1d1d1;       /* muted text on dark panels */
  --land: #fbf8f0;
  --water: #ebe3cf;

  --display: Ultra, "Rockwell Extra Bold", Georgia, serif;
  --sans: "Source Sans 3", "Helvetica Neue", Arial, sans-serif;

  --r-sm: 4px; --r-md: 10px; --r-lg: 20px; --r-pill: 999px;
  --keyline: #4d4d4d;          /* Black 70%: sticker outlines, clusters, avatars */
  --shadow: #4d4d4d;           /* Black 70%: the hard offset shadow under sticker pieces */
  --sticker: 4px 4px 0 var(--shadow);

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  /* desktop layout */
  --hdr: 76px;
  --colw: 360px;
  --gut: 32px;
  --tiles-h: 104px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--cream);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--crimson); }
a:hover { color: var(--red); }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
p { margin: 0; }

:focus-visible { outline: 2px solid var(--crimson); outline-offset: 2px; }
.gameday :focus-visible { outline-color: var(--cream); }
/* Sheet titles get focus only so screen readers start there; no ring needed. */
#sheet-title:focus { outline: none; }

.eyebrow {
  font-size: 12px; line-height: 16px; font-weight: 700; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--crimson);
}

#map { position: fixed; inset: 0; z-index: 1; background: var(--water); }


/* ── Header ──────────────────────────────────────────────── */

.appbar {
  position: fixed; z-index: 12;
  top: calc(var(--safe-top) + 16px); left: 16px; right: 16px; height: 64px;
  padding: 8px 10px 8px 8px;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--r-md);
  display: flex; align-items: center; gap: 8px;
}
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; min-width: 0; flex: 1; }
.brand-logo { width: 44px; height: auto; flex-shrink: 0; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-family: var(--display); font-size: 24px; line-height: 1.1; color: var(--crimson); white-space: nowrap; }
.brand-sub { font-size: 13px; line-height: 18px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 360px) { .brand-name { font-size: 24px; } .brand-sub { display: none; } }
.desk-nav, .go-small { display: none; }

.me-btn {
  position: relative; flex-shrink: 0;
  min-width: 44px; height: 44px; padding: 0 12px; border-radius: var(--r-pill);
  border: 1px solid var(--crimson); background: var(--crimson); color: var(--white);
  font-weight: 600; font-size: 14px; cursor: pointer;
}
.me-btn:hover { background: var(--red); }
.me-btn.has-avatar { padding: 0; width: 44px; border: 0; background: none; }
.me-btn .avatar { width: 44px; height: 44px; border: 2px solid var(--keyline); font-size: 15px; }
.me-badge {
  position: absolute; top: -5px; right: -7px; min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: var(--r-pill); background: var(--crimson); color: var(--white); border: 2px solid var(--white);
  font-size: 12px; font-weight: 700; line-height: 18px; text-align: center;
}


/* ── Map HUD (pills, count card, controls) ───────────────── */

.hud {
  position: fixed; z-index: 10;
  top: calc(var(--safe-top) + 92px); left: 16px; right: 16px;
  display: flex; flex-direction: column; gap: 12px;
  pointer-events: none;
}
.hud > *, .hud-row > * { pointer-events: auto; }

.pill {
  flex-shrink: 0; height: 44px; padding: 0 16px; border-radius: var(--r-pill);
  border: 1px solid var(--control); background: var(--white); color: var(--ink);
  font-weight: 600; font-size: 14px; white-space: nowrap; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px;
}
.pill:hover { color: var(--ink); border-color: var(--ink); }
.pill[aria-pressed=true] { background: var(--crimson); border-color: var(--crimson); color: var(--white); }
.pill.sm { height: 40px; padding: 0 14px; }

.hud-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; pointer-events: none; }

.count-card {
  width: auto; max-width: 62%; padding: 10px 16px 12px;
  background: var(--white); border: 3px solid var(--keyline); border-radius: var(--r-lg); box-shadow: var(--sticker);
  display: flex; flex-direction: column; gap: 2px;
}
.count-n { font-family: var(--display); font-size: 28px; line-height: 1.1; }
.count-where { font-size: 13px; line-height: 18px; color: var(--muted); }
.legend {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 13px; line-height: 18px;
  border-top: 1px solid var(--line); margin-top: 6px; padding-top: 6px;
}
.legend:empty { display: none; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.swatch { display: block; }
@media (max-width: 959px) { .legend .era-yrs { display: none; } }

.map-ctrls { display: flex; flex-direction: column; gap: 8px; margin-left: auto; }
.latest-btn { margin-left: auto; }
@media (max-width: 959px) { .map-ctrls { display: none; } }
.ctrl {
  width: 44px; height: 44px; border-radius: var(--r-md); border: 1px solid var(--control);
  background: var(--white); color: var(--ink); cursor: pointer;
  display: grid; place-items: center;
}
.ctrl:hover { border-color: var(--ink); }
.ctrl-locate { color: var(--crimson); }
.ctrl.busy svg { animation: pulse 1s ease-in-out infinite; }

.install-pill {
  display: inline-flex; align-self: flex-start; align-items: center; border-radius: var(--r-pill);
  background: var(--white); border: 1px solid var(--line);
}
.install-pill button {
  border: 0; background: none; cursor: pointer; color: var(--crimson);
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px;
}
#install-open { padding: 0 4px 0 14px; font-weight: 700; font-size: 14px; }
#install-x { padding: 0 12px 0 6px; color: var(--muted); }
#focus-open { padding: 0 4px 0 16px; font-weight: 700; font-size: 15px; }
#focus-x { padding: 0 12px 0 6px; color: var(--muted); }
.focus-pill { border: 2px solid var(--keyline); box-shadow: var(--sticker); }
/* while one fan's flags are showing, the pill stands in for the count card and game day box */
body.focus-on .hud-row, body.focus-on .gameday, body.focus-on .newest { display: none; }
.demo-note {
  align-self: flex-start; padding: 4px 10px; border-radius: var(--r-sm);
  background: var(--ink); color: var(--cream); font-size: 13px;
}


/* ── Game day panel ──────────────────────────────────────── */

.gameday {
  padding: 14px 16px; margin-right: 4px;
  background: var(--muted); color: var(--cream);
  border: 3px solid var(--muted); border-radius: var(--r-lg); box-shadow: 4px 4px 0 var(--crimson);
  display: flex; flex-direction: column; gap: 10px;
}
.gd-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.gd-live { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px 4px 10px; border-radius: var(--r-pill); background: var(--crimson); color: var(--cream); }
.gd-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--cream); animation: pulse 1.6s ease-in-out infinite; }
.gd-game { margin-left: auto; font-size: 14px; line-height: 20px; font-weight: 600; }
.gd-count { display: flex; align-items: flex-end; gap: 12px; }
.gd-n { font-family: var(--display); font-size: 48px; line-height: 1; }
.gd-what { display: flex; flex-direction: column; padding-bottom: 2px; }
.gd-what b { font-size: 16px; line-height: 22px; }
.gd-what span, .gd-switch small { font-size: 13px; line-height: 18px; color: var(--dark-muted); }
.gd-rule { height: 1px; background: rgba(248, 244, 232, .3); }
.gd-switch { display: flex; align-items: center; gap: 12px; min-height: 36px; font-size: 16px; line-height: 22px; font-weight: 600; cursor: pointer; }
.gd-switch > span { flex: 1; display: flex; flex-direction: column; }
.gd-switch small { font-weight: 400; }
.sw {
  appearance: none; -webkit-appearance: none; position: relative; margin: 0; flex-shrink: 0;
  width: 52px; height: 32px; border-radius: var(--r-pill); background: #666666; border: 2px solid var(--cream); cursor: pointer;
}
.sw::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px;
  border-radius: 50%; background: var(--cream); transition: left .15s;
}
.sw:checked { background: var(--crimson); }
.sw:checked::after { left: 23px; }


/* ── Dock: newest flag + the button ──────────────────────── */

.dock {
  position: fixed; z-index: 10; left: 16px; right: 16px;
  bottom: calc(var(--safe-bottom) + 16px);
  max-width: 560px; margin: 0 auto;
  display: flex; flex-direction: column; gap: 12px;
}
/* the newest flag: a one-line pill above the button */
.newest {
  align-self: center; max-width: 100%; min-height: 44px; padding: 5px 16px 5px 5px; cursor: pointer; text-align: left;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--r-pill);
  display: flex; gap: 8px; align-items: center; font-size: 15px; line-height: 20px;
}
.newest:hover { border-color: var(--ink); }
.newest .avatar { width: 32px; height: 32px; font-size: 12px; }
.newest-text { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.newest-text b { color: var(--crimson); }
.newest-text span { color: var(--muted); }
.chev { flex-shrink: 0; color: var(--muted); }

.go {
  position: relative; overflow: hidden;
  width: calc(100% - 4px); min-height: 76px; padding: 8px 16px;
  background: var(--crimson); color: var(--white);
  border: 3px solid var(--keyline); border-radius: var(--r-lg); box-shadow: var(--sticker);
  display: flex; align-items: center; justify-content: center; gap: 14px;
  cursor: pointer; text-align: left;
  transition: transform .08s ease-out, box-shadow .08s ease-out;
}
.go:hover { background: var(--red); }
.go:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--shadow); }
.go-text { display: flex; flex-direction: column; gap: 6px; }
.go-big { font-family: var(--display); font-size: 32px; line-height: 1; }
.go-sub { font-size: 14px; line-height: 20px; font-weight: 600; color: var(--cream); }
/* game day: cream stripe along the bottom */
body.gameday-live .go::after, body.gameday-live .go-small::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 6px; background: var(--cream);
}
body.gameday-live .go { justify-content: center; text-align: center; }
body.gameday-live .go .go-pin { display: none; }
body.gameday-live .go-text { align-items: center; }

body.sheet-open .dock, body.logging .dock, body.logging .hud { visibility: hidden; }
@media (max-width: 959px) { body.sheet-open .hud { visibility: hidden; } }


/* ── Logging, step 1 ─────────────────────────────────────── */

.logtop {
  position: fixed; z-index: 20; top: 0; left: 0; right: 0;
  padding: calc(var(--safe-top) + 12px) 16px 16px;
  background: var(--cream); border-bottom: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 12px;
}
.step-head { display: flex; align-items: center; gap: 12px; min-height: 56px; }
.step-head .icon-btn { margin-left: -6px; }
.sheet .step-head h2, .logtop .step-head h2 { color: var(--ink); font-family: var(--display); font-weight: 400; font-size: 24px; line-height: 1.1; margin: 0; }
.icon-btn {
  width: 44px; height: 44px; border-radius: var(--r-pill); border: 0; background: none;
  display: grid; place-items: center; cursor: pointer; flex-shrink: 0; color: var(--ink);
}
.icon-btn:hover { background: rgba(28, 28, 28, .06); }

.seg {
  display: flex; gap: 4px; padding: 4px;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--r-md);
}
.seg button {
  flex: 1; min-height: 40px; border: 0; border-radius: 6px; background: none; cursor: pointer;
  font-weight: 600; font-size: 15px; color: var(--ink);
}
.seg button[aria-pressed=true] { background: var(--crimson); color: var(--white); }

.search { position: relative; }
.search svg { position: absolute; left: 14px; top: 14px; color: var(--muted); pointer-events: none; }
.search input[type=search] { padding-left: 44px; }
.results {
  position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 4px);
  list-style: none; margin: 0; padding: 4px 0; max-height: 50vh; overflow-y: auto;
  background: var(--white); border: 1px solid var(--control); border-radius: var(--r-md);
  box-shadow: 0 8px 24px rgba(28, 28, 28, .15);
}
.results button {
  width: 100%; border: 0; background: none; text-align: left; cursor: pointer;
  padding: 10px 14px; display: flex; flex-direction: column; min-height: 44px;
}
.results button:hover, .results button:focus-visible { background: var(--cream); }
.results b { font-weight: 700; }
.results span { font-size: 14px; color: var(--muted); }
.results .none { padding: 10px 14px; color: var(--muted); }

.centerpin { position: fixed; z-index: 15; width: 48px; height: 48px; pointer-events: none; }
.centerpin .gd { display: none; }
.centerpin svg { display: block; overflow: visible; filter: drop-shadow(0 6px 4px rgba(28, 28, 28, .25)); transition: transform .15s; }
.centerpin.lifted svg { transform: translateY(-8px); }
.centerpin::after {
  content: ""; position: absolute; left: 0; top: 44px; width: 14px; height: 6px;
  border-radius: 50%; background: var(--ink); opacity: .3;
}
.pin-hint {
  position: absolute; bottom: calc(100% + 14px); left: 7px; transform: translateX(-50%);
  white-space: nowrap; padding: 8px 16px; border-radius: var(--r-md);
  background: var(--ink); color: var(--cream); font-size: 15px; transition: opacity .3s;
}
.pin-hint::after {
  content: ""; position: absolute; left: 50%; top: 100%; margin-left: -6px;
  border: 6px solid transparent; border-top-color: var(--ink);
}
.pin-hint.gone { opacity: 0; }
.log-locate { position: fixed; z-index: 16; right: 16px; }


/* ── Sheet (bottom sheet on phones, left column on desktop) ─ */

.sheet {
  position: fixed; z-index: 30; left: 0; right: 0; bottom: 0;
  max-width: 600px; margin: 0 auto;
  max-height: min(88dvh, 88vh);
  display: flex; flex-direction: column;
  background: var(--white);
  border-top: 3px solid var(--keyline);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  box-shadow: 0 -8px 40px rgba(28, 28, 28, .14);
  animation: sheet-up .24s cubic-bezier(.2, .8, .2, 1);
}
.sheet.compact { max-height: 62dvh; }
.sheet.full { top: 0; max-height: none; border-top: 0; border-radius: 0; background: var(--cream); box-shadow: none; max-width: none; }
.sheet.full .sheet-grip { display: none; }
.sheet.bare .sheet-close { display: none; }
.sheet.still { animation: none; }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }

.sheet-grip { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 10px auto 0; flex-shrink: 0; }
.sheet-close {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  width: 44px; height: 44px; border-radius: var(--r-pill); border: 1px solid var(--control);
  background: var(--white); color: var(--ink); cursor: pointer;
  display: grid; place-items: center;
}
.sheet-body {
  overflow-y: auto; overscroll-behavior: contain; flex: 1;
  padding: 12px 20px calc(var(--safe-bottom) + 24px);
}
.sheet.full .sheet-body { padding-top: calc(var(--safe-top) + 12px); width: 100%; max-width: 560px; margin: 0 auto; }


/* ── Sheet content ───────────────────────────────────────── */

.sheet h2 {
  font-family: var(--display); font-weight: 400;
  font-size: 26px; line-height: 1.15;
  margin: 4px 52px 8px 0; color: var(--crimson);
}
.sheet h3 { font-size: 20px; line-height: 26px; margin: 24px 0 8px; }
.h-rule { font-family: var(--display); font-weight: 400; font-size: 24px; line-height: 1.15; margin: 28px 0 16px; color: var(--ink); }
.h-rule::after { content: ""; display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--crimson); margin-top: 8px; }
.h-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.h-row .link-btn { margin-top: 22px; flex-shrink: 0; }
.lede { margin: 0 0 16px; color: var(--muted); font-size: 17px; }
.lede strong { color: var(--ink); }

label, .label { display: block; font-weight: 600; margin: 18px 0 6px; font-size: 16px; }
label .opt, .label .opt { font-weight: 400; color: var(--muted); }
.hint { margin: 6px 0 0; font-size: 14px; line-height: 20px; color: var(--muted); }
.hint.bad { color: var(--crimson); font-weight: 600; }

input[type=text], input[type=email], input[type=search], input[type=number], input[type=date], input[type=time], textarea, select {
  width: 100%; font: inherit; font-size: 17px; /* 16px+ stops iOS zoom */
  min-height: 48px; padding: 10px 14px; border: 1px solid var(--control); border-radius: var(--r-sm);
  background: var(--white); color: var(--ink);
}
select { appearance: none; -webkit-appearance: none; padding-right: 36px;
  background: var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%231c1c1c' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center; }
input:focus, textarea:focus, select:focus { border-color: var(--crimson); outline: 2px solid var(--crimson); outline-offset: 2px; }
textarea { resize: none; min-height: 132px; line-height: 1.5; }
/* iPhone Safari sizes date/time boxes to their own content and centers the text; keep them in their column */
input[type=date], input[type=time] { -webkit-appearance: none; appearance: none; display: block; min-width: 0; max-width: 100%; text-align: left; }
input[type=date]::-webkit-date-and-time-value, input[type=time]::-webkit-date-and-time-value { text-align: left; }
input::placeholder, textarea::placeholder { color: #767676; }
.code-input { font-size: 28px !important; letter-spacing: .3em; text-align: center; font-weight: 600; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid2 > div { min-width: 0; }
.count-hint { text-align: right; }

.row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.btn {
  flex: 1; min-height: 48px; padding: 0 20px; border-radius: var(--r-md); border: 1px solid transparent;
  font-weight: 600; font-size: 16px; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
}
.btn-primary { background: var(--crimson); color: var(--white); border-color: var(--crimson); }
.btn-primary:hover { background: var(--red); border-color: var(--red); color: var(--white); }
.btn-primary:disabled { opacity: .45; cursor: default; background: var(--crimson); }
.btn-sticker {
  width: calc(100% - 4px); min-height: 56px; font-size: 18px; font-weight: 700;
  border: 3px solid var(--keyline); box-shadow: var(--sticker); border-radius: var(--r-md);
}
.btn-sticker:hover { border-color: var(--keyline); }
.btn-sticker:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--shadow); }
.btn-quiet { background: var(--white); color: var(--ink); border-color: var(--control); }
.btn-quiet:hover { border-color: var(--ink); color: var(--ink); }
.btn-small { min-height: 44px; font-size: 15px; padding: 0 14px; flex: 0 0 auto; }
.btn-block { width: 100%; flex: none; }
.link-btn {
  border: 0; background: none; padding: 0; min-height: 44px; color: var(--crimson); font-weight: 600;
  cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
}
.link-btn:hover { color: var(--red); }
.link-btn.muted { color: var(--muted); font-weight: 400; }

.status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex-shrink: 0; }
.dot.ok { background: var(--ink); }
.dot.warn { background: var(--crimson); }
.dot.busy { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 44px; padding: 0 18px; border-radius: var(--r-pill);
  border: 1px solid var(--control); background: var(--white); color: var(--ink);
  font-weight: 600; font-size: 16px; cursor: pointer;
}
.chip[aria-pressed=true] { background: var(--crimson); border-color: var(--crimson); color: var(--white); }
.tag {
  display: inline-flex; align-items: center; padding: 4px 12px; border-radius: var(--r-pill);
  border: 1px solid var(--line); font-size: 14px; font-weight: 600; line-height: 20px; color: var(--ink);
}
.tag.era { background: var(--muted); border-color: var(--muted); color: var(--cream); }
.tag.gd { background: var(--ink); border-color: var(--ink); color: var(--cream); }
.tag.wait { border-style: dashed; border-color: var(--crimson); color: var(--crimson); }
.tag.no { color: var(--muted); }
.tag.warn { background: var(--ink); border-color: var(--ink); color: var(--white); }
.badge {
  display: inline-flex; align-items: center; padding: 4px 10px; border-radius: var(--r-pill);
  background: var(--keyline); color: var(--cream); font-size: 12px; font-weight: 700; letter-spacing: 1.5px;
  white-space: nowrap; text-transform: uppercase;
}

.card {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px;
}
.card.sticker { border: 3px solid var(--keyline); box-shadow: var(--sticker); }
.note { display: flex; gap: 12px; align-items: flex-start; color: var(--muted); font-size: 16px; text-align: left; }
.note svg { flex-shrink: 0; margin-top: 2px; }

.place-card { display: flex; gap: 12px; align-items: center; }
.place-ico {
  width: 44px; height: 44px; border-radius: var(--r-md); background: var(--cream); color: var(--crimson);
  display: grid; place-items: center; flex-shrink: 0;
}
.place-main { flex: 1; min-width: 0; }
.place-name {
  width: 100%; border: 0 !important; outline: 0; padding: 0 !important; min-height: 0 !important; background: none !important;
  font: 700 20px/26px var(--sans) !important; color: var(--ink);
  border-bottom: 1px dashed transparent !important; border-radius: 0 !important;
}
.place-name:focus { border-bottom-color: var(--crimson) !important; outline: 0 !important; }
.place-sub { font-size: 15px; color: var(--muted); margin-top: 2px; }


/* ── Flag story ──────────────────────────────────────────── */

.story-head { display: flex; gap: 12px; align-items: center; margin-right: 52px; }
.story-head .who { flex: 1; min-width: 0; }
.story-head .badge { flex-shrink: 0; }
.who-name { font-size: 20px; line-height: 26px; font-weight: 700; color: var(--ink); text-decoration: none; display: block; overflow-wrap: anywhere; }
a.who-name:hover { text-decoration: underline; color: var(--ink); }
.who-line { font-size: 13px; line-height: 18px; color: var(--muted); }
.sheet .story-place { margin: 16px 0 2px; font-family: var(--display); font-weight: 400; font-size: 24px; line-height: 1.15; color: var(--crimson); overflow-wrap: anywhere; }
.story-meta { font-size: 14px; line-height: 20px; color: var(--muted); }
.story-text { margin: 14px 0 0; font-size: 18px; line-height: 28px; overflow-wrap: anywhere; }
.story .chips { margin-top: 14px; }
.story .row { margin-top: 20px; }
.era-note { margin-top: 10px; font-size: 15px; font-weight: 600; color: var(--muted); }


/* ── Flag planted ────────────────────────────────────────── */

.planted { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 16px; min-height: 100%; }
.planted-logo { width: 200px; height: auto; margin-top: 12px; }
.planted h2 { margin: 0; font-size: 36px; }
.planted .lede { margin: 0; color: var(--ink); font-size: 18px; line-height: 28px; max-width: 32ch; }
.planted .note { width: 100%; }
.planted .actions { width: 100%; display: flex; flex-direction: column; gap: 12px; margin-top: auto; padding-top: 8px; }
.stat-tiles { width: 100%; display: grid; grid-template-columns: repeat(var(--n, 2), 1fr); gap: 12px; }
.stat-tile { background: var(--white); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 12px; min-width: 0; }
.stat-tile b { display: block; font-family: var(--display); font-weight: 400; font-size: 28px; line-height: 1.1; overflow-wrap: anywhere; }
.profile .stat-tile b { white-space: nowrap; overflow: hidden; overflow-wrap: normal; }
.stat-tile span { display: block; font-size: 15px; color: var(--muted); }
.planted .stat-tile { text-align: center; }


/* ── People + lists ──────────────────────────────────────── */

.avatar {
  width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; overflow: hidden;
  background: var(--muted); color: var(--cream);
  font-family: var(--sans); font-weight: 700; font-size: 15px; line-height: 1;
  object-fit: cover;
}
.avatar.md { width: 48px; height: 48px; font-size: 16px; border: 2px solid var(--keyline); }
.avatar.lg { width: 92px; height: 92px; font-size: 32px; border: 4px solid var(--keyline); box-shadow: 3px 3px 0 var(--shadow); }
.avatar.sm { width: 36px; height: 36px; font-size: 13px; }

.profile-head { display: flex; gap: 16px; align-items: center; margin: 8px 52px 0 0; }
.profile-head h2 { margin: 0; font-size: 32px; overflow-wrap: anywhere; }
.profile-head .who-line { font-size: 15px; line-height: 20px; margin-top: 4px; }
.profile .stat-tiles { margin-top: 20px; }
.profile .stat-tile b { font-size: 26px; }

.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.flag-row {
  width: 100%; display: flex; gap: 14px; align-items: center; text-align: left; cursor: pointer;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px;
}
.flag-row:hover { border-color: var(--ink); }
.flag-row b { display: block; font-size: 17px; line-height: 24px; }
.flag-row .place-main > span { display: block; font-size: 15px; color: var(--muted); }
.flag-row .place-main { min-width: 0; }
.row-actions { display: flex; gap: 8px; margin: 8px 0 0 4px; flex-wrap: wrap; }

.story-card {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 16px;
}
.story-card:hover { border-color: var(--ink); }
.story-card.featured { border: 3px solid var(--keyline); box-shadow: var(--sticker); width: calc(100% - 4px); }
.story-card .who-row { display: flex; gap: 12px; align-items: center; }
.story-card .who-text b { display: block; font-size: 17px; line-height: 22px; }
.story-card .who-text > span { display: block; font-size: 14px; line-height: 20px; color: var(--muted); }
.story-card p { margin-top: 10px; font-size: 17px; line-height: 26px; overflow-wrap: anywhere; }
.story-card .tag { margin-top: 10px; }

.choices { border: 0; margin: 10px 0 0; padding: 0; }
.choices legend { font-weight: 600; padding: 0; margin-bottom: 6px; }
.choice {
  display: flex; align-items: center; gap: 12px; margin: 0; padding: 12px 4px; min-height: 48px;
  font-weight: 400; border-top: 1px solid var(--line); cursor: pointer;
}
.choice:first-of-type { border-top: 0; }
.choice input { width: 20px; height: 20px; accent-color: var(--crimson); margin: 0; }

.tabs { display: flex; gap: 8px; margin: 8px 0 16px; overflow-x: auto; scrollbar-width: none; }
.tab {
  flex-shrink: 0; min-height: 44px; padding: 0 16px; border-radius: var(--r-pill);
  border: 1px solid var(--control); background: var(--white); color: var(--ink);
  font-weight: 600; font-size: 15px; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px;
}
.tab[aria-selected=true] { background: var(--crimson); border-color: var(--crimson); color: var(--white); }
.tab .n { background: var(--white); color: var(--crimson); border-radius: var(--r-pill); padding: 0 7px; font-size: 13px; line-height: 20px; }
.tab[aria-selected=false] .n { background: var(--crimson); color: var(--white); }

.avatar-pick {
  width: 104px; height: 104px; border-radius: 50%; border: 2px dashed var(--control); background: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  cursor: pointer; color: var(--muted); font-weight: 600; font-size: 14px; flex-shrink: 0; padding: 0; overflow: hidden;
}
.avatar-pick .avatar { width: 100%; height: 100%; font-size: 36px; }
.join-top { display: flex; gap: 16px; align-items: flex-end; margin-top: 18px; }
.join-top > div { flex: 1; min-width: 0; }
.join-top label { margin-top: 0; }
.era-help { display: flex; gap: 10px; align-items: flex-start; margin-top: 10px; font-size: 15px; color: var(--muted); }
.era-help svg { flex-shrink: 0; margin-top: 2px; }
.at-field { position: relative; }
.at-field span { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; }
.at-field input { padding-left: 32px; }

.join-hero { text-align: center; }
.join-hero img { width: 180px; height: auto; margin: 8px auto 4px; display: block; }
.join-hero h2 { margin: 8px auto; font-size: 28px; line-height: 1.1; max-width: 13em; }
.join-hero .lede { margin: 0 auto 8px; }

.empty { text-align: center; color: var(--muted); padding: 24px 8px; }
.empty p { margin: 0 0 14px; }
.fine { font-size: 14px; color: var(--muted); margin: 20px 0 0; }

.steps { list-style: none; counter-reset: step; margin: 6px 0 0; padding: 0; }
.steps li {
  counter-increment: step; position: relative; padding: 12px 0 12px 48px; min-height: 52px;
  border-top: 1px solid var(--line); font-size: 17px;
}
.steps li:first-child { border-top: 0; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: 10px;
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--crimson); color: var(--white); font-weight: 700; border: 2px solid var(--keyline);
}
.steps .ico { display: inline-block; vertical-align: -5px; margin: 0 2px; color: #0A84FF; }
.install-card { margin: 0; padding: 14px; border-radius: var(--r-md); background: var(--white); border: 1px dashed var(--control); text-align: left; width: 100%; }
.install-card p { margin: 0 0 10px; }

.welcome { text-align: center; }
.welcome img { width: 220px; height: auto; display: block; margin: 8px auto 0; }
.welcome h2 { margin: 12px 0 12px; font-size: 32px; }
.welcome p { text-align: left; margin-bottom: 12px; font-size: 17px; }
.welcome .fine { text-align: center; }


/* ── Admin ───────────────────────────────────────────────── */

.q-card { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.q-head { display: flex; gap: 12px; align-items: center; }
.q-head b { display: block; font-size: 17px; line-height: 22px; }
.q-head > div span { display: block; font-size: 14px; color: var(--muted); }
.q-story { font-size: 17px; line-height: 26px; overflow-wrap: anywhere; }
.q-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.q-actions .link-btn { margin-left: 4px; }
.report-note { font-size: 15px; color: var(--crimson); font-weight: 600; }
.seg-inline { display: flex; gap: 8px; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; margin: 0 -4px; }
table.sched { width: 100%; border-collapse: collapse; font-size: 15px; }
.sched th { text-align: left; font-size: 12px; line-height: 16px; letter-spacing: 1px; color: var(--muted); font-weight: 700; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: bottom; }
.sched td { padding: 10px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.sched td.n { white-space: nowrap; }
.live-pill { display: inline-flex; padding: 2px 10px; border-radius: var(--r-pill); background: var(--crimson); color: var(--white); font-weight: 700; font-size: 14px; white-space: nowrap; }
.sched .del { min-height: 36px; width: 36px; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: var(--r-pill); }
.sched .del:hover { background: var(--cream); color: var(--crimson); }


/* ── Map flags ───────────────────────────────────────────── */

.flag-icon { background: none; border: 0; }
.flag-icon svg { display: block; overflow: visible; filter: drop-shadow(0 1px 1px rgba(28, 28, 28, .35)); transform-origin: 4px 27.6px; transition: transform .15s; }
.flag-icon .gd { display: none; }
.flag-icon.gd-flag .gd { display: block; }
.flag-icon.classmate .cloth { fill: #63696f; }
.flag-icon.classmate .shade { fill: #4a4f54; }
.flag-icon.classmate .light { fill: #7a8086; }
.flag-icon.pending .cloth { fill: #fff; }
.flag-icon.pending .shade, .flag-icon.pending .light { display: none; }
.flag-icon.pending .edge { stroke: var(--crimson); stroke-width: 1.6; stroke-dasharray: 2.6 1.8; }
.flag-icon.selected svg { transform: scale(1.35); }
.flag-icon.selected .edge { stroke-width: 1.5; }
.flag-icon.selected svg { filter: drop-shadow(0 0 0 var(--cream)) drop-shadow(0 2px 2px rgba(28, 28, 28, .45)); }
.flag-icon.drop svg { animation: drop .55s cubic-bezier(.3, 1.6, .5, 1) both; }
@keyframes drop {
  0% { transform: translateY(-60px) scale(.9); opacity: 0; }
  60% { opacity: 1; }
  100% { transform: none; }
}

.cluster {
  display: grid; place-items: center; border-radius: 50%;
  background: var(--crimson); color: var(--white);
  border: 2px solid var(--keyline);
  font-family: var(--sans); font-weight: 700; font-size: 13px;
  position: relative;
}
.cluster.big { border-width: 3px; box-shadow: 3px 3px 0 var(--shadow); font-size: 15px; }
.cluster.gd { box-shadow: 0 0 0 3px var(--cream), 0 0 0 5px var(--keyline); }
.cluster.big.gd { box-shadow: 0 0 0 3px var(--cream), 0 0 0 6px var(--keyline); }
/* a gray dot on clusters that hold Cougs from your era */
.cluster-era {
  position: absolute; top: -4px; right: -4px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--muted); border: 2px solid var(--keyline);
}

.leaflet-container { font-family: var(--sans); background: var(--water); }
/* map credits: required by the OpenStreetMap license, kept small and quiet */
.leaflet-container .leaflet-control-attribution { font-size: 9px; line-height: 14px; padding: 0 6px; background: rgba(251, 248, 240, .55) !important; color: #808080; }
.leaflet-control-attribution a { color: #808080; text-decoration: none; }
.leaflet-bottom.leaflet-right { bottom: calc(var(--safe-bottom) + 160px); }
body.logging .leaflet-bottom.leaflet-right, body.sheet-open .leaflet-bottom.leaflet-right { bottom: 0; }


/* ── Toast ───────────────────────────────────────────────── */

.toast {
  position: fixed; z-index: 50; left: 50%; top: calc(var(--safe-top) + 92px);
  transform: translateX(-50%); max-width: calc(100% - 32px);
  padding: 10px 16px; border-radius: var(--r-md); background: var(--ink); color: var(--cream);
  font-size: 15px; opacity: 0; pointer-events: none; transition: opacity .2s;
}
.toast.show { opacity: 1; }
body.logging .toast { top: calc(var(--safe-top) + 228px); }


/* ── Desktop ─────────────────────────────────────────────── */

.feed-col, .tiles { display: none; }

@media (min-width: 960px) {
  body { background: var(--cream); }
  .appbar {
    top: 0; left: 0; right: 0; height: var(--hdr); padding: 0 var(--gut);
    border: 0; border-bottom: 1px solid var(--line); border-radius: 0; gap: 32px;
  }
  .brand { flex: 0 0 auto; }
  .brand-name { font-size: 28px; }
  .brand-sub { display: none; }
  .desk-nav { display: flex; gap: 8px; align-self: stretch; margin-right: auto; }
  .desk-nav a {
    display: flex; align-items: center; padding: 0 12px; color: var(--ink); text-decoration: none;
    font-weight: 600; font-size: 16px; border-bottom: 3px solid transparent; margin-bottom: -1px;
  }
  .desk-nav a[aria-current=page] { color: var(--crimson); border-bottom-color: var(--crimson); }
  .go-small {
    display: block; position: relative; overflow: hidden;
    height: 48px; padding: 0 24px; border-radius: var(--r-md);
    background: var(--crimson); color: var(--white); border: 3px solid var(--keyline); box-shadow: var(--sticker);
    font-family: var(--display); font-size: 20px; cursor: pointer;
  }
  .go-small:hover { background: var(--red); }
  .go-small:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--shadow); }

  #map {
    left: calc(var(--gut) + var(--colw) + 24px); right: var(--gut);
    top: calc(var(--hdr) + 24px); bottom: calc(var(--gut) + var(--tiles-h) + 20px);
    border: 3px solid var(--keyline); border-radius: var(--r-lg); overflow: hidden;
  }
  .leaflet-bottom.leaflet-right { bottom: 0 !important; }

  .feed-col {
    display: block; position: fixed; z-index: 5;
    left: var(--gut); top: var(--hdr); bottom: 0; width: var(--colw);
    overflow-y: auto; padding: 24px 6px 32px 2px; scrollbar-width: thin;
  }
  .feed-col h2 { font-family: var(--display); font-weight: 400; font-size: 32px; line-height: 1.1; margin: 4px 0 16px; }
  .feed-col h2::after { content: ""; display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--crimson); margin-top: 8px; }
  .feed-col .tabs { flex-wrap: wrap; overflow: visible; }

  .tiles {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; position: fixed; z-index: 5;
    left: calc(var(--gut) + var(--colw) + 24px); right: var(--gut); bottom: var(--gut); height: var(--tiles-h);
  }
  .tiles .stat-tile { padding: 16px 20px; display: flex; flex-direction: column; justify-content: center; }
  .tiles .stat-tile b { font-family: var(--sans); font-weight: 700; font-size: 20px; line-height: 26px; }

  .hud {
    left: calc(var(--gut) + var(--colw) + 24px + 16px); right: calc(var(--gut) + 16px);
    top: calc(var(--hdr) + 24px + 16px); bottom: calc(var(--gut) + var(--tiles-h) + 20px + 16px);
  }
  .latest-btn { display: none; }
  .hud-row { position: absolute; inset: 0; }
  .count-card { position: absolute; left: 0; bottom: 0; width: 300px; }
  .count-n { font-size: 40px; }
  .map-ctrls { position: absolute; right: 0; top: 0; }
  .gameday { width: 420px; margin: 0; }
  body.gameday-live .count-card { display: none; }
  .install-pill { display: none !important; }

  .dock { display: none; }
  body.sheet-open .feed-col { visibility: hidden; }

  .sheet {
    left: var(--gut); right: auto; top: calc(var(--hdr) + 24px); bottom: var(--gut);
    width: var(--colw); max-width: none; max-height: none; margin: 0;
    border: 1px solid var(--line); border-radius: var(--r-lg);
    box-shadow: 0 8px 32px rgba(28, 28, 28, .1);
    animation-name: panel-in;
  }
  .sheet.compact { max-height: none; }
  .sheet.full { top: calc(var(--hdr) + 24px); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--white); box-shadow: 0 8px 32px rgba(28, 28, 28, .1); }
  .sheet.full .sheet-body { padding-top: 16px; }
  .sheet.wide { width: min(760px, calc(100vw - 2 * var(--gut))); }
  .sheet-grip { display: none; }
  .sheet-body { padding: 20px 24px 24px; }
  @keyframes panel-in { from { transform: translateX(-24px); opacity: 0; } }

  /* logging: the top panel floats over the map card */
  .logtop {
    left: calc(var(--gut) + var(--colw) + 24px + 16px); right: auto; top: calc(var(--hdr) + 24px + 16px);
    width: 440px; padding: 12px 16px 16px; border: 1px solid var(--line); border-radius: var(--r-lg);
  }
  body.logging .hud { visibility: hidden; }
  .leaflet-bottom.leaflet-right { bottom: 0; }

  .toast { top: calc(var(--hdr) + 40px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
