@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@500;700;800&family=Source+Serif+4:ital,wght@0,400;0,600;0,700;1,400&display=swap');

/* -------- Good mode — heaven, crosses, angel light -------- */
:root,
[data-theme="light"] {
  --gold: #c4a035;
  --gold-bright: #e6c65a;
  --copper: #6a8fc4;
  --bg: #eef3fb;
  --bg-elevated: #f7f9fd;
  --card: #fcfdff;
  --card-hover: #ffffff;
  --line: #c8d4e8;
  --line-soft: #e0e8f4;
  --ink: #1a2740;
  --muted: #5c6f8c;
  --danger: #a84848;
  --success: #3d7a52;
  --shadow: 0 10px 28px rgba(70, 110, 180, .12);
  --radius: 12px;
  --font-display: 'Cinzel', Georgia, serif;
  --font-body: 'Source Serif 4', Georgia, serif;

  /* Soft sky vault + sacred gold shafts (no icons in the wash) */
  --bg-atmosphere:
    radial-gradient(ellipse 120% 70% at 50% -22%, rgba(255, 255, 255, .98), transparent 58%),
    radial-gradient(ellipse 40% 55% at 50% 0%, rgba(230, 198, 90, .18), transparent 55%),
    radial-gradient(ellipse 55% 40% at 12% 88%, rgba(106, 143, 196, .12), transparent 52%),
    radial-gradient(ellipse 50% 35% at 90% 78%, rgba(180, 210, 255, .16), transparent 50%),
    linear-gradient(180deg, #f5f8fd 0%, var(--bg) 42%, #dce6f5 100%);

  --topbar-bg: linear-gradient(180deg, rgba(255, 255, 255, .97), rgba(247, 249, 253, .94));
  --topbar-border: rgba(196, 160, 53, .32);
  --topbar-shadow: 0 1px 0 rgba(255, 255, 255, .85), 0 10px 24px rgba(70, 110, 180, .08);
  --brand-shadow: 0 1px 0 rgba(255, 255, 255, .8), 0 0 18px rgba(230, 198, 90, .25);
  --nav-hover-bg: rgba(196, 160, 53, .12);
  --nav-active-bg: linear-gradient(135deg, rgba(196, 160, 53, .22), rgba(106, 143, 196, .12));
  --nav-active-border: rgba(196, 160, 53, .48);
  --nav-active-inset: inset 0 1px 0 rgba(255, 255, 255, .7);
  --title-shadow: 0 1px 0 rgba(255, 255, 255, .85), 0 0 20px rgba(230, 198, 90, .2);
  --title-rule: linear-gradient(90deg, var(--gold), rgba(106, 143, 196, .3) 70%, transparent);
  --card-face: linear-gradient(165deg, #ffffff 0%, var(--card) 55%);
  --card-inset: inset 0 1px 0 rgba(255, 255, 255, .95);
  --card-hover-border: rgba(196, 160, 53, .42);
  --card-hover-shadow: 0 14px 32px rgba(70, 110, 180, .12), inset 0 1px 0 rgba(255, 255, 255, .95);
  --card-head-bg: linear-gradient(180deg, rgba(255, 255, 255, .98), var(--bg-elevated));
  --pill-bg: rgba(196, 160, 53, .12);
  --pill-border: rgba(196, 160, 53, .32);
  --input-bg: #ffffff;
  --focus-ring: 0 0 0 3px rgba(196, 160, 53, .18);
  --focus-border: rgba(196, 160, 53, .55);
  --btn-primary-bg: linear-gradient(180deg, #ead070, var(--gold));
  --btn-primary-color: #1a1408;
  --btn-primary-shadow: 0 2px 0 rgba(90, 70, 20, .18), 0 6px 14px rgba(196, 160, 53, .28);
  --btn-ghost-bg: rgba(255, 255, 255, .6);
  --bulletin-bg:
    linear-gradient(135deg, rgba(196, 160, 53, .14), transparent 42%),
    linear-gradient(180deg, #ffffff, var(--card));
  --bulletin-border: rgba(196, 160, 53, .35);
  --bulletin-inset: inset 0 1px 0 rgba(255, 255, 255, .85);
}

/* -------- Evil mode — softer dungeon (less eye strain) -------- */
[data-theme="evil"] {
  --gold: #c9a227;
  --gold-bright: #dfc056;
  --copper: #b04a4a;
  --bg: #14100e;
  --bg-elevated: #1c1613;
  --card: #1a1512;
  --card-hover: #221b17;
  --line: #3a2a24;
  --line-soft: #2a1e1a;
  --ink: #ebe0d4;
  --muted: #9a8a80;
  --danger: #c44a55;
  --success: #6b8f3a;
  --shadow: 0 10px 28px rgba(0, 0, 0, .45);

  /* Warm charcoal + quiet blood wash — no hot neon */
  --bg-atmosphere:
    radial-gradient(ellipse 90% 50% at 50% -10%, rgba(140, 40, 45, .22), transparent 55%),
    radial-gradient(ellipse 50% 40% at 10% 100%, rgba(30, 18, 14, .5), transparent 55%),
    radial-gradient(ellipse 40% 35% at 92% 88%, rgba(80, 35, 30, .18), transparent 50%),
    linear-gradient(180deg, #1a1210 0%, var(--bg) 42%, #100c0a 100%);

  --topbar-bg: linear-gradient(180deg, rgba(28, 22, 18, .97), rgba(20, 16, 14, .95));
  --topbar-border: rgba(176, 74, 74, .35);
  --topbar-shadow: 0 1px 0 rgba(201, 162, 39, .06), 0 8px 20px rgba(0, 0, 0, .35);
  --brand-shadow: 0 0 12px rgba(176, 74, 74, .25);
  --nav-hover-bg: rgba(176, 74, 74, .12);
  --nav-active-bg: linear-gradient(135deg, rgba(176, 74, 74, .22), rgba(201, 162, 39, .08));
  --nav-active-border: rgba(176, 74, 74, .4);
  --nav-active-inset: inset 0 1px 0 rgba(223, 192, 86, .1);
  --title-shadow: 0 1px 8px rgba(0, 0, 0, .5);
  --title-rule: linear-gradient(90deg, var(--danger), rgba(201, 162, 39, .3) 55%, transparent);
  --card-face: linear-gradient(165deg, rgba(32, 26, 22, .98) 0%, var(--card) 50%);
  --card-inset: inset 0 1px 0 rgba(176, 74, 74, .08);
  --card-hover-border: rgba(176, 74, 74, .38);
  --card-hover-shadow: 0 12px 28px rgba(0, 0, 0, .4), inset 0 1px 0 rgba(176, 74, 74, .1);
  --card-head-bg: linear-gradient(180deg, rgba(28, 22, 18, .95), var(--bg-elevated));
  --pill-bg: rgba(176, 74, 74, .12);
  --pill-border: rgba(176, 74, 74, .3);
  --input-bg: #1c1613;
  --focus-ring: 0 0 0 3px rgba(176, 74, 74, .18);
  --focus-border: rgba(176, 74, 74, .5);
  --btn-primary-bg: linear-gradient(180deg, #c4555e, #8a3038);
  --btn-primary-color: #fff8f6;
  --btn-primary-shadow: 0 2px 0 rgba(40, 10, 12, .4), 0 6px 14px rgba(140, 40, 45, .25);
  --btn-ghost-bg: transparent;
  --bulletin-bg:
    linear-gradient(135deg, rgba(176, 74, 74, .14), transparent 42%),
    linear-gradient(180deg, rgba(28, 22, 18, .98), var(--card));
  --bulletin-border: rgba(176, 74, 74, .35);
  --bulletin-inset: inset 0 1px 0 rgba(176, 74, 74, .1);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  background-image: var(--bg-atmosphere);
  background-attachment: fixed;
  transition: background-color .25s ease, color .2s ease;
}

a { color: var(--gold-bright); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--topbar-border);
  box-shadow: var(--topbar-shadow);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar .brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--gold);
  letter-spacing: .1em;
  text-transform: uppercase;
  text-shadow: var(--brand-shadow);
  text-decoration: none;
  flex-shrink: 0;
}
.topbar .brand:hover { text-decoration: none; color: var(--gold-bright); }

[data-theme="evil"] .topbar .brand {
  color: var(--gold-bright);
  background: none;
  -webkit-background-clip: unset;
  background-clip: unset;
  -webkit-text-fill-color: unset;
  text-shadow: var(--brand-shadow);
}

.topbar .nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 18px;
  flex: 1;
  min-width: 0;
  flex-wrap: wrap;
}
.topbar .nav-primary,
.topbar .nav-end {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}
.topbar .nav-end { margin-left: auto; }

.topbar .nav a,
.topbar .nav-more > summary {
  color: var(--muted);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: .92rem;
  font-weight: 600;
  border: 1px solid transparent;
  transition: background .18s ease, color .18s ease, border-color .18s ease;
  cursor: pointer;
  list-style: none;
  font-family: inherit;
  background: transparent;
}
.topbar .nav-more > summary::-webkit-details-marker { display: none; }
.topbar .nav-more > summary::after {
  content: ' ▾';
  font-size: .75em;
  opacity: .7;
}

.topbar .nav a:hover,
.topbar .nav-more > summary:hover {
  background: var(--nav-hover-bg);
  color: var(--ink);
  text-decoration: none;
}
.topbar .nav a.active,
.topbar .nav-more > summary.active {
  background: var(--nav-active-bg);
  color: var(--gold);
  border-color: var(--nav-active-border);
  box-shadow: var(--nav-active-inset);
}

[data-theme="evil"] .topbar .nav a.active,
[data-theme="evil"] .topbar .nav-more > summary.active {
  color: var(--gold-bright);
}

.nav-more { position: relative; }
.nav-more-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 10.5rem;
  padding: 6px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card-face, var(--card));
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 120;
}
.nav-more-menu a { display: block; white-space: nowrap; }
.nav-more[open] > summary {
  background: var(--nav-hover-bg);
  color: var(--ink);
}

.page-wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 20px 56px;
}

.page-title {
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--gold);
  margin: 0 0 6px;
  letter-spacing: .06em;
  text-shadow: var(--title-shadow);
}

.page-title::after {
  content: '';
  display: block;
  width: min(12rem, 40%);
  height: 2px;
  margin-top: 12px;
  background: var(--title-rule);
  border-radius: 2px;
}

[data-theme="evil"] .page-title {
  color: var(--gold-bright);
}

.page-sub {
  color: var(--muted);
  margin: 0 0 28px;
  font-size: .95rem;
  letter-spacing: .02em;
}

.banner {
  padding: 14px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--card);
  margin-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  align-items: center;
}

.banner.open { border-color: rgba(61, 122, 82, .45); background: rgba(61, 122, 82, .1); }
.banner.locked { border-color: rgba(168, 72, 72, .4); background: rgba(168, 72, 72, .08); }
[data-theme="evil"] .banner.open { border-color: rgba(107, 143, 58, .4); background: rgba(107, 143, 58, .1); }
[data-theme="evil"] .banner.locked { border-color: rgba(196, 74, 85, .4); background: rgba(196, 74, 85, .1); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  font-size: .85rem;
  color: var(--ink);
}

.chip strong { color: var(--gold); }

.card {
  background: var(--card-face);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow), var(--card-inset);
  overflow: hidden;
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.card:hover {
  border-color: var(--card-hover-border);
  box-shadow: var(--card-hover-shadow);
}

.card-head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--card-head-bg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.card-head h2, .card-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--gold);
  font-weight: 700;
}

.card-body { padding: 18px; }

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 10px 12px;
    overflow: visible;
  }
  .topbar .brand { text-align: center; font-size: 1rem; }
  .topbar .nav {
    justify-content: space-between;
    gap: 8px;
    overflow: visible;
  }
  .topbar .nav-primary,
  .topbar .nav-end {
    flex-wrap: wrap;
    overflow: visible;
  }
  .topbar .nav-end { margin-left: 0; }
  .topbar .nav a,
  .topbar .nav-more > summary {
    flex-shrink: 0;
    padding: 8px 12px;
    font-size: .84rem;
  }
  /* Fixed panel — absolute menus get clipped inside scroll/flex rows on iOS */
  .nav-more-menu {
    position: fixed;
    left: 12px;
    right: 12px;
    top: auto;
    width: auto;
    min-width: 0;
    max-width: none;
    z-index: 200;
  }
  .page-wrap { padding: 16px 12px 36px; }
  .page-title { font-size: 1.35rem; }
  .banner { padding: 12px 14px; gap: 8px; }
  .card-body { padding: 14px; }
  .filters { flex-direction: column; align-items: stretch; }
  .filters select { width: 100%; }
}

.pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
  background: var(--pill-bg);
  color: var(--gold);
  border: 1px solid var(--pill-border);
  margin-left: 6px;
}

.pill.muted-pill {
  background: rgba(106, 96, 84, .08);
  color: var(--muted);
  border-color: var(--line);
}

.pill.new-pill {
  background: rgba(61, 122, 82, .12);
  color: var(--success);
  border-color: rgba(61, 122, 82, .3);
}

[data-theme="evil"] .pill.new-pill {
  background: rgba(92, 255, 154, .1);
  border-color: rgba(92, 255, 154, .35);
}

.list-clean {
  list-style: none;
  margin: 0;
  padding: 0;
}

.list-clean li {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}

.list-clean li:last-child { border-bottom: 0; }

.empty-state {
  color: var(--muted);
  font-style: italic;
  padding: 16px;
  text-align: center;
}

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0;
  flex-wrap: wrap;
}

.tab-btn {
  font-family: var(--font-display);
  font-size: .88rem;
  font-weight: 600;
  letter-spacing: .03em;
  padding: 12px 20px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .15s, border-color .15s;
}

.tab-btn:hover { color: var(--ink); }
.tab-btn.active {
  color: var(--gold-bright);
  border-bottom-color: var(--gold);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.gold-text { color: var(--gold-bright); font-weight: 700; }

.btn {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: .85rem;
  letter-spacing: .04em;
  padding: 10px 18px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: transform .1s, filter .15s;
}

.btn:active { transform: scale(.98); }
.btn-primary {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-color);
  box-shadow: var(--btn-primary-shadow);
}
.btn-primary:hover { filter: brightness(1.04); }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn-ghost {
  background: var(--btn-ghost-bg);
  color: var(--muted);
  border: 1px solid var(--line);
}
.btn-ghost:hover { border-color: var(--gold); color: var(--gold); background: var(--nav-hover-bg); }

select, input[type=text], input[type=password], textarea {
  background: var(--input-bg);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: .95rem;
  transition: border-color .15s ease, box-shadow .15s ease;
}

select:focus, input:focus, textarea:focus {
  outline: none;
  border-color: var(--focus-border);
  box-shadow: var(--focus-ring);
}

.commish-bulletin {
  margin: 0 0 22px;
  padding: 18px 20px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--bulletin-border);
  background: var(--bulletin-bg);
  box-shadow: var(--shadow), var(--bulletin-inset);
}
.commish-bulletin h2 {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--gold-bright);
  letter-spacing: .06em;
  text-transform: uppercase;
}
.commish-bulletin-body {
  color: var(--ink);
  font-size: .98rem;
  line-height: 1.65;
  white-space: pre-wrap;
}

/* -------- Home (tavern board) -------- */
.home-wrap {
  max-width: 58rem;
}
.home-hero {
  margin: 0 0 22px;
  text-align: center;
  animation: home-fade-up .55s ease-out both;
  position: relative;
}
.home-kicker {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: .72rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--muted);
}
.home-brand {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 8vw, 3.75rem);
  font-weight: 800;
  letter-spacing: .05em;
  line-height: 1.02;
  color: var(--gold);
  text-shadow: var(--title-shadow);
}
[data-theme="evil"] .home-brand {
  color: var(--gold-bright);
}
.home-week {
  margin: 14px 0 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 12px;
}
.home-week-num {
  display: inline-block;
  font-family: var(--font-display);
  font-size: .95rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--copper);
  padding: 6px 14px;
  border: 1px solid var(--pill-border);
  border-radius: 999px;
  background: var(--pill-bg);
}

.home-top-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 16px;
  margin: 0 0 28px;
  align-items: stretch;
  animation: home-fade-up .55s ease-out .08s both;
}
@media (max-width: 820px) {
  .home-top-grid { grid-template-columns: 1fr; }
}

.home-plaque {
  margin: 0;
  padding: 18px 18px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--bulletin-border);
  background: var(--bulletin-bg);
  box-shadow: var(--shadow), var(--bulletin-inset);
  display: flex;
  flex-direction: column;
}
.home-plaque-identity {
  margin: 0 0 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
}
.home-plaque-team {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: .03em;
  color: var(--ink);
  line-height: 1.25;
}
.home-plaque-owner {
  margin: 4px 0 0;
  font-size: .88rem;
  color: var(--muted);
}
.home-plaque-rank {
  margin: 10px 0 0;
  display: inline-block;
  font-family: var(--font-display);
  font-size: .78rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--gold);
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--pill-border);
  background: var(--pill-bg);
}
.home-plaque-stats {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
}
@media (max-width: 520px) {
  .home-plaque-stats { grid-template-columns: 1fr; }
}
.home-plaque-stats li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.home-plaque-label {
  font-family: var(--font-display);
  font-size: .68rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}
.home-plaque-value {
  font-size: 1.02rem;
  color: var(--ink);
  font-weight: 600;
  line-height: 1.3;
  word-break: break-word;
}
.home-plaque-value.is-open { color: var(--success); }
.home-plaque-value.is-locked { color: var(--danger); }
.home-plaque-gold {
  color: var(--gold);
  font-family: var(--font-display);
  letter-spacing: .04em;
}
[data-theme="evil"] .home-plaque-gold { color: var(--gold-bright); }

.home-league-pot {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  margin: 0;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(90, 154, 110, .35);
  background:
    linear-gradient(135deg, rgba(90, 154, 110, .14), transparent 55%),
    var(--pill-bg);
}
.home-league-pot-label {
  font-family: var(--font-display);
  font-size: .68rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}
.home-league-pot-amount {
  font-weight: 700;
  font-size: .95rem;
  font-variant-numeric: tabular-nums;
  color: #7dba8f;
  letter-spacing: .02em;
}
[data-theme="evil"] .home-league-pot-amount { color: #9ad0a8; }
.home-league-pot-you {
  font-size: .72rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.home-plaque-cta { margin-top: auto; }
.home-cta-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: .75rem 1.2rem;
  font-size: 1rem;
  text-decoration: none;
  width: 100%;
  box-sizing: border-box;
}
.home-cta-note {
  margin: 8px 0 10px;
  color: var(--muted);
  font-size: .85rem;
}
.home-cta-secondary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.home-cta-secondary .btn { text-decoration: none; }

.home-standings {
  margin: 0;
  padding: 16px 16px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--card-face);
  box-shadow: var(--shadow), var(--card-inset);
  min-width: 0;
}
.home-standings-head { margin: 0 0 12px; }
.home-standings-head h2 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--gold);
  letter-spacing: .06em;
  text-transform: uppercase;
}
[data-theme="evil"] .home-standings-head h2 { color: var(--gold-bright); }
.home-standings-head p {
  margin: 0;
  color: var(--muted);
  font-size: .82rem;
}
.home-standings-head a { color: var(--gold); }
.home-standings-empty {
  margin: 8px 0;
  color: var(--muted);
  font-style: italic;
}
.home-standings-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.home-standings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}
.home-standings-table th {
  text-align: left;
  padding: 6px 8px;
  font-family: var(--font-display);
  font-size: .68rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.home-standings-table td {
  padding: 9px 8px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
  color: var(--ink);
}
.home-standings-table tr:last-child td { border-bottom: none; }
.home-standings-table tr.is-me td {
  background: rgba(154, 111, 31, .12);
}
[data-theme="evil"] .home-standings-table tr.is-me td {
  background: rgba(232, 160, 32, .12);
}
.home-standings-table .col-rank {
  width: 2rem;
  font-family: var(--font-display);
  color: var(--muted);
}
.home-standings-table .col-rec,
.home-standings-table .col-pct,
.home-standings-table .col-pf,
.home-standings-table .col-pa {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.home-standings-table th.col-rec,
.home-standings-table th.col-pct,
.home-standings-table th.col-pf,
.home-standings-table th.col-pa { text-align: right; }
.stand-team {
  display: block;
  font-weight: 700;
  line-height: 1.25;
}
.stand-owner {
  display: block;
  font-size: .78rem;
  color: var(--muted);
  margin-top: 2px;
}

.home-bulletin {
  margin-bottom: 28px;
  animation: home-fade-up .6s ease-out .18s both;
}

.town-board {
  margin: 0 0 40px;
  animation: home-fade-up .55s ease-out .28s both;
}
.town-board-head { margin: 0 0 14px; }
.town-board-head h2 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--gold);
  letter-spacing: .06em;
  text-transform: uppercase;
}
[data-theme="evil"] .town-board-head h2 { color: var(--gold-bright); }
.town-board-head p {
  margin: 0;
  color: var(--muted);
  font-size: .9rem;
}
.town-board-compose {
  display: grid;
  gap: 8px;
  margin: 0 0 18px;
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--card-inset);
}
.town-board-compose-row {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}
.town-board-compose select,
.town-board-compose textarea {
  width: 100%;
  box-sizing: border-box;
  padding: .55rem .7rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--input-bg);
  color: var(--ink);
  font: inherit;
}
.town-board-compose select {
  width: auto;
  min-width: 7rem;
}
.town-board-compose textarea {
  resize: vertical;
  min-height: 4.5rem;
}
.town-board-err {
  margin: 0;
  color: var(--danger);
  font-size: .88rem;
}
.town-board-empty {
  color: var(--muted);
  font-style: italic;
  margin: 8px 0;
}
.town-board-feed {
  display: grid;
  gap: 10px;
}
.town-post {
  padding: 12px 14px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--card-face);
  box-shadow: var(--card-inset);
}
.town-post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
  margin: 0 0 6px;
  font-size: .82rem;
}
.town-post-kind {
  font-family: var(--font-display);
  font-size: .68rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--pill-border);
  background: var(--pill-bg);
  color: var(--gold);
}
.town-post-kind.kind-bug {
  border-color: rgba(168, 72, 72, .4);
  color: var(--danger);
  background: rgba(168, 72, 72, .1);
}
.town-post-kind.kind-idea {
  border-color: rgba(61, 122, 82, .4);
  color: var(--success);
  background: rgba(61, 122, 82, .1);
}
.town-post-author {
  font-weight: 700;
  color: var(--ink);
}
.town-post-when {
  color: var(--muted);
  margin-left: auto;
}
.town-post-body {
  margin: 0 0 8px;
  white-space: pre-wrap;
  line-height: 1.5;
  color: var(--ink);
}
.town-post-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.town-react {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: .85rem;
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.town-react:hover {
  border-color: var(--gold);
  color: var(--gold-bright);
}
.town-react.is-mine {
  color: var(--copper);
  border-color: rgba(184, 149, 42, .45);
  background: rgba(184, 149, 42, .1);
}
[data-theme="evil"] .town-react.is-mine {
  color: var(--danger);
  border-color: rgba(196, 30, 58, .5);
  background: rgba(196, 30, 58, .14);
}
.town-react-glyph { font-size: .95rem; line-height: 1; }
.town-react-count { font-variant-numeric: tabular-nums; min-width: .75rem; }

/* Who reacted — show on hover when data-tip is set */
.town-react[data-tip]:hover::after,
.town-react[data-tip]:focus-visible::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  z-index: 40;
  min-width: 6rem;
  max-width: 16rem;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--card-face, var(--card));
  color: var(--ink);
  font-size: .78rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  line-height: 1.35;
  white-space: normal;
  text-align: center;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .28);
  pointer-events: none;
}
.town-react[data-tip]:hover::before,
.town-react[data-tip]:focus-visible::before {
  content: '';
  position: absolute;
  left: 50%;
  bottom: calc(100% + 2px);
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--line);
  z-index: 41;
  pointer-events: none;
}

/* Evil: hearts become blood on hover */
[data-theme="evil"] .town-react[data-react="heart"]:hover .town-react-glyph {
  font-size: 0;
}
[data-theme="evil"] .town-react[data-react="heart"]:hover .town-react-glyph::after {
  content: '🩸';
  font-size: .95rem;
}
[data-theme="evil"] .town-react[data-react="heart"]:hover {
  color: var(--danger);
  border-color: rgba(196, 30, 58, .55);
  background: rgba(196, 30, 58, .18);
}

.perk-class,
.stash-class {
  font-weight: 600;
  color: var(--gold-bright);
  margin-right: 2px;
}

.fbz-nice-pop {
  position: fixed;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -40%) scale(.85);
  z-index: 9999;
  padding: 18px 36px;
  border-radius: 14px;
  font-family: var(--font-display);
  font-size: 1.75rem;
  letter-spacing: .06em;
  color: var(--btn-primary-color);
  background: var(--btn-primary-bg);
  box-shadow: var(--btn-primary-shadow), 0 20px 60px rgba(0,0,0,.35);
  border: 1px solid rgba(255,255,255,.2);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .25s ease;
}
.fbz-nice-pop.is-show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

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

@keyframes home-fade-up {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .home-hero,
  .home-top-grid,
  .home-bulletin,
  .town-board {
    animation: none;
  }
}

.currency-legend {
  color: var(--muted);
  font-size: .92rem;
  margin: -8px 0 18px;
}
.currency-legend strong { color: var(--gold-bright); }
.chip.currency-usd { border-color: rgba(90,154,110,.35); }

/* Account / settings */
.account-menu {
  display: grid;
  gap: 10px;
  max-width: 420px;
}
.account-menu a.account-link {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow);
  color: var(--ink);
  text-decoration: none;
  transition: border-color .15s, box-shadow .15s;
}
.account-menu a.account-link:hover {
  border-color: var(--card-hover-border);
  box-shadow: var(--card-hover-shadow);
  text-decoration: none;
}
.account-menu a.account-link strong {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: .04em;
  font-size: .95rem;
}
.account-menu a.account-link span {
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--muted);
  font-size: .85rem;
  letter-spacing: 0;
  text-align: right;
}
.account-menu a.account-link.danger {
  color: var(--danger);
  border-color: rgba(168, 72, 72, .4);
}
[data-theme="evil"] .account-menu a.account-link.danger {
  border-color: rgba(255, 45, 85, .45);
}

.settings-label {
  margin: 1.5rem 0 10px;
  font-family: var(--font-display);
  font-size: .95rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: .04em;
}
.settings-label:first-of-type { margin-top: 0; }

.settings-form {
  display: grid;
  gap: 10px;
  max-width: 28rem;
  margin: 0 0 1.25rem;
}
.settings-field {
  display: grid;
  gap: 4px;
}
.settings-field-label {
  font-size: .8rem;
  color: var(--muted);
}
.settings-form input[type="text"],
.settings-form input[type="password"],
.settings-form input[type="tel"] {
  width: 100%;
  padding: .55rem .7rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  box-sizing: border-box;
}
.settings-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: .9rem;
  color: var(--ink);
  line-height: 1.35;
  max-width: 28rem;
}
.settings-check input {
  margin-top: .2rem;
  flex-shrink: 0;
}

.season-card {
  max-width: 36rem;
  margin: 0 0 1.25rem;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow);
}
.season-dl {
  display: grid;
  gap: 8px 16px;
  margin: 0;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
}
.season-dl > div {
  display: grid;
  gap: 2px;
}
.season-dl dt {
  margin: 0;
  font-size: .72rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}
.season-dl dd {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}
.season-gold {
  color: var(--gold);
  font-family: var(--font-display);
}
.season-stash-label {
  margin: 10px 0 4px;
  font-size: .78rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.season-stash-list {
  margin: 0;
  padding: 0 0 0 1.1rem;
  font-size: .92rem;
}
.season-stash-list li { margin: 3px 0; }
.season-stash-store {
  margin-left: 6px;
  font-size: .78rem;
  color: var(--muted);
}
.settings-form .btn {
  justify-self: start;
  margin-top: .15rem;
}
.settings-error {
  margin: -.5rem 0 1rem;
  color: var(--danger, #b33);
  font-size: .9rem;
}

.settings-details {
  max-width: 28rem;
  margin: 0 0 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  padding: 0 14px 4px;
}
.settings-details > summary {
  cursor: pointer;
  list-style: none;
  padding: 12px 0;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: .03em;
  color: var(--ink);
}
.settings-details > summary::-webkit-details-marker { display: none; }
.settings-details > summary::after {
  content: ' ▾';
  color: var(--muted);
  font-size: .85em;
}
.settings-details[open] > summary::after { content: ' ▴'; }
.settings-details .settings-form { margin-bottom: .75rem; }
.settings-details .page-sub { margin-top: 0; }

.impersonation-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 16px;
  padding: 8px 14px;
  background: #5c3d12;
  color: #f6e7c8;
  font-size: .9rem;
  text-align: center;
}
[data-theme="light"] .impersonation-banner {
  background: #3d2a10;
  color: #f6e7c8;
}
.impersonation-banner strong { color: #ffd700; }
.impersonation-exit {
  color: #ffd700;
  font-weight: 700;
  text-decoration: underline;
}
.impersonation-exit:hover { color: #fff; }

.btn-sm {
  padding: 6px 10px;
  font-size: .85rem;
}

.theme-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  max-width: 420px;
}
@media (max-width: 560px) {
  .theme-picker { grid-template-columns: 1fr; }
}
.theme-option {
  position: relative;
  cursor: pointer;
  border-radius: var(--radius);
  border: 2px solid var(--line);
  background: var(--card);
  padding: 0;
  overflow: visible;
  text-align: left;
  font: inherit;
  color: inherit;
  box-shadow: var(--shadow);
  transition: border-color .15s, box-shadow .15s;
}
.theme-option:hover { border-color: var(--card-hover-border); }
.theme-option.is-selected {
  border-color: var(--gold);
  box-shadow: var(--card-hover-shadow);
}
.theme-option .theme-swatch {
  height: 64px;
  display: block;
  border-radius: calc(var(--radius) - 2px) calc(var(--radius) - 2px) 0 0;
}
.theme-option .theme-swatch.light {
  background:
    radial-gradient(circle at 50% 18%, rgba(255,255,255,.95), transparent 42%),
    radial-gradient(circle at 50% 8%, rgba(230,198,90,.35), transparent 40%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60' viewBox='0 0 60 60'%3E%3Cg fill='none' stroke='%23c4a035' stroke-width='2' opacity='.55'%3E%3Cpath d='M30 10v28M18 22h24'/%3E%3C/g%3E%3C/svg%3E") center 58% / 36px 36px no-repeat,
    linear-gradient(135deg, #f7f9fd, #dce6f5 55%, #c4a035);
}
.theme-option .theme-swatch.evil {
  background:
    radial-gradient(circle at 50% 0%, rgba(176,74,74,.4), transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(201,162,39,.15), transparent 50%),
    linear-gradient(160deg, #1c1613, #14100e 60%, #1a1210);
}
.theme-option .theme-meta {
  display: block;
  padding: 18px 22px 20px;
  box-sizing: border-box;
}
.theme-option .theme-meta strong {
  display: block;
  font-family: var(--font-display);
  font-size: .92rem;
  color: var(--gold);
  margin: 0;
  padding: 0;
  letter-spacing: .03em;
  line-height: 1.35;
}
.theme-option .theme-meta span {
  display: block;
  margin-top: 4px;
  font-size: .82rem;
  color: var(--muted);
  font-weight: 400;
}
.theme-saved {
  margin: 10px 0 0;
  color: var(--success);
  font-size: .88rem;
  min-height: 1.2em;
}

@media (prefers-reduced-motion: reduce) {
  .topbar .nav a,
  .card,
  select, input, textarea,
  html, body {
    transition: none;
  }
  .card:hover {
    transform: none;
  }
}
