:root {
  --blue: #052d45;
  --blue-deep: #031a2a;
  --green: #064a35;
  --red: #780512;
  --red-deep: #39040b;
  --gold: #f3be35;
  --gold-bright: #ffe48a;
  --cream: #f7ead0;
  --ink: #fff8df;
}

@font-face {
  font-family: "TeX Gyre Bonum";
  src: url("assets/fonts/texgyrebonum-regular.otf") format("opentype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "TeX Gyre Bonum";
  src: url("assets/fonts/texgyrebonum-bold.otf") format("opentype");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "TeX Gyre Bonum";
  src: url("assets/fonts/texgyrebonum-italic.otf") format("opentype");
  font-style: italic;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "TeX Gyre Bonum";
  src: url("assets/fonts/texgyrebonum-bolditalic.otf") format("opentype");
  font-style: italic;
  font-weight: 700;
  font-display: swap;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  background:
    radial-gradient(circle at 50% 10%, rgba(255, 228, 138, 0.18), transparent 28rem),
    linear-gradient(135deg, rgba(6, 74, 53, 0.82), transparent 42%),
    linear-gradient(215deg, rgba(120, 5, 18, 0.76), transparent 46%),
    linear-gradient(180deg, var(--blue), var(--blue-deep) 58%, var(--red-deep));
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 228, 138, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 228, 138, 0.05) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.72), transparent 74%);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 18px 20px 0;
}

.main-nav {
  width: min(1160px, 100%);
  margin: 0 auto;
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid rgba(255, 228, 138, 0.5);
  border-radius: 8px;
  background: rgba(3, 26, 42, 0.78);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(10px);
}

.main-nav a {
  min-width: 126px;
  padding: 12px 12px;
  color: var(--gold-bright);
  text-align: center;
  text-decoration: none;
  text-transform: uppercase;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0;
  border-radius: 6px;
  border: 1px solid transparent;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.main-nav a:hover,
.main-nav a:focus-visible,
.main-nav a[aria-current="page"] {
  outline: none;
  color: #1a0900;
  border-color: rgba(255, 228, 138, 0.8);
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  transform: translateY(-1px);
}

.hero {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0 72px;
  display: grid;
  justify-items: center;
  gap: 22px;
}

.logo {
  width: min(100%, 490px);
  height: auto;
  filter: drop-shadow(0 26px 34px rgba(0, 0, 0, 0.45));
}

.intro-box {
  width: min(760px, 100%);
  padding: clamp(22px, 4vw, 34px);
  border: 1px solid rgba(255, 228, 138, 0.62);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(5, 45, 69, 0.88), rgba(57, 4, 11, 0.84)),
    var(--blue);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    0 22px 58px rgba(0, 0, 0, 0.35);
  text-align: center;
}

.intro-box h1 {
  margin: 0 0 12px;
  color: var(--gold-bright);
  font-size: clamp(2rem, 6vw, 4.25rem);
  line-height: 0.95;
  text-shadow: 0 3px 0 rgba(92, 46, 0, 0.8);
}

.intro-box p {
  margin: 0 auto;
  max-width: 58ch;
  color: var(--cream);
  font-family: Arial, Helvetica, sans-serif;
  font-size: clamp(1rem, 2.2vw, 1.2rem);
  line-height: 1.65;
}

.intro-box p + p {
  margin-top: 14px;
}

.intro-box a {
  color: var(--gold-bright);
  font-weight: 700;
  text-decoration-color: rgba(255, 228, 138, 0.65);
  text-underline-offset: 4px;
}

.intro-box a:hover,
.intro-box a:focus-visible {
  color: #ffffff;
  outline: none;
  text-decoration-color: var(--gold-bright);
}

.home-boxes {
  width: min(960px, 100%);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  align-items: stretch;
}

.home-boxes .intro-box {
  width: 100%;
}

.home-intro h1 {
  font-size: clamp(2rem, 4.2vw, 3.35rem);
}

.home-links {
  text-align: left;
}

.home-links h2 {
  margin: 0 0 18px;
  color: var(--gold-bright);
  font-size: clamp(2rem, 4.2vw, 3.35rem);
  line-height: 0.95;
  text-align: center;
  text-shadow: 0 3px 0 rgba(92, 46, 0, 0.8);
}

.home-links ul {
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
  list-style: none;
  font-family: Arial, Helvetica, sans-serif;
  font-size: clamp(1rem, 2.2vw, 1.15rem);
}

.home-links li {
  padding-top: 12px;
  border-top: 1px solid rgba(255, 228, 138, 0.24);
}

.info-page {
  display: grid;
  gap: 22px;
}

.info-section {
  padding-top: 18px;
  border-top: 1px solid rgba(255, 228, 138, 0.28);
  text-align: left;
}

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

.rules-page {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  padding: 46px 0 84px;
}

.rules-content {
  display: grid;
  gap: 24px;
}

.rules-hero,
.rule-section {
  border: 1px solid rgba(255, 228, 138, 0.48);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(5, 45, 69, 0.88), rgba(3, 26, 42, 0.82)),
    var(--blue);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.07),
    0 18px 46px rgba(0, 0, 0, 0.28);
}

.rules-hero {
  padding: clamp(28px, 5vw, 52px);
  text-align: center;
}

.rules-hero h1 {
  margin: 0;
  color: var(--gold-bright);
  font-size: clamp(3rem, 10vw, 6.5rem);
  line-height: 0.9;
  text-shadow: 0 4px 0 rgba(92, 46, 0, 0.82);
}

.version {
  margin: 0 0 12px;
  color: var(--cream);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  text-transform: uppercase;
}

.rule-section {
  padding: clamp(22px, 4vw, 38px);
}

.rule-section h2,
.rule-section h3 {
  color: var(--gold-bright);
  line-height: 1.05;
  text-shadow: 0 2px 0 rgba(92, 46, 0, 0.72);
}

.rule-section h2 {
  margin: 0 0 16px;
  font-size: clamp(2rem, 5vw, 3.5rem);
}

.rule-section h3 {
  margin: 24px 0 10px;
  font-size: clamp(1.25rem, 3vw, 1.8rem);
}

.rule-section p,
.property-list {
  color: var(--cream);
  font-family: Arial, Helvetica, sans-serif;
  font-size: clamp(1rem, 2vw, 1.12rem);
  line-height: 1.7;
}

.rule-section p {
  margin: 0;
}

.rule-section p + p {
  margin-top: 14px;
}

.rule-media-grid {
  display: grid;
  grid-template-columns: minmax(220px, 340px) 1fr;
  gap: clamp(20px, 4vw, 36px);
  align-items: start;
}

.rule-media-grid.reversed {
  grid-template-columns: 1fr minmax(220px, 340px);
}

.rule-media-grid.reversed .rule-figure {
  order: 2;
}

.rule-figure {
  margin: 0;
}

.rule-figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid rgba(255, 228, 138, 0.56);
  border-radius: 8px;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.34);
}

.rule-figure figcaption {
  margin-top: 10px;
  color: var(--cream);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.9rem;
  text-align: center;
}

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

.rule-list strong,
.property-list dt {
  color: var(--gold-bright);
}

.pdf-links {
  text-align: center;
}

.pdf-link-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.pdf-link-list a {
  min-width: min(100%, 260px);
  padding: 14px 20px;
  color: #1a0900;
  text-decoration: none;
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 800;
  border: 1px solid rgba(255, 228, 138, 0.85);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.24);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.pdf-link-list a:hover,
.pdf-link-list a:focus-visible {
  outline: none;
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.32);
}

.property-list {
  margin: 0;
  display: grid;
  gap: 12px;
}

.property-list div {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 228, 138, 0.22);
}

.property-list div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.property-list dt {
  font-weight: 700;
}

.property-list dd {
  margin: 0;
}

.personal-card-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 320px);
  gap: clamp(22px, 4vw, 38px);
  align-items: start;
}

.personal-card-figure {
  margin: 0;
}

.personal-card-figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid rgba(255, 228, 138, 0.56);
  border-radius: 8px;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.34);
}

.personal-card-figure figcaption {
  margin-top: 10px;
  color: var(--cream);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.9rem;
  line-height: 1.45;
  text-align: center;
}

.card-builder {
  display: grid;
  grid-template-columns: minmax(280px, 0.92fr) minmax(300px, 1fr);
  gap: clamp(18px, 3vw, 28px);
  align-items: start;
  padding: clamp(18px, 3vw, 28px);
  border: 1px solid rgba(255, 228, 138, 0.48);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(5, 45, 69, 0.9), rgba(3, 26, 42, 0.84)),
    var(--blue);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.07),
    0 18px 46px rgba(0, 0, 0, 0.28);
}

.card-builder-form,
.card-preview-panel {
  display: grid;
  gap: 16px;
}

.builder-heading h2 {
  margin: 0 0 8px;
  color: var(--gold-bright);
  font-size: clamp(2rem, 4vw, 3.3rem);
  line-height: 1;
  text-shadow: 0 2px 0 rgba(92, 46, 0, 0.72);
}

.builder-heading p {
  margin: 0;
  color: var(--cream);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.55;
}

.builder-field,
.builder-fieldset {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  color: var(--cream);
  font-family: Arial, Helvetica, sans-serif;
  border: 0;
}

.builder-field > span,
.builder-fieldset legend {
  color: var(--gold-bright);
  font-weight: 800;
}

.field-label-with-help {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.help-tooltip {
  position: relative;
  width: 19px;
  height: 19px;
  display: inline-grid;
  place-items: center;
  color: #1a0900;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1;
  border: 1px solid rgba(255, 228, 138, 0.9);
  border-radius: 50%;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  cursor: help;
}

.help-tooltip::after {
  content: "Panorera med vänster musknapp.\A Zooma ut och in med mushjulet.";
  position: absolute;
  left: 50%;
  bottom: calc(100% + 9px);
  z-index: 3;
  width: max-content;
  max-width: min(280px, 70vw);
  padding: 9px 11px;
  color: var(--cream);
  white-space: pre-line;
  font: 700 0.86rem/1.35 Arial, Helvetica, sans-serif;
  border: 1px solid rgba(255, 228, 138, 0.48);
  border-radius: 6px;
  background: rgba(3, 26, 42, 0.96);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.34);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 4px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.help-tooltip:hover::after,
.help-tooltip:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.stat-legend {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
}

.stat-total {
  min-width: 0;
  padding: 4px 10px;
  color: var(--gold-bright);
  text-align: left;
  border-radius: 4px;
  background: rgba(3, 26, 42, 0.42);
}

.stat-random-button {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  color: #1a0900;
  font-size: 1.1rem;
  line-height: 1;
  border: 1px solid rgba(255, 228, 138, 0.85);
  border-radius: 6px;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.2);
}

.stat-random-button:hover,
.stat-random-button:focus-visible {
  outline: none;
  transform: translateY(-1px);
  box-shadow: 0 9px 18px rgba(0, 0, 0, 0.28);
}

.builder-field input,
.builder-field textarea,
.stat-grid input {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  color: #fffdf5;
  font: 600 1rem Arial, Helvetica, sans-serif;
  border: 1px solid rgba(255, 228, 138, 0.36);
  border-radius: 6px;
  background: rgba(3, 26, 42, 0.72);
}

.stat-grid input.stat-over-limit {
  border-color: rgba(255, 170, 140, 0.78);
  background: rgba(82, 4, 10, 0.88);
}

.builder-field textarea {
  resize: vertical;
  line-height: 1.45;
}

.builder-field input:focus,
.builder-field textarea:focus,
.stat-grid input:focus {
  outline: 2px solid rgba(255, 228, 138, 0.72);
  outline-offset: 2px;
}

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

.stat-grid label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.stat-grid span {
  font-size: 0.88rem;
  font-weight: 800;
}

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

.checkbox-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 228, 138, 0.24);
  border-radius: 6px;
  background: rgba(3, 26, 42, 0.42);
}

.checkbox-grid input {
  width: 17px;
  height: 17px;
  accent-color: var(--gold);
}

.split-field > div {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.canvas-shell {
  width: min(100%, 420px);
  justify-self: center;
  padding: 12px;
  border: 1px solid rgba(255, 228, 138, 0.42);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 248, 223, 0.08), rgba(255, 248, 223, 0.02)),
    rgba(3, 26, 42, 0.58);
  box-shadow: 0 20px 46px rgba(0, 0, 0, 0.34);
}

#personal-card-canvas {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
  border-radius: 6px;
  background: #f3dfb8;
}

.download-actions {
  width: min(100%, 420px);
  justify-self: center;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.download-button {
  min-height: 44px;
  padding: 12px 14px;
  color: #1a0900;
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 900;
  border: 1px solid rgba(255, 228, 138, 0.85);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.24);
}

.download-button:hover,
.download-button:focus-visible {
  outline: none;
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.32);
}

.table-wrap {
  margin-top: 18px;
  overflow-x: auto;
}

.info-table {
  width: 100%;
  border-collapse: collapse;
  color: var(--cream);
  font-family: Arial, Helvetica, sans-serif;
  font-size: clamp(0.95rem, 1.8vw, 1.06rem);
  line-height: 1.55;
}

.info-table th,
.info-table td {
  padding: 12px 14px;
  border: 1px solid rgba(255, 228, 138, 0.28);
  vertical-align: top;
}

.info-table th {
  color: var(--gold-bright);
  text-align: left;
  background: rgba(3, 26, 42, 0.52);
}

.info-table td:last-child {
  width: 190px;
}

.attribute-table th:first-child,
.attribute-table td:first-child {
  width: 190px;
}

.attribute-table th:last-child,
.attribute-table td:last-child {
  width: auto;
}

.cards-page {
  width: min(980px, calc(100% - 32px));
  margin: 0 auto;
  padding: 46px 0 84px;
  display: grid;
  gap: 24px;
}

.cards-intro {
  width: 100%;
}

.intro-placeholder {
  padding-top: 18px;
  border-top: 1px solid rgba(255, 228, 138, 0.28);
  text-align: left;
}

.cards-accordion {
  padding: clamp(22px, 4vw, 38px);
  border: 1px solid rgba(255, 228, 138, 0.48);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(5, 45, 69, 0.88), rgba(3, 26, 42, 0.82)),
    var(--blue);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.07),
    0 18px 46px rgba(0, 0, 0, 0.28);
}

.cards-accordion h2 {
  margin: 0 0 18px;
  color: var(--gold-bright);
  font-size: clamp(2rem, 5vw, 3.5rem);
  line-height: 1.05;
  text-align: center;
  text-shadow: 0 2px 0 rgba(92, 46, 0, 0.72);
}

.card-series {
  border: 1px solid rgba(255, 228, 138, 0.32);
  border-radius: 8px;
  background: rgba(3, 26, 42, 0.48);
  overflow: hidden;
}

.card-series + .card-series {
  margin-top: 10px;
}

.card-series summary {
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  color: var(--gold-bright);
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 800;
  list-style: none;
}

.card-series summary::-webkit-details-marker {
  display: none;
}

.card-series summary::before {
  content: "+";
  flex: 0 0 auto;
  color: var(--gold-bright);
}

.card-series[open] summary::before {
  content: "-";
}

.card-series summary span:first-of-type {
  margin-right: auto;
}

.card-series summary span:last-of-type {
  color: var(--cream);
  white-space: nowrap;
}

.card-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid rgba(255, 228, 138, 0.22);
}

.card-list li,
.trix-list li {
  display: grid;
  grid-template-columns: 76px minmax(180px, 1fr) minmax(300px, 390px);
  gap: 14px;
  align-items: center;
  padding: 14px 18px;
  color: var(--cream);
  font-family: Arial, Helvetica, sans-serif;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.card-list li:first-child,
.trix-list li:first-child {
  border-top: 0;
}

.trix-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid rgba(255, 228, 138, 0.22);
}

.trix-list li {
  grid-template-columns: 1fr;
}

.card-number {
  color: var(--gold-bright);
  font-weight: 800;
}

.card-title-block {
  display: grid;
  gap: 2px;
}

.card-name-button {
  width: fit-content;
  max-width: 100%;
  padding: 0;
  color: #ffffff;
  font: inherit;
  font-weight: 800;
  text-align: left;
  text-decoration: underline;
  text-decoration-color: rgba(255, 228, 138, 0.55);
  text-underline-offset: 4px;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.card-name-button:hover,
.card-name-button:focus-visible,
.trix-name-button:hover,
.trix-name-button:focus-visible {
  color: var(--gold-bright);
  outline: none;
  text-decoration-color: var(--gold-bright);
}

.trix-name-button {
  width: fit-content;
  max-width: 100%;
  padding: 0;
  color: #ffffff;
  font: inherit;
  font-weight: 800;
  text-align: left;
  text-decoration: underline;
  text-decoration-color: rgba(255, 228, 138, 0.55);
  text-underline-offset: 4px;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.card-title-block strong {
  color: #ffffff;
}

.card-title-block span {
  color: var(--cream);
}

.card-stats {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  align-items: center;
}

.card-stat {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 42px;
  aspect-ratio: 1;
}

.card-stat img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 4px 5px rgba(0, 0, 0, 0.28));
}

.card-stat span {
  position: relative;
  z-index: 1;
  color: #130b02;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1rem, 2vw, 1.35rem);
  font-weight: 800;
  line-height: 1;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.8),
    0 -1px 0 rgba(255, 255, 255, 0.45);
}

.card-modal {
  width: min(1200px, calc(100% - 28px));
  padding: 0;
  color: var(--cream);
  border: 1px solid rgba(255, 228, 138, 0.58);
  border-radius: 8px;
  background: transparent;
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.55);
}

.card-modal::backdrop {
  background: rgba(3, 10, 16, 0.72);
}

.card-modal-panel {
  position: relative;
  padding: clamp(24px, 4vw, 38px);
  background:
    linear-gradient(180deg, rgba(5, 45, 69, 0.98), rgba(57, 4, 11, 0.94)),
    var(--blue);
}

.card-modal-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 370px);
  gap: clamp(24px, 4vw, 46px);
  align-items: start;
}

.card-modal-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: clamp(18px, 3vw, 28px);
  align-items: start;
  margin-bottom: 24px;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 38px;
  height: 38px;
  color: #1a0900;
  font-size: 1.6rem;
  line-height: 1;
  border: 1px solid rgba(255, 228, 138, 0.85);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  cursor: pointer;
}

.card-modal h2 {
  margin: 0 48px 6px 0;
  color: var(--gold-bright);
  font-size: clamp(2rem, 5vw, 3.6rem);
  line-height: 1;
  text-shadow: 0 2px 0 rgba(92, 46, 0, 0.72);
}

.modal-subtitle {
  margin: 0;
  color: var(--cream);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
}

.modal-image-actions {
  position: relative;
  display: block;
  width: 150px;
  justify-self: start;
}

.modal-image-actions .modal-card-image-button img {
  aspect-ratio: 1;
  object-fit: cover;
}

.modal-image-actions .modal-zoom-button {
  right: 8px;
  bottom: 8px;
}

.modal-card-actions {
  position: relative;
  width: 100%;
  justify-self: end;
}

.modal-card-actions .modal-zoom-button {
  right: 8px;
  bottom: 8px;
}

.modal-card-image-button {
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid rgba(255, 228, 138, 0.48);
  border-radius: 8px;
  background: rgba(3, 26, 42, 0.54);
  cursor: pointer;
  overflow: hidden;
}

.modal-card-image-button img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}

.modal-zoom-button {
  position: absolute;
  right: -46px;
  bottom: 0;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: #1a0900;
  border: 1px solid rgba(255, 228, 138, 0.85);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  cursor: pointer;
}

.zoom-icon {
  position: relative;
  width: 16px;
  height: 16px;
  border: 3px solid currentColor;
  border-radius: 50%;
}

.zoom-icon::after {
  content: "";
  position: absolute;
  width: 9px;
  height: 3px;
  right: -8px;
  bottom: -5px;
  border-radius: 2px;
  background: currentColor;
  transform: rotate(45deg);
}

.modal-details {
  margin: 0;
  display: grid;
  gap: 14px;
  font-family: Arial, Helvetica, sans-serif;
}

.modal-details div {
  padding-top: 14px;
  border-top: 1px solid rgba(255, 228, 138, 0.26);
}

.modal-details div[hidden] {
  display: none;
}

.modal-details dt {
  margin-bottom: 5px;
  color: var(--gold-bright);
  font-weight: 800;
}

.modal-details dd {
  margin: 0;
  line-height: 1.65;
}

.attribute-icon {
  width: 1.45em;
  height: 1.45em;
  margin: 0 0.18em 0.1em 0;
  vertical-align: middle;
  object-fit: contain;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.45));
}

.image-modal {
  width: min(94vw, 1100px);
  max-height: 94vh;
  padding: 0;
  border: 1px solid rgba(255, 228, 138, 0.58);
  border-radius: 8px;
  background: rgba(3, 26, 42, 0.96);
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.62);
}

.image-modal::backdrop {
  background: rgba(3, 10, 16, 0.82);
}

.image-modal-panel {
  position: relative;
  display: grid;
  place-items: center;
  padding: 54px 18px 18px;
}

.image-modal img {
  display: block;
  max-width: 100%;
  max-height: calc(94vh - 74px);
  width: auto;
  height: auto;
  border-radius: 6px;
}

.gallery-page {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 46px 0 84px;
  display: grid;
  gap: 24px;
}

.gallery-section {
  padding: clamp(22px, 4vw, 38px);
  border: 1px solid rgba(255, 228, 138, 0.48);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(5, 45, 69, 0.88), rgba(3, 26, 42, 0.82)),
    var(--blue);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.07),
    0 18px 46px rgba(0, 0, 0, 0.28);
}

.gallery-section h2 {
  margin: 0 0 18px;
  color: var(--gold-bright);
  font-size: clamp(2rem, 5vw, 3.5rem);
  line-height: 1.05;
  text-align: center;
  text-shadow: 0 2px 0 rgba(92, 46, 0, 0.72);
}

.image-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 16px;
}

.gallery-item {
  display: grid;
  gap: 10px;
  align-content: start;
  min-height: 100%;
  padding: 12px;
  color: var(--cream);
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 700;
  text-align: center;
  border: 1px solid rgba(255, 228, 138, 0.32);
  border-radius: 8px;
  background: rgba(3, 26, 42, 0.48);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.gallery-item:hover,
.gallery-item:focus-visible {
  outline: none;
  border-color: rgba(255, 228, 138, 0.78);
  background: rgba(5, 45, 69, 0.72);
  transform: translateY(-1px);
}

.gallery-item img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: 6px;
  background:
    linear-gradient(45deg, rgba(255, 255, 255, 0.08) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255, 255, 255, 0.08) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255, 255, 255, 0.08) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255, 255, 255, 0.08) 75%),
    rgba(255, 255, 255, 0.05);
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
}

@media (max-width: 640px) {
  .site-header {
    padding: 12px 12px 0;
  }

  .main-nav {
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px;
  }

  .main-nav a {
    min-width: 0;
    flex: 1 1 calc(33.333% - 6px);
    padding: 10px 8px;
    font-size: 0.68rem;
    white-space: normal;
  }

  .hero {
    width: min(100% - 20px, 1180px);
    padding-top: 26px;
  }

  .home-boxes {
    grid-template-columns: 1fr;
  }

  .rules-page {
    width: min(100% - 20px, 1080px);
    padding-top: 28px;
  }

  .cards-page {
    width: min(100% - 20px, 980px);
    padding-top: 28px;
  }

  .gallery-page {
    width: min(100% - 20px, 1180px);
    padding-top: 28px;
  }

  .rule-media-grid,
  .rule-media-grid.reversed {
    grid-template-columns: 1fr;
  }

  .rule-media-grid.reversed .rule-figure {
    order: 0;
  }

  .property-list div {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .personal-card-intro {
    grid-template-columns: 1fr;
  }

  .card-builder {
    grid-template-columns: 1fr;
  }

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

  .card-series summary,
  .card-list li {
    padding-left: 12px;
    padding-right: 12px;
  }

  .card-list li {
    grid-template-columns: 58px 1fr;
  }

  .card-stats {
    grid-column: 1 / -1;
    grid-template-columns: repeat(6, minmax(42px, 1fr));
  }

  .card-modal-heading {
    grid-template-columns: 1fr;
    margin-bottom: 20px;
  }

  .card-modal-content {
    grid-template-columns: 1fr;
  }

  .modal-card-actions {
    width: min(100%, 340px);
    justify-self: center;
  }
}
