:root {
  --ink: #172033;
  --muted: #647083;
  --navy: #10233f;
  --navy-soft: #18385f;
  --paper: #fbf8f1;
  --paper-deep: #f2eadb;
  --white: #ffffff;
  --gold: #d4a33c;
  --gold-deep: #9d6f16;
  --line: #ded6c8;
  --shadow: 0 18px 48px rgba(23, 32, 51, 0.1);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;
  --content: 1180px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 0%, rgba(212, 163, 60, 0.1), transparent 28rem),
    var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
}

img {
  max-width: 100%;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

button,
.button {
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 3px solid rgba(212, 163, 60, 0.72);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.7rem 1rem;
  border-radius: 8px;
  background: var(--white);
  color: var(--navy);
  transform: translateY(-160%);
  transition: transform 160ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: sticky;
  z-index: 50;
  top: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(16, 35, 63, 0.97);
  color: var(--white);
  backdrop-filter: blur(14px);
}

.header-inner {
  display: flex;
  width: min(calc(100% - 2rem), var(--content));
  min-height: 72px;
  margin: 0 auto;
  align-items: center;
  gap: 1.25rem;
}

.brand {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.72rem;
  color: var(--white);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  background: linear-gradient(145deg, #f4c86d, var(--gold));
  clip-path: polygon(50% 0%, 88% 18%, 100% 58%, 73% 100%, 27% 100%, 0 58%, 12% 18%);
  color: var(--navy);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.88rem;
  font-weight: 800;
}

.brand-copy {
  display: grid;
  line-height: 1.05;
}

.brand-copy strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.26rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-copy small {
  margin-top: 0.28rem;
  color: #b7c6d9;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.menu-toggle {
  display: none;
  margin-left: auto;
  padding: 0.55rem 0.72rem;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  background: transparent;
  color: var(--white);
  cursor: pointer;
}

.header-nav {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
}

.header-links {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.header-links a {
  padding: 0.55rem 0.72rem;
  border-radius: 8px;
  color: #dbe7f5;
  font-size: 0.9rem;
  text-decoration: none;
}

.header-links a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--white);
}

.header-search {
  display: flex;
  width: min(310px, 32vw);
  align-items: center;
}

.header-search input {
  width: 100%;
  min-width: 0;
  padding: 0.62rem 0.78rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 9px 0 0 9px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--white);
}

.header-search input::placeholder {
  color: #afc0d4;
}

.header-search button {
  align-self: stretch;
  padding: 0 0.8rem;
  border: 0;
  border-radius: 0 9px 9px 0;
  background: var(--gold);
  color: var(--navy);
  cursor: pointer;
  font-weight: 800;
}

.container {
  width: min(calc(100% - 2rem), var(--content));
  margin-inline: auto;
}

.hero {
  position: relative;
  overflow: hidden;
  padding: clamp(4.5rem, 9vw, 8rem) 0 clamp(4rem, 8vw, 7rem);
  background:
    linear-gradient(135deg, rgba(16, 35, 63, 0.98), rgba(24, 56, 95, 0.94)),
    repeating-linear-gradient(30deg, transparent 0 34px, rgba(255, 255, 255, 0.04) 34px 35px);
  color: var(--white);
}

.hero::before,
.hero::after {
  position: absolute;
  width: 360px;
  height: 360px;
  border: 1px solid rgba(212, 163, 60, 0.25);
  border-radius: 50%;
  content: "";
}

.hero::before {
  top: -200px;
  right: -80px;
}

.hero::after {
  bottom: -260px;
  left: -100px;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 840px;
}

.eyebrow {
  margin: 0 0 0.75rem;
  color: var(--gold-deep);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero .eyebrow,
.theme-hero .eyebrow {
  color: #f2c96f;
}

h1,
h2,
h3 {
  margin-top: 0;
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.16;
}

h1 {
  margin-bottom: 1rem;
  font-size: clamp(2.4rem, 6vw, 5rem);
  letter-spacing: -0.045em;
}

h2 {
  font-size: clamp(1.7rem, 3vw, 2.5rem);
  letter-spacing: -0.028em;
}

h3 {
  font-size: 1.2rem;
}

.hero-lede {
  max-width: 720px;
  margin: 0;
  color: #d8e4f2;
  font-size: clamp(1.05rem, 2.1vw, 1.3rem);
}

.hero-actions,
.theme-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 2rem;
}

.button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.75rem 1.05rem;
  border: 1px solid transparent;
  border-radius: 11px;
  background: var(--navy);
  color: var(--white);
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 9px 24px rgba(23, 32, 51, 0.18);
}

.button-primary {
  background: var(--gold);
  color: var(--navy);
}

.button-secondary {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.08);
}

.button-theme {
  background: var(--theme, var(--navy));
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  margin-top: -2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--white);
  box-shadow: var(--shadow);
}

.stat {
  padding: 1.25rem;
  text-align: center;
}

.stat + .stat {
  border-left: 1px solid var(--line);
}

.stat strong {
  display: block;
  color: var(--navy);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.75rem;
}

.stat span {
  color: var(--muted);
  font-size: 0.82rem;
}

.section {
  padding: clamp(3.4rem, 7vw, 6rem) 0;
}

.section-alt {
  border-block: 1px solid var(--line);
  background: rgba(242, 234, 219, 0.54);
}

.section-heading {
  display: flex;
  margin-bottom: 1.6rem;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
}

.section-heading > div {
  max-width: 710px;
}

.section-heading h2 {
  margin-bottom: 0.45rem;
}

.section-heading p {
  margin: 0;
  color: var(--muted);
}

.search-panel {
  margin-top: 2rem;
  padding: 1.2rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.08);
}

.search-panel label {
  display: block;
  margin-bottom: 0.5rem;
  color: #f0f5fb;
  font-size: 0.86rem;
  font-weight: 800;
}

.search-control {
  display: flex;
  gap: 0.6rem;
}

.search-control input,
.filter-control input,
.sidebar-filter input {
  width: 100%;
  min-height: 48px;
  padding: 0.72rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
  color: var(--ink);
}

.search-panel .search-control input {
  border: 0;
}

.theme-grid,
.card-grid,
.related-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.theme-card,
.table-card,
.related-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--white);
  box-shadow: 0 10px 28px rgba(23, 32, 51, 0.06);
  transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
}

.theme-card:hover,
.table-card:hover,
.related-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--theme, var(--gold)) 48%, var(--line));
  box-shadow: 0 16px 34px rgba(23, 32, 51, 0.12);
}

.theme-card::before,
.table-card::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 5px;
  background: var(--theme, var(--navy));
  content: "";
}

.theme-card a,
.table-card a,
.related-card a {
  display: block;
  height: 100%;
  padding: 1.3rem;
  text-decoration: none;
}

.theme-card-mark {
  display: grid;
  width: 48px;
  height: 48px;
  margin-bottom: 1rem;
  place-items: center;
  border-radius: 13px;
  background: color-mix(in srgb, var(--theme) 13%, white);
  color: var(--theme);
  font-weight: 900;
  letter-spacing: 0.06em;
}

.theme-card h3,
.table-card h3,
.related-card h3 {
  margin-bottom: 0.45rem;
}

.theme-card p,
.table-card p,
.related-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.card-kicker {
  display: block;
  margin-bottom: 0.4rem;
  color: var(--theme, var(--gold-deep));
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.card-link {
  display: inline-block;
  margin-top: 0.9rem;
  color: var(--theme, var(--navy));
  font-size: 0.84rem;
  font-weight: 850;
}

.search-results[hidden],
.is-filtered-out {
  display: none !important;
}

.search-results {
  padding-top: 2.25rem;
}

.search-summary {
  margin-top: -0.7rem;
  color: var(--muted);
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.step {
  padding: 1.35rem;
  border-left: 4px solid var(--gold);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  background: var(--white);
}

.step-number {
  color: var(--gold-deep);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.step h3 {
  margin: 0.42rem 0;
}

.step p {
  margin: 0;
  color: var(--muted);
}

.theme-hero {
  padding: clamp(3.5rem, 7vw, 6rem) 0;
  background:
    linear-gradient(120deg, color-mix(in srgb, var(--theme) 32%, var(--navy)), var(--navy));
  color: var(--white);
}

.theme-hero h1 {
  max-width: 850px;
  font-size: clamp(2.25rem, 5vw, 4.2rem);
}

.theme-hero p:not(.eyebrow) {
  max-width: 760px;
  margin-bottom: 0;
  color: #dce6f2;
  font-size: 1.08rem;
}

.breadcrumbs {
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.65);
}

.breadcrumbs ol {
  display: flex;
  margin: 0;
  padding: 0;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
  list-style: none;
  color: var(--muted);
  font-size: 0.84rem;
}

.breadcrumbs li + li::before {
  margin-right: 0.45rem;
  color: #9ba3af;
  content: "/";
}

.breadcrumbs a {
  color: var(--navy-soft);
}

.filter-control {
  margin-bottom: 1.4rem;
}

.filter-control label,
.sidebar-filter label {
  display: block;
  margin-bottom: 0.45rem;
  color: var(--navy);
  font-size: 0.83rem;
  font-weight: 800;
}

.table-page {
  padding: 2.5rem 0 5rem;
}

.table-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  align-items: start;
  gap: 2rem;
}

.table-article {
  min-width: 0;
}

.table-article > header {
  margin-bottom: 1.6rem;
}

.table-article h1 {
  margin-bottom: 0.75rem;
  color: var(--navy);
  font-size: clamp(2.2rem, 5vw, 4rem);
}

.table-intro {
  max-width: 780px;
  margin: 0;
  color: var(--muted);
  font-size: 1.06rem;
}

.table-random-actions {
  display: flex;
  margin: 1.6rem 0 1rem;
  padding: 1rem;
  flex-wrap: wrap;
  gap: 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--white);
  box-shadow: 0 10px 28px rgba(23, 32, 51, 0.06);
}

.table-random-actions .button {
  flex: 1 1 250px;
}

.table-random-actions + .roller-panel {
  margin-top: 1rem;
}

.roller-panel {
  margin: 2rem 0 3rem;
  padding: clamp(1.35rem, 4vw, 2rem);
  border: 2px solid color-mix(in srgb, var(--theme) 34%, var(--line));
  border-radius: var(--radius-lg);
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--theme) 7%, white), white);
  box-shadow: var(--shadow);
}

.roller-panel h2 {
  margin-bottom: 0.35rem;
  font-size: 1.55rem;
}

.roller-panel > p {
  margin: 0;
  color: var(--muted);
}

.roll-result {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  min-height: 94px;
  margin: 1.3rem 0;
  padding: 1rem;
  align-items: center;
  gap: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--white);
}

.roll-number {
  display: grid;
  width: 64px;
  height: 64px;
  place-items: center;
  border-radius: 18px;
  background: var(--theme);
  color: var(--white);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.7rem;
  font-weight: 800;
}

.roll-copy {
  margin: 0;
  color: var(--ink);
  font-size: 1.07rem;
  font-weight: 720;
}

.roll-button {
  width: 100%;
  min-height: 54px;
  border: 0;
  border-radius: 12px;
  background: var(--theme);
  color: var(--white);
  cursor: pointer;
  font-size: 1.02rem;
  font-weight: 850;
}

.roll-button:hover {
  filter: brightness(0.92);
}

.table-wrap {
  overflow-x: auto;
  margin: 1.5rem 0 3.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--white);
  box-shadow: 0 10px 28px rgba(23, 32, 51, 0.05);
}

.result-table {
  width: 100%;
  border-collapse: collapse;
}

.result-table caption {
  padding: 1rem 1rem 0.5rem;
  color: var(--navy);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.24rem;
  font-weight: 700;
  text-align: left;
}

.result-table th,
.result-table td {
  padding: 0.82rem 1rem;
  border-top: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.result-table th {
  background: color-mix(in srgb, var(--theme) 7%, white);
  color: var(--navy);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.result-table td:first-child,
.result-table th:first-child {
  width: 92px;
  text-align: center;
}

.result-table tbody tr:nth-child(even) {
  background: #fcfaf6;
}

.result-table tbody tr.is-rolled {
  background: color-mix(in srgb, var(--theme) 14%, white);
  box-shadow: inset 5px 0 0 var(--theme);
  font-weight: 760;
}

.theme-sidebar {
  position: sticky;
  top: 96px;
}

.sidebar-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--white);
  box-shadow: 0 12px 30px rgba(23, 32, 51, 0.06);
}

.sidebar-card h2 {
  margin: 0;
  padding: 1rem 1rem 0;
  font-size: 1.24rem;
}

.sidebar-filter {
  padding: 0.75rem 1rem;
}

.sidebar-filter input {
  min-height: 42px;
}

.sidebar-list {
  max-height: 58vh;
  overflow-y: auto;
  padding: 0 0.65rem 0.8rem;
}

.sidebar-list a {
  display: block;
  padding: 0.58rem 0.65rem;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.84rem;
  text-decoration: none;
}

.sidebar-list a:hover,
.sidebar-list a[aria-current="page"] {
  background: color-mix(in srgb, var(--theme) 10%, white);
  color: var(--navy);
}

.related-section {
  margin-top: 3rem;
  padding-top: 2.5rem;
  border-top: 1px solid var(--line);
}

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

.content-page {
  width: min(calc(100% - 2rem), 820px);
  margin: 0 auto;
  padding: 3.5rem 0 5rem;
}

.content-page h1 {
  color: var(--navy);
  font-size: clamp(2.35rem, 5vw, 4rem);
}

.content-page h2 {
  margin-top: 2.5rem;
  font-size: 1.65rem;
}

.content-page p,
.content-page li {
  color: #424d5f;
}

.notice {
  padding: 1rem 1.15rem;
  border-left: 4px solid var(--gold);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--paper-deep);
}

.site-footer {
  padding: 2.8rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--navy);
  color: #c7d5e5;
}

.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(220px, 1fr);
  gap: 2rem;
}

.footer-brand {
  margin-bottom: 0.65rem;
  color: var(--white);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.4rem;
}

.footer-copy {
  max-width: 580px;
  margin: 0;
  color: #aebfd2;
  font-size: 0.9rem;
}

.footer-links {
  display: flex;
  align-content: flex-start;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.45rem 1rem;
}

.footer-links a {
  color: #dce7f4;
  font-size: 0.88rem;
}

.footer-bottom {
  margin-top: 2rem;
  padding-top: 1.2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a8bf;
  font-size: 0.8rem;
}

.empty-state {
  padding: 2rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  color: var(--muted);
  text-align: center;
}

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

@media (max-width: 980px) {
  .header-inner {
    flex-wrap: wrap;
    padding: 0.8rem 0;
  }

  .menu-toggle {
    display: block;
  }

  .header-nav {
    display: none;
    flex: 0 0 100%;
    align-items: stretch;
    flex-direction: column;
    gap: 0.8rem;
    padding: 0.7rem 0 0.2rem;
  }

  .header-nav.is-open {
    display: flex;
  }

  .header-links {
    align-items: stretch;
    flex-direction: column;
  }

  .header-search {
    width: 100%;
  }

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

  .table-layout {
    grid-template-columns: 1fr;
  }

  .theme-sidebar {
    position: static;
  }

  .sidebar-list {
    max-height: 320px;
  }
}

@media (max-width: 700px) {
  .container,
  .header-inner {
    width: min(calc(100% - 1.25rem), var(--content));
  }

  .brand-copy small {
    display: none;
  }

  .hero {
    padding: 3.6rem 0 4.5rem;
  }

  .hero-actions,
  .theme-actions,
  .search-control {
    align-items: stretch;
    flex-direction: column;
  }

  .button {
    width: 100%;
  }

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

  .stat:nth-child(3) {
    border-left: 0;
  }

  .stat:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }

  .section-heading {
    align-items: start;
    flex-direction: column;
    gap: 0.5rem;
  }

  .theme-grid,
  .card-grid,
  .related-grid,
  .steps,
  .footer-grid {
    grid-template-columns: 1fr;
  }

  .footer-links {
    justify-content: flex-start;
  }

  .roll-result {
    grid-template-columns: 52px minmax(0, 1fr);
  }

  .roll-number {
    width: 52px;
    height: 52px;
  }

  .result-table th,
  .result-table td {
    padding: 0.72rem;
  }

  .result-table td:first-child,
  .result-table th:first-child {
    width: 64px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
