/* Pirate Court Card Gallery — Weathered map & skull-adorned style */
:root {
  --color-bg: #1a1510;
  --color-surface: #e8d5a3;
  --color-border: #7a5c2e;
  --color-border-strong: #4a3520;
  --color-accent: #c0392b;
  --color-accent-gold: #d4a017;
  --color-text: #33261a;
  --color-muted: #6b5a42;
  --radius: 8px;
  --radius-sm: 2px;
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.5), 0 0 24px rgba(139, 105, 20, 0.1);
  --shadow-hover:
    0 8px 28px rgba(0, 0, 0, 0.6), 0 0 12px rgba(192, 57, 43, 0.15);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
  font-size: 14px;
  line-height: 1.6;
  background: var(--color-bg);
  background-image:
    radial-gradient(
      ellipse at 20% 50%,
      rgba(100, 80, 30, 0.12) 0%,
      transparent 70%
    ),
    radial-gradient(
      ellipse at 80% 50%,
      rgba(192, 57, 43, 0.06) 0%,
      transparent 70%
    );
  color: var(--color-text);
  padding: 32px 18px 72px;
}

/* ─── Header ─── */
.header {
  max-width: 1000px;
  margin: 0 auto 44px;
  background: var(--color-surface);
  border: 4px double var(--color-border);
  border-radius: var(--radius);
  padding: 40px 48px;
  text-align: center;
  position: relative;
  background-image:
    linear-gradient(to bottom, rgba(100, 80, 30, 0.06) 1px, transparent 1px),
    radial-gradient(
      ellipse at center,
      rgba(100, 80, 30, 0.1) 0%,
      transparent 70%
    );
  background-size:
    100% 28px,
    100% 100%;
  box-shadow:
    inset 0 0 40px rgba(74, 53, 32, 0.1),
    0 6px 20px rgba(0, 0, 0, 0.4);
}
.header::before,
.header::after {
  content: "☠";
  position: absolute;
  font-size: 28px;
  color: var(--color-accent);
  opacity: 0.5;
  top: 10px;
}
.header::before {
  left: 18px;
}
.header::after {
  right: 18px;
}

.header__title {
  margin: 0 0 6px;
  font-size: 36px;
  font-weight: 700;
  color: var(--color-accent);
  text-shadow:
    2px 2px 4px rgba(0, 0, 0, 0.25),
    0 0 12px rgba(192, 57, 43, 0.12);
  font-variant: small-caps;
  letter-spacing: 0.06em;
  overflow-wrap: break-word;
  word-wrap: break-word;
}
.header__title::before {
  content: "⚓ ";
  font-size: 0.65em;
}
.header__title::after {
  content: " ⚓";
  font-size: 0.65em;
}

.header__subtitle {
  margin: 0;
  font-size: 16px;
  font-weight: 400;
  font-style: italic;
  color: var(--color-muted);
  letter-spacing: 0.08em;
}

/* ─── Main content ─── */
.main {
  max-width: 1000px;
  margin: 0 auto;
}

/* ─── Cardset Sections ─── */
.cardset-section {
  margin-bottom: 24px;
}

.cardset-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 6px 12px;
  margin-bottom: 10px;
  border-bottom: 2px solid var(--color-border);
  border-left: 5px solid var(--color-accent);
  background: linear-gradient(to right, rgba(74, 53, 32, 0.08), transparent);
}

.cardset-header__title {
  font-size: 16px;
  font-weight: 700;
  font-variant: small-caps;
  letter-spacing: 0.05em;
  color: var(--color-accent);
}

.cardset-header__count {
  font-size: 11px;
  color: var(--color-muted);
}

.cardset-page-break {
  height: 2px;
  margin: 24px 0;
  border: none;
  border-top: 2px dashed var(--color-border);
}

@media print {
  .cardset-page-break {
    display: block;
    height: 0;
    margin: 0;
    border: none;
    page-break-after: always;
    break-after: page;
  }

  .cardset-section {
    page-break-inside: avoid;
  }
}

/* ─── Cards Grid - 3 columns ─── */
.cards-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 40px;
}

/* ─── Individual Card ─── */
.card {
  background: var(--color-surface);
  border: 3px double var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  height: 100%;
  flex: 0 1 calc(33.333% - 12px);
  max-width: 240px;
  max-height: 320px;
  min-height: 320px;
  position: relative;
  background-image: linear-gradient(
    to bottom,
    rgba(100, 80, 30, 0.04) 1px,
    transparent 1px
  );
  background-size: 100% 20px;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: var(--color-accent);
}

/* ─── Card Header ─── */
.card__header {
  padding-top: 3px;
  padding-bottom: 2px;
  padding-left: 16px;
  padding-right: 16px;
  border-bottom: 2px solid var(--color-border);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-height: 48px;
  background: linear-gradient(to bottom, rgba(74, 53, 32, 0.08), transparent);
}

.card__title {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-accent);
  margin: 0;
  line-height: 1.3;
  font-variant: small-caps;
  letter-spacing: 0.03em;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
}

.card__quest-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 8px;
}

.card__quest-type {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-accent-gold);
  letter-spacing: 0.5px;
}

/* ─── Card Body ─── */
.card__body {
  padding: 6px;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.dice {
  width: 26px;
  height: 26px;
  margin-left: 2px;
  margin-right: 2px;
}

.card__reward .dice {
  vertical-align: middle;
}

.card__task-list {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.card__task-item {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 5px 2px;
}

.card__task-content {
  display: block;
  font-size: 12px;
  line-height: 1.25;
}

.card__task-content .dice {
  vertical-align: middle;
}

.card__task-content--find .dice {
  width: 42px;
  height: 42px;
}

/* ─── Page Footer ─── */
.footer {
  max-width: 1200px;
  margin: 60px auto 0;
  padding-top: 40px;
  text-align: center;
  color: #a08c6c;
  font-size: 13px;
  font-style: italic;
  position: relative;
}
.footer::before {
  content: "⸻  ☠  ⸻";
  display: block;
  margin-bottom: 12px;
  color: var(--color-accent);
  opacity: 0.35;
  letter-spacing: 0.2em;
}

.footer p {
  margin: 0;
}

/* ─── Print Styles ─── */
@media print {
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  body {
    padding: 24px;
    background: white;
    background-image: none;
  }

  .header {
    display: none;
    page-break-after: avoid;
  }
  .header::before,
  .header::after {
    display: none;
  }

  .card {
    box-shadow: none;
    border: 1px solid var(--color-border);
    page-break-inside: avoid;
    background-image: none;
  }
  .card:hover {
    transform: none;
    box-shadow: none;
  }

  .footer {
    display: none;
  }
}

/* ─── Responsive adjustments ─── */
@media (max-width: 768px) {
  .cards-grid {
    gap: 16px;
  }

  .card {
    flex: 0 1 calc(50% - 8px);
    min-width: 280px;
  }

  .card__header {
    flex-direction: column;
    gap: 6px;
  }
}

@media (max-width: 480px) {
  body {
    padding: 12px 12px 20px;
  }

  .header {
    padding: 20px 16px;
    margin-bottom: 20px;
  }

  .header__title {
    font-size: 24px;
  }

  .header__subtitle {
    font-size: 14px;
  }

  .cards-grid {
    gap: 12px;
  }

  .card {
    flex: 0 1 100%;
  }

  .card__body {
    padding: 12px;
    gap: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
