/* College Fair platform — one stylesheet, one visual system.

   Type: serif throughout, from fonts already on the device (Latin: New York /
   Iowan Old Style / Georgia; Chinese: Songti, Noto Serif CJK, SimSun). Nothing is
   downloaded; an iPhone, which has no Chinese serif, shows its system face.
   Structure follows the grouped-list idiom: a grouped background, white rounded
   groups with inset hairlines, capsule buttons, a translucent bar whose hairline
   appears only once content scrolls beneath it.
   Colours are tokens on :root, redefined for dark mode both for the system
   setting and for an explicit data-theme. */

:root {
  color-scheme: light dark;
  --bg: #F2F2F7;
  --surface: #FFFFFF;
  --thumb: #FFFFFF;
  --fill: rgba(118, 118, 128, .12);
  --fill-2: rgba(118, 118, 128, .2);
  --label: #1C1C1E;
  --label-2: #6C6C70;
  --label-3: #8E8E93;
  --separator: rgba(60, 60, 67, .22);
  --tint: #8A2B34;
  --tint-soft: rgba(138, 43, 52, .1);
  --marker: #F2B33D;
  --marker-2: #D6962A;
  --marker-3: #B97D1C;
  --marker-ink: #3D2A05;
  --bar: rgba(242, 242, 247, .78);
  --sheet: rgba(255, 255, 255, .88);
  --shadow: 0 12px 40px rgba(0, 0, 0, .16), 0 2px 6px rgba(0, 0, 0, .06);
  --thumb-shadow: 0 3px 8px rgba(0, 0, 0, .12), 0 3px 1px rgba(0, 0, 0, .04);
  --slab-top: #FAFAFC;
  --slab-side: #C7CAD3;
  --plan-line: #B4B8C3;
  --room: #FFFFFF;
  --room-used: #FFF4DC;
  --room-open: #FBE2AE;
  --corridor: #ECEDF1;
  --stairs: #DADDE4;
  --wc: #E4E6EB;
  --entrance: #E3EADF;
  --halo: #FFFFFF;
  --serif: ui-serif, "New York", "Iowan Old Style", Palatino, Georgia, "Songti SC", "STSongti-SC-Regular",
    "Noto Serif CJK SC", "Noto Serif SC", "Source Han Serif SC", "Source Han Serif CN", SimSun, STSong,
    "PingFang SC", serif;
  --r-chip: 7px;
  --r-field: 10px;
  --r-group: 12px;
  --r-card: 16px;
  --ease: cubic-bezier(.32, .72, 0, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000; --surface: #1C1C1E; --thumb: #636366; --fill: rgba(118, 118, 128, .24); --fill-2: rgba(118, 118, 128, .34);
    --label: #F2F2F7; --label-2: #AEAEB2; --label-3: #8E8E93; --separator: rgba(84, 84, 88, .65);
    --tint: #F2939C; --tint-soft: rgba(242, 147, 156, .16); --marker: #F5C451; --marker-2: #D9A63A; --marker-3: #B88A2A;
    --marker-ink: #2B1D02; --bar: rgba(22, 22, 24, .74); --sheet: rgba(44, 44, 46, .9);
    --shadow: 0 12px 40px rgba(0, 0, 0, .6); --thumb-shadow: 0 3px 8px rgba(0, 0, 0, .3);
    --slab-top: #26262A; --slab-side: #0E0E10; --plan-line: #4A4A50; --room: #2C2C2E; --room-used: #3B3222;
    --room-open: #574526; --corridor: #1F1F22; --stairs: #3A3A3F; --wc: #303035; --entrance: #232B26; --halo: #1C1C1E;
  }
}
:root[data-theme="dark"] {
  --bg: #000000; --surface: #1C1C1E; --thumb: #636366; --fill: rgba(118, 118, 128, .24); --fill-2: rgba(118, 118, 128, .34);
  --label: #F2F2F7; --label-2: #AEAEB2; --label-3: #8E8E93; --separator: rgba(84, 84, 88, .65);
  --tint: #F2939C; --tint-soft: rgba(242, 147, 156, .16); --marker: #F5C451; --marker-2: #D9A63A; --marker-3: #B88A2A;
  --marker-ink: #2B1D02; --bar: rgba(22, 22, 24, .74); --sheet: rgba(44, 44, 46, .9);
  --shadow: 0 12px 40px rgba(0, 0, 0, .6); --thumb-shadow: 0 3px 8px rgba(0, 0, 0, .3);
  --slab-top: #26262A; --slab-side: #0E0E10; --plan-line: #4A4A50; --room: #2C2C2E; --room-used: #3B3222;
  --room-open: #574526; --corridor: #1F1F22; --stairs: #3A3A3F; --wc: #303035; --entrance: #232B26; --halo: #1C1C1E;
}

/* ---- base ---- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--label);
  font-family: var(--serif); font-size: 1.0625rem; line-height: 1.7;
  font-variant-numeric: lining-nums; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: var(--tint); text-underline-offset: .2em; text-decoration-thickness: 1px; }
:focus-visible { outline: 3px solid var(--marker); outline-offset: 2px; }
img, svg { max-width: 100%; }
[hidden] { display: none !important; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
main { display: block; max-width: 1080px; margin: 0 auto; padding: 0 16px 56px; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
button, input { font: inherit; color: inherit; }
a, button, label, input { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

/* type scale: tight leading and slight negative tracking only for large titles */
.large-title { font-size: clamp(2rem, 7.2vw, 3.1rem); line-height: 1.14; font-weight: 700; letter-spacing: -.008em; text-wrap: balance; }
.title2 { font-size: 1.375rem; line-height: 1.32; }
.footnote { font-size: .8125rem; line-height: 1.5; letter-spacing: .01em; color: var(--label-2); }

/* ---- bar ---- */
.demo-banner { margin: 0; padding: 8px 16px; background: var(--marker); color: var(--marker-ink); font-size: .875rem; text-align: center; }
.top {
  position: sticky; top: 0; z-index: 30;
  background: var(--bar); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
}
.top::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: .5px; background: var(--separator);
  opacity: 0; transition: opacity .2s; }
.is-scrolled .top::after { opacity: 1; }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 8px; max-width: 1080px; margin: 0 auto; padding: 8px 12px 8px 16px; }
.brand { color: var(--label); text-decoration: none; font-weight: 700; font-size: 1.0625rem; white-space: nowrap; }
.nav { display: flex; gap: 2px; }
.nav a { padding: 6px 10px; border-radius: 999px; color: var(--label-2); text-decoration: none; font-size: .9375rem; white-space: nowrap; }
.nav a[aria-current] { background: var(--fill); color: var(--label); font-weight: 600; }
@media (hover: hover) { .nav a:hover { color: var(--label); } }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px;
  border: 0; border-radius: 999px; font-size: 1rem; font-weight: 600; line-height: 1.2; text-decoration: none; cursor: pointer;
  transition: transform .1s ease-out, background-color .2s, color .2s, opacity .2s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .4; cursor: default; transform: none; }
.btn-filled { background: var(--label); color: var(--bg); }
.btn-tinted { background: var(--tint-soft); color: var(--tint); }
.btn-gray { background: var(--fill); color: var(--label); }
.btn-small { min-height: 36px; padding: 0 14px; font-size: .9375rem; }
@media (hover: hover) { .btn:not(:disabled):hover { opacity: .86; } }
.i { width: 1.1em; height: 1.1em; flex: none; }

/* ---- grouped lists ---- */
.group-title { margin: 28px 16px 7px; font-size: .8125rem; font-weight: 400; color: var(--label-2); letter-spacing: .02em; }
.group-title .n { margin-left: 6px; color: var(--label-3); }
.group-foot { margin: 7px 16px 0; font-size: .8125rem; line-height: 1.5; color: var(--label-2); }
.list { position: relative; margin: 0; padding: 0; list-style: none; overflow: hidden; border-radius: var(--r-group); background: var(--surface); }
.list > li { position: relative; }
.list > li::after { content: ""; position: absolute; left: 16px; right: 0; bottom: 0; height: .5px; background: var(--separator); }
.list::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--surface); }
.row { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 10px 16px; color: inherit; text-decoration: none; transition: background-color .15s; }
a.row:active, label.row:active { background: var(--fill); transition: none; }
.row-main { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.row-title { font-weight: 600; line-height: 1.4; }
.row-sub { font-size: .8125rem; line-height: 1.4; color: var(--label-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-tint { color: var(--tint); }
.chev { flex: none; width: 8px; height: 13px; color: var(--label-3); }
@media (min-width: 760px) { .list.two { display: grid; grid-template-columns: 1fr 1fr; } }

.chip { flex: none; display: inline-flex; align-items: center; justify-content: center; min-width: 2.2em; height: 26px; padding: 0 7px;
  border-radius: var(--r-chip); background: var(--marker); color: var(--marker-ink);
  font-size: .9375rem; font-weight: 700; line-height: 1; font-variant-numeric: lining-nums tabular-nums; }
.likes { flex: none; font-size: .8125rem; color: var(--label-2); font-variant-numeric: lining-nums tabular-nums; }
.likes:empty { display: none; }

.card { padding: 16px 18px; border-radius: var(--r-group); background: var(--surface); }
.pending { margin: 12px 0; padding: 16px 18px; border-radius: var(--r-group); background: var(--surface); color: var(--label-2); }
.note { color: var(--label-2); }

/* ---- search ---- */
.search { position: relative; display: block; }
.search .i-search { position: absolute; left: 12px; top: 50%; width: 17px; height: 17px; margin-top: -8.5px; color: var(--label-2); pointer-events: none; }
.search input { width: 100%; min-height: 44px; padding: 0 14px 0 38px; border: 0; border-radius: var(--r-field); background: var(--fill);
  font-size: 1rem; -webkit-appearance: none; appearance: none; }
.search input::placeholder { color: var(--label-2); opacity: 1; }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }

/* ---- page heads ---- */
.page-head { padding: 20px 0 4px; }
.lede { margin: 8px 0 0; max-width: 36em; color: var(--label-2); }
.foot { max-width: 1080px; margin: 0 auto; padding: 8px 16px 40px; color: var(--label-2); font-size: .8125rem; line-height: 1.6; }
.foot p { margin: 2px 0; }
.foot a { color: var(--label-2); }

/* ---- home ---- */
.hero { display: grid; gap: 24px; align-items: center; padding: 20px 0 30px; }
.hero h1 .t0 { display: block; }
.hero h1 .t1 { display: block; margin-top: 6px; font-size: .58em; font-weight: 600; line-height: 1.3; letter-spacing: .04em; color: var(--label-2); }
.when { display: flex; flex-wrap: wrap; gap: 2px 18px; margin: 16px 0 0; font-weight: 600; }
.when span + span { font-weight: 400; color: var(--label-2); }
.intro { margin: 6px 0 0; max-width: 30em; color: var(--label-2); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 22px 0 0; }
.hero-map { display: block; }
.hero-map svg { display: block; margin: 0 auto; max-height: 70vh; }
@media (min-width: 860px) { .hero.has-map { grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); } }
.schools-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px 24px; padding-top: 8px; }
.schools-head .search { flex: 1 1 240px; max-width: 380px; }
.search-empty { margin: 18px 0 0; }

/* ---- school page ---- */
.s-head { padding: 20px 0 2px; }
.s-region { margin: 0 0 2px; }
.s-head .en { display: block; margin-top: 4px; font-size: clamp(1.0625rem, 4.2vw, 1.3rem); font-weight: 400; line-height: 1.35; color: var(--label-2); }
.react { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 18px 0 4px; }
.like[aria-pressed="true"] { background: var(--marker); color: var(--marker-ink); }
.like .i-like { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.like[aria-pressed="true"] .i-like { fill: currentColor; }
.like-count { font-variant-numeric: lining-nums tabular-nums; }
.like-count:empty { display: none; }
.api-note { flex-basis: 100%; margin: 0; }
.locate { display: grid; gap: 12px; margin: 16px 0 0; }
.loc-no { display: flex; align-items: center; gap: 12px; font-size: .9375rem; color: var(--label-2); font-weight: 400; }
.loc-no .chip { height: auto; padding: 8px 14px; border-radius: 12px; font-size: 2.4rem; }
.loc-room { margin: 12px 0 0; font-weight: 600; }
.loc-hint { margin: 0; color: var(--label-2); }
.loc-card .btn { margin-top: 14px; }
.loc-map { margin: 0; padding: 6px; border-radius: var(--r-group); background: var(--surface); }
@media (min-width: 860px) { .locate:not(.is-pending) { grid-template-columns: minmax(0, .72fr) minmax(0, 1.28fr); align-items: start; } }
.section-title { margin: 34px 0 10px; font-size: 1.375rem; line-height: 1.32; }
.prose { max-width: 40em; }
.prose h3 { margin: 22px 0 4px; font-size: 1.125rem; }
.prose h4 { margin: 18px 0 4px; font-size: 1rem; }
.prose p, .prose ul, .prose ol { margin: 8px 0; }
.prose li + li { margin-top: 4px; }
.prose li.sub { margin-left: 1.2em; }
.prose blockquote { margin: 14px 0; padding: 2px 0 2px 16px; border-left: 3px solid var(--marker); color: var(--label-2); }
.poster img { display: block; width: 100%; max-width: 860px; height: auto; border-radius: var(--r-group); background: var(--surface); }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 36px 0 0; }
.pager a { display: flex; flex-direction: column; justify-content: center; min-height: 64px; padding: 10px 16px; border-radius: var(--r-group);
  background: var(--surface); color: var(--label); text-decoration: none; font-weight: 600; line-height: 1.4; transition: transform .1s ease-out; }
.pager a:active { transform: scale(.98); }
.pager a span { font-size: .8125rem; font-weight: 400; color: var(--label-2); }
.pager .next { align-items: flex-end; text-align: right; }

/* ---- floor drawings ---- */
.iso { display: block; width: 100%; height: auto; }
.iso .slab-top { fill: var(--slab-top); stroke: var(--plan-line); stroke-width: 1.5; stroke-linejoin: round; }
.iso .slab-side { fill: var(--slab-side); }
.iso .area { fill: var(--corridor); stroke: var(--plan-line); stroke-width: 1; }
.iso .area-stairs { fill: var(--stairs); }
.iso .area-wc, .iso .area-lift { fill: var(--wc); }
.iso .area-entrance { fill: var(--entrance); }
.iso .room-shape { fill: var(--room); stroke: var(--plan-line); stroke-width: 1.5; stroke-linejoin: round; }
.iso .room.has-booths .room-shape { fill: var(--room-used); }
.iso .b-t { fill: var(--marker); }
.iso .b-l { fill: var(--marker-2); }
.iso .b-r { fill: var(--marker-3); }
.iso text { font-family: var(--serif); font-variant-numeric: lining-nums; fill: var(--label); paint-order: stroke;
  stroke: var(--halo); stroke-width: 5px; stroke-linejoin: round; pointer-events: none; }
.iso .room-label { font-weight: 600; fill: var(--label-2); }
.iso .area-label { fill: var(--label-3); }
.iso .floor-label { font-weight: 600; fill: var(--label-2); }
.iso .booth-no { font-weight: 700; }
.iso .pulse { display: none; fill: none; stroke: var(--tint); stroke-width: 3; }
.iso .booth.is-target .b-t, .iso .booth.is-target .b-l, .iso .booth.is-target .b-r { fill: var(--tint); }
.iso .booth.is-target .b-l, .iso .booth.is-target .b-r { filter: brightness(.82); }
.iso .booth.is-target .pulse { display: inline; transform-box: fill-box; transform-origin: center; animation: pulse 1.6s ease-out 3 forwards; }
.iso .booth-no.is-target { fill: var(--tint); font-size: 26px; }
@keyframes pulse { from { opacity: .9; transform: scale(.55); } to { opacity: 0; transform: scale(1.5); } }

/* ---- map page ---- */
.map-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin: 16px 0 12px; }
.segmented { display: inline-flex; max-width: 100%; padding: 2px; overflow-x: auto; border-radius: var(--r-field); background: var(--fill); }
.segmented button { min-height: 36px; padding: 0 14px; border: 0; border-radius: 8px; background: transparent; font-size: .9375rem;
  white-space: nowrap; cursor: pointer; transition: background-color .2s, box-shadow .2s; }
.segmented button[aria-pressed="true"] { background: var(--thumb); box-shadow: var(--thumb-shadow); font-weight: 600; }
.map-canvas { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--r-card); background: var(--surface); }
.view { padding: 8px; }
.view:not([hidden]) { animation: view-in .2s ease-out; }
@keyframes view-in { from { opacity: 0; } }
.view-all svg { max-height: 76vh; margin: 0 auto; }
.view-floor svg { min-width: 620px; }
.iso .floor[role="button"], .iso .room.has-booths[role="button"] { cursor: pointer; }
.iso .room.is-open .room-shape { fill: var(--room-open); stroke: var(--label); stroke-width: 3; }
.iso [role="button"]:focus { outline: none; }
.iso .floor[role="button"]:focus-visible .slab-top, .iso .room[role="button"]:focus-visible .room-shape { stroke: var(--tint); stroke-width: 3; }
@media (hover: hover) {
  .iso .floor[role="button"]:hover .slab-top { fill: var(--room-used); }
  .iso .room.has-booths[role="button"]:hover .room-shape { stroke: var(--label-2); stroke-width: 3; }
}

.sheet {
  position: fixed; left: 8px; right: 8px; bottom: 8px; z-index: 40; max-height: 68vh; overflow: auto;
  padding: 6px 16px calc(14px + env(safe-area-inset-bottom)); border-radius: var(--r-card);
  background: var(--sheet); -webkit-backdrop-filter: saturate(180%) blur(24px); backdrop-filter: saturate(180%) blur(24px);
  box-shadow: var(--shadow); will-change: transform;
}
.sheet .list { background: transparent; }
.sheet .list::after { background: transparent; }
.sheet .row { padding-left: 0; padding-right: 0; }
.sheet .list > li::after { left: 0; }
.sheet .list > li:last-child::after { display: none; }
.sheet-grab { display: block; touch-action: none; cursor: grab; }
.sheet-grabber { display: block; width: 36px; height: 5px; margin: 2px auto 8px; border-radius: 3px; background: var(--label-3); opacity: .55; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet-head h2 { font-size: 1.25rem; }
.sheet-hint { margin: 2px 0 4px; font-size: .875rem; color: var(--label-2); }
.sheet-list li.is-target .row-title { color: var(--tint); }
@media (min-width: 860px) {
  .sheet { left: auto; right: 24px; bottom: 24px; width: 380px; }
  .sheet-grabber { display: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .top { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .sheet { background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; }
}

/* ---- voting ---- */
.ballot { min-width: 0; margin: 26px 0 0; padding: 0; border: 0; }
.ballot legend { padding: 0; }
.ballot .note { margin: 2px 0 12px; }
.ballot .search { margin: 0 0 10px; }
.choices .row { cursor: pointer; }
.choices input { position: absolute; opacity: 0; pointer-events: none; }
.check { flex: none; width: 22px; height: 22px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--label-3); transition: background-color .15s, box-shadow .15s; }
.choices input:checked + .check { background: var(--tint); box-shadow: none; }
.choices input:checked + .check::after { content: ""; display: block; width: 6px; height: 11px; margin: 4px 0 0 8px;
  border: solid var(--surface); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }
.choices input:focus-visible + .check { outline: 3px solid var(--marker); outline-offset: 2px; }
.choices li.is-picked .row-title { color: var(--tint); }
.vote-submit {
  position: sticky; bottom: 0; z-index: 5; margin: 16px -16px 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--bar); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
}
.vote-submit .btn { width: 100%; }
@media (min-width: 640px) { .vote-submit .btn { width: auto; min-width: 220px; } }
.vote-submit .picked { margin: 0 0 8px; font-weight: 600; }
.vote-submit .footnote { margin: 8px 0 0; }
.vote-done h2 { margin-bottom: 6px; }

/* ---- results ---- */
.result .row { display: grid; grid-template-columns: minmax(0, 8.5em) minmax(0, 1fr) auto; gap: 12px; }
.bar { height: 10px; border-radius: 5px; background: var(--marker); width: calc(var(--w) * 100%); min-width: 4px; }
.r-n { font-weight: 700; font-variant-numeric: lining-nums tabular-nums; }

@media print {
  body { background: #FFFFFF; }
  .top, .demo-banner, .react, .pager, .sheet { display: none !important; }
}

/* reduced motion: no scaling, sliding or pulsing; colour and opacity changes stay */
@media (prefers-reduced-motion: reduce) {
  .btn, .pager a, .row { transition: none; }
  .btn:active, .pager a:active { transform: none; }
  .view:not([hidden]) { animation: none; }
  .iso .booth.is-target .pulse { animation: none; opacity: .8; }
}
@media (prefers-contrast: more) {
  :root { --separator: rgba(60, 60, 67, .6); --label-2: #3A3A3C; }
  .btn-gray, .search input, .segmented { box-shadow: inset 0 0 0 1px var(--label-2); }
}
