:root {
  --shell-bg: rgba(10, 20, 19, 0.9);
  --shell-border: rgba(236, 230, 216, 0.12);
  --control-bg: rgba(20, 33, 31, 0.72);
  --control-hover: rgba(255, 106, 69, 0.1);
}

html[data-theme="light"] {
  --ink: #f7faf8;
  --ink-2: #edf3f0;
  --card: #ffffff;
  --bone: #17231f;
  --dim: #536760;
  --coral: #c44828;
  --coral-soft: rgba(196, 72, 40, 0.1);
  --learn: #16788b;
  --learn-soft: rgba(22, 120, 139, 0.1);
  --green: #367a54;
  --gold: #876600;
  --cust: #16788b;
  --buyer: #16788b;
  --signal: #16788b;
  --neg: #16788b;
  --prod: #a45d00;
  --seller: #a45d00;
  --emit: #a45d00;
  --excess: #a45d00;
  --cons: #367a54;
  --mkt: #2e7b62;
  --quantity: #2e7b62;
  --active: #367a54;
  --idle: #64746e;
  --line: rgba(23, 55, 47, 0.16);
  --line-2: rgba(23, 55, 47, 0.09);
  --shell-bg: rgba(247, 250, 248, 0.92);
  --shell-border: rgba(23, 55, 47, 0.16);
  --control-bg: rgba(255, 255, 255, 0.82);
  --control-hover: rgba(196, 72, 40, 0.08);
}

body {
  min-width: 320px;
  transition: background-color 180ms ease, color 180ms ease;
}

h1,
h2,
h3,
.tagline {
  letter-spacing: 0 !important;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--coral, #ff6a45);
  outline-offset: 3px;
}

.topbar {
  min-height: 68px;
  gap: 18px;
  background: var(--shell-bg) !important;
  border-bottom: 1px solid transparent;
  backdrop-filter: blur(16px) saturate(125%) !important;
  -webkit-backdrop-filter: blur(16px) saturate(125%);
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.topbar.is-scrolled {
  border-bottom-color: var(--shell-border);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.14);
}

.theme-toggle {
  display: inline-grid;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line, rgba(236, 230, 216, 0.12));
  border-radius: 6px;
  color: var(--bone, #ece6d8);
  background: var(--control-bg);
  font-family: var(--mono, ui-monospace, monospace);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  transition: color 180ms ease, border-color 180ms ease, background 180ms ease;
}

.theme-toggle:hover {
  border-color: var(--coral, #ff6a45);
  background: var(--control-hover);
}

.topbar .brand {
  min-width: 0;
  flex: 1 1 auto;
}

.topbar .brand .txt {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-left: auto;
}

.site-nav a,
.paper-footer-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  gap: 7px;
  border: 1px solid var(--line, rgba(236, 230, 216, 0.12));
  border-radius: 6px;
  padding: 7px 11px;
  color: var(--bone, #ece6d8);
  background: var(--control-bg);
  font-family: var(--mono, ui-monospace, monospace);
  font-size: 11.5px;
  line-height: 1;
  letter-spacing: 0;
  text-decoration: none;
  white-space: nowrap;
  transition: color 180ms ease, border-color 180ms ease, background 180ms ease;
}

.site-nav a:hover,
.paper-footer-actions a:hover {
  color: var(--bone, #ece6d8);
  border-color: rgba(255, 106, 69, 0.62);
  background: var(--control-hover);
}

.site-nav .site-pdf,
.paper-footer-actions .footer-pdf {
  color: #1a0a05;
  border-color: var(--coral, #ff6a45);
  background: var(--coral, #ff6a45);
  font-weight: 600;
}

.site-nav .site-pdf:hover,
.paper-footer-actions .footer-pdf:hover {
  color: #1a0a05;
  background: #ff7b5c;
  border-color: #ff7b5c;
}

.topbar .toggle {
  flex: 0 0 auto;
  border-radius: 6px !important;
}

.topbar .toggle button {
  min-height: 32px;
}

.reading-progress {
  position: fixed;
  z-index: 80;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  pointer-events: none;
}

.reading-progress::after {
  content: "";
  display: block;
  width: var(--reading-progress, 0%);
  height: 100%;
  background: var(--coral, #ff6a45);
  transition: width 80ms linear;
}

.hero {
  min-height: min(900px, 92svh) !important;
}

.stats,
.tablewrap,
.callout,
.chip,
.icard,
.card,
.mathcard,
.fig,
.blink,
.gpanel,
.gamebox,
.sidenote,
.paper-card {
  border-radius: 8px !important;
}

.paper-footer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 24px;
}

.paper-footer-actions + .disc {
  margin-top: 22px;
}

.practice-section {
  background: var(--ink-2, #0f1c1a);
  border-top: 1px solid var(--line, rgba(236, 230, 216, 0.12));
  border-bottom: 1px solid var(--line, rgba(236, 230, 216, 0.12));
}

.practice-section .practice-lede {
  max-width: 68ch;
}

.practice-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(18px, 2.7vw, 32px);
  margin-top: clamp(34px, 5vw, 54px);
}

.practice-item {
  min-width: 0;
  padding-top: 18px;
  border-top: 2px solid var(--learn, #5fb8c9);
}

.practice-item:nth-child(2) {
  border-top-color: var(--coral, #ff6a45);
}

.practice-item:nth-child(3) {
  border-top-color: #77b982;
}

.practice-item:nth-child(4) {
  border-top-color: #d9a441;
}

.practice-item h3 {
  margin: 0 0 10px;
  color: var(--bone, #ece6d8);
  font-family: var(--disp, system-ui, sans-serif);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0;
}

.practice-item p {
  margin: 0;
  color: var(--dim, #9db0a8);
  font-size: 14px;
  line-height: 1.58;
}

html[data-theme="light"] .collection-bar {
  background: var(--shell-bg);
  border-bottom-color: var(--shell-border);
  box-shadow: 0 8px 28px rgba(23, 55, 47, 0.07);
}

html[data-theme="light"] .toggle {
  background: var(--control-bg) !important;
}

html[data-theme="light"] .toggle button.active,
html[data-theme="light"] .site-nav .site-pdf,
html[data-theme="light"] .paper-footer-actions .footer-pdf,
html[data-theme="light"] .paper-actions .primary,
html[data-theme="light"] .pcard .tag,
html[data-theme="light"] .gbtn.accept:hover,
html[data-theme="light"] .gbtn.reject:hover,
html[data-theme="light"] .bfill .v {
  color: #ffffff;
}

html[data-theme="light"] .topbar.is-scrolled {
  box-shadow: 0 10px 30px rgba(23, 55, 47, 0.09);
}

html[data-theme="light"] .eqblock,
html[data-theme="light"] .gpill {
  background: rgba(23, 55, 47, 0.025);
}

html[data-theme="light"] svg [stroke^="rgba(236,230,216"],
html[data-theme="light"] svg [stroke^="rgba(157,176,168"] {
  stroke: rgba(23, 55, 47, 0.3);
}

html[data-theme="light"] svg [fill^="rgba(157,176,168"] {
  fill: rgba(83, 103, 96, 0.14);
}

@media (max-width: 760px) {
  .topbar {
    padding: 14px 18px !important;
    gap: 10px;
  }

  .topbar .brand {
    flex: 0 1 auto;
  }

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

  .site-nav a {
    min-width: 34px;
    padding-inline: 9px;
  }

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

@media (max-width: 480px) {
  .topbar .brand svg {
    display: none;
  }

  .site-nav {
    gap: 6px;
  }

  .site-nav .site-pdf {
    font-size: 0;
  }

  .site-nav .site-pdf::before {
    content: "PDF";
    font-size: 11px;
  }

  .topbar .toggle button {
    padding-inline: 9px !important;
  }

  .theme-toggle {
    flex-basis: 32px;
    width: 32px;
    height: 32px;
  }

  .practice-grid {
    grid-template-columns: 1fr;
  }
}

@media print {
  .topbar,
  .reading-progress,
  .paper-footer-actions,
  .theme-toggle {
    display: none !important;
  }

  body {
    background: #fff !important;
    color: #111 !important;
  }
}
