/* ============ TRAD BUDDY — the screens (2026 redesign) ============
   The pieces of the new layout: header, tabs, the level card, tune rows, faces, segmented controls,
   Settings, getting started. One set of rules for every look — each look sets the --u-* variables:
   the 8-bit values are here, Classic and Night set theirs in look-classic.css. */

:root {
  --u-r: 0px; --u-r-sm: 0px; --u-pill-r: 0px;
  --u-bw: 3px; --u-bw-thin: 2px;
  --u-surface: var(--panel); --u-surface2: var(--panel2); --u-paper: var(--bg);
  --u-line: var(--line); --u-line2: var(--line-bright);
  --u-ink: var(--bright); --u-muted: var(--dim);
  --u-accent: var(--gold); --u-accent-ink: var(--gold); --u-on-accent: #2a1f00;
  --u-tint: rgba(242, 201, 76, .12); --u-tint-ink: var(--gold);
  --u-brass-tint: rgba(242, 201, 76, .14); --u-brass-ink: var(--gold);
  --u-avatar: #051509;
  --u-shadow: 0 4px 0 rgba(0, 0, 0, .45);
  --u-font-ui: var(--font-body); --u-font-label: var(--font-px); --u-font-name: var(--font-body);
  --u-fs: 22px; --u-fs-sm: 20px; --u-fs-name: 25px; --u-fs-label: 9px; --u-fs-h1: 14px; --u-fs-h2: 10px; --u-fs-btn: 9px;
  --u-sep: 2px dashed var(--line);
  --u-track: #051509;
}

/* ---------- header: the shamrock and name, you (or Sign in) on the right ---------- */
.hud-top { flex-wrap: nowrap; }
.logo { background: none; border: 0; padding: 0; margin: 0; cursor: pointer; color: inherit; font: inherit; min-height: 44px; text-align: left; }
.hud-btns { align-items: center; }
.hud-me {
  width: 46px; height: 46px; flex: none; padding: 0; cursor: pointer;
  display: grid; place-items: center;
  background: var(--u-avatar); border: var(--u-bw) solid var(--u-line); border-radius: var(--u-r-sm);
}
.hud-me svg { display: block; }
.hud-signin { font-size: var(--u-fs-btn); }
.sidecard { display: none; }
.tab-ico { width: 22px; height: 22px; fill: currentColor; flex: none; }
.tab .tab-ico { filter: none; }

/* ---------- headings, labels, links ---------- */
.viewhead { margin: 0 0 14px; }
.viewhead .view-title { margin-bottom: 4px; }
.viewhead .view-sub { margin: 0; }
.u-label {
  display: block; margin: 0 0 8px;
  font-family: var(--u-font-label); font-size: var(--u-fs-label); line-height: 1.5;
  letter-spacing: .06em; text-transform: uppercase; color: var(--u-muted);
}
.u-h2 { margin: 22px 0 10px; font-family: var(--u-font-label); font-size: var(--u-fs-h2); line-height: 1.4; color: var(--u-ink); }
.u-meta { font-family: var(--u-font-ui); font-size: var(--u-fs-sm); line-height: 1.3; color: var(--u-muted); }
.u-link {
  background: none; border: 0; padding: 8px 2px; min-height: 44px; cursor: pointer;
  font-family: var(--u-font-ui); font-size: var(--u-fs-sm); font-weight: 700; color: var(--u-accent-ink);
  text-decoration: underline; text-underline-offset: 3px;
}
.u-link-red { color: var(--red); }
.u-meta .u-link { min-height: 0; padding: 0; font-size: inherit; }
.u-listhead .u-link { white-space: nowrap; }
.u-listhead { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.u-listhead .u-label, .u-listhead .u-h2 { margin-bottom: 4px; }
.u-chev { width: 22px; height: 22px; flex: none; fill: none; stroke: var(--u-muted); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.u-back {
  display: inline-flex; align-items: center; gap: 4px; min-height: 48px; padding: 0 12px 0 4px;
  background: none; border: 0; cursor: pointer;
  font-family: var(--u-font-ui); font-size: var(--u-fs); font-weight: 700; color: var(--u-accent-ink);
}
.u-back svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.sheet-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 6px; min-height: 48px; }
.sheet-title { margin: 0 0 16px; font-family: var(--u-font-label); font-size: var(--u-fs-h1); line-height: 1.3; color: var(--u-ink); }

/* ---------- avatars and faces ---------- */
.u-av {
  flex: none; width: 48px; height: 48px; display: grid; place-items: center;
  background: var(--u-avatar); border-radius: var(--u-r-sm);
}
.u-av svg { display: block; }
.u-faces { display: inline-flex; align-items: center; flex: none; }
.u-face {
  width: 28px; height: 28px; display: grid; place-items: center; flex: none;
  background: var(--u-avatar); border: 2px solid var(--u-surface); border-radius: 8px;
  overflow: hidden;
}
.u-face + .u-face { margin-left: -7px; }
.u-face svg { display: block; }

.u-face-n { background: var(--u-surface2); color: var(--u-ink); font-family: var(--u-font-ui); font-size: 13px; font-weight: 700; }

/* ---------- a tune as a row ---------- */
.u-rows { display: flex; flex-direction: column; }
.u-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: var(--u-sep); min-height: 64px; }
.u-row:last-child { border-bottom: 0; }
.u-row-main {
  flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; align-items: flex-start;
  background: none; border: 0; padding: 4px 0; cursor: pointer; text-align: left; color: inherit;
}
.u-name { font-family: var(--u-font-name); font-size: var(--u-fs-name); line-height: 1.15; color: var(--u-ink); overflow-wrap: anywhere; }
@media (hover: hover) { .u-row-main:hover .u-name { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; } }
.u-who { display: inline-flex; align-items: center; gap: 8px; font-family: var(--u-font-ui); font-size: var(--u-fs-sm); color: var(--u-muted); }
.u-who .u-face { width: 26px; height: 26px; }
.u-who-r { display: inline-flex; align-items: center; flex: none; }
.u-row.is-rusty .u-name { opacity: .7; }
.u-learn, .u-got { flex: none; white-space: nowrap; }
.u-pill {
  flex: none; display: inline-flex; align-items: center; min-height: 32px; padding: 2px 12px;
  border-radius: var(--u-pill-r); white-space: nowrap;
  font-family: var(--u-font-ui); font-size: var(--u-fs-sm); font-weight: 700;
}
.u-pill-learn { background: var(--u-brass-tint); color: var(--u-brass-ink); }
.u-pill-know { background: var(--u-tint); color: var(--u-tint-ink); }
.show-more { display: block; margin: 12px auto 0; }

/* ---------- the round play button ---------- */
.u-play {
  flex: none; width: 56px; height: 56px; border: 0; cursor: pointer;
  display: grid; place-items: center;
  border-radius: var(--u-pill-r);
  background: var(--u-accent); color: var(--u-on-accent);
  box-shadow: var(--u-shadow);
}
.u-play svg { width: 22px; height: 22px; fill: currentColor; margin-left: 3px; }
.u-play-sm { width: 48px; height: 48px; }
.u-play-sm svg { width: 18px; height: 18px; }

/* ---------- segmented choices (I know · Learning · Rusty, Text size, Look…) ---------- */
.u-seg {
  display: flex; gap: 4px; padding: 4px; margin: 0 0 14px;
  background: var(--u-track); border: var(--u-bw-thin) solid var(--u-line); border-radius: var(--u-r-sm);
}
.u-seg > button {
  flex: 1 1 0; min-width: 0; min-height: 44px; padding: 6px 8px; cursor: pointer;
  background: transparent; border: 0; border-radius: calc(var(--u-r-sm) - 4px);
  font-family: var(--u-font-ui); font-size: var(--u-fs-sm); font-weight: 700; line-height: 1.15; color: var(--u-muted);
}
.u-seg > button[aria-selected="true"], .u-seg > button[aria-checked="true"], .u-seg > button.active {
  background: var(--u-surface); color: var(--u-accent-ink); box-shadow: 0 1px 4px rgba(0, 0, 0, .18);
}

/* ---------- search ---------- */
.u-search {
  display: flex; align-items: center; gap: 10px; min-height: 54px; padding: 0 8px 0 16px; margin: 0 0 14px;
  background: var(--u-surface); border: var(--u-bw-thin) solid var(--u-line2); border-radius: var(--u-r-sm);
}
.u-search svg { width: 22px; height: 22px; flex: none; fill: none; stroke: var(--u-muted); stroke-width: 2; stroke-linecap: round; }
.u-search input {
  flex: 1; min-width: 0; min-height: 48px; border: 0; outline: 0; background: transparent; color: var(--u-ink);
  font-family: var(--u-font-ui); font-size: var(--u-fs);
}
.u-search input::-webkit-search-cancel-button { display: none; }
.u-search:focus-within { border-color: var(--u-accent); }
.u-search-x { width: 44px; height: 44px; flex: none; border: 0; background: none; cursor: pointer; color: var(--u-muted); font-size: 18px; }

/* ---------- Quests ---------- */
.levelcard {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; margin: 0 0 18px;
  cursor: pointer; text-align: left; color: var(--u-ink);
}
.levelcard .u-av { width: 46px; height: 46px; }
.lc-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.lc-line { font-family: var(--u-font-ui); font-size: var(--u-fs-sm); color: var(--u-ink); }
.lc-line b { color: var(--u-brass-ink); }
.lc-bar { display: block; height: 10px; background: var(--u-track); border-radius: 5px; overflow: hidden; }
.lc-fill { display: block; height: 100%; width: 0; background: var(--u-accent); border-radius: 5px; transition: width .4s; }
.keepgoing { display: flex; align-items: center; gap: 12px; padding: 14px 16px; margin: 0 0 16px; }
.kg-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; align-items: flex-start; background: none; border: 0; padding: 0; cursor: pointer; text-align: left; color: inherit; }
.kg-name { font-family: var(--u-font-name); font-size: calc(var(--u-fs-name) + 4px); line-height: 1.12; color: var(--u-ink); }
.quest-session { padding: 14px 16px 6px; margin: 0 0 16px; }
/* the Quests sections: the same heading over each, a rule above it */
.q-head { margin: 26px 0 12px; padding-top: 16px; border-top: var(--u-sep); font-family: var(--u-font-label); font-size: var(--u-fs-h2); line-height: 1.3; color: var(--u-ink); }
.q-head[hidden] { display: none; }
.q-headrow { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 10px 0 8px; padding-top: 16px; border-top: var(--u-sep); }
.q-headrow .q-head { margin: 0; padding: 0; border: 0; }
.q-headrow .u-link { white-space: nowrap; }
.qs-groups { margin: 2px 0 8px; }
.qs-line { margin: 0 0 4px; font-family: var(--u-font-ui); font-size: var(--u-fs-sm); color: var(--u-muted); }
.qs-label { margin: 8px 0; font-family: var(--u-font-ui); font-size: var(--u-fs-sm); color: var(--u-ink); }
#quests-empty .btn { margin: 6px 4px 0; }
.empty-title { font-family: var(--u-font-label); font-size: var(--u-fs-h2); line-height: 1.5; color: var(--u-ink); margin: 0 0 6px; }

/* ---------- My Tunes ---------- */
#tb-seg > button[hidden] { display: none; }
.tb-count { margin: 0 0 4px; }
.tb-keyrow { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; }
.tb-keyrow .u-label { margin: 0; }
.tb-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0 14px; }
.tb-head .u-link { white-space: nowrap; }
.tb-more { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 20px 0 8px; }

/* ---------- Friends ---------- */
.frow .u-chev { margin-left: auto; }

/* ---------- Sets ---------- */
.setgroup-note { margin: -2px 0 14px; }
.set-opts { margin: 4px 0 12px; }
.set-opts summary {
  cursor: pointer; min-height: 44px; display: flex; align-items: center; list-style-position: inside;
  font-family: var(--u-font-ui); font-size: var(--u-fs-sm); font-weight: 700; color: var(--u-accent-ink);
}
.set-opts summary::-webkit-details-marker { display: none; }
.set-opts summary::after { content: ''; width: 9px; height: 9px; margin-left: 10px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-3px); transition: transform .15s; }
.set-opts[open] summary::after { transform: rotate(-135deg) translateX(-3px); }
.set-opts[open] summary { margin-bottom: 8px; }
.friends-actions .fa-btn { min-height: 56px; padding: 10px 12px; }
/* biggest text on a small phone: the two buttons stack rather than squeeze to three lines each */
body[data-ts="3"] .friends-actions { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.set-starts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.set-starts .btn { margin: 0; width: 100%; }
.saved-sets { margin: 18px 0 8px; }
.saved-set { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: var(--u-sep); }
.saved-set:last-child { border-bottom: 0; }
.saved-set-main { flex: 1; min-width: 0; }
.saved-set-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.saved-set-name { font-family: var(--u-font-name); font-size: var(--u-fs-name); color: var(--u-ink); }
.saved-set-actions { display: flex; gap: 14px; flex-wrap: wrap; }
.saved-set-actions .u-link { min-height: 36px; padding: 4px 0; font-weight: 400; font-size: calc(var(--u-fs-sm) - 1px); }
.surprise-row {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; margin: 18px 0 8px;
  cursor: pointer; text-align: left; color: var(--u-ink);
}
.surprise-tx { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.surprise-tx b { font-family: var(--u-font-ui); font-size: var(--u-fs); }
.surprise-tx span { font-family: var(--u-font-ui); font-size: var(--u-fs-sm); color: var(--u-muted); line-height: 1.3; }

/* ---------- Settings ---------- */
.me-head { display: flex; align-items: center; gap: 16px; margin: 4px 0 6px; }
.me-av { width: 84px; height: 84px; flex: none; display: grid; place-items: center; padding: 0; cursor: pointer; background: var(--u-avatar); border: 0; border-radius: calc(var(--u-r-sm) + 6px); }
.me-tx { min-width: 0; }
.me-name { margin: 0; font-family: var(--u-font-label); font-size: var(--u-fs-h1); line-height: 1.2; color: var(--u-ink); overflow-wrap: anywhere; }
.me-tx .u-meta { margin: 2px 0 0; }
.me-tx .u-link { min-height: 36px; padding: 4px 0; }
.me-stats { margin: 0 0 8px; }
.set-sec .u-h2 { margin-top: 20px; }
.ts-seg > button { font-family: var(--u-font-name); }
.ts-a1 { font-size: 18px; } .ts-a2 { font-size: 23px; } .ts-a3 { font-size: 29px; }
.look-seg .look-8bit { font-family: 'Press Start 2P', monospace; font-size: 11px; letter-spacing: 0; }
.set-rows { margin: 22px 0 0; padding: 0 !important; overflow: hidden; }
.u-navrow {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 60px; padding: 8px 14px 8px 16px; cursor: pointer;
  background: none; border: 0; border-bottom: var(--u-sep); text-align: left; color: var(--u-ink);
  font-family: var(--u-font-ui); font-size: var(--u-fs);
}
.u-navrow:last-child { border-bottom: 0; }
.u-navrow > span:first-child { flex: 1; font-weight: 700; }
.u-navrow .u-meta { text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 55%; }
.u-navrow[hidden] { display: none; }
#acct-signedout .btn-big { width: 100%; margin: 8px 0 0; }

/* ---------- forms: fields, password with Show ---------- */
.u-field-label { display: block; margin: 16px 0 6px; font-family: var(--u-font-ui); font-size: var(--u-fs-sm); font-weight: 700; color: var(--u-ink); }
.u-input {
  width: 100%; min-height: 54px; padding: 10px 14px; box-sizing: border-box;
  background: var(--u-surface); color: var(--u-ink);
  border: var(--u-bw-thin) solid var(--u-line2); border-radius: var(--u-r-sm);
  font-family: var(--u-font-ui); font-size: var(--u-fs);
}
.u-input:focus { outline: 0; border-color: var(--u-accent); box-shadow: 0 0 0 3px var(--u-tint); }
.u-pwrow { display: flex; gap: 8px; align-items: stretch; }
.u-pwrow .u-input { flex: 1; min-width: 0; }
.u-pwrow .btn { flex: none; min-width: 72px; margin: 0; }
.u-or { display: flex; align-items: center; gap: 10px; margin: 20px 0 12px; font-family: var(--u-font-ui); font-size: var(--u-fs-sm); color: var(--u-muted); }
.u-or::before, .u-or::after { content: ''; flex: 1; border-top: 1px solid var(--u-line); }

/* ---------- getting started ---------- */
.onboard {
  position: fixed; inset: 0; z-index: 130; overflow-y: auto; overscroll-behavior: contain;
  background: var(--u-paper);
}
.ob-inner { max-width: 520px; min-height: 100%; margin: 0 auto; padding: 12px 20px calc(24px + env(safe-area-inset-bottom, 0px)); box-sizing: border-box; display: flex; flex-direction: column; }
.ob-top { display: flex; align-items: center; justify-content: space-between; min-height: 48px; }
.ob-top .u-back[hidden] { display: none; }
.ob-step { flex: 1; display: flex; flex-direction: column; }
.ob-step[hidden] { display: none; }
.ob-hero { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 14px; padding: 12px 0 20px; }
.ob-brand { display: flex; align-items: center; gap: 12px; margin: 0 0 6px; font-family: var(--font-serif, var(--u-font-label)); font-weight: 700; font-size: 24px; color: var(--u-ink); }
.ob-logo { width: 48px; height: 48px; flex: none; background: url('icons/icon-192.png') center / contain no-repeat; image-rendering: pixelated; border-radius: 10px; }
/* the welcome's tune, on a sheet like a tunebook page */
.ob-tune { background: var(--c-sheet, #FFFDF5); color: var(--c-sheet-ink, #1B1F1C); border: var(--u-bw-thin) solid var(--u-line); border-radius: var(--u-r-sm); padding: 12px 14px 16px; }
.ob-tune-head { display: flex; align-items: center; gap: 12px; margin: 0 0 8px; }
.ob-tune-tx { flex: 1; min-width: 0; margin: 0; display: flex; flex-direction: column; gap: 2px; }
.ob-tune-name { font-family: var(--u-font-name, var(--u-font-label)); font-size: var(--u-fs-name); line-height: 1.2; }
.ob-tune-meta { font-family: var(--u-font-ui); font-size: var(--u-fs-sm); opacity: .72; } /* the sheet's own ink: the sheet is light in every look but Night */
.ob-tune-bars { color: var(--c-sheet-ink, #1B1F1C); }
.ob-h { margin: 8px 0 8px; font-family: var(--u-font-label); font-size: var(--u-fs-h1); line-height: 1.25; color: var(--u-ink); }
.ob-hero .ob-h { font-size: calc(var(--u-fs-h1) + 2px); }
.ob-p { margin: 0 0 10px; font-family: var(--u-font-ui); font-size: var(--u-fs); line-height: 1.45; color: var(--u-muted); }
.ob-foot { margin-top: auto; padding-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.ob-foot .btn { width: 100%; margin: 0; }
/* getting started: which step this is, in words (dots left people wondering) */
.ob-stepno { margin: 6px 0 0; text-align: center; font-family: var(--u-font-ui); font-size: var(--u-fs-sm); color: var(--u-muted); }
.ob-stepno[hidden] { display: none; }
.ob-insts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 8px 0 0; }
.ob-inst {
  display: flex; align-items: center; gap: 10px; min-height: 64px; padding: 8px 10px; cursor: pointer; text-align: left;
  background: var(--u-surface); color: var(--u-ink);
  border: var(--u-bw-thin) solid var(--u-line); border-radius: var(--u-r-sm);
}
.ob-inst .u-av { width: 42px; height: 42px; }
.ob-inst-tx { display: flex; flex-direction: column; min-width: 0; }
.ob-inst-tx b { font-family: var(--u-font-ui); font-size: var(--u-fs-sm); line-height: 1.15; }
.ob-inst[aria-pressed="true"] { border-color: var(--u-accent); background: var(--u-tint); box-shadow: inset 0 0 0 1px var(--u-accent); }
.ob-scan { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; margin: 8px 0 0; }
.ob-scan svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.2; }
.ob-code { text-transform: uppercase; letter-spacing: .12em; font-weight: 700; }
.ob-otp { letter-spacing: .3em; font-weight: 700; font-size: calc(var(--u-fs) + 4px); }
.ob-sign {
  display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 14px 0 0; padding: 14px; text-align: center;
  background: #173B27; border: 4px solid #A97C2A; box-shadow: inset 0 0 0 3px #173B27, inset 0 0 0 5px #E2B44C;
}
.ob-sign[hidden] { display: none; }
.ob-sign-name { font-family: var(--font-serif, var(--u-font-label)); font-weight: 700; font-size: 22px; letter-spacing: .04em; text-transform: uppercase; color: #F2C94C; }
.ob-sign-sub { font-family: var(--u-font-ui); font-size: 16px; color: #F3EAD3; }
.ob-msg { min-height: 1.4em; margin: 10px 0 0; color: var(--u-ink); }
.ob-done { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin: 4px 0 8px; font-family: var(--u-font-ui); font-size: var(--u-fs-sm); }
.ob-done[hidden] { display: none; }
.ob-note { text-align: center; }
#ob-back-form > .btn { width: 100%; margin: 14px 0 0; }

/* ---------- the tune page ---------- */
.detail-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 48px; margin: 0 0 2px; }
.detail-status:empty { display: none; }
.whoplays {
  display: flex; align-items: center; gap: 10px; width: 100%; margin: 4px 0 14px; padding: 10px 12px; cursor: pointer; text-align: left;
  background: var(--u-surface); color: var(--u-ink); border: var(--u-bw-thin) solid var(--u-line); border-radius: var(--u-r-sm);
  font-family: var(--u-font-ui); font-size: var(--u-fs-sm); line-height: 1.3;
}
.whoplays[hidden] { display: none; }
.whoplays:disabled { cursor: default; opacity: 1; }
.whoplays .u-face { width: 30px; height: 30px; }

/* ---------- a friend's profile ---------- */
.fp-head { display: flex; align-items: center; gap: 16px; margin: 0 0 12px; }
.fp-av { flex: none; }
.fp-av .frow-av { width: 84px; height: 84px; border-radius: calc(var(--u-r-sm) + 6px); background: var(--u-avatar); }
.fp-name { margin: 0; font-family: var(--u-font-label); font-size: var(--u-fs-h1); line-height: 1.2; color: var(--u-ink); overflow-wrap: anywhere; }
.fp-id .u-meta { margin: 3px 0 0; }
.fp-id .u-meta[hidden] { display: none; }
.fp-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.fp-tags[hidden] { display: none; }
.fp-tag.u-tag { border: 0; border-radius: var(--u-pill-r); padding: 6px 12px; background: var(--u-tint); color: var(--u-tint-ink); font-weight: 700; }
.fp-tag.u-tag-brass { background: var(--u-brass-tint); color: var(--u-brass-ink); }
.fp-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0 6px; }
.fp-actions .btn { margin: 0; width: 100%; }
.fp-actions .btn[hidden] { display: none; }

/* ---------- a session's page ---------- */
.gp-signwrap { padding: 0; margin: 0 0 14px; }
.gp-head { padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.gp-headrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.gp-headrow .gp-faces { margin: 0; justify-content: flex-start; }
.gp-players { font-weight: 400; text-decoration: none; color: var(--u-muted); }
.gp-players b { color: var(--u-ink); }
.gp-gaplabel { margin: 0 0 6px; font-family: var(--u-font-ui); font-size: var(--u-fs); color: var(--u-ink); }
.gp-head > .btn { width: 100%; margin: 0; }
.gp-surprise { display: flex; align-items: center; justify-content: center; gap: 10px; }
.gp-surprise .u-av { width: 32px; height: 32px; }
.gp-seg { margin-top: 18px; }
.gp-listhead { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.gp-listhead .u-meta:empty { display: none; }

/* ---------- phones: the tabs live at the bottom ---------- */
@media (max-width: 600px) {
  .tab .tab-ico { width: 24px; height: 24px; }
  .set-starts { grid-template-columns: 1fr; }
  .ob-insts { gap: 8px; }
}
@media (max-width: 360px) {
  .ob-insts { grid-template-columns: 1fr; }
  .fp-actions { grid-template-columns: 1fr; }
}

/* ---------- tablet and desktop: the tabs become a side menu ---------- */
@media (min-width: 1000px) {
  body:not(.native) .hud {
    position: fixed; top: 0; bottom: 0; left: 0; width: 240px; z-index: 60; box-sizing: border-box;
    padding: 24px 16px 16px; display: flex; flex-direction: column; gap: 6px; overflow-y: auto;
    border-bottom: 0; border-right: var(--u-bw) solid var(--u-line); box-shadow: none;
  }
  body:not(.native) .hud-top { display: block; margin: 0 0 18px; max-width: none; }
  body:not(.native) .hud-btns { margin-top: 12px; }
  body:not(.native) .hud-me { display: none; }
  body:not(.native) .tabs {
    position: static; display: flex; flex-direction: column; align-items: stretch; gap: 6px;
    max-width: none; margin: 0; padding: 0; background: none; border: 0; box-shadow: none;
  }
  body:not(.native) .tab {
    flex: none; flex-direction: row; justify-content: flex-start; gap: 12px; min-height: 52px; padding: 0 14px;
    margin: 0; transform: none; border-radius: var(--u-r-sm);
  }
  body:not(.native) .tab.active { margin: 0; padding: 0 14px; min-height: 52px; }
  body:not(.native) .tab .count { position: static; margin-left: auto; }
  body:not(.native) .sidecard {
    display: flex; align-items: center; gap: 10px; margin-top: auto; padding: 10px; cursor: pointer; text-align: left;
    background: var(--u-surface); color: var(--u-ink); border: var(--u-bw-thin) solid var(--u-line); border-radius: var(--u-r-sm);
  }
  .sidecard-av { width: 42px; height: 42px; flex: none; display: grid; place-items: center; background: var(--u-avatar); border-radius: 11px; }
  .sidecard-tx { display: flex; flex-direction: column; min-width: 0; font-family: var(--u-font-ui); font-size: var(--u-fs-sm); }
  .sidecard-tx b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sidecard-tx span { color: var(--u-muted); font-size: calc(var(--u-fs-sm) - 2px); }
  body:not(.native) main { margin-left: 240px; max-width: 760px; padding: 32px 36px 48px; }
  body:not(.native) #levelcard { display: none; } /* you're in the side menu */
  /* the pages that open over everything sit beside the menu, not over it */
  body:not(.native) .detail, body:not(.native) .well, body:not(.native) .syncsheet, body:not(.native) .tuneform,
  body:not(.native) .setplayer { left: 240px; }
  body:not(.native) .onboard { left: 0; z-index: 140; }
  /* the player bar centres in the page beside the menu, not on the whole window */
  body:not(.native) .lilt .dock { left: calc(240px + (100% - 240px) / 2); width: min(760px, calc(100% - 272px)); }
  body:not(.native) .lt-count { left: calc(240px + (100% - 240px) / 2); }
}

/* the native app shell: the getting-started screens clear the notch too */
body.native .onboard { padding-top: env(safe-area-inset-top, 0px); }

/* ---------- 8-bit: headings in capitals, in the pixel font ---------- */
html[data-look="8bit"] .view-title, html[data-look="8bit"] .u-h2, html[data-look="8bit"] .q-head, html[data-look="8bit"] .sheet-title,
html[data-look="8bit"] .ob-h, html[data-look="8bit"] .me-name, html[data-look="8bit"] .fp-name,
html[data-look="8bit"] .empty-title, html[data-look="8bit"] .tab-lbl, html[data-look="8bit"] .logo-text,
html[data-look="8bit"] .u-back, html[data-look="8bit"] .badge, html[data-look="8bit"] .u-pill { text-transform: uppercase; }
html[data-look="8bit"] .badge-key { text-transform: none; } /* "Em": a capital M would read as major */
html[data-look="8bit"] .u-back { font-family: var(--font-px); font-size: 10px; }
html[data-look="8bit"] .view-title { color: var(--gold); }
html[data-look="8bit"] .u-h2, html[data-look="8bit"] .q-head { color: var(--green); }
html[data-look="8bit"] .quest-session .q-headrow { margin-top: 0; padding-top: 0; border-top: 0; } /* already in its own box */
html[data-look="8bit"] .ob-h { line-height: 1.6; }
html[data-look="8bit"] .u-pill { font-family: var(--font-px); font-size: 8px; border: 2px solid currentColor; }
html[data-look="8bit"] .u-seg > button[aria-selected="true"], html[data-look="8bit"] .u-seg > button[aria-checked="true"] {
  background: var(--panel2); color: var(--gold); box-shadow: inset 0 0 0 2px var(--gold);
}
html[data-look="8bit"] .u-face, html[data-look="8bit"] .u-av, html[data-look="8bit"] .hud-me { image-rendering: pixelated; }
html[data-look="8bit"] .lc-fill { background: repeating-linear-gradient(to right, var(--green) 0px, var(--green) 6px, #2db968 6px, #2db968 8px); border-radius: 0; }
html[data-look="8bit"] .lc-bar { border: 2px solid var(--line); border-radius: 0; }
html[data-look="8bit"] .u-play { box-shadow: 0 4px 0 var(--gold-dk); }
html[data-look="8bit"] .logo-text { font-size: 12px; }

/* a friend's tunes, as plain rows */
.friend-list.u-rows { gap: 0; }
.friend-list .u-row { background: none; border: 0; border-bottom: var(--u-sep); padding: 8px 0; margin: 0; }
.friend-list .u-row:last-child { border-bottom: 0; }
.fp-stats { flex: none; margin: 0 0 12px; }
.fp-rank { margin: 3px 0 0; }
/* 8-bit: labels are written in normal case now — the pixel look sets them in capitals */
html[data-look="8bit"] .panel-label,
html[data-look="8bit"] .set-card-title,
html[data-look="8bit"] .gp-est,
html[data-look="8bit"] .gp-signsub,
html[data-look="8bit"] .gp-name,
html[data-look="8bit"] .frow-pub .frow-name,
html[data-look="8bit"] .toast,
html[data-look="8bit"] .levelup-title,
html[data-look="8bit"] .levelup-rank,
html[data-look="8bit"] .fp-stat span,
html[data-look="8bit"] .bl-tag,
html[data-look="8bit"] .bl-title,
html[data-look="8bit"] .sub,
html[data-look="8bit"] .scan-title,
html[data-look="8bit"] .avatar-name,
html[data-look="8bit"] .empty-title,
html[data-look="8bit"] .data-summary,
html[data-look="8bit"] .dialog-btns .btn,
html[data-look="8bit"] .lc-line b,
html[data-look="8bit"] .glist summary span,
html[data-look="8bit"] .u-field-label { text-transform: uppercase; }
html[data-look="8bit"] .u-field-label { font-family: var(--font-px); font-size: 9px; }
@media (max-width: 360px) {
  .hud-top { gap: 8px; }
  .hud-btns { gap: 6px; }
}

/* ---------- avatars: initials (Classic, Night) or the pixel instrument (8-bit) ---------- */
.av-in {
  display: none; width: 100%; height: 100%; align-items: center; justify-content: center; border-radius: inherit;
  font-family: var(--u-font-ui); font-weight: 700; line-height: 1; letter-spacing: .02em; color: #FFFFFF;
}
.av-in svg { width: 58%; height: 58%; fill: currentColor; }
.av-in:only-child { display: flex; } /* 8-bit, someone with no instrument: their initials */
html[data-look="8bit"] .av-in { background: #051509; color: var(--gold); font-family: var(--font-px); font-weight: 400; }
html[data-look="classic"] .av-in { display: flex; }
html[data-look="classic"] .av-px { display: none; }
.av-t0 { background: #1F5641; } .av-t1 { background: #7A5413; } .av-t2 { background: #2F5D7C; }
.av-t3 { background: #6B3F69; } .av-t4 { background: #2E6B66; } .av-t5 { background: #8A3B2E; }
html[data-look="classic"] #hud-me, html[data-look="classic"] #lc-av, html[data-look="classic"] #sidecard-av,
html[data-look="classic"] #me-av, html[data-look="classic"] #ob-done-av, html[data-look="classic"] .u-face,
html[data-look="classic"] .frow-av, html[data-look="classic"] .gp-faces .frow-av {
  border-radius: 50%; overflow: hidden; background: transparent; image-rendering: auto;
}
html[data-look="classic"] .u-face { border-radius: 50%; }
html[data-look="classic"] .frow-av { border: 0; }
.ob-inst-label { margin: 18px 0 6px; }
#ob-name-row[hidden] { display: none; }

/* ---------- ▶ quick play on a tune row ---------- */
.u-qplay {
  flex: none; width: 44px; height: 44px; padding: 0 0 0 2px; cursor: pointer;
  display: grid; place-items: center;
  border-radius: 50%; border: var(--u-bw-thin) solid var(--u-line2);
  background: var(--u-surface); color: var(--u-accent-ink);
  font-size: 15px; line-height: 1;
}
@media (hover: hover) { .u-qplay:hover { border-color: var(--u-accent); } }
.u-qplay.playing { background: var(--u-accent); border-color: var(--u-accent); color: var(--u-on-accent); padding: 0; }
html[data-look="8bit"] .u-qplay { border-radius: 0; }
.u-who-in { display: inline-flex; align-items: center; vertical-align: middle; margin-left: 6px; }
.u-who-in .u-face { width: 22px; height: 22px; }

/* a tune's state in a row: plain words with a tick, clearly not a button */
.u-state { flex: none; white-space: nowrap; font-family: var(--u-font-ui); font-size: var(--u-fs-sm); font-weight: 700; padding: 0 2px; }
.u-state-know { color: var(--u-tint-ink); }
.u-state-learn { color: var(--u-brass-ink); }
.detail-status .u-state { font-size: calc(var(--u-fs-sm) + 1px); }
html[data-look="8bit"] .u-state { font-family: var(--font-px); font-size: 8px; text-transform: uppercase; }

/* a tune you don't have yet: "+ Learn" and "✓ I know it" on their own line under the name, big and clear */
.u-row { flex-wrap: wrap; }
.u-row-acts { flex: 1 0 100%; display: flex; gap: 10px; margin: 2px 0 4px; }
.u-row-acts .btn { flex: 0 1 auto; margin: 0; min-height: 44px; }

/* ↑ Top: bottom centre, clear of the buttons down the right of a list */
.top-btn { right: auto; left: 50%; transform: translateX(-50%); }
.top-btn:active { transform: translateX(-50%) translateY(1px); }
@media (min-width: 1000px) {
  body:not(.native) #main-top { left: calc(240px + (100% - 240px) / 2); }
}

/* ---------- who plays a tune (the faces, tapped) ---------- */
.u-who-r, .u-who-line { background: none; border: 0; padding: 4px 2px; cursor: pointer; color: inherit; min-height: 44px; }
.u-who-r { display: inline-flex; align-items: center; flex: none; }
.u-who-line { flex: 1 0 100%; display: flex; justify-content: flex-start; margin: -2px 0 2px; text-align: left; }
@media (hover: hover) { .u-who-r:hover .u-face, .u-who-line:hover span { text-decoration: underline; } }
.whosheet .dialog-box { max-width: 420px; width: calc(100% - 32px); max-height: 80vh; overflow-y: auto; text-align: left; }
.who-title { margin: 0 0 10px; font-family: var(--u-font-label); font-size: var(--u-fs-h2); line-height: 1.3; color: var(--u-ink); }
.who-list { display: flex; flex-direction: column; margin: 0 0 14px; }
.who-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 6px 2px; background: none; border: 0; border-bottom: var(--u-sep); text-align: left; color: var(--u-ink); cursor: pointer; }
.who-row:last-child { border-bottom: 0; }
div.who-row { cursor: default; }
.who-row .u-face { width: 36px; height: 36px; border: 0; }
.who-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; font-family: var(--u-font-ui); font-size: var(--u-fs); }
.whosheet #who-close { width: 100%; margin: 0; }
html[data-look="8bit"] .who-title { text-transform: uppercase; }

/* ---------- the tune page: a link to thesession, the rusty note ---------- */
.thesession-link { display: block; width: fit-content; margin: -4px auto 14px; padding: 8px; text-align: center; font-family: var(--u-font-ui); font-size: var(--u-fs-sm); color: var(--u-accent-ink); }
.thesession-link[hidden] { display: none; }
.detail-note { flex: 1 0 100%; margin: 4px 0 6px; text-align: center; font-family: var(--u-font-ui); font-size: var(--u-fs-sm); line-height: 1.4; color: var(--u-muted); }

/* the tune's name always keeps room to be read; when the row is short of space (big text, small phone)
   ▶ and "In your tunes" / "I know it" drop to the line below instead of squeezing the name */
.u-row-main { flex: 1 1 150px; min-width: 150px; }
.u-row > .u-qplay:first-of-type { margin-left: auto; }

/* ---------- sets: the three to pick from, the line over a set on the tune page ---------- */
.setplayer-head .u-back { margin-left: -4px; }
.setplayer-head #sp-pos[hidden] { display: none; }
.set-card-key { flex: none; font-family: var(--u-font-ui); font-size: var(--u-fs-sm); font-weight: 400; color: var(--u-muted); }
#sp-reroll { min-width: 220px; }
.detail-sethead { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; margin: 0 0 8px; }
.detail-sethead[hidden] { display: none; }
.detail-sethead .u-label { margin: 0; }
.detail-sethead .set-heart { margin: 0; min-width: 0; }
.saved-set { cursor: pointer; }
.group-setlist #group-setlist-play { width: 100%; margin: 8px 0 4px; }
html[data-look="classic"] .gset-tune { min-height: 56px; padding: 8px 2px; gap: 12px; background: none; border: 0; border-bottom: var(--u-sep); }
html[data-look="classic"] .gset li { margin: 0; }
html[data-look="classic"] .gset li:last-child .gset-tune { border-bottom: 0; }
@media (hover: hover) { html[data-look="classic"] .gset-tune:hover .u-name { text-decoration: underline; } }
/* the tune page's Back keeps its name on one line; "In your tunes" gives way instead */
.detail-top .u-back { flex: none; white-space: nowrap; }
.detail-top .detail-status { min-width: 0; text-align: right; }
.detail-top .detail-status .u-state { white-space: normal; }
