:root {
  color-scheme: light;
  --page:           #f6f7f5;
  --surface-1:      #ffffff;
  --surface-2:      #eef1ee;
  --text-primary:   #16201d;
  --text-secondary: #4a5551;
  --text-muted:     #6a7470;
  --border:         rgba(22, 32, 29, 0.10);
  --border-strong:  rgba(22, 32, 29, 0.18);
  --accent:         #0f6b62;
  --accent-soft:    rgba(15, 107, 98, 0.10);
  --on-accent:      #ffffff;
  --shadow:         0 1px 2px rgba(22, 32, 29, 0.05), 0 6px 18px rgba(22, 32, 29, 0.06);
  --shadow-hover:   0 2px 4px rgba(22, 32, 29, 0.06), 0 12px 28px rgba(22, 32, 29, 0.10);
  /* One hue per group: the thin bar on each card's top edge. */
  --g-games:   #c2552f;
  --g-studios: #7a4fc4;
  --g-reading: #2f6fc2;
  --g-home:    #2f9a5a;
  --badge:          #eef1ee;
  --badge-text:     #3d4743;
  --radius:    14px;
  --radius-sm: 8px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page:           #101413;
    --surface-1:      #181d1b;
    --surface-2:      #222826;
    --text-primary:   #eef2ef;
    --text-secondary: #b4bdb8;
    --text-muted:     #8e9893;
    --border:         rgba(238, 242, 239, 0.09);
    --border-strong:  rgba(238, 242, 239, 0.18);
    --accent:         #6fd1c3;
    --accent-soft:    rgba(111, 209, 195, 0.12);
    --on-accent:      #0d1f1c;
    --shadow:         0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-hover:   0 8px 24px rgba(0, 0, 0, 0.45);
    --g-games:   #ee8a62;
    --g-studios: #b394f0;
    --g-reading: #7fb0f0;
    --g-home:    #6fd39a;
    --badge:          #252b29;
    --badge-text:     #c3cbc6;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page:           #101413;
  --surface-1:      #181d1b;
  --surface-2:      #222826;
  --text-primary:   #eef2ef;
  --text-secondary: #b4bdb8;
  --text-muted:     #8e9893;
  --border:         rgba(238, 242, 239, 0.09);
  --border-strong:  rgba(238, 242, 239, 0.18);
  --accent:         #6fd1c3;
  --accent-soft:    rgba(111, 209, 195, 0.12);
  --on-accent:      #0d1f1c;
  --shadow:         0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-hover:   0 8px 24px rgba(0, 0, 0, 0.45);
  --g-games:   #ee8a62;
  --g-studios: #b394f0;
  --g-reading: #7fb0f0;
  --g-home:    #6fd39a;
  --badge:          #252b29;
  --badge-text:     #c3cbc6;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--page);
  color: var(--text-primary);
  font-family: var(--font);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Top bar: brand → theme toggle pushed right. */
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 12px 20px;
  padding: 10px max(20px, env(safe-area-inset-right)) 10px max(20px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--surface-1) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  text-decoration: none;
  color: var(--text-primary);
}
.brand:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: var(--radius-sm); }
.brand-mark { width: 32px; height: 32px; flex: none; }
.brand-mark-bg { fill: var(--accent); }
.brand-mark-line { fill: none; stroke: var(--on-accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.brand-name { font-size: 1.3rem; font-weight: 750; letter-spacing: -0.02em; }
.brand-accent { color: var(--accent); }

.icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-toggle {
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
}
.theme-toggle:hover { background: var(--surface-2); color: var(--accent); }

/* [hidden] must win over the display rules below (css-display-override-traps). */
[hidden] { display: none !important; }

/* Top right after the theme toggle: the Sign in pill (signed out) or the account circle + its panel (signed in). */
.account { position: relative; flex: none; }
.account-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 10;
  width: max-content;
  min-width: 15rem;
  max-width: calc(100vw - 32px);
  padding: 6px;
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-hover);
}
.account-signout {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 0 10px;
  border: 0;
  border-top: 1px solid var(--border);
  background: none;
  color: var(--text-primary);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.account-signout:hover { background: var(--surface-2); color: var(--accent); }
.account-signout:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* Signed out: the sign-in card in place of the cards (.wl-auth-card, end of file). */
.gate { margin: 32px auto 0; }

.prose p { color: var(--text-secondary); max-width: 64ch; }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.page {
  flex: 1;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 max(16px, env(safe-area-inset-left)) 48px max(16px, env(safe-area-inset-right));
}

/* Hero */
.hero { padding: 40px 0 8px; max-width: 760px; }
.eyebrow {
  margin: 0 0 10px;
  font-size: 0.8rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.hero h1 {
  margin: 0 0 14px;
  font-size: clamp(1.75rem, 1.2rem + 2.4vw, 2.75rem);
  line-height: 1.15;
  letter-spacing: -0.025em;
  font-weight: 750;
  text-wrap: balance;
}
.hero-text { margin: 0 0 16px; font-size: 1.08rem; color: var(--text-secondary); max-width: 64ch; }
.hero-meta {
  display: inline-block;
  margin: 0;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 600;
}
.hero-meta:empty { display: none; }

/* Groups */
.group { margin-top: 40px; }
.group-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 14px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.group-head h2 { margin: 0; font-size: 1.15rem; font-weight: 700; letter-spacing: -0.01em; }
.group-head p { margin: 0; color: var(--text-muted); font-size: 0.93rem; }

.cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
@media (min-width: 640px) { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 980px) { .cards { grid-template-columns: repeat(3, 1fr); } }

/* The whole card is the link's hit area (the heading link stretches over it). */
.card {
  --g: var(--accent);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px 18px 16px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--g);
  z-index: 1; /* stays above the preview when it zooms on hover (a transform paints like a positioned box) */
}
.card--games   { --g: var(--g-games); }
.card--studios { --g: var(--g-studios); }
.card--reading { --g: var(--g-reading); }
.card--home    { --g: var(--g-home); }
.card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.card:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
/* The preview picture across the card's top, edge to edge (public/previews/<id>.jpg, 16:10, made by
   scripts/previews/capture.mjs). Decorative: the heading says what the card is. */
.card-shot {
  display: block;
  width: calc(100% + 36px);
  max-width: none;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  margin: -20px -18px 6px;
  background: var(--badge);
  border-bottom: 1px solid var(--border);
  transition: transform 0.35s ease;
}
.card:hover .card-shot { transform: scale(1.03); }
/* The app's icon in a soft tile of its group hue (the hue itself is too faint as text on dark, the stroke is fine). */
.card-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--g) 13%, transparent);
  color: var(--g);
}
.card-icon .icon { width: 22px; height: 22px; }
.card-head h3 { flex: 1; align-self: center; }
.card h3 { margin: 0;font-size: 1.1rem; font-weight: 700; letter-spacing: -0.01em; line-height: 1.3; }
.card h3 a { color: var(--text-primary); text-decoration: none; }
.card h3 a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.card h3 a:focus-visible { outline: none; }
.card-open { flex: none; width: 18px; height: 18px; color: var(--text-muted); transition: color 0.15s ease, transform 0.15s ease; }
.card:hover .card-open { color: var(--g); transform: translate(2px, -2px); }
.card p { margin: 0; color: var(--text-secondary); font-size: 0.95rem; flex: 1; }
.card-foot { margin-top: 6px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--badge);
  color: var(--badge-text);
  font-size: 0.78rem;
  font-weight: 550;
  white-space: nowrap;
}
.badge-icon { width: 13px; height: 13px; stroke-width: 2.2; }
.badge--public { background: var(--accent-soft); color: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  .card, .card-open { transition: none; }
  .card:hover { transform: none; }
  .card:hover .card-open { transform: none; }
  .card-shot { transition: none; }
  .card:hover .card-shot { transform: none; }
}

.footer {
  padding: 20px max(16px, env(safe-area-inset-left)) max(20px, env(safe-area-inset-bottom));
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}
.footer a { color: var(--text-muted); }

/* The hub's token names, mapped onto the ones the shared block reads. */
:root { --accent-text: var(--on-accent); --muted: var(--text-muted); }


/* ── weekendlab sign-in UI (same look in every weekendlab.dev app; game-planner is the reference) ──
   .wl-signin = the pill "Sign in" top right where the account circle sits when signed in;
   .wl-auth-card = the centred card on a signed-out page; .wl-avatar = the account circle (email initial). */
.wl-signin {
  display: inline-flex; align-items: center; gap: 6px; flex: none; min-height: 40px; padding: 0 14px 0 10px;
  box-sizing: border-box; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-1);
  color: var(--text-primary); font: inherit; font-size: 0.92rem; font-weight: 600; line-height: 1; text-decoration: none;
  white-space: nowrap; cursor: pointer;
}
button.wl-signin { padding: 0 14px; }
.wl-signin svg { width: 18px; height: 18px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.wl-signin:hover { background: var(--surface-2); border-color: var(--accent); color: var(--text-primary); }
.wl-signin:focus-visible, .wl-auth-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
form.wl-signout-top { margin: 0; flex: none; }
main.wl-auth-page { display: flex; justify-content: center; padding-top: clamp(32px, 10vh, 96px); }
.wl-auth-wrap { padding-top: clamp(24px, 8vh, 72px); }
.wl-auth-card {
  width: 100%; max-width: 26rem; box-sizing: border-box; margin: 0 auto; padding: 32px 28px 26px; text-align: center;
  background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius, 12px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}
.wl-auth-card form { margin: 0; }
.wl-auth-tile {
  display: inline-flex; align-items: center; justify-content: center; width: 52px; height: 52px; margin-bottom: 14px;
  border-radius: 14px; background: var(--surface-2); color: var(--accent);
}
.wl-auth-tile svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.wl-auth-card h2 { margin: 0 0 8px; font-size: 1.35rem; letter-spacing: -0.01em; color: var(--text-primary); }
.wl-auth-text { margin: 0 0 22px; color: var(--text-secondary); line-height: 1.5; overflow-wrap: anywhere; }
.wl-auth-text strong { color: var(--text-primary); }
.wl-auth-error { margin: 0 0 16px; color: var(--danger, #b3261e); }
.wl-auth-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 100%; min-height: 44px; box-sizing: border-box;
  padding: 0 18px; border: 0; border-radius: var(--radius-sm, 8px); background: var(--accent); color: var(--accent-text);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.wl-auth-btn:hover { filter: brightness(1.1); color: var(--accent-text); }
.wl-auth-note { margin: 16px 0 0; font-size: 0.82rem; color: var(--muted, var(--text-secondary)); }
.wl-avatar {
  display: inline-flex; align-items: center; justify-content: center; flex: none; width: 2.1rem; height: 2.1rem;
  border-radius: 50%; background: var(--accent); color: var(--accent-text); font-weight: 700; font-size: 0.95rem;
  line-height: 1; text-transform: uppercase; user-select: none;
}
.wl-avatar.large { width: 2.6rem; height: 2.6rem; font-size: 1.2rem; }
button.wl-avatar-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; }
button.wl-avatar-btn:hover, button.wl-avatar-btn[aria-expanded="true"] { background: none; border-color: transparent; }
.wl-avatar-btn:hover .wl-avatar, .wl-avatar-btn[aria-expanded="true"] .wl-avatar { box-shadow: 0 0 0 3px var(--surface-2); }
.wl-who { display: flex; align-items: center; gap: 10px; padding: 8px 10px 10px; text-align: left; }
.wl-who-email { font-weight: 600; color: var(--text-primary); overflow-wrap: anywhere; }
.wl-who-role { font-size: 0.8rem; color: var(--text-secondary); margin-top: 2px; }
