:root {
  --ink: #17130f;
  --muted: #6d6257;
  --paper: #f8f4ec;
  --panel: #fffaf1;
  --line: #dfd1bd;
  --red: #9d1f1f;
  --gold: #b98208;
  --green: #2d7225;
  --blue: #155fc8;
  --rose: #a84d77;
  --shadow: 0 18px 44px rgba(47, 31, 18, 0.14);
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(120deg, rgba(157, 31, 31, 0.08), transparent 34%),
    linear-gradient(240deg, rgba(21, 95, 200, 0.08), transparent 38%),
    var(--paper);
  color: var(--ink);
}

a {
  color: var(--blue);
}

img {
  max-width: 100%;
  display: block;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px clamp(18px, 4vw, 56px);
  background: rgba(248, 244, 236, 0.88);
  border-bottom: 1px solid rgba(47, 31, 18, 0.1);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--panel);
  font-weight: 900;
}

.brand strong,
.brand small {
  display: block;
  line-height: 1.1;
}

.brand small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
}

.tabs {
  display: flex;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 250, 241, 0.8);
}

.tabs a {
  min-width: 92px;
  padding: 10px 14px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 750;
  text-align: center;
  text-decoration: none;
}

.tabs a[aria-current] {
  background: var(--ink);
  color: #fff;
}

main {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
  padding: 44px 0 72px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  align-items: center;
  gap: clamp(28px, 6vw, 80px);
  min-height: calc(100vh - 150px);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--gold);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.7rem, 6vw, 5.9rem);
  line-height: 0.95;
}

h2 {
  margin: 0 0 18px;
  color: var(--red);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.9rem, 4vw, 3.4rem);
  line-height: 1;
  text-decoration: underline;
  text-decoration-thickness: 3px;
  text-underline-offset: 5px;
}

h3 {
  margin: 0 0 12px;
  font-size: 1.18rem;
}

.hero-copy p:not(.eyebrow),
.page-heading p:not(.eyebrow) {
  max-width: 680px;
  color: var(--muted);
  font-size: clamp(1.05rem, 1.7vw, 1.35rem);
  line-height: 1.6;
}

.hero-actions,
.button-row,
.output-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 26px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  color: var(--ink);
  background: transparent;
  font: inherit;
  font-weight: 850;
  text-decoration: none;
  cursor: pointer;
}

.button.primary {
  background: var(--ink);
  color: #fff;
}

.button.ghost {
  background: rgba(255, 250, 241, 0.74);
}

.card-fan {
  position: relative;
  min-height: 430px;
}

.showcase-card {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(260px, 58vw);
  aspect-ratio: 5 / 7;
  padding: 16px;
  border: 9px solid #16120f;
  border-radius: 4.75%;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.32), transparent 34%),
    linear-gradient(140deg, #d9c098, #f2ead5 42%, #98876e);
  box-shadow: var(--shadow);
  transform-origin: 50% 85%;
}

.showcase-card::before {
  content: "";
  display: block;
  height: 45%;
  margin-bottom: 14px;
  border: 2px solid rgba(22, 18, 15, 0.55);
  border-radius: 5px;
  background:
    radial-gradient(circle at 42% 45%, rgba(255, 255, 255, 0.95) 0 8%, transparent 9%),
    radial-gradient(circle at 48% 50%, rgba(255, 214, 101, 0.75) 0 18%, transparent 19%),
    linear-gradient(135deg, rgba(34, 29, 22, 0.15), rgba(34, 29, 22, 0.02));
}

.showcase-card span {
  position: absolute;
  top: 13px;
  right: 13px;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid rgba(22, 18, 15, 0.45);
  border-radius: 50%;
  background: #f7f1e4;
  font-weight: 900;
}

.showcase-card strong,
.showcase-card em,
.showcase-card p {
  display: block;
  color: #17130f;
}

.showcase-card strong {
  padding-right: 30px;
  font-size: 1.1rem;
}

.showcase-card em {
  margin-top: 7px;
  padding-block: 5px;
  border-block: 1px solid rgba(22, 18, 15, 0.32);
  font-size: 0.8rem;
  font-style: normal;
  font-weight: 800;
}

.showcase-card p {
  margin: 10px 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.9rem;
  line-height: 1.35;
}

.showcase-card.land {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.28), transparent 34%),
    linear-gradient(140deg, #a7b494, #e2d7a5 44%, #8e9e83);
}

.showcase-card.land::before {
  background:
    linear-gradient(150deg, rgba(38, 75, 57, 0.8), transparent 42%),
    linear-gradient(40deg, rgba(205, 226, 255, 0.88), transparent 48%),
    #bfc9a1;
}

.showcase-card.equipment {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.24), transparent 34%),
    linear-gradient(140deg, #aeb7c6, #eee6d0 44%, #6d7788);
}

.showcase-card.equipment::before {
  background:
    radial-gradient(circle at 54% 42%, rgba(255, 250, 210, 0.9) 0 8%, transparent 9%),
    linear-gradient(135deg, rgba(245, 200, 58, 0.7), transparent 34%),
    linear-gradient(320deg, rgba(35, 55, 86, 0.82), transparent 48%),
    #aab3c0;
}

.showcase-card:nth-child(1) {
  transform: translate(-76%, -44%) rotate(-12deg);
}

.showcase-card:nth-child(2) {
  transform: translate(-50%, -52%) rotate(4deg);
}

.showcase-card:nth-child(3) {
  transform: translate(-24%, -40%) rotate(16deg);
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: -18px;
}

.quick-link {
  display: block;
  min-height: 132px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  text-decoration: none;
  box-shadow: 0 10px 30px rgba(47, 31, 18, 0.08);
}

.quick-link span {
  display: block;
  margin-bottom: 10px;
  color: var(--gold);
  font-size: 0.85rem;
  font-weight: 900;
  text-transform: uppercase;
}

.quick-link strong {
  font-size: 1.3rem;
  line-height: 1.35;
}

.page-heading {
  margin-bottom: 34px;
}

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

.rule-section {
  padding: clamp(22px, 4vw, 36px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.78);
  box-shadow: 0 12px 34px rgba(47, 31, 18, 0.08);
}

.philosophy blockquote {
  margin: 0;
  max-width: 980px;
  color: #2f2a25;
  font-size: clamp(1.13rem, 2.2vw, 1.55rem);
  font-style: italic;
  font-weight: 520;
  line-height: 1.55;
}

.rule-list,
.resource-grid {
  display: grid;
  gap: 18px;
}

.rule-card {
  padding: 20px;
  border-left: 6px solid currentColor;
  border-radius: 8px;
  background: #fff;
}

.rule-card.green {
  color: var(--green);
}

.rule-card.blue {
  color: var(--blue);
}

.rule-card.rose {
  color: var(--rose);
}

.rule-card.red {
  color: var(--red);
}

.rule-card.gold {
  color: var(--gold);
}

.rule-card ul,
.card-links {
  margin: 0;
  color: var(--ink);
  line-height: 1.55;
}

.rule-card li + li,
.card-links li + li {
  margin-top: 8px;
}

.ban-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 18px;
  margin-top: 24px;
}

.ban-card {
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 26px rgba(47, 31, 18, 0.08);
}

.ban-card-image {
  display: grid;
  min-height: 255px;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(157, 31, 31, 0.1), transparent 46%),
    #f0e7d8;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
  text-transform: uppercase;
}

.ban-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

.ban-card > div:last-child {
  display: grid;
  gap: 7px;
  align-content: start;
  padding: 14px;
}

.ban-card span {
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.ban-card a {
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 900;
  line-height: 1.2;
  text-decoration: none;
}

.ban-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.4;
}

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

.resource-grid section {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

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

.bracket-card {
  display: grid;
  gap: 8px;
  min-height: 190px;
  padding: 18px;
  border: 1px solid var(--line);
  border-top: 6px solid var(--gold);
  border-radius: 8px;
  background: #fff;
}

.bracket-card span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.bracket-card h3 {
  margin: 0;
  color: var(--ink);
}

.bracket-card p,
.source-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.source-note {
  margin-top: 14px;
}

.source-note code {
  padding: 2px 5px;
  border-radius: 5px;
  background: #f0e7d8;
  color: var(--ink);
}

.dynamic-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.card-preview {
  position: fixed;
  z-index: 100;
  width: 260px;
  pointer-events: none;
}

.card-preview img {
  border-radius: 4.75%;
  box-shadow: var(--shadow);
}

.importer-heading h1 {
  max-width: 780px;
}

.importer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 18px;
  align-items: start;
}

.import-panel,
.status-panel,
.output-panel {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 12px 34px rgba(47, 31, 18, 0.08);
}

.import-panel {
  display: grid;
  gap: 12px;
}

.import-panel label {
  font-weight: 850;
}

input,
textarea {
  width: 100%;
  border: 1px solid #cbbba6;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

input {
  min-height: 44px;
  padding: 0 12px;
}

textarea {
  min-height: 320px;
  padding: 12px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  line-height: 1.45;
  resize: vertical;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
}

.check input {
  width: 18px;
  min-height: 18px;
}

.status-panel {
  display: grid;
  gap: 14px;
}

.status-panel div {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.status-panel div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.stat-label {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
  text-transform: uppercase;
}

.status-panel strong {
  display: block;
  margin-top: 3px;
  font-size: 1.45rem;
}

.output-panel {
  margin-top: 18px;
}

.analysis-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 12px 34px rgba(47, 31, 18, 0.08);
}

.analysis-panel[hidden] {
  display: none;
}

.analysis-stat {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.analysis-stat strong {
  display: block;
  margin-top: 5px;
  font-size: 1.65rem;
  line-height: 1.1;
}

.game-changer-list {
  grid-column: 1 / -1;
  color: var(--muted);
  line-height: 1.45;
}

.bracket-reasons {
  grid-column: 1 / -1;
  color: var(--muted);
  line-height: 1.45;
}

.bracket-reasons ul {
  margin: 0;
  padding-left: 20px;
}

.analysis-note {
  grid-column: 1 / -1;
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.analysis-note code {
  padding: 2px 5px;
  border-radius: 5px;
  background: #f0e7d8;
  color: var(--ink);
}

.game-changer-list strong {
  color: var(--ink);
}

.output-actions {
  margin-top: 0;
}

.notice,
.errors {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 8px;
  background: #f0e7d8;
  color: #4f4033;
  line-height: 1.5;
}

.errors {
  background: #fee8e0;
  color: #7e2114;
}

.errors ul {
  margin: 0;
}

.resolved-sections {
  display: grid;
  gap: 28px;
  margin-top: 20px;
}

.resolved-section {
  display: grid;
  gap: 14px;
}

.resolved-section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.resolved-section-heading h2 {
  margin: 0;
  font-size: clamp(1.35rem, 3vw, 2.15rem);
}

.resolved-section-heading span,
.print-meta {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
  text-transform: uppercase;
}

.resolved-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
}

.resolved-card {
  display: grid;
  gap: 9px;
}

.resolved-card img {
  width: 100%;
  border-radius: 4.75%;
  box-shadow: 0 10px 24px rgba(47, 31, 18, 0.13);
}

.resolved-card a {
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.25;
  text-decoration: none;
}

.print-meta {
  display: block;
  line-height: 1;
}

@media (max-width: 800px) {
  .site-header {
    position: static;
    align-items: stretch;
    flex-direction: column;
  }

  .tabs {
    overflow-x: auto;
  }

  .tabs a {
    flex: 1 0 max-content;
  }

  .hero,
  .importer-grid,
  .quick-grid,
  .resource-grid,
  .analysis-panel {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
    padding-top: 14px;
  }

  .card-fan {
    min-height: 340px;
  }

  .showcase-card {
    width: min(210px, 54vw);
  }
}

@media (max-width: 520px) {
  main {
    width: min(100% - 22px, 1160px);
    padding-top: 28px;
  }

  .site-header {
    padding: 14px 12px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .rule-section,
  .import-panel,
  .status-panel,
  .output-panel {
    padding: 18px;
  }

  .card-preview {
    display: none;
  }
}
