/* Shared look for every page on the Family Game Shelf: colours, buttons, header, dialogs, family board. */
:root {
  --ink: #303b35;
  --muted: #788073;
  --soft: #92988b;
  --paper: #faf7f1;
  --card: #fffdf9;
  --line: #e5e5dc;
  --wall: #505a4d;
  --accent: #bd6648;
  --forest: #354e43;
  --alert: #b84031;
  font-family: ui-rounded, 'Avenir Next', 'Trebuchet MS', sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--paper); }
button, a, label { -webkit-tap-highlight-color: transparent; }
button {
  font: inherit; color: inherit; cursor: pointer; touch-action: manipulation;
  border: 1px solid #dedfd7; border-radius: 12px; background: var(--card); padding: 12px 16px;
}
button:hover { filter: brightness(.97); }
button:disabled { opacity: .4; cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid #a65032; outline-offset: 4px; }

/* ---------- header / intro ---------- */
header { max-width: 1200px; margin: auto; padding: 30px 42px; display: flex; align-items: center; justify-content: space-between; }
.brand { text-decoration: none; color: inherit; font-size: 22px; font-weight: 800; letter-spacing: -1px; }
.brandmark { color: #c76c4e; font-size: 30px; margin-right: 8px; }
.quiet { border: 0; background: transparent; font-size: 14px; }
.quiet span { border: 1px solid #b6bdb1; border-radius: 50%; padding: 2px 7px; margin-left: 7px; }

footer { max-width: 1140px; margin: auto; padding: 16px 32px 30px; border-top: 1px solid #e6e5db; color: var(--soft); font-size: 11px; display: flex; justify-content: space-between; }

/* ---------- dialogs ---------- */
dialog { border: 1px solid #dddcd1; border-radius: 24px; padding: 32px; max-width: 460px; width: calc(100% - 32px); color: #354437; background: var(--card); box-shadow: 0 20px 100px #0003; }
dialog::backdrop { background: #263c3555; backdrop-filter: blur(3px); }
dialog h2 { font: 30px Georgia, serif; margin: 10px 0 14px; }
dialog p { font-size: 15px; line-height: 1.7; color: #6c7768; }
dialog .small { font-size: 13px; }
.close { float: right; border: 0; padding: 0 4px; background: transparent; font-size: 26px; line-height: 1; }

/* ---------- family board ---------- */
.header-actions { display: flex; align-items: center; gap: 8px; }
.player-chip { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px; font-size: 13px; font-weight: 700; background: var(--card); }
.player-chip .short { display: none; }
.player-chip:not(:has(.chip-cat)) { padding: 8px 14px; color: var(--accent); border-color: #e8c8bb; }
.chip-cat { width: 30px; height: 30px; border-radius: 50%; background: #f2f2eb; display: grid; place-items: center; }
.chip-cat svg { width: 26px; height: 26px; }
.chip-pts { font-weight: 400; color: var(--muted); font-variant-numeric: tabular-nums; }
.chip-name { max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

dialog.wide { max-width: 560px; }
.step { display: flex; flex-direction: column; gap: 8px; }
.step label, .step .label { font-size: 13px; font-weight: 700; margin-top: 8px; }
.step input { font: inherit; font-size: 18px; padding: 12px 14px; border: 1px solid #d6d6cc; border-radius: 12px; background: #fff; color: var(--ink); width: 100%; }
.step input:focus { outline: 3px solid #a6503255; border-color: var(--accent); }
.step .primary { margin-top: 8px; }
.choice { display: grid; gap: 10px; margin-top: 6px; }
.choice button { font-size: 16px; padding: 16px; }
.link { border: 0; background: transparent; padding: 8px 0; font-size: 13px; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 8px; }
.form-error { color: var(--alert) !important; font-size: 13px !important; min-height: 1.2em; margin: 2px 0 !important; }
.fine { font-size: 12px !important; line-height: 1.5 !important; color: var(--soft) !important; margin: 0 !important; }
.cat-pick { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.cat-pick button { padding: 6px 2px 4px; border-radius: 12px; display: flex; flex-direction: column; align-items: center; gap: 2px; background: #f6f5ef; border: 2px solid transparent; }
.cat-pick button.on { border-color: var(--forest); background: #fff; }
.cat-pick svg { width: 100%; max-width: 46px; aspect-ratio: 1; }
.cat-pick small { font-size: 10px; color: var(--muted); }

.goal { background: #f2f2eb; border-radius: 14px; padding: 14px 16px; margin: 4px 0 16px; }
.goal-text { font-size: 14px; color: var(--muted); }
.goal-text strong { color: var(--ink); font-size: 20px; font-variant-numeric: tabular-nums; }
.goal-bar { height: 10px; border-radius: 99px; background: #e2e1d6; margin-top: 10px; overflow: hidden; }
.goal-bar span { display: block; height: 100%; width: 0; background: var(--forest); border-radius: 99px; transition: width .6s ease; }
.ranks { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 8px; max-height: 52vh; overflow-y: auto; }
.rank { display: grid; grid-template-columns: 22px 44px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; }
.rank.me { border-color: var(--forest); background: #f4f8f1; }
.rank:first-child .place { color: var(--accent); }
.place { font: 20px Georgia, serif; color: var(--soft); text-align: center; }
.rank-cat svg { width: 44px; height: 44px; }
.who { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.nm { font-weight: 700; font-size: 15px; overflow-wrap: anywhere; }
.sizes, .badges { display: flex; flex-wrap: wrap; gap: 4px; }
.size-chip { font-size: 11px; background: #f2f2eb; border-radius: 6px; padding: 2px 6px; color: var(--muted); }
.size-chip b { color: var(--ink); }
.badges span { font-size: 11px; color: var(--accent); font-weight: 700; }
.badges span + span::before { content: '· '; color: var(--soft); }
.pts { text-align: right; font-size: 11px; color: var(--soft); display: flex; flex-direction: column; font-variant-numeric: tabular-nums; }
.pts b { font-size: 24px; color: var(--ink); line-height: 1; }
.loading { color: var(--soft); font-size: 14px; padding: 12px 0; }
@media (max-width: 690px) {
  .header-actions { gap: 2px; }
  .chip-pts, .player-chip .long { display: none; }
  .player-chip .short { display: inline; }
  .quiet { font-size: 0; }
  .quiet span { font-size: 14px; margin: 0; }
  .rank { grid-template-columns: 18px 36px minmax(0, 1fr) auto; gap: 8px; padding: 10px; }
  .rank-cat svg { width: 36px; height: 36px; }
}

@media (max-width: 690px) {
  header { padding: 16px 20px; }
  .brand { font-size: 19px; }
  .quiet { padding: 8px; }
  footer { padding: 15px 22px; font-size: 10px; }
}
.crumb { font-size: 13px; color: var(--muted); text-decoration: none; margin-left: 4px; }
.crumb:hover { text-decoration: underline; }
.game-name { font-size: 11px; font-weight: 700; color: var(--ink); margin-right: 2px; align-self: center; }
.eyebrow { font-size: 10px; font-weight: 800; letter-spacing: 2px; color: #82897b; }
.brand-wrap { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 10px; min-width: 0; }
@media (max-width: 690px) {
  .brand-wrap { flex-direction: column; align-items: flex-start; gap: 2px; }
  .crumb { margin-left: 30px; font-size: 12px; }
}
