@font-face{font-family:'Inter';font-style:normal;font-weight:100 900;font-display:swap;src:url('/fonts/inter-latin-wght-normal.woff2') format('woff2');}
@font-face{font-family:'Bricolage Grotesque';font-style:normal;font-weight:200 800;font-display:swap;src:url('/fonts/bricolage-grotesque-latin-wght-normal.woff2') format('woff2');}

/* ---------- tokens ---------- */
:root {
  --bg: #181412;
  --surface: #221d19;
  --card: #2a241f;
  --card-hover: #322b25;
  --line: #3b322a;
  --text: #f3ece2;
  --muted: #a3968a;
  --faint: #6f6458;
  --accent: #e8a33d;
  --accent-bright: #f0b454;
  --danger: #d96c5f;
  --ok: #7fb069;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-display: 'Bricolage Grotesque', var(--font-ui);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { color-scheme: dark; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-variant-numeric: tabular-nums;
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}

h1, h2, h3 { font-family: var(--font-display); letter-spacing: -0.02em; font-weight: 700; }

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }

/* stroke icon set */
.icon {
  width: 1.05em;
  height: 1.05em;
  display: inline-block;
  vertical-align: -0.16em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
.icon.gold { color: #f5c542; }
.icon.silver { color: #c0c4ce; }
.icon.bronze { color: #cd8f5a; }
.icon.accent { color: var(--accent-bright); }
.tab-item .icon { width: 22px; height: 22px; }
.auth-logo img { width: 64px; height: 64px; display: block; }
.empty .e-emoji .icon { width: 44px; height: 44px; color: var(--muted); }
.sb-cover .icon { width: 26px; height: 26px; color: var(--muted); }
.cover-die .icon { width: 16px; height: 16px; }
.medal .icon { width: 17px; height: 17px; }
.brand-mark { width: 22px; height: 22px; display: inline-block; vertical-align: -0.22em; }
input, select, textarea { font: inherit; }
a { color: var(--accent-bright); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- nav ---------- */
nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 22px;
  background: rgba(24, 20, 18, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
nav:empty { display: none; }
.brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.035em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand:hover { text-decoration: none; }
.nav-links { display: flex; gap: 4px; }
.nav-link {
  padding: 7px 13px;
  border-radius: 9px;
  color: var(--muted);
  font-weight: 600;
}
.nav-link:hover { color: var(--text); text-decoration: none; }
.nav-link.active { color: var(--text); background: var(--card); }
.nav-spacer { flex: 1; }
.nav-user { color: var(--muted); font-size: 14px; padding: 6px 9px; border-radius: 8px; }
button.nav-user:hover { color: var(--text); background: var(--card); }

/* ---------- layout ---------- */
.container { max-width: 1100px; margin: 0 auto; padding: 28px 22px 80px; }
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.page-head h1 { font-size: 26px; letter-spacing: -0.3px; }
.page-head .sub { color: var(--muted); margin-top: 2px; font-size: 14px; }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 14px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  transition: background 0.15s, transform 0.05s;
}
.btn:hover { background: var(--card-hover); }
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #241a09;
}
.btn-primary:hover { background: var(--accent-bright); }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--card); }
.btn-danger { color: var(--danger); }
.btn-sm { padding: 5px 11px; font-size: 13px; border-radius: 8px; }
.btn[disabled] { opacity: 0.5; cursor: default; }

input[type="text"], input[type="password"], input[type="number"], input[type="url"], input[type="date"], select, textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--faint); }
label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 12px 0 5px; }
select { width: auto; padding: 8px 10px; }

/* ---------- share bar ---------- */
.share-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 22px;
}
.share-bar .share-label { font-weight: 700; font-size: 14px; }
.share-link {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.share-bar.is-private .share-link { opacity: 0.35; text-decoration: line-through; }
.share-spacer { flex: 1; }

/* toggle switch */
.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; }
.switch input { display: none; }
.switch .track {
  width: 38px; height: 22px;
  border-radius: 999px;
  background: var(--line);
  position: relative;
  transition: background 0.15s;
}
.switch .track::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.15s, background 0.15s;
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(16px); background: #241a09; }
.switch .switch-label { font-size: 13px; font-weight: 600; color: var(--muted); }

/* ---------- filter bar ---------- */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.filter-bar .search { flex: 1 1 200px; max-width: 280px; }
.filter-group { display: flex; align-items: center; gap: 5px; }
.filter-group .glabel { font-size: 12px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: 0.5px; margin-right: 3px; }
.chip-btn {
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
.chip-btn:hover { color: var(--text); }
.chip-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #241a09;
}
.segmented {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.segmented button {
  padding: 6px 13px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  background: var(--surface);
}
.segmented button.active { background: var(--card-hover); color: var(--text); }

.result-count { color: var(--faint); font-size: 13px; margin-bottom: 12px; }

/* ---------- game grid & cards ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}
.game-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  transition: transform 0.12s, box-shadow 0.12s, background 0.12s;
  cursor: pointer;
}
.game-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); background: var(--card-hover); }
.cover {
  aspect-ratio: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cover-letter {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 64px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.85);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}
.cover-die {
  position: absolute;
  right: 10px;
  bottom: 8px;
  font-size: 16px;
  opacity: 0.5;
}
.card-body { padding: 11px 13px 13px; }
.card-title {
  font-weight: 700;
  font-size: 14.5px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.6em;
}
.card-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 7px; }
.badge {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-notes {
  margin-top: 7px;
  font-size: 12.5px;
  color: var(--muted);
  font-style: italic;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.badge.loan {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 45%, transparent);
  background: color-mix(in srgb, var(--danger) 10%, transparent);
}
.badge.loan.overdue {
  color: #fff;
  background: var(--danger);
  border-color: var(--danger);
  font-weight: 700;
}
.badge.milestone {
  color: var(--accent-bright);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}
.exp-line {
  display: block;
  margin-top: 8px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--accent-bright);
  text-align: left;
  padding: 0;
}
.exp-line:hover { text-decoration: underline; }
.exp-arrow { color: var(--faint); }
.card-owners { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 8px; }
.owner-chip {
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
  color: var(--c);
  background: color-mix(in srgb, var(--c) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 35%, transparent);
}
.card-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.12s;
}
.game-card:hover .card-actions { opacity: 1; }
.icon-btn {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(24, 20, 18, 0.82);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:hover { background: rgba(24, 20, 18, 0.95); }
.icon-btn.danger:hover { color: var(--danger); border-color: var(--danger); }
.added-date { font-size: 11px; color: var(--faint); margin-top: 7px; }

/* ---------- bottom tab bar (mobile) ---------- */
#tabbar {
  display: none;
  position: fixed;
  top: auto; /* the generic nav rule sets top: 0 — without this it stretches full-screen */
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  gap: 0;
  align-items: stretch;
  background: rgba(24, 20, 18, 0.96);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  border-bottom: none;
  padding: 0 0 env(safe-area-inset-bottom);
}
.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 0 7px;
  font-size: 19px;
  color: var(--muted);
}
.tab-item span { font-size: 10.5px; font-weight: 700; letter-spacing: 0.2px; }
.tab-item.active { color: var(--accent-bright); }

/* ---------- loading skeletons ---------- */
.skel {
  background: linear-gradient(90deg, var(--card) 25%, var(--card-hover) 50%, var(--card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
  border-radius: 10px;
}
@keyframes shimmer { to { background-position: -200% 0; } }
.skel-title { height: 30px; width: 55%; margin: 8px 0 12px; }
.skel-line { height: 15px; margin: 9px 0; }
.skel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-top: 24px; }
.skel-card { aspect-ratio: 1 / 1.4; }

/* ---------- members row ---------- */
.members-wrap { position: relative; margin: 4px 0 18px; }
.members-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.members-fade {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  width: 48px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 2px;
  background: linear-gradient(90deg, transparent, var(--bg) 72%);
  color: var(--accent-bright);
  font-size: 22px;
  font-weight: 800;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}
.member {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 13px 5px 6px;
}
button.member { cursor: pointer; transition: background 0.12s, border-color 0.12s; }
button.member:hover { background: var(--card); }
.member.active {
  border-color: var(--c);
  background: color-mix(in srgb, var(--c) 14%, transparent);
}
.avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--c);
  color: #241a09;
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}
.member .m-name { font-weight: 700; font-size: 13.5px; }
.member .m-count { color: var(--faint); font-size: 12.5px; }

/* ---------- matrix ---------- */
.matrix-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}
table.matrix { border-collapse: collapse; width: 100%; min-width: 480px; }
.matrix th, .matrix td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  text-align: center;
  font-size: 14px;
}
.matrix th { background: var(--surface); font-size: 12.5px; color: var(--muted); position: sticky; top: 0; }
.matrix th:first-child, .matrix td:first-child {
  text-align: left;
  position: sticky;
  left: 0;
  background: var(--card);
  max-width: 260px;
}
.matrix th:first-child { background: var(--surface); }
.matrix tr:last-child td { border-bottom: none; }
.matrix tr:hover td { background: var(--card-hover); }
.matrix .g-title { font-weight: 700; }
.matrix .g-meta { color: var(--faint); font-size: 12px; margin-left: 7px; white-space: nowrap; }
.matrix .check { font-weight: 800; font-size: 15px; }
.matrix th .dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 6px;
}

/* ---------- lists (crews) ---------- */
.tile-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.tile {
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  color: var(--text);
  transition: transform 0.12s, box-shadow 0.12s;
}
.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow); text-decoration: none; }
.tile h3 { font-size: 17px; margin-bottom: 4px; }
.tile .tile-sub { color: var(--muted); font-size: 13.5px; }
.code-chip {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 700;
  letter-spacing: 2px;
  background: var(--bg);
  border: 1px dashed var(--faint);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 13px;
  color: var(--accent-bright);
}
.big-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: 8px;
  color: var(--accent-bright);
  text-align: center;
  padding: 18px 10px;
  background: var(--bg);
  border: 1px dashed var(--faint);
  border-radius: 12px;
  margin: 14px 0;
}

/* ---------- side-by-side forms ---------- */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.panel h3 { font-size: 15px; margin-bottom: 4px; }
.panel .panel-sub { color: var(--muted); font-size: 13px; margin-bottom: 10px; }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(10, 8, 7, 0.7);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 7vh 16px 16px;
  overflow-y: auto;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  width: 100%;
  max-width: 560px;
  box-shadow: var(--shadow);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 14px 10px 20px;
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  border-radius: 16px 16px 0 0;
}
.modal-head h2 { font-size: 19px; }
.modal-close {
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
  min-width: 44px;
  min-height: 44px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card);
}
.modal-close .icon { width: 19px; height: 19px; vertical-align: middle; }
.modal-close:hover { color: var(--text); background: var(--card-hover); }
.modal-body { padding: 14px 20px 20px; }

/* tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tab {
  padding: 9px 14px;
  font-weight: 700;
  font-size: 14px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab.active { color: var(--accent-bright); border-bottom-color: var(--accent); }

/* owner picker in add modal */
.owner-pick {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin: 0 0 14px;
  padding: 10px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
}

/* owners modal rows */
.owner-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 8px;
}
.owner-row:hover { background: var(--card); }
.owner-row .owner-main { display: flex; align-items: center; gap: 11px; flex: 1; cursor: pointer; min-width: 0; }
.owner-row input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--accent); }
.owner-row .m-name { font-weight: 700; font-size: 14px; }
.owner-row select.loc { width: auto; max-width: 46%; font-size: 13px; padding: 6px 8px; }
.owner-row select.loc:disabled { opacity: 0.35; }

/* game detail modal */
.gd-top { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 8px; }
.gd-cover {
  width: 124px;
  height: 124px;
  border-radius: 12px;
  overflow: hidden;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gd-cover img { width: 100%; height: 100%; object-fit: cover; }
.gd-meta { flex: 1; min-width: 0; padding-top: 4px; }
.gd-desc {
  white-space: pre-line;
  color: var(--text);
  opacity: 0.92;
  font-size: 14.5px;
  line-height: 1.6;
  max-height: 38vh;
  overflow-y: auto;
  margin: 10px 0 4px;
}
.gd-makers { color: var(--muted); font-size: 13px; line-height: 1.45; margin-top: 9px; }
.gd-links { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
/* BGG attribution — required by the BGG API approval, shown wherever their data surfaces */
.gd-attribution { margin-top: 12px; font-size: 11.5px; letter-spacing: 0.3px; }
.gd-attribution a { color: var(--faint); text-decoration: none; }
.gd-attribution a:hover { color: var(--muted); text-decoration: underline; }
/* Phase 2 expansion-finder: missing-expansion list in the detail modal */
.gd-expansions { margin: 14px 0 4px; }
.gd-expansions h3 {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 4px;
}
.exp-miss {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  color: var(--text);
  text-decoration: none;
  padding: 5px 0;
  border-bottom: 1px solid var(--line);
}
.exp-miss:last-child { border-bottom: 0; }
.exp-miss:hover { color: var(--accent-bright); }
.exp-miss .icon { width: 13px; height: 13px; color: var(--faint); margin-left: auto; flex: none; }
.exp-more { color: var(--muted); font-weight: 600; }
.exp-wish {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-radius: 999px;
  padding: 1px 6px;
}

/* score inputs in the log-play modal (hidden until the Scores toggle) */
.owner-row input.lp-score {
  display: none;
  width: 76px;
  height: auto;
  flex: none;
  text-align: right;
  padding: 8px 10px;
}
#lp-players.show-scores .owner-row input.lp-score { display: block; }
#lp-players.show-scores .lp-won-txt { display: none; }

/* owners-modal due-date line (scoped: log-play rows must stay single-line) */
#owner-rows .owner-row { flex-wrap: wrap; }
.owner-row .due-wrap {
  flex: 1 1 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}
.owner-row .due-wrap input { flex: 1; padding: 7px 10px; }

/* who-has-what loan chip */
.matrix .m-loan {
  display: inline-block;
  margin-left: 5px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}
.matrix .m-loan.overdue { color: var(--danger); }

/* play heatmap */
.hm-scroll { overflow-x: auto; padding: 4px 0; }
.hm-grid {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(7, 11px);
  grid-auto-columns: 11px;
  gap: 3px;
  width: max-content;
}
.hm-cell { width: 11px; height: 11px; border-radius: 2.5px; background: var(--card); }
.hm-cell.l1 { background: color-mix(in srgb, var(--accent) 30%, var(--card)); }
.hm-cell.l2 { background: color-mix(in srgb, var(--accent) 55%, var(--card)); }
.hm-cell.l3 { background: color-mix(in srgb, var(--accent) 78%, var(--card)); }
.hm-cell.l4 { background: var(--accent-bright); }

/* nemesis line under a standings name */
.nemesis-line { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

/* detail-modal stat tiles + loan history */
.gd-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
  margin: 12px 0 6px;
}
.gd-tile {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 11px;
}
.gd-num { font-weight: 800; font-size: 15.5px; }
.gd-lbl { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.gd-loans { margin: 12px 0 4px; }
.gd-loans h3 {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 6px;
}

/* leaderboard */
.stats-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 18px;
}
.stats-blurb { color: var(--muted); font-size: 14px; font-weight: 600; }
.stats-section { margin-bottom: 28px; }
.stats-section h3 {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 10px;
}
.medal { display: inline-block; width: 22px; }

/* Phase 3: Makers view + maker profile modal */
.maker-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; }
/* the maker board is a simple Designer|Games table — drop .matrix's 480px min-width
   (meant for the dense "who has what" matrix) so it fits a phone without overflowing */
.maker-board table.matrix { min-width: 0; }
.maker-board tbody tr { cursor: pointer; }
.maker-board tbody td { height: 40px; }
.maker-board tbody tr:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.maker-link {
  display: inline; padding: 0; color: var(--muted); font: inherit;
  text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 2px;
}
.maker-link:hover { color: var(--accent-bright); text-decoration-color: var(--accent); }
.mk-games { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
.mk-game { display: flex; flex-direction: column; gap: 6px; text-align: left; padding: 0; }
.mk-cover {
  aspect-ratio: 1; border-radius: 10px; overflow: hidden; position: relative;
  display: flex; align-items: center; justify-content: center;
}
.mk-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.mk-cover .cover-letter { color: #fff; font-weight: 800; font-size: 24px; }
.mk-title { font-size: 12px; font-weight: 600; color: var(--text); line-height: 1.3; }
.mk-more { display: flex; flex-direction: column; }
@media (max-width: 640px) { .maker-cols { grid-template-columns: minmax(0, 1fr); gap: 8px; } }
.lp-won { flex: none; }
.lp-won:disabled { opacity: 0.3; cursor: default; }

/* packed toggle (static/offline page) */
.pack-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(24, 20, 18, 0.82);
  border: 1px solid var(--line);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pack-btn.on { background: var(--accent); border-color: var(--accent); }

/* surprise banner (game night picker) */
.surprise-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
  margin-bottom: 16px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  background: color-mix(in srgb, var(--accent) 9%, transparent);
  border-radius: var(--radius);
}
.sb-cover {
  width: 54px;
  height: 54px;
  border-radius: 10px;
  overflow: hidden;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  background: var(--card);
}
.sb-cover img { width: 100%; height: 100%; object-fit: cover; }
.sb-body { flex: 1; min-width: 0; }
.sb-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); }
.sb-title { font-size: 18px; font-weight: 800; line-height: 1.25; }
.sb-meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.sb-actions { display: flex; gap: 8px; align-items: center; }

/* search results in add modal */
.search-results { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; max-height: 330px; overflow-y: auto; }
.r-thumb { width: 42px; height: 42px; border-radius: 8px; object-fit: cover; flex: none; background: var(--bg); }
.result-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.result-row .r-title { font-weight: 700; font-size: 14px; }
.result-row .r-year { color: var(--faint); font-weight: 400; margin-left: 5px; }
.result-row .r-meta { color: var(--muted); font-size: 12.5px; }
.result-row .r-grow { flex: 1; min-width: 0; }
.result-row.added { opacity: 0.55; }
.search-hint { color: var(--faint); font-size: 13px; margin-top: 10px; text-align: center; }

/* ---------- auth ---------- */
.auth-wrap { display: flex; align-items: center; justify-content: center; min-height: 92vh; padding: 20px; }
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 30px 28px;
  box-shadow: var(--shadow);
}
.auth-logo { text-align: center; font-size: 44px; }
.auth-card h1 { text-align: center; font-size: 24px; margin: 6px 0 2px; font-weight: 800; letter-spacing: -0.035em; }
.auth-tag { text-align: center; color: var(--muted); font-size: 14px; margin-bottom: 18px; }
.form-error {
  color: var(--danger);
  font-size: 13.5px;
  font-weight: 600;
  margin-top: 12px;
  min-height: 1.2em;
}
.auth-card .btn { width: 100%; justify-content: center; margin-top: 16px; }

/* ---------- empty states ---------- */
.empty {
  text-align: center;
  padding: 70px 20px;
  color: var(--muted);
}
.empty .e-emoji { font-size: 46px; margin-bottom: 10px; }
.empty h2 { color: var(--text); font-size: 19px; margin-bottom: 6px; }
.empty p { max-width: 420px; margin: 0 auto 18px; font-size: 14.5px; }

/* ---------- misc ---------- */
.public-banner {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  color: var(--accent-bright);
  font-size: 13.5px;
  font-weight: 600;
  padding: 9px 14px;
  border-radius: 10px;
  margin-bottom: 18px;
}
.public-footer { text-align: center; margin-top: 50px; color: var(--muted); font-size: 14px; }
.stats-line { color: var(--muted); font-size: 13.5px; margin: -6px 0 16px; }

#toast-root { position: fixed; bottom: 26px; left: 0; right: 0; z-index: 200; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  background: #0f0d0b;
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ---------- mobile ---------- */
@media (max-width: 640px) {
  .two-col { grid-template-columns: 1fr; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .page-head h1 { font-size: 22px; }
  .page-head { gap: 10px; }
  nav { padding: 10px 14px; gap: 10px; }
  .container { padding: 18px 14px 96px; }

  /* hide verbose labels on small screens — icons carry the meaning */
  .seg-txt { display: none; }

  /* bottom tabs replace top-nav links and account on phones */
  #tabbar:not(:empty) { display: flex; }
  .nav-links, .nav-user { display: none; }
  #toast-root { bottom: 86px; }
  .skel-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }

  /* 16px stops iOS Safari from auto-zooming focused inputs */
  input[type="text"], input[type="password"], input[type="number"], input[type="url"], input[type="date"], select, textarea { font-size: 16px; }

  /* comfortable touch targets */
  .btn { padding: 10px 16px; }
  .btn-sm { padding: 7px 12px; }
  .chip-btn { padding: 9px 14px; }
  .icon-btn { width: 38px; height: 38px; font-size: 15px; }
  .card-actions { gap: 8px; }
  .exp-line { padding: 7px 0; }
  .nav-user { min-height: 40px; }

  .filter-bar { gap: 8px; }
  .filter-bar .search { max-width: none; flex: 1 1 110px; min-width: 0; }
  .segmented button { padding: 9px 10px; }

  .share-bar { gap: 8px; }
  .share-link { display: none; }

  .members-row {
    gap: 7px;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    scrollbar-width: none;
  }
  .members-row::-webkit-scrollbar { display: none; }
  .member { flex: none; padding: 6px 12px 6px 6px; }
  .matrix th, .matrix td { padding: 8px 10px; font-size: 13px; }
  .big-code { font-size: 26px; letter-spacing: 5px; }
  .modal-backdrop { padding: 10px 8px; }
  .modal-body { padding: 12px 14px 16px; }
  .modal-head { padding: 12px 12px 10px 16px; }
  .cover-letter { font-size: 48px; }
}

/* touch devices have no hover — keep card actions visible */
@media (hover: none) {
  .card-actions { opacity: 1; }
}

/* ===== backlog pack: wishlists, nights, requests, tags, picker ===== */

.section-h {
  font-size: 17px;
  margin: 26px 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-h .count { color: var(--faint); font-weight: 500; font-size: 14px; }

.badge.grabs { background: rgba(127, 176, 105, 0.14); color: #a6cf91; border-color: rgba(127, 176, 105, 0.35); }
.badge.exp-avail { color: var(--accent-bright); background: color-mix(in srgb, var(--accent) 12%, transparent); border-color: color-mix(in srgb, var(--accent) 42%, transparent); }
/* gamer-profile "Fits" badges — green = great, amber = good, then muted/faint */
.badge.fit-great { background: rgba(127, 176, 105, 0.16); color: #a6cf91; border-color: rgba(127, 176, 105, 0.4); }
.badge.fit-good { color: var(--accent-bright); background: color-mix(in srgb, var(--accent) 12%, transparent); border-color: color-mix(in srgb, var(--accent) 42%, transparent); }
.badge.fit-ok { color: var(--muted); }
.badge.fit-stretch { color: var(--faint); opacity: 0.85; }
.icon-btn.gotit { color: #a6cf91; }

/* account-tab notification badge */
.tab-item { position: relative; }
.tab-badge {
  position: absolute;
  top: 4px;
  right: calc(50% - 21px);
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--danger, #e07a5f);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.link-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 13.5px;
  margin-top: 12px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.link-btn:hover { color: var(--text); }

.acct-h { font-size: 15px; margin-top: 22px; display: flex; align-items: center; gap: 7px; }
.req-actions { display: flex; gap: 8px; margin-top: 8px; align-items: center; flex-wrap: wrap; }
.req-actions .req-due { width: 142px; margin: 0; font-size: 13px; padding: 7px 8px; }
.badge.req-approved { background: rgba(127, 176, 105, 0.14); color: #a6cf91; border-color: rgba(127, 176, 105, 0.35); }
.badge.req-declined, .badge.req-canceled { opacity: 0.65; }

/* game nights */
.event-card {
  display: flex;
  gap: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius, 14px);
  padding: 16px;
  margin-bottom: 14px;
}
.event-card.tonight { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.ev-date {
  flex: none;
  width: 64px;
  height: 78px;
  border-radius: 12px;
  background: var(--bg, #181412);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
}
.ev-dow { font-size: 11px; letter-spacing: 1px; color: var(--accent); font-weight: 700; }
.ev-day { font-size: 26px; font-weight: 800; line-height: 1; }
.ev-mon { font-size: 12px; color: var(--muted); }
.ev-body { flex: 1; min-width: 0; }
.ev-title { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ev-edit { margin-left: auto; }
.ev-rsvp { display: flex; gap: 8px; margin-top: 12px; align-items: center; flex-wrap: wrap; }
.ev-rsvp .chip-btn.active {
  background: rgba(232, 163, 61, 0.13);
  border-color: var(--accent);
  color: var(--accent-bright);
}
.ev-in-row { display: inline-flex; margin-left: 4px; }
.ev-in-row .avatar { width: 24px; height: 24px; font-size: 10px; margin-left: -6px; border: 2px solid var(--card); color: #1d1812; }
.ev-votes { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.vote-row { display: flex; align-items: center; gap: 10px; width: 100%; }
.vote-row .vote { flex: none; }
.vote-row .chip-btn.active {
  background: rgba(232, 163, 61, 0.13);
  border-color: var(--accent);
  color: var(--accent-bright);
}
.vote-thumb { width: 30px; height: 30px; border-radius: 6px; object-fit: cover; flex: none; }
.vote-title { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sg-wrap { width: 100%; }
.sg-wrap .sg-q { margin-top: 6px; }

/* tags */
.gd-tags { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin: 4px 0 10px; }
.gd-tags .glabel { color: var(--faint); }
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 6px 4px 11px;
  font-size: 13px;
}
.tag-chip button { color: var(--faint); display: inline-flex; padding: 2px; border-radius: 50%; }
.tag-chip button:hover { color: var(--text); }
.tag-chip button .icon { width: 13px; height: 13px; }
#gd-tag-new { width: 130px; margin: 0; font-size: 13.5px; padding: 6px 10px; }
.gd-borrow { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 12px; }

/* activity feed */
.act-row { display: flex; align-items: baseline; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.act-row:last-child { border-bottom: none; }
.act-icn { color: var(--faint); flex: none; transform: translateY(2px); }
.act-txt { flex: 1; min-width: 0; color: var(--muted); }
.act-txt strong { color: var(--text); font-weight: 600; }
.act-ago { color: var(--faint); font-size: 12.5px; flex: none; }

/* first-player picker */
.fp-stage {
  margin: 18px 0 14px;
  min-height: 84px;
  border-radius: 14px;
  border: 1px dashed var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 800;
  gap: 10px;
  padding: 10px;
  text-align: center;
}
.fp-stage.winner { border-style: solid; border-color: var(--accent); background: rgba(232, 163, 61, 0.07); }

@media (max-width: 640px) {
  .event-card { padding: 13px; gap: 11px; }
  .ev-date { width: 56px; height: 70px; }
  .ev-day { font-size: 22px; }
  .req-actions .req-due { width: 128px; }
}

/* ===== play pack: live mode, coop, durations, expansion stats ===== */

.live-strip { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.live-strip:empty { display: none; }
.live-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  min-height: 44px;
  border-radius: var(--radius);
  border: 1px solid rgba(232, 163, 61, 0.55);
  background: rgba(232, 163, 61, 0.1);
  cursor: pointer;
}
.live-banner:hover { background: rgba(232, 163, 61, 0.16); }
.live-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-bright);
  flex: none;
  animation: live-pulse 1.6s ease-in-out infinite;
}
@keyframes live-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(232, 163, 61, 0.55); }
  50% { box-shadow: 0 0 0 7px transparent; }
}
.live-banner .lb-body { flex: 1; min-width: 0; }
.live-banner .lb-title { font-weight: 800; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-banner .lb-meta { color: var(--muted); font-size: 12.5px; }
.live-banner .lb-elapsed {
  margin-left: auto;
  flex: none;
  font-family: ui-monospace, Menlo, monospace;
  font-weight: 700;
  font-size: 15px;
  color: var(--accent-bright);
}
.live-banner .lb-elapsed.stale { color: var(--danger); }

.live-timer {
  text-align: center;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 40px;
  font-weight: 800;
  letter-spacing: 2px;
  margin: 6px 0 14px;
  font-variant-numeric: tabular-nums;
}
.lv-stepper { display: flex; align-items: center; gap: 6px; }
.lv-stepper button {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 20px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.lv-stepper button:active { background: var(--card-hover); }
.lv-stepper input.lv-score { width: 64px; text-align: center; font-size: 16px; padding: 9px 6px; }
#lv-players .owner-row { flex-wrap: nowrap; }
#lv-players .owner-main { overflow: hidden; }
#lv-players .m-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

/* coop result chips (log modal + live finish) */
#lp-players.coop-mode .lp-won { display: none; }
#lp-coop { margin: 2px 0 6px; }
.lp-coop-win.active { background: rgba(127, 176, 105, 0.14); border-color: var(--ok); color: var(--ok); }
.lp-coop-loss.active { background: rgba(217, 108, 95, 0.12); border-color: var(--danger); color: var(--danger); }

/* expansion usage line in the game detail modal */
.gd-exp-usage { color: var(--muted); font-size: 12.5px; margin: 0 0 8px; }

@media (max-width: 640px) {
  .live-timer { font-size: 34px; }
  .lv-stepper { gap: 4px; }
}

/* ===== player layer: person tagging, players leaderboard, household mgmt ===== */

.owner-block { margin-bottom: 8px; }
.owner-block > .owner-row { margin-bottom: 0; }
.person-pick { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 2px 2px 40px; }
.person-pick[hidden] { display: none; } /* display:flex beats the UA [hidden] rule */
.person-chip.active {
  background: rgba(232, 163, 61, 0.13);
  border-color: var(--c, var(--accent));
  color: var(--c, var(--accent-bright));
}
.person-chip.retired { opacity: 0.7; font-style: italic; }
#lp-players .person-row { margin: 6px 0 0 28px; padding: 7px 12px; }
#lp-players .person-row .m-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person-band { width: 4px; align-self: stretch; min-height: 26px; border-radius: 2px; background: var(--c); flex: none; }
#lp-players .owner-row.has-people .lp-won { display: none; } /* people take over the crown */
#lp-players.show-scores .owner-row.has-people input.lp-score { display: none; } /* matches the show rule's specificity */
#lv-players .person-row .owner-main { gap: 11px; }
#lv-crowns .chip-btn { box-shadow: inset 3px 0 0 var(--c); } /* household band survives the active fill */
.hh-retired { opacity: 0.6; }
.stats-head { flex-wrap: wrap; }

/* player-layer review fixes */
.hh-tag { color: var(--faint); font-weight: 600; font-size: 11px; }
#hh-list .m-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#hh-list .avatar { flex: none; }
@media (max-width: 640px) {
  .person-chip, .lp-won, #grain-seg button { min-height: 44px; }
}

/* ===== player profiles ===== */

/* the Players-board row IS the tap target — full row, >=44px (td height acts
   as min-height). No role="button" on the tr: that would strip the standings
   cells from the accessibility tree (children-presentational + label override). */
#player-board tbody tr { cursor: pointer; }
#player-board tbody td { height: 44px; }
#player-board tbody tr:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
/* WebKit never paints outlines on table-row boxes — draw the ring on the cells */
#player-board tbody tr:focus-visible td { box-shadow: inset 0 2px 0 var(--accent), inset 0 -2px 0 var(--accent); }

/* modal header: color avatar + person name + household tag on one shrinkable line */
.pp-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pp-head .avatar { flex: none; }
.pp-head .pp-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pp-head .hh-tag { flex: none; font-size: 12px; max-width: 35%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* per-game table: narrower than the base matrix so phones see numbers, not just titles */
#pp-games table.matrix { min-width: 420px; }
#pp-games th:first-child, #pp-games td:first-child { max-width: 150px; }
#pp-games td:first-child .g-title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* head-to-head rows */
.pp-h2h .avatar { flex: none; }
.pp-rec { font-weight: 800; font-size: 14.5px; font-variant-numeric: tabular-nums; flex: none; }

/* standalone meta lines (retired note, empty H2H) — the global .r-meta rule
   is scoped under .result-row and never reaches these */
#pp-body .r-meta { color: var(--muted); font-size: 12.5px; }

/* ===== bg stats import ===== */
.imp-wrap { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.imp-wrap input[type="file"] { font-size: 13px; color: var(--muted); }
.imp-done { color: var(--accent-bright); font-size: 13px; margin-top: 8px; line-height: 1.5; }

/* ===== pwa: standalone safe areas ===== */
#nav { padding-top: calc(12px + env(safe-area-inset-top, 0px)); } /* id beats the element rule; #tabbar's own padding shorthand is untouched */
.modal-backdrop { padding-top: calc(7vh + env(safe-area-inset-top, 0px)); }
@media (max-width: 640px) {
  /* the id selector outranks the element rules inside media queries too —
     every base value the #nav rule overrides needs its mobile companion */
  #nav { padding-top: calc(10px + env(safe-area-inset-top, 0px)); }
  .modal-backdrop { padding-top: calc(10px + env(safe-area-inset-top, 0px)); }
  #toast-root { bottom: calc(86px + env(safe-area-inset-bottom, 0px)); }
}

/* ---------- gamer profiles ---------- */
/* Profiles sub-view: a card per crew person */
.gp-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.gp-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.gp-card:hover { background: var(--card-hover); border-color: var(--accent); }
.gp-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.gp-card-blank { cursor: default; }
.gp-card-blank:hover { background: var(--card); border-color: var(--line); }
.gp-card-head { display: flex; align-items: center; gap: 10px; }
.gp-card-id { flex: 1; min-width: 0; }
.gp-card-name { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 6px; }
.gp-edit { flex: none; }
.gp-bartle { margin-top: 9px; font-weight: 700; font-size: 13px; color: var(--accent-bright); }
.gp-card-snap { margin-top: 4px; color: var(--muted); font-size: 13px; }
.gp-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.gp-tag {
  font-size: 11.5px; font-weight: 600; color: var(--muted);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; padding: 2px 9px;
}
.gp-cluster { margin-top: 10px; font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.gp-cluster-lg { font-size: 14px; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; margin: 14px 0 4px; }

/* Profile modal: snapshot + score bars + themes */
.gp-snap { margin-bottom: 12px; }
.gp-meta-lines { display: flex; flex-direction: column; gap: 5px; font-size: 14px; }
.gp-meta-lines svg { width: 15px; height: 15px; vertical-align: -2px; color: var(--faint); margin-right: 5px; }
.gp-bars { display: flex; flex-direction: column; gap: 7px; }
.gp-bar { display: grid; grid-template-columns: 130px 1fr 22px; align-items: center; gap: 10px; }
.gp-bar-l { font-size: 13px; font-weight: 600; }
.gp-bar-track { height: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.gp-bar-fill { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.gp-bar-v { font-size: 12.5px; font-weight: 700; color: var(--muted); text-align: right; }
.gp-themes { display: flex; flex-wrap: wrap; gap: 7px; }
.gp-theme { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px 4px 5px; }
.gp-theme-n { display: inline-flex; align-items: center; justify-content: center; width: 19px; height: 19px; border-radius: 50%; background: var(--accent); color: #241a09; font-size: 11.5px; font-weight: 800; }

/* Questionnaire editor */
.pe-section { margin-bottom: 18px; }
.pe-q { margin-bottom: 14px; }
.pe-label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; }
.pe-in { width: 100%; }
textarea.pe-in { resize: vertical; min-height: 38px; font: inherit; }
.pe-scale { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.pe-scale-end { font-size: 11.5px; color: var(--faint); }
.pe-scale-b { min-width: 34px; text-align: center; }
.pe-multi { display: flex; flex-wrap: wrap; gap: 6px; }
.pe-rank { display: flex; flex-direction: column; gap: 6px; }
.pe-rank-row { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 7px 10px; }
.pe-rank-lbl { flex: 1; font-size: 13.5px; font-weight: 600; }
.pe-rank-btns { display: flex; gap: 2px; flex: none; }
.pe-rank-btns .icon-btn { font-size: 12px; line-height: 1; }
.pe-actions { position: sticky; bottom: 0; background: var(--card); padding: 12px 0 2px; margin-top: 8px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; }
@media (max-width: 640px) {
  .gp-bar { grid-template-columns: 104px 1fr 20px; gap: 8px; }
  .gp-cards { grid-template-columns: 1fr; }
}
