/* Shared look for every game on the site: font, palette, buttons, dialogs, Cheer squad. */
@font-face {
  font-family: 'Bricolage Grotesque';
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url(fonts/bricolage-latin.woff2) format('woff2');
}
:root {
  --paper: #f4efe6;
  --paper-2: #ebe4d6;
  --ink: #1f1d24;
  --muted: #736d64;
  --c1: #ff6b4a; --c2: #ffbe2e; --c3: #34c98a; --c4: #3a9dff;
  --c5: #9a6bff; --c6: #ff6fae; --c7: #1fc2c4;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--paper); color: var(--ink); }
body {
  font-family: 'Bricolage Grotesque', ui-rounded, system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }

.pill {
  font: inherit; font-weight: 700; font-size: 14px; color: var(--ink);
  background: transparent; border: 2px solid var(--ink); border-radius: 999px;
  padding: 5px 14px; cursor: pointer;
}
.pill:active { background: var(--ink); color: var(--paper); }

/* Dialogs */
dialog {
  border: none; border-radius: 20px; padding: 20px;
  background: var(--paper); color: var(--ink);
  width: min(calc(100vw - 32px), 440px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  touch-action: auto;
}
dialog::backdrop { background: rgba(21, 19, 26, 0.55); }
dialog h2 { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.hint { color: var(--muted); font-size: 15px; line-height: 1.4; margin: 10px 0; }
.btn {
  font: inherit; font-weight: 700; font-size: 16px; color: var(--ink);
  background: var(--paper-2); border: 2px solid var(--ink); border-radius: 12px;
  padding: 10px 16px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.btn:focus:not(:focus-visible), .pill:focus:not(:focus-visible) { outline: none; }
.btn.primary { background: var(--ink); color: var(--paper); }
.btn.wide { width: 100%; }
.link-btn { font: inherit; font-size: 14px; font-weight: 600; background: none; border: none; padding: 4px 0; color: var(--muted); cursor: pointer; text-decoration: underline; }
.link-btn.armed { color: #c9342a; }

.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.squad-list { display: flex; flex-direction: column; gap: 10px; max-height: 48dvh; overflow-y: auto; touch-action: pan-y; margin: 6px -4px 14px; padding: 0 4px; }
.squad-row { display: flex; gap: 12px; align-items: center; background: #fff; border-radius: 12px; padding: 8px; }
.squad-row img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; flex: none; }
.squad-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.squad-meta input {
  width: 100%; font: inherit; font-size: 16px; padding: 8px 10px;
  border: 2px solid var(--paper-2); border-radius: 8px; background: var(--paper);
  -webkit-user-select: text; user-select: text;
}
.squad-meta input:focus { outline: none; border-color: var(--ink); }
.empty-note { color: var(--muted); text-align: center; padding: 18px 0; margin: 0; border: 2px dashed var(--paper-2); border-radius: 12px; }
.sheet-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.sheet-actions > * { flex: 1; }
.row-actions { display: flex; gap: 10px; margin-top: 16px; }
.row-actions > * { flex: 1; }
.card-dlg { text-align: center; }

/* On/off switch rows (game settings) */
.switch-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-top: 2px solid var(--paper-2); cursor: pointer; text-align: left; }
.switch-row:first-of-type { border-top: none; }
.switch-row input { appearance: none; -webkit-appearance: none; flex: none; margin: 2px 0 0; width: 48px; height: 28px; border-radius: 999px; background: var(--paper-2); border: 2px solid var(--ink); position: relative; cursor: pointer; transition: background 0.15s; }
.switch-row input::after { content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: var(--ink); transition: transform 0.15s; }
.switch-row input:checked { background: var(--c3); }
.switch-row input:checked::after { transform: translateX(20px); }
.switch-row input:disabled { opacity: 0.4; }
.switch-row b { display: block; font-size: 17px; }
.switch-row span { display: block; color: var(--muted); font-size: 14px; line-height: 1.35; margin-top: 2px; }

/* Account (shared/account.js) */
.acct-text { margin: 0; color: var(--muted); line-height: 1.4; }
.acct-error { margin: 6px 0 0; color: #c9342a; font-size: 14px; font-weight: 600; flex-basis: 100%; }
.acct-full { display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; margin-top: 4px; }
.acct-full .acct-text { flex: 1 1 240px; }
.acct-slot { margin-top: 12px; }
.acct-slot:empty { display: none; }
.acct-slot .acct-text { font-size: 14px; text-align: center; }

/* Family (shared/family.js) */
.fam-join { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.fam-join input {
  font: inherit; font-size: 16px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  width: 9em; padding: 9px 12px; border: 2px solid var(--ink); border-radius: 12px; background: #fff; color: var(--ink);
}
.fam-join input::placeholder { letter-spacing: 0; text-transform: none; font-weight: 500; color: var(--muted); }
.fam-code { color: var(--ink); letter-spacing: 0.12em; }
.fam-table-wrap { overflow-x: auto; margin: 10px 0 4px; }
.fam-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.fam-table th {
  text-align: left; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); padding: 6px 8px; border-bottom: 2px solid var(--paper-2); white-space: nowrap;
}
.fam-table td { padding: 8px; border-bottom: 1px solid var(--paper-2); text-align: left; }
.fam-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.fam-table tr.me td { font-weight: 800; }
.family-day { margin-top: 12px; }
.family-day:empty { display: none; }
.family-day h3 { margin: 0; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }

/* How to play (shared/howto.js) */
.pill-help { padding: 5px 0; width: 36px; flex: none; }
.howto-dlg { width: min(calc(100vw - 32px), 520px); padding: 18px 20px 20px; }
.howto-dlg h2 { font-size: 22px; }
.howto-scroll { max-height: min(70dvh, 640px); overflow-y: auto; touch-action: pan-y; margin-top: 8px; padding-right: 4px; }
.howto-goal { font-size: 17px; font-weight: 700; line-height: 1.4; margin: 6px 0 4px; }
.howto-h { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 16px 0 4px; }
.howto-list { margin: 0; padding-left: 20px; line-height: 1.45; font-size: 16px; }
.howto-list li { margin: 4px 0; }
.howto-all-link { display: inline-block; margin-top: 14px; color: var(--ink); font-weight: 700; }
.howto-nav { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0 8px; }
.howto-nav .pill { text-decoration: none; }
.howto-game { background: #fff; border-radius: 18px; padding: 16px 18px 18px; margin-top: 16px; scroll-margin-top: 16px; }
.howto-game h2 { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.howto-play { text-decoration: none; flex: none; }

/* Tutorial coach (shared/tour.js) */
.tour-card {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 1000;
  top: calc(env(safe-area-inset-top, 0px) + 10px);
  width: min(calc(100vw - 24px), 440px);
  background: var(--ink); color: var(--paper); border-radius: 16px; padding: 14px 16px 12px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
}
.tour-card.bottom { top: auto; bottom: calc(env(safe-area-inset-bottom, 0px) + 10px); }
.tour-card.pop { animation: tour-pop 0.42s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes tour-pop { from { transform: translateX(-50%) scale(0.92); opacity: 0; } to { transform: translateX(-50%) scale(1); opacity: 1; } }
.tour-text { margin: 0; font-size: 17px; font-weight: 600; line-height: 1.4; }
.tour-row { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.tour-count { color: rgba(244, 239, 230, 0.6); font-size: 13px; font-weight: 700; margin-right: auto; }
.tour-card .tour-skip { color: rgba(244, 239, 230, 0.75); }
.tour-card .tour-next { background: var(--paper); color: var(--ink); border-color: var(--paper); padding: 6px 16px; font-size: 15px; }
.tour-ring {
  position: fixed; z-index: 999; pointer-events: none; border-radius: 14px;
  border: 3px solid var(--c2); box-shadow: 0 0 0 4px rgba(255, 190, 46, 0.35);
  animation: tour-pulse 1.2s ease-in-out infinite;
  transition: left 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), top 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
    width 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), height 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes tour-pulse { 50% { box-shadow: 0 0 0 10px rgba(255, 190, 46, 0.12); } }
@media (prefers-reduced-motion: reduce) { .tour-card.pop, .tour-ring { animation: none; transition: none; } }
.howto-tutorial { margin-top: 12px; }
