/* FamFamU demo. Phones first: every screen is checked at 375 px wide. */
:root {
  --bg: #FDF9F6; --surface: #FFFFFF; --sunken: #F5EEE8; --line: #E7DCD3; --line-strong: #CDBFB3;
  --text: #2B2330; --muted: #6F6475; --brand: #8C1515; --brand-ink: #2E2D29; --brand-soft: #F6E7E4;
  --ok: #2F6B3A; --ok-soft: #E5F1E6; --warn: #8A5A00; --warn-soft: #FBF0D9;
  --radius: 14px; --shadow: 0 1px 2px rgba(43,35,48,.06), 0 4px 16px rgba(43,35,48,.06);
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------------------------------------------------------- top bar and tabs */
.top { position: sticky; top: 0; z-index: 20; background: rgba(253,249,246,.96); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top, 0px); }
.top__in { max-width: 1100px; margin: 0 auto; display: flex; align-items: center; gap: 12px; padding: 10px 16px; }
.wordmark { font-weight: 800; font-size: 1.25rem; letter-spacing: -.02em; color: #8C1515; text-decoration: none; }
.wordmark span { color: #2E2D29; }
.top__me { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: .9rem; color: var(--muted); text-decoration: none; }
.top__me .av { width: 34px; height: 34px; border-radius: 50%; background: var(--sunken); overflow: hidden; border: 1px solid var(--line); }
.tabs { max-width: 1100px; margin: 0 auto; display: flex; gap: 2px; overflow-x: auto; padding: 0 10px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; padding: 8px 10px 10px; text-decoration: none; color: var(--muted); font-size: .92rem; font-weight: 600; border-bottom: 3px solid transparent; white-space: nowrap; }
.tab[aria-current="page"] { color: var(--brand); border-color: var(--brand); }
.tab__s { display: none; }
/* Phones: short labels share the width, so every tab shows without sideways scrolling (checked at 360 px).
   If a tab bar ever overflows anyway, it scrolls with a fade at the right edge (.tabs--more, set by student.js). */
@media (max-width: 640px) {
  .tabs { gap: 0; padding: 0 4px; }
  .tab { flex: 1 1 auto; padding: 8px 4px 10px; font-size: .84rem; text-align: center; }
  .tab__l { display: none; }
  .tab__s { display: inline; }
  .tab b { margin-left: 2px; }
}
.tabs--more { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent); }
.tab b { display: inline-block; min-width: 1.3em; padding: 0 .35em; margin-left: 4px; border-radius: 99px; background: var(--brand); color: #fff; font-size: .72rem; line-height: 1.35em; text-align: center; }

main { max-width: 1100px; margin: 0 auto; padding: 16px 16px 80px; }
h1 { font-size: 1.45rem; line-height: 1.2; margin: 4px 0 6px; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; margin: 0 0 8px; }
h3 { font-size: .95rem; margin: 0 0 6px; }
.lede { color: var(--muted); margin: 0 0 14px; }

/* ---------------------------------------------------------------- controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); font-weight: 600; font-size: .92rem; cursor: pointer; text-decoration: none; color: var(--text); }
.btn:hover { border-color: var(--text); }
.btn--primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn--primary:hover { background: #741010; border-color: #741010; }
.btn--small { min-height: 32px; padding: 4px 10px; font-size: .85rem; border-radius: 8px; }
.btn--ghost { border-color: transparent; background: transparent; color: var(--brand); }
.btn[aria-pressed="true"] { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
/* Connected: a subset of Saved, in its own colour */
.btn[data-connected], .btn[aria-pressed="true"][data-connected] { background: #E3EDF8; border-color: #1F5A8A; color: #1F5A8A; }
.tag.tag--connected { background: #E3EDF8; color: #1F5A8A; }
.connected-note { margin: 14px 0 0; padding: 10px 12px; border-radius: 10px; background: #E3EDF8; color: #1F5A8A; font-weight: 700; text-align: center; }
.btn:disabled { opacity: .5; cursor: default; }
.input, select.input { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); }
.input:focus, .btn:focus-visible, .chip:focus-visible { outline: 3px solid rgba(140,21,21,.25); outline-offset: 1px; border-color: var(--brand); }
textarea.input { min-height: 72px; resize: vertical; }
label.check { display: flex; align-items: flex-start; gap: 8px; font-size: .9rem; padding: 4px 0; cursor: pointer; }
label.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--brand); flex: none; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 6px 11px; border-radius: 99px; border: 1px solid var(--line-strong); background: var(--surface); font-size: .86rem; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.why { display: inline-block; padding: 2px 8px; border-radius: 99px; background: var(--ok-soft); color: var(--ok); font-size: .76rem; font-weight: 600; }
.why--nodata { background: var(--sunken); color: var(--muted); font-weight: 500; }
.tag { display: inline-block; padding: 1px 7px; border-radius: 6px; background: var(--sunken); color: var(--muted); font-size: .75rem; font-weight: 600; }
.tag--warn { background: var(--warn-soft); color: var(--warn); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.note { padding: 10px 12px; border-radius: 10px; background: var(--sunken); font-size: .88rem; color: var(--muted); }
.note--warn { background: var(--warn-soft); color: var(--warn); }
.toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--text); color: #fff; padding: 10px 16px; border-radius: 99px; font-size: .9rem; z-index: 100; box-shadow: var(--shadow); max-width: calc(100vw - 32px); }

/* ---------------------------------------------------------------- selector */
.ways { display: grid; gap: 12px; }
.search { position: relative; }
.search__list { position: absolute; z-index: 15; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px; list-style: none; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: var(--shadow); max-height: 60vh; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
.search__list li { padding: 9px 10px; border-radius: 8px; cursor: pointer; }
.search__list li[aria-selected="true"], .search__list li:hover { background: var(--sunken); }
.search__list .muted { font-size: .82rem; }
.discover { padding: 14px; }
.discover__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.fgroup { border-top: 1px solid var(--line); padding: 12px 0; }
.fgroup:first-of-type { border-top: 0; }
.fgroup > h3 { display: flex; align-items: baseline; gap: 6px; }
.fgroup > h3 small { font-weight: 500; color: var(--muted); font-size: .78rem; }
.frow { display: grid; gap: 8px; margin-top: 8px; }
@media (min-width: 440px) { .frow--2 { grid-template-columns: 1fr 1fr; } }
.jump { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 30; box-shadow: 0 6px 20px rgba(43,35,48,.25); border-radius: 99px; min-height: 46px; padding: 10px 20px; }
@media (min-width: 900px) { .jump { display: none !important; } }
.more { border-top: 1px solid var(--line); }
.more > summary { cursor: pointer; padding: 12px 0; font-weight: 700; color: var(--brand); list-style: none; }
.more > summary::-webkit-details-marker { display: none; }
.more > summary::after { content: " ▾"; }
.more[open] > summary::after { content: " ▴"; }
.results__head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 18px 0 8px; flex-wrap: wrap; }
.count { font-size: 1.1rem; font-weight: 800; }
.rows { display: grid; gap: 10px; }
.row { padding: 12px 14px; display: grid; gap: 6px; }
.row__top { display: flex; gap: 10px; align-items: flex-start; }
.row__name { font-weight: 700; font-size: 1rem; line-height: 1.25; background: none; border: 0; padding: 0; text-align: left; cursor: pointer; color: var(--text); }
.row__name:hover { color: var(--brand); text-decoration: underline; }
.row__facts { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .84rem; color: var(--muted); }
.row__facts b { color: var(--text); font-weight: 600; }
.row__save { margin-left: auto; flex: none; }
.row__why { display: flex; flex-wrap: wrap; gap: 4px; }
.cap-sm { width: 40px; height: 34px; flex: none; }

@media (min-width: 900px) {
  .selector { display: grid; grid-template-columns: 360px 1fr; gap: 20px; align-items: start; }
  .selector .ways { position: sticky; top: 112px; max-height: calc(100vh - 128px); overflow: auto; }
  .results__head { margin-top: 0; }
}

/* ---------------------------------------------------------------- summary card (sheet) */
.sheet { position: fixed; inset: 0; z-index: 50; background: rgba(43,35,48,.45); display: flex; align-items: flex-end; justify-content: center; }
.sheet__panel { background: var(--bg); width: 100%; max-width: 680px; max-height: 94vh; overflow: auto; border-radius: 18px 18px 0 0; padding: 0 16px calc(24px + env(safe-area-inset-bottom, 0px)); overscroll-behavior: contain; }
@media (min-width: 700px) { .sheet { align-items: center; } .sheet__panel { border-radius: 18px; max-height: 90vh; } }
.sheet__bar { position: sticky; top: 0; z-index: 2; background: var(--bg); display: flex; align-items: center; gap: 8px; padding: 12px 0 10px; border-bottom: 1px solid var(--line); }
.sheet__bar .btn--close { margin-left: auto; }
.fc__head { display: flex; gap: 12px; align-items: center; padding: 14px 0 6px; }
.fc__head .cap-lg { width: 72px; height: 62px; flex: none; }
.fc__head h2 { font-size: 1.3rem; margin: 0; line-height: 1.2; }
.fc__sec { padding: 12px 14px; margin-top: 10px; }
.fc__sec h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 8px; }
.fc__sec .fc__sub { margin: 14px 0 4px; font-size: .9rem; text-transform: none; letter-spacing: 0; color: var(--text); }
.fact { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 7px 0; border-top: 1px solid var(--line); }
.fact:first-of-type { border-top: 0; }
.fact__l { font-size: .9rem; }
.fact__v { font-weight: 700; text-align: right; font-size: .95rem; }
.fact__s { grid-column: 1 / -1; font-size: .74rem; color: var(--muted); }
.fact__s a { color: var(--muted); }
.fact--long .fact__v { grid-column: 1 / -1; text-align: left; font-weight: 600; font-size: .9rem; }
.fact--none .fact__v { font-weight: 500; color: var(--muted); font-style: italic; }
.bands { width: 100%; border-collapse: collapse; font-size: .86rem; margin-top: 4px; }
.bands td { padding: 4px 0; border-top: 1px solid var(--line); }
.bands td:last-child { text-align: right; font-weight: 600; }
.bands tr.is-mine td { color: var(--brand); font-weight: 700; }

/* ---------------------------------------------------------------- saved list */
.saved { display: grid; gap: 10px; }
.sv { padding: 12px 14px; display: grid; gap: 8px; }
.sv__top { display: flex; gap: 10px; align-items: center; }
.sv__top .cap-sm { width: 46px; height: 40px; }
.stages { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; background: var(--sunken); border-radius: 10px; padding: 3px; }
.stages button { border: 0; background: transparent; border-radius: 8px; padding: 6px 2px; font-size: .8rem; font-weight: 600; color: var(--muted); cursor: pointer; }
.stages button[aria-pressed="true"] { background: var(--surface); color: var(--brand); box-shadow: var(--shadow); }
.stages.seg { grid-template-columns: repeat(4, 1fr); margin-top: 6px; }
.stages.seg button { padding: 8px 2px; font-size: .78rem; }
.sv--pending { border-style: dashed; border-color: var(--line-strong); background: #FFFDF9; }
.sv__actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- avatar builder (Rig Viewer v6 layout) */
.studio { display: grid; grid-template-rows: auto auto minmax(0, 1fr); height: var(--studio-h, calc(100dvh - 104px)); gap: 8px; }
.studio__stage { position: relative; height: 22dvh; min-height: 130px; display: flex; align-items: center; justify-content: center; background: var(--sunken); border-radius: var(--radius); }
.studio__stage svg { height: 100%; width: auto; max-width: 100%; }
.studio__tools { position: absolute; right: 8px; bottom: 8px; display: flex; flex-direction: column; align-items: stretch; gap: 6px; }
.studio__state { position: absolute; left: 10px; bottom: 8px; font-size: .78rem; color: var(--muted); }
.cats { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px 0; }
.cats::-webkit-scrollbar { display: none; }
.cat { flex: none; padding: 7px 12px; border-radius: 99px; border: 1px solid var(--line-strong); background: var(--surface); font-weight: 600; font-size: .86rem; cursor: pointer; }
.cat[aria-selected="true"] { background: var(--text); color: #fff; border-color: var(--text); }
.cat small { margin-left: 4px; font-size: .72rem; opacity: .8; }
.opts { overflow: auto; overscroll-behavior: contain; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; }
.opts__head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 8px; font-size: .9rem; }
.opts__head span { color: var(--muted); }
.swrow { margin-bottom: 10px; }
.swrow__l { font-size: .8rem; color: var(--muted); margin-bottom: 4px; display: flex; gap: 6px; }
.swrow__l em { font-style: normal; color: var(--text); }
.sws { display: flex; flex-wrap: wrap; gap: 6px; }
.sw { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--line); padding: 2px; background: var(--surface); cursor: pointer; }
.sw i { display: block; width: 100%; height: 100%; border-radius: 50%; }
.sw--big { width: 40px; height: 40px; }
.sw--text { width: auto; padding: 0 10px; border-radius: 99px; font-size: .8rem; font-weight: 600; }
.sw[aria-pressed="true"] { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; }
.opt { display: grid; gap: 2px; padding: 4px; border: 2px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; position: relative; }
.opt[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); }
.opt__img { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; background: var(--sunken); border-radius: 8px; overflow: hidden; }
.opt__img img { width: 100%; height: 100%; object-fit: contain; }
.opt__none { font-size: .78rem; color: var(--muted); }
.opt__l { font-size: .7rem; color: var(--muted); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.opt__tick { position: absolute; top: 4px; right: 6px; color: var(--brand); font-weight: 800; display: none; }
.opt[aria-pressed="true"] .opt__tick { display: block; }
.optcheck { display: flex; align-items: center; gap: 8px; font-size: .88rem; margin: 6px 0 10px; }
@media (min-width: 900px) {
  .studio { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); grid-template-rows: auto minmax(0, 1fr); column-gap: 20px; }
  .studio__stage { grid-row: 1 / span 2; height: auto; }
  .cats { flex-wrap: wrap; }
}

/* ---------------------------------------------------------------- vote page */
.hero { display: flex; gap: 14px; align-items: center; padding: 6px 0 12px; }
.hero__av { width: 96px; height: 101px; flex: none; border-radius: 18px; background: var(--sunken); overflow: hidden; display: flex; align-items: flex-end; justify-content: center; }
.hero__av svg { width: 100%; height: 100%; }
.hero h1 { margin: 0; }
.hero__ask { margin: 6px 0 0; font-size: .95rem; }
.vc { padding: 12px 14px; display: grid; gap: 10px; }
.vc__top { display: flex; gap: 10px; align-items: center; }
.vc__top .cap-sm { width: 50px; height: 44px; }
.vc__name { font-weight: 700; line-height: 1.25; }
.votes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.votes button { min-height: 44px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); font-weight: 600; font-size: .86rem; cursor: pointer; padding: 4px; }
.votes button[aria-pressed="true"][data-v="love"] { background: #E5F1E6; border-color: #2F6B3A; color: #2F6B3A; }
.votes button[aria-pressed="true"][data-v="unsure"] { background: #FBF0D9; border-color: #8A5A00; color: #8A5A00; }
.votes button[aria-pressed="true"][data-v="no"] { background: #F3E6E6; border-color: #7A2E2E; color: #7A2E2E; }
.saved-mark { font-size: .78rem; color: var(--ok); }

/* Help Me Choose: the name step comes first */
.who--step { border: 2px solid var(--brand); }
.who--flash { animation: who-flash 1.6s ease-out; }
@keyframes who-flash { 0%, 40% { box-shadow: 0 0 0 6px rgba(140,21,21,.28); } 100% { box-shadow: var(--shadow); } }
.lockline { margin: 0 0 10px; padding: 8px 12px; border-radius: 10px; background: var(--sunken); color: var(--muted); font-size: .9rem; font-weight: 600; }
#gated.is-locked .vc > :not(.vc__top), #gated.is-locked .vc__top > :not([data-learn]), #gated.is-locked > :not(.saved) { opacity: .45; }
#gated.is-locked .vc__top .cap-sm { filter: grayscale(1); }
#gated.is-locked .votes button, #gated.is-locked .check, #gated.is-locked summary, #gated.is-locked .input { cursor: not-allowed; }

/* ---------------------------------------------------------------- inbox */
.tot { display: flex; gap: 8px; flex-wrap: wrap; font-size: .85rem; }
.tot span { padding: 2px 9px; border-radius: 99px; background: var(--sunken); font-weight: 600; }
.quote { border-left: 3px solid var(--line-strong); padding: 2px 0 2px 10px; font-size: .9rem; }
.quote b { font-weight: 600; }

/* ---------------------------------------------------------------- what colleges see */
.split { display: grid; gap: 14px; }
@media (min-width: 900px) { .split { grid-template-columns: 1fr 1fr; } }
.sample { position: relative; padding: 14px; border: 2px dashed var(--line-strong); }
.sample__tag { position: absolute; top: -11px; left: 12px; background: var(--warn); color: #fff; font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; padding: 2px 8px; border-radius: 6px; }
dl.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0; font-size: .9rem; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; font-weight: 600; }

.empty { text-align: center; padding: 28px 16px; color: var(--muted); }
.center { max-width: 460px; margin: 40px auto; text-align: center; }
