:root {
  color-scheme: dark;
  --ink: #080806;
  --coal: #151410;
  --panel: rgba(18, 16, 12, 0.84);
  --panel-strong: rgba(10, 10, 8, 0.9);
  --paper: #f1e5c8;
  --muted: #b8ab8d;
  --brass: #d6aa4b;
  --teal: #39c8bc;
  --red: #c75555;
  --line: rgba(241, 229, 200, 0.16);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--paper);
  background:
    linear-gradient(90deg, rgba(8, 8, 6, 0.9), rgba(8, 8, 6, 0.5) 48%, rgba(8, 8, 6, 0.86)),
    url("assets/syndicate-backdrop.png") center / cover fixed,
    var(--ink);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background-image:
    linear-gradient(rgba(214, 170, 75, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(214, 170, 75, 0.045) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: radial-gradient(circle at 50% 20%, black, transparent 72%);
}

button,
input,
select {
  font: inherit;
}

a {
  color: inherit;
}

button,
.family-link {
  min-height: 44px;
  border: 1px solid rgba(214, 170, 75, 0.45);
  border-radius: 6px;
  color: #110f0b;
  background: linear-gradient(135deg, #f5d073, var(--brass));
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
  cursor: pointer;
  transition: transform 160ms ease, filter 160ms ease;
}

button:hover,
.family-link:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--paper);
  background: rgba(7, 7, 7, 0.62);
  outline: none;
  padding: 0 14px;
}

input:focus,
select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(57, 200, 188, 0.16);
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 86px 0 42px;
}

body[data-route="home"],
body[data-route="login"],
body[data-route="register"] {
  background: #030303;
}

body[data-route="home"] .app-shell,
body[data-route="login"] .app-shell,
body[data-route="register"] .app-shell {
  width: 100%;
  padding: 0;
}

body[data-route="home"] .masthead,
body[data-route="login"] .masthead,
body[data-route="register"] .masthead {
  display: none;
}

body[data-route="home"] .view,
body[data-route="login"] .view,
body[data-route="register"] .view {
  gap: 0;
  margin: 0;
}

body[data-route="influence"] .masthead {
  display: none;
}

body[data-route="influence"] .app-shell {
  width: min(980px, calc(100% - 32px));
  padding-top: 86px;
}

.masthead,
.intro-grid,
.family-card,
.family-hero,
.member-card,
.rankings-panel,
.house-panel,
.profile-chooser,
.code-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.masthead {
  display: grid;
  align-content: space-between;
  min-height: 420px;
  padding: 24px;
  overflow: hidden;
}

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 50;
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  overflow-x: auto;
  border-bottom: 1px solid rgba(214, 170, 75, 0.22);
  background: rgba(8, 8, 6, 0.9);
  backdrop-filter: blur(18px);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.36);
}

.topbar a {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--paper);
  background: rgba(0, 0, 0, 0.24);
  text-decoration: none;
}

.hero-copy {
  max-width: 840px;
  padding: 54px 0;
}

.hero-copy h1,
.intro-grid h2,
.family-hero h2,
.rankings-panel h2,
.house-panel h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  line-height: 0.94;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero-copy h1 {
  font-size: clamp(3.4rem, 8vw, 7.4rem);
}

.hero-copy p:not(.eyebrow),
.intro-grid p,
.family-hero p,
.code-panel p {
  max-width: 660px;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.65;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.summary-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.summary-strip span {
  padding: 10px 12px;
  border: 1px solid rgba(214, 170, 75, 0.26);
  border-radius: 6px;
  color: var(--brass);
  background: rgba(0, 0, 0, 0.38);
}

.business-clock {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px solid rgba(214, 170, 75, 0.34);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.52);
}

.business-clock strong {
  color: var(--brass);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.55rem;
}

.business-clock span {
  color: var(--muted);
  text-align: right;
}

.business-clock.is-open {
  border-color: rgba(57, 200, 188, 0.62);
  background: rgba(20, 74, 66, 0.72);
}

.business-clock.is-open strong {
  color: var(--teal);
}

.business-clock.is-closed {
  border-color: rgba(199, 85, 85, 0.58);
  background: rgba(82, 28, 28, 0.72);
}

.business-clock.is-closed strong {
  color: #ffb0a8;
}

.view {
  display: grid;
  gap: 24px;
  margin-top: 24px;
}

.secret-home {
  height: 100vh;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  background: #030303;
}

.speakeasy-stage,
.phone-stage,
.login-page {
  min-height: 100vh;
}

.speakeasy-stage,
.phone-stage {
  position: relative;
  display: grid;
  place-items: center;
  scroll-snap-align: start;
  overflow: hidden;
}

.speakeasy-stage {
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.78), rgba(0, 0, 0, 0.24) 48%, rgba(0, 0, 0, 0.78)),
    linear-gradient(0deg, rgba(0, 0, 0, 0.82), transparent 32%, rgba(0, 0, 0, 0.28)),
    url("assets/speakeasy-hero.png") center / cover no-repeat;
}

.watch-copy {
  display: grid;
  gap: 24px;
  width: min(760px, calc(100% - 36px));
  text-align: center;
}

.watch-copy > p {
  margin: 0;
  color: var(--paper);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.35rem, 4vw, 3.5rem);
  line-height: 0.92;
  text-transform: uppercase;
  text-shadow: 0 18px 46px rgba(0, 0, 0, 0.85);
}

.watch-copy .business-clock {
  width: min(680px, 100%);
  margin: 0 auto;
}

.phone-stage {
  background:
    radial-gradient(circle at 50% 42%, rgba(214, 170, 75, 0.18), transparent 34%),
    linear-gradient(180deg, #030303, #0b0805 52%, #030303);
}

.phone-button {
  display: block;
  width: min(620px, calc(100% - 42px));
  border-radius: 8px;
  outline: none;
  transition: transform 180ms ease, filter 180ms ease;
}

.phone-button:hover,
.phone-button:focus-visible {
  transform: translateY(-4px) scale(1.01);
  filter: brightness(1.08);
}

.phone-button img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid rgba(214, 170, 75, 0.25);
  border-radius: 8px;
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.62);
}

.login-page {
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 20%, rgba(214, 170, 75, 0.08), transparent 28%),
    #000;
}

.login-form {
  display: grid;
  gap: 14px;
  width: min(420px, 100%);
}

.login-form h2 {
  margin: 0 0 10px;
  color: var(--paper);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.2rem, 8vw, 4rem);
  line-height: 0.94;
  text-transform: uppercase;
}

.login-form label span {
  display: block;
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.login-form button {
  margin-top: 4px;
}

.join-link,
.admin-link {
  justify-self: center;
  margin-top: 8px;
  color: var(--teal);
  font-weight: 700;
  text-transform: lowercase;
  text-decoration: none;
}

.admin-link {
  color: var(--muted);
  font-size: 0.92rem;
}

.form-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.member-session {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.member-session span {
  color: var(--muted);
}

.member-session button {
  min-width: 100px;
}

.intro-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 28px;
  padding: 24px;
}

.intro-grid h2,
.family-hero h2,
.rankings-panel h2,
.house-panel h2 {
  font-size: clamp(2rem, 4vw, 4rem);
}

.week-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.week-list li,
.compact-list article,
.ledger li {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
}

.week-list li {
  display: grid;
  grid-template-columns: 38px 1fr;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 8px 12px;
}

.week-list span,
.ranking-row > strong {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(214, 170, 75, 0.4);
  border-radius: 50%;
  color: var(--brass);
  font-family: Georgia, "Times New Roman", serif;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.section-heading span {
  color: var(--muted);
}

.families,
.member-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.family-card {
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  gap: 16px;
  min-height: 360px;
  padding: 18px;
}

.profile-chooser {
  padding: 22px;
}

.profile-chooser .section-heading p:not(.eyebrow) {
  max-width: 620px;
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.preview-card {
  min-height: 260px;
}

.family-mark {
  width: 54px;
  height: 10px;
  border-radius: 99px;
  box-shadow: 0 0 24px currentColor;
}

.family-card h2,
.member-card h3,
.code-panel h3,
.ranking-row h3,
.house-actions h3 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
}

.family-card h2 {
  font-size: 2rem;
}

.family-story {
  color: var(--muted);
  line-height: 1.5;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.stats-grid div,
.member-sums div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.22);
}

.stats-grid dt,
.member-sums dt {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.stats-grid dd,
.member-sums dd {
  margin: 4px 0 0;
  color: var(--brass);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.35rem;
  overflow-wrap: anywhere;
}

.family-link {
  display: grid;
  place-items: center;
  padding: 0 14px;
  text-decoration: none;
}

.family-link.secondary {
  color: var(--paper);
  background: rgba(0, 0, 0, 0.36);
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.commissioner-line {
  margin-top: 14px;
}

.commissioner-line strong {
  color: var(--brass);
}

.family-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 24px;
  padding: 26px;
  border-color: color-mix(in srgb, var(--family-color), var(--line) 55%);
}

.major dd {
  font-size: 1.8rem;
}

.member-card {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.member-sums {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.family-sums {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.member-topline {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
}

.member-topline strong {
  color: var(--teal);
}

.member-card h3 {
  font-size: 2rem;
}

.member-name-button {
  min-height: 0;
  border: 0;
  border-radius: 0;
  color: var(--paper);
  background: transparent;
  box-shadow: none;
  padding: 0;
  font: inherit;
  text-align: left;
}

.member-name-button:hover,
.member-name-button.is-selected {
  color: var(--teal);
  transform: none;
  filter: none;
}

.member-ledger-panel {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.member-ledger-panel h3 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.8rem;
}

.member-ledger-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.member-ledger-list li {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
}

.member-ledger-list strong {
  display: block;
  margin-bottom: 4px;
}

.member-ledger-list span {
  color: var(--muted);
}

.member-ledger-list dl {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 0;
}

.member-ledger-list dl div {
  min-width: 110px;
  padding: 8px;
  border: 1px solid rgba(214, 170, 75, 0.2);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.22);
}

.member-ledger-list dt {
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
}

.member-ledger-list dd {
  margin: 3px 0 0;
  color: var(--brass);
  font-family: Georgia, "Times New Roman", serif;
}

.empty-ledger {
  color: var(--muted);
}

.code-panel,
.rankings-panel,
.text-page,
.house-panel,
.matrix-page,
.schedule-page,
.bankroll-page {
  padding: 22px;
}

.bankroll-page {
  border: 1px solid rgba(214, 170, 75, 0.3);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(11, 26, 19, 0.82), rgba(8, 8, 6, 0.94) 46%, rgba(21, 20, 16, 0.9)),
    var(--panel);
  box-shadow: var(--shadow);
}

.bankroll-hero {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(214, 170, 75, 0.28);
}

.bankroll-hero h2 {
  max-width: 920px;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.2rem, 5vw, 4.8rem);
  line-height: 0.94;
  letter-spacing: 0;
  text-transform: uppercase;
}

.bankroll-hero p,
.bankroll-block p,
.bankroll-block li {
  color: #ded2b6;
  line-height: 1.55;
}

.bankroll-hero p {
  max-width: 880px;
  margin: 0;
}

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

.bankroll-block {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  break-inside: avoid;
}

.bankroll-block h3 {
  margin: 0 0 10px;
  color: var(--brass);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.24rem;
  line-height: 1.15;
  text-transform: uppercase;
}

.bankroll-block p {
  margin: 7px 0;
}

.bankroll-block ul {
  margin: 8px 0 0;
  padding-left: 20px;
}

.reward-card {
  display: inline-grid;
  min-width: 150px;
  margin: 10px 0 0;
  padding: 9px 11px;
  border: 1px solid rgba(214, 170, 75, 0.28);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.28);
}

.reward-card dt {
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: uppercase;
}

.reward-card dd {
  margin: 3px 0 0;
  color: var(--brass);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.32rem;
}

.bankroll-closing,
.bankroll-footer {
  color: var(--brass);
}

.bankroll-footer {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(214, 170, 75, 0.26);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.45rem;
}

.schedule-page {
  border: 1px solid rgba(214, 170, 75, 0.3);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(11, 26, 19, 0.82), rgba(8, 8, 6, 0.94) 46%, rgba(21, 20, 16, 0.9)),
    var(--panel);
  box-shadow: var(--shadow);
}

.schedule-hero {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(214, 170, 75, 0.28);
}

.schedule-hero h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.4rem, 5vw, 5rem);
  line-height: 0.94;
  letter-spacing: 0;
  text-transform: uppercase;
}

.schedule-list {
  display: grid;
  gap: 10px;
}

.schedule-item {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.schedule-item.is-completed {
  border-color: rgba(57, 200, 188, 0.44);
  background: rgba(57, 200, 188, 0.08);
}

.schedule-toggle {
  display: grid;
  grid-template-columns: 98px minmax(0, 1fr) minmax(128px, auto);
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 62px;
  border: 0;
  border-radius: 0;
  color: var(--paper);
  background: transparent;
  box-shadow: none;
  padding: 14px 16px;
  text-align: left;
}

.schedule-toggle:hover {
  transform: none;
  filter: none;
  background: rgba(214, 170, 75, 0.06);
}

.night-number,
.night-status {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.night-number {
  color: var(--teal);
}

.night-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.45rem;
}

.night-status {
  justify-self: end;
  padding: 7px 9px;
  border: 1px solid rgba(214, 170, 75, 0.28);
  border-radius: 6px;
  color: var(--brass);
  background: rgba(0, 0, 0, 0.28);
}

.is-completed .night-status {
  border-color: rgba(57, 200, 188, 0.42);
  color: var(--teal);
}

.schedule-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 260ms ease;
}

.schedule-panel p {
  margin: 0;
  padding: 0 16px 16px 128px;
  color: #ded2b6;
  line-height: 1.65;
}

.schedule-footer {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(214, 170, 75, 0.26);
  color: var(--brass);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.45rem;
}

.matrix-page {
  border: 1px solid rgba(214, 170, 75, 0.34);
  border-radius: 8px;
  color: var(--paper);
  background:
    linear-gradient(135deg, rgba(11, 26, 19, 0.92), rgba(8, 8, 6, 0.96) 42%, rgba(21, 20, 16, 0.94)),
    var(--panel-strong);
  box-shadow: var(--shadow);
}

.matrix-hero {
  display: grid;
  gap: 8px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(214, 170, 75, 0.28);
}

.matrix-hero h2 {
  max-width: 900px;
  margin: 0;
  color: var(--paper);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.3rem, 5vw, 5.2rem);
  line-height: 0.94;
  letter-spacing: 0;
  text-transform: uppercase;
}

.matrix-version {
  margin: 0;
  color: var(--brass);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.matrix-tagline {
  max-width: 780px;
  margin: 10px 0 0;
  color: var(--paper);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.25rem, 2.4vw, 2rem);
  line-height: 1.25;
}

.matrix-section {
  margin-top: 22px;
  break-inside: avoid;
}

.matrix-section h3 {
  margin: 0 0 10px;
  color: var(--brass);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.34rem;
  line-height: 1.15;
  text-transform: uppercase;
}

.matrix-section p {
  max-width: 900px;
  margin: 7px 0;
  color: #ded2b6;
  line-height: 1.55;
}

.matrix-section strong,
.matrix-footer {
  color: var(--brass);
}

.matrix-note {
  margin-top: 12px;
  padding: 12px 14px;
  border-left: 3px solid rgba(214, 170, 75, 0.58);
  background: rgba(0, 0, 0, 0.24);
}

.matrix-table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border: 1px solid rgba(241, 229, 200, 0.2);
  border-radius: 6px;
  font-size: 0.96rem;
}

.matrix-table th,
.matrix-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(241, 229, 200, 0.14);
  text-align: left;
  vertical-align: top;
}

.matrix-table th {
  color: #10100c;
  background: linear-gradient(135deg, #ead082, var(--brass));
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.matrix-table tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.035);
}

.matrix-table td:last-child {
  width: 190px;
  color: var(--brass);
  font-weight: 700;
}

.matrix-definitions {
  display: grid;
  gap: 10px;
  margin: 0;
}

.matrix-definitions div {
  display: grid;
  grid-template-columns: minmax(160px, 0.35fr) minmax(0, 1fr);
  gap: 14px;
  padding: 12px;
  border: 1px solid rgba(241, 229, 200, 0.16);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.22);
}

.matrix-definitions dt {
  color: var(--brass);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.12rem;
}

.matrix-definitions dd {
  margin: 0;
  color: #ded2b6;
  line-height: 1.45;
}

.matrix-footer {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid rgba(214, 170, 75, 0.28);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.65rem;
}

.text-page {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.text-page h2 {
  margin: 0 0 18px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.3rem, 5vw, 4.8rem);
  line-height: 0.94;
  letter-spacing: 0;
  text-transform: uppercase;
}

.text-page p {
  max-width: 820px;
  color: var(--muted);
  font-size: 1.04rem;
  line-height: 1.72;
}

.text-page:not(.code-book) p:last-child {
  color: var(--brass);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.5rem;
}

.code-book h2 {
  margin-top: 34px;
}

.code-book h2:first-child {
  margin-top: 0;
}

.code-book h3 {
  max-width: 820px;
  margin: 26px 0 8px;
  color: var(--brass);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.55rem;
  line-height: 1.15;
}

.code-book strong {
  color: var(--paper);
}

.code-quote {
  color: var(--brass);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.45rem;
}

.code-item {
  max-width: 780px;
  margin: 6px 0 6px 18px;
  padding-left: 12px;
  border-left: 2px solid rgba(214, 170, 75, 0.32);
}

.code-divider {
  max-width: 840px;
  margin: 28px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.text-link {
  display: inline-flex;
  margin-top: 8px;
  color: var(--teal);
  font-weight: 700;
  text-decoration: none;
}

.code-list {
  display: grid;
  gap: 10px;
  max-width: 760px;
  margin: 20px 0;
}

.code-list div {
  display: grid;
  grid-template-columns: minmax(180px, 0.6fr) minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
}

.code-list dt {
  color: var(--muted);
  text-transform: uppercase;
  font-size: 0.78rem;
}

.code-list dd {
  margin: 0;
  color: var(--paper);
}

.ranking-list,
.compact-list,
.ledger {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ranking-row {
  display: grid;
  grid-template-columns: 42px 12px minmax(0, 1fr) 80px;
  align-items: center;
  gap: 14px;
  min-height: 78px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
}

.ranking-row h3 {
  font-size: 1.35rem;
}

.ranking-row p {
  margin: 4px 0 0;
  color: var(--muted);
}

.ranking-row b {
  color: var(--brass);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2rem;
  text-align: right;
}

.family-dot {
  width: 10px;
  height: 48px;
  border-radius: 99px;
}

.house-access {
  display: grid;
  grid-template-columns: minmax(160px, 220px) 92px;
  gap: 8px;
}

.house-access.is-hidden {
  display: none;
}

.error-line {
  min-height: 22px;
  margin: 0 0 12px;
  color: var(--red);
}

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

.compact-list article {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px;
  padding: 12px;
}

.compact-list article.is-selected {
  border-color: rgba(57, 200, 188, 0.58);
  background: rgba(57, 200, 188, 0.1);
}

.compact-list article > span:not(.drag-handle) {
  grid-column: 2;
}

.compact-list .member-sums {
  grid-column: 2;
  margin-top: 4px;
}

.compact-list .member-sums div {
  padding: 8px;
}

.compact-list .member-sums dd {
  font-size: 1.05rem;
}

.reorder-list article {
  cursor: grab;
}

.reorder-list article.is-dragging {
  opacity: 0.58;
  cursor: grabbing;
  outline: 1px solid rgba(214, 170, 75, 0.6);
}

.drag-handle {
  grid-row: span 3;
  align-self: center;
  padding: 5px 7px;
  border: 1px solid rgba(214, 170, 75, 0.28);
  border-radius: 6px;
  color: var(--brass);
  font-size: 0.68rem;
  text-transform: uppercase;
}

.family-rank-button,
.clear-family-filter {
  min-height: 0;
  width: fit-content;
  border: 0;
  border-radius: 0;
  color: var(--paper);
  background: transparent;
  box-shadow: none;
  padding: 0;
  text-align: left;
}

.family-rank-button {
  justify-self: start;
  font-weight: 700;
}

.family-rank-button:hover,
.clear-family-filter:hover {
  color: var(--teal);
  transform: none;
  filter: none;
}

.clear-family-filter {
  color: var(--brass);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.compact-list span,
.ledger span {
  color: var(--muted);
}

.house-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 18px 0;
}

.house-actions form {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
}

.house-actions label {
  display: grid;
  gap: 6px;
}

.house-actions label span,
.target-choice {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.target-checklist {
  display: grid;
  gap: 7px;
  max-height: 285px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(7, 7, 7, 0.62);
}

.target-choice {
  grid-template-columns: 18px 22px minmax(0, 1fr);
  align-items: center;
  min-height: 38px;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
}

.target-choice input {
  width: 16px;
  min-height: 16px;
  margin: 0;
  accent-color: var(--teal);
}

.target-checkmark {
  color: transparent;
  font-size: 0.95rem;
}

.target-choice:has(input:checked) {
  border-color: rgba(57, 200, 188, 0.46);
  color: var(--paper);
  background: rgba(57, 200, 188, 0.1);
}

.target-choice:has(input:checked) .target-checkmark {
  color: var(--teal);
}

.form-divider {
  height: 1px;
  margin: 8px 0 2px;
  background: var(--line);
}

.danger-button {
  border-color: rgba(199, 85, 85, 0.6);
  color: var(--paper);
  background: linear-gradient(135deg, #7f2b2b, #3a1111);
}

.ledger li {
  padding: 12px;
}

.ledger strong {
  display: block;
  margin-bottom: 4px;
}

.ledger-entry-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ledger-undo-button {
  min-height: 34px;
  padding: 0 12px;
  color: var(--paper);
  background: rgba(199, 85, 85, 0.22);
}

.empty {
  padding: 28px;
  border: 1px dashed rgba(241, 229, 200, 0.28);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 900px) {
  .intro-grid,
  .family-hero,
  .house-grid,
  .house-actions,
  .bankroll-grid {
    grid-template-columns: 1fr;
  }

  .masthead {
    min-height: 360px;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding: 16px 0 28px;
  }

  .masthead,
  .intro-grid,
  .family-hero,
  .rankings-panel,
  .house-panel,
  .matrix-page,
  .schedule-page,
  .bankroll-page {
    padding: 16px;
  }

  .hero-copy {
    padding: 34px 0;
  }

  .summary-strip,
  .business-clock,
  .topbar,
  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    align-items: center;
    flex-direction: row;
    justify-content: flex-start;
  }

  .business-clock span {
    text-align: left;
  }

  .stats-grid,
  .house-access,
  .code-list div,
  .matrix-definitions div {
    grid-template-columns: 1fr;
  }

  .ranking-row {
    grid-template-columns: 38px 10px minmax(0, 1fr);
  }

  .ranking-row b {
    grid-column: 3;
    text-align: left;
  }

  .schedule-toggle {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .night-status {
    justify-self: start;
  }

  .schedule-panel p {
    padding: 0 16px 16px;
  }
}

@media print {
  @page {
    margin: 0.45in;
  }

  body {
    color: #f1e5c8;
    background: #080806;
  }

  body::before,
  .masthead {
    display: none;
  }

  .app-shell {
    width: 100%;
    padding: 0;
  }

  .view {
    margin: 0;
  }

  .matrix-page {
    border-color: #7c672f;
    box-shadow: none;
    background: #0d0f0b;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .matrix-hero h2 {
    font-size: 38pt;
  }

  .matrix-tagline {
    font-size: 16pt;
  }

  .matrix-section h3 {
    font-size: 13pt;
  }

  .matrix-section p,
  .matrix-table,
  .matrix-definitions dd {
    font-size: 9.5pt;
  }

  .matrix-table th,
  .matrix-table td {
    padding: 6pt 7pt;
  }
}
