.page-section, .page-shell { width: var(--page); margin: 0 auto; }
.page-section { padding: 110px 0; }
.page-shell { min-height: calc(100vh - 204px); padding: 78px 0 100px; }
.page-shell > h1 { max-width: 950px; margin-bottom: 22px; font-size: clamp(2.8rem, 5vw, 5.2rem); }
.narrow-shell { max-width: 700px; }
.lede { max-width: 760px; color: var(--muted); font-size: 1.15rem; }

.balance-card { margin: 30px 0; padding: 24px; display: grid; gap: 2px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.balance-card span, .balance-card small { color: var(--muted); }
.balance-card strong { font-size: 2rem; }

.content-shell { width: min(1040px, calc(100vw - 40px)); margin: 0 auto; padding: 72px 0 110px; }
.content-shell--short { min-height: calc(100vh - 204px); }
.content-hero { max-width: 820px; margin: 0 auto 36px; }
.content-hero h1 { margin-bottom: 16px; font-size: clamp(3.1rem, 7vw, 6.4rem); }
.content-hero > p:not(.eyebrow) { max-width: 720px; color: var(--muted); font-size: clamp(1.05rem, 2vw, 1.3rem); }
.content-hero small { color: var(--faint); }
.prose-card { max-width: 820px; margin: 0 auto; }
.prose-card > section { padding: 34px 0; border-top: 1px solid var(--line); }
.prose-card h2 { margin-bottom: 20px; font-size: clamp(1.75rem, 3vw, 2.6rem); }
.prose-card h3 { margin: 26px 0 8px; color: var(--ink); }
.prose-card p, .prose-card li { color: var(--muted); font-size: 1.02rem; line-height: 1.75; }
.prose-card a { color: var(--ink); }
.content-callout { margin: 8px 0 38px; padding: 28px 30px; border: 1px solid color-mix(in srgb, var(--accent) 38%, var(--line)); border-radius: var(--radius); background: var(--surface); }
.content-callout h2 { font-size: 1.35rem; }
.content-callout p:last-child { margin-bottom: 0; }
.numbered-sections { counter-reset: legal-section; }
.numbered-sections > section { position: relative; padding-left: 58px; counter-increment: legal-section; }
.numbered-sections > section::before { content: counter(legal-section); position: absolute; top: 39px; left: 0; display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--accent); font-weight: 600; }
.contact-card { padding: 30px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.contact-link { color: var(--ink) !important; font-size: clamp(1.2rem, 3vw, 1.7rem); font-weight: 600; }
.history-timeline { margin-top: 28px; border-left: 1px solid var(--line); }
.history-timeline > div { position: relative; padding: 0 0 28px 30px; }
.history-timeline > div::before { content: ""; position: absolute; top: 7px; left: -5px; width: 9px; height: 9px; border-radius: 50%; background: var(--long); box-shadow: 0 0 0 5px var(--canvas); }
.history-timeline time { color: var(--accent); font-weight: 600; }
.history-timeline p { margin: 5px 0 0; }
.content-cta { padding-top: 36px; text-align: center; }
.content-cta p { color: var(--ink); font-size: 1.25rem; }

.milestone-modal {
  position: fixed;
  inset: 50% auto auto 50%;
  z-index: 100;
  width: min(560px, calc(100vw - 30px));
  max-height: calc(100svh - 30px);
  margin: 0;
  padding: clamp(28px, 5vw, 48px);
  transform: translate(-50%, -50%);
  overflow: hidden;
  color: var(--ink);
  border: 1px solid color-mix(in srgb, var(--long) 42%, var(--line));
  border-radius: 24px;
  background: var(--surface);
  box-shadow: 0 0 0 100vmax var(--surface), 0 36px 100px var(--surface);
  text-align: center;
}
.milestone-modal h2 { position: relative; margin: 8px 0 16px; font-size: clamp(2.15rem, 6vw, 3.8rem); }
.milestone-modal > p { position: relative; color: var(--muted); }
.milestone-modal strong { color: var(--long); }
.modal-kicker { color: var(--accent) !important; font-weight: 600; }
.modal-note { font-size: 0.9rem; }
.modal-actions { position: relative; margin-top: 26px; display: flex; justify-content: center; gap: 10px; }
.modal-actions form { margin: 0; }
.milestone-glow { position: absolute; width: 260px; height: 260px; top: -170px; left: 50%; transform: translateX(-50%); border-radius: 50%; background: var(--surface); filter: blur(42px); }

.asset-list { margin-top: 44px; border-top: 1px solid var(--line); }
.asset-list-header, .asset-row { display: grid; grid-template-columns: minmax(250px, 1.4fr) minmax(260px, 1.25fr) minmax(90px, 0.45fr) minmax(90px, 0.45fr); gap: 20px; align-items: center; }
.asset-list-header { padding: 12px 18px; color: var(--faint); font-size: 0.76rem; }
.asset-row { min-height: 82px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.asset-row:hover { background: var(--surface); }
.asset-row > div { display: grid; gap: 2px; }
.asset-row small { display: none; color: var(--faint); }
.asset-row span { color: var(--muted); font-size: 0.9rem; }
.asset-name strong { color: var(--accent); font: 500 1rem var(--font-mono); }
.asset-name span { color: var(--ink); }

.leaderboard-page > .lede { margin-bottom: 48px; }
.leaderboard-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; align-items: start; }
.leaderboard-panel { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.leaderboard-heading { padding: 24px; display: flex; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); }
.leaderboard-heading span { color: var(--accent); font-size: 0.75rem; font-weight: 600; }
.leaderboard-heading h2 { margin: 4px 0 0; font-size: 1.75rem; }
.leaderboard-heading p { max-width: 180px; margin: 0; color: var(--muted); font-size: 0.8rem; text-align: right; }
.score-list { margin: 0; padding: 0; list-style: none; }
.score-list li { min-height: 68px; padding: 12px 20px; display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: center; border-bottom: 1px solid var(--surface); }
.score-list li:last-child { border-bottom: 0; }
.score-rank { color: var(--faint); font: 500 0.85rem var(--font-mono); }
.score-list li:nth-child(-n+3) .score-rank { color: var(--accent); }
.score-player { display: grid; font-weight: 600; }
.score-player small { color: var(--faint); font-weight: 500; }
.score-list li > strong { color: var(--long); font-size: 1.02rem; }
.empty-board { min-height: 230px; padding: 38px; display: grid; place-items: center; align-content: center; text-align: center; }
.empty-board p { color: var(--muted); }

.account-page { padding-top: 56px; }
.account-hero { display: grid; grid-template-columns: auto 1fr auto; gap: 20px; align-items: center; padding-bottom: 32px; }
.account-hero h1 { margin: 0 0 4px; font-size: clamp(2.4rem, 5vw, 4.5rem); }
.account-hero p:last-child { margin: 0; color: var(--muted); }
.account-avatar { display: grid; width: 70px; height: 70px; place-items: center; border: 1px solid var(--line); border-radius: 20px; color: var(--accent); background: var(--surface); font-size: 1.8rem; font-weight: 600; }
.account-stats { display: grid; grid-template-columns: repeat(3, 1fr); border-block: 1px solid var(--line); }
.account-stats > div { padding: 22px; display: grid; gap: 3px; }
.account-stats > div + div { border-left: 1px solid var(--line); }
.account-stats span { color: var(--muted); font-size: 0.8rem; }
.account-stats strong { font-size: 1.5rem; }
.account-layout { margin-top: 48px; display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr); gap: 54px; align-items: start; }
.account-section, .account-settings { min-width: 0; }
.section-heading { margin-bottom: 22px; display: flex; justify-content: space-between; gap: 18px; align-items: end; }
.section-heading h2 { margin: 0; font-size: 2rem; }
.section-heading .eyebrow { margin-bottom: 6px; }
.game-history-list { border-top: 1px solid var(--line); }
.game-history-list article { padding: 17px 12px; display: grid; grid-template-columns: minmax(150px, 1fr) repeat(3, minmax(95px, 0.7fr)); gap: 18px; align-items: center; border-bottom: 1px solid var(--line); }
.game-history-list article > div { display: grid; }
.game-history-list span, .game-history-list small { color: var(--faint); font-size: 0.76rem; }
.game-history-list article > div:not(:first-child) strong { font-size: 0.92rem; }
.empty-copy { padding: 34px 0; color: var(--muted); }
.account-settings { padding: 26px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.settings-block { padding: 24px 0; border-top: 1px solid var(--line); }
.settings-block h3 { margin-bottom: 5px; }
.settings-block > p { color: var(--muted); font-size: 0.83rem; }
.compact-form { display: grid; gap: 9px; }
.cooldown-note { margin: 14px 0 0; padding: 12px; border-radius: 9px; background: var(--surface); }
.form-errors { margin-bottom: 22px; padding: 16px 20px; border: 1px solid color-mix(in srgb, var(--short) 55%, var(--line)); border-radius: 12px; background: var(--surface); }
.form-errors ul { margin-bottom: 0; }

.flash { width: var(--page); margin: 14px auto 0; padding: 11px 15px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.flash--alert { border-color: color-mix(in srgb, var(--short) 55%, var(--line)); }
.flash--notice { border-color: color-mix(in srgb, var(--long) 55%, var(--line)); }

.auth-shell { width: var(--page); min-height: calc(100vh - 204px); margin: 0 auto; padding: 54px 0 80px; display: grid; place-items: start center; }
.auth-card { width: min(100%, 500px); padding: clamp(24px, 5vw, 40px); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 28px 70px var(--surface); }
.auth-card--wide { width: min(100%, 620px); }
.auth-card h1 { margin-bottom: 18px; font-size: clamp(2.2rem, 5vw, 3.4rem); }
.auth-intro { margin-bottom: 20px; color: var(--muted); font-size: 0.9rem; }
.auth-card .actions { margin: 20px 0 14px; }
.auth-card .field input[type="checkbox"] + label { display: inline; margin-left: 6px; }
.auth-card > a { display: inline-block; margin: 4px 14px 0 0; color: var(--muted); font-size: 0.9rem; }
.auth-card br + a { margin-top: 8px; }
.auth-card em, .auth-card i { color: var(--faint); font-size: 0.8rem; }
#error_explanation { margin-bottom: 16px; padding: 12px 14px; border: 1px solid color-mix(in srgb, var(--short) 52%, var(--line)); border-radius: 10px; background: var(--surface); }
#error_explanation h2 { margin-bottom: 6px; font-size: 0.95rem; letter-spacing: 0; }
#error_explanation ul { margin: 0; padding-left: 20px; color: var(--muted); font-size: 0.8rem; }

.signup-page { height: 100svh; min-height: 0; overflow: hidden; }
.signup-page .site-footer { display: none; }
.signup-page .auth-shell { height: calc(100svh - 72px); min-height: 0; padding: 12px 0; place-items: center; overflow: hidden; }
.signup-page .auth-card { max-height: 100%; padding: 16px clamp(20px, 4vw, 34px); }
.signup-page .auth-card h1 { margin-bottom: 8px; font-size: clamp(1.85rem, 4.2vh, 2.7rem); }
.signup-page .auth-card .eyebrow { margin-bottom: 6px; }
.signup-page .auth-intro { margin-bottom: 12px; }
.signup-page form .field { margin-bottom: 9px; }
.signup-page label { margin-bottom: 3px; font-size: 0.78rem; }
.signup-page input[type="email"], .signup-page input[type="password"], .signup-page input[type="text"] { padding-block: 9px; }
.signup-page .auth-card .actions { margin: 13px 0 8px; }

.site-footer { width: var(--page); margin: 0 auto; padding: 28px 0 40px; display: flex; justify-content: space-between; gap: 24px; border-top: 1px solid var(--line); color: var(--faint); font-size: 0.78rem; }
.site-footer p { margin: 0; }
.site-footer nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 18px; }

form .field { margin-bottom: 16px; }
label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 0.88rem; }
input[type="email"], input[type="password"], input[type="text"] { width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); outline: none; background: var(--surface); }
input:focus { border-color: color-mix(in srgb, var(--long) 64%, var(--line)); box-shadow: 0 0 0 3px var(--surface); }
input[type="submit"] { min-height: 42px; padding: 10px 17px; border: 0; border-radius: 9px; color: var(--canvas); background: var(--long); font-weight: 600; cursor: pointer; }

@media (max-width: 980px) {
  .leaderboard-grid { grid-template-columns: 1fr; }
  .account-layout { grid-template-columns: 1fr; gap: 40px; }
  .asset-list-header, .asset-row { grid-template-columns: minmax(220px, 1.2fr) minmax(240px, 1fr) 80px 80px; }
}

@media (max-width: 760px) {
  .asset-list-header { display: none; }
  .asset-row { grid-template-columns: 1fr 1fr; gap: 12px 20px; }
  .asset-row small { display: block; }
  .account-stats { grid-template-columns: 1fr; }
  .account-stats > div + div { border-left: 0; border-top: 1px solid var(--line); }
  .game-history-list article { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 620px) {
  .page-shell { padding: 58px 0 76px; }
  .page-section { padding: 74px 0; }
  .content-shell { width: min(100% - 28px, 1040px); padding: 56px 0 78px; }
  .content-hero { margin-bottom: 28px; }
  .content-callout { padding: 22px; }
  .numbered-sections > section { padding-left: 0; padding-top: 64px; }
  .numbered-sections > section::before { top: 22px; }
  .site-footer { flex-direction: column; }
  .site-footer nav { justify-content: flex-start; }
  .leaderboard-heading { display: block; }
  .leaderboard-heading p { margin-top: 9px; max-width: none; text-align: left; }
  .account-hero { grid-template-columns: auto 1fr; }
  .account-hero > form { grid-column: 1 / -1; }
  .account-avatar { width: 54px; height: 54px; border-radius: 15px; }
  .account-settings { padding: 20px; }
  .asset-row { padding-inline: 8px; }

  .modal-actions { flex-direction: column; }
  .modal-actions .button, .modal-actions form { width: 100%; }

  .signup-page .auth-shell { height: calc(100svh - 62px); }
  .signup-page .auth-card { padding: 16px 18px; }
  .signup-page .auth-intro { font-size: 0.78rem; }
}

@media (max-height: 700px) {
  .signup-page .auth-intro { display: none; }
  .signup-page .auth-card { padding-block: 13px; }
  .signup-page .auth-card h1 { font-size: 1.75rem; }
  .signup-page form .field { margin-bottom: 6px; }
  .signup-page input[type="email"], .signup-page input[type="password"], .signup-page input[type="text"] { padding-block: 7px; }
}
