:root {
  --paper: #f1e9d8;
  --ink: #201b17;
  --line: rgba(31, 27, 23, 0.16);
  --panel: rgba(244, 232, 210, 0.92);
  --panel-strong: rgba(236, 218, 188, 0.98);
  --accent: #9d4d2a;
  --accent-soft: #c67245;
  --link: #6e2619;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Spectral", Georgia, serif;
  color: var(--ink);
  min-height: 100vh;
  background: radial-gradient(circle at 20% 15%, #324450 0%, #1f2a39 47%, #0f121a 100%);
}

.bg-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.33;
  background-image:
    linear-gradient(35deg, rgba(242, 234, 219, 0.09) 0%, rgba(242, 234, 219, 0) 45%),
    repeating-linear-gradient(
      0deg,
      rgba(255, 255, 255, 0.045) 0,
      rgba(255, 255, 255, 0.045) 1px,
      transparent 1px,
      transparent 5px
    );
}

.page {
  position: relative;
  z-index: 1;
  max-width: 1460px;
  margin: 0 auto;
  padding: 2.2rem 1rem 3.5rem;
}

.hero {
  text-align: center;
  margin-bottom: 1.4rem;
}

.hero-left {
  text-align: left;
}

.kicker {
  margin: 0;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #f6dfc4;
  font-size: 0.78rem;
}

h1 {
  margin: 0.55rem 0 0.65rem;
  font-family: "Cinzel", serif;
  font-size: clamp(1.9rem, 5.6vw, 3.2rem);
  letter-spacing: 0.05em;
  color: #f6ebd2;
}

h2 {
  margin: 0 0 0.7rem;
  font-family: "Cinzel", serif;
  font-size: 1.22rem;
  color: #2d221c;
}

.subtitle {
  margin: 0;
  color: #e7cfb4;
  font-size: clamp(0.95rem, 2.4vw, 1.06rem);
}

.top-nav {
  margin-top: 1rem;
  display: inline-flex;
  gap: 0.7rem;
}

.top-nav a {
  color: #261a14;
  text-decoration: none;
  padding: 0.4rem 0.72rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: linear-gradient(165deg, rgba(255, 241, 220, 0.96), rgba(223, 196, 162, 0.9));
  font-size: 0.92rem;
}

.top-nav a:hover {
  background: linear-gradient(165deg, rgba(255, 245, 230, 0.97), rgba(234, 205, 172, 0.92));
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0.95rem;
  box-shadow: 0 9px 22px rgba(0, 0, 0, 0.22);
  padding: 1rem;
}

.search-wrap {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.search-wrap span {
  font-size: 0.93rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: #382922;
}

.search-wrap input {
  width: 100%;
  border: 1px solid rgba(64, 45, 33, 0.28);
  border-radius: 0.62rem;
  background: rgba(255, 250, 240, 0.98);
  color: #231913;
  font-size: 1rem;
  line-height: 1.2;
  padding: 0.7rem 0.8rem;
}

.result-count {
  margin: 0 0 0.85rem;
  color: #433228;
  font-size: 0.95rem;
}

.table-wrap {
  overflow: auto;
  border-radius: 0.72rem;
  border: 1px solid rgba(63, 45, 32, 0.22);
  background: rgba(255, 253, 247, 0.94);
}

.ingredient-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.93rem;
}

.ingredient-table th,
.ingredient-table td {
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid rgba(49, 35, 26, 0.11);
  text-align: left;
  white-space: nowrap;
}

.ingredient-table th {
  font-family: "Cinzel", serif;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  color: #3a2a1f;
  background: rgba(239, 223, 198, 0.84);
  position: sticky;
  top: 0;
}

.ingredient-table tr:hover td {
  background: rgba(242, 230, 208, 0.45);
}

.ingredient-link {
  color: var(--link);
  text-decoration: none;
  font-weight: 600;
}

.ingredient-link:hover {
  text-decoration: underline;
}

.detail-layout {
  display: grid;
  gap: 0.9rem;
}

.chip-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.chip {
  padding: 0.26rem 0.58rem;
  font-size: 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(58, 42, 31, 0.28);
  background: rgba(240, 223, 194, 0.75);
}

.deck-card-panel {
  display: grid;
  grid-template-columns: minmax(120px, 170px) 1fr;
  gap: 0.9rem;
  align-items: start;
}

.detail-card-image {
  width: 100%;
  border-radius: 0.6rem;
  border: 1px solid var(--line);
  display: block;
  background: var(--paper);
}

.muted {
  color: #5c473a;
}

/* Deck page styles */
.deck-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
  gap: 1rem;
}

.card-tile {
  border: 0;
  background: linear-gradient(145deg, rgba(255, 241, 220, 0.96), rgba(221, 197, 164, 0.92));
  padding: 0.55rem 0.55rem 0.65rem;
  border-radius: 0.95rem;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.card-tile:hover,
.card-tile:focus-visible {
  transform: translateY(-4px) scale(1.015);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.35);
  outline: 2px solid rgba(211, 129, 84, 0.7);
  outline-offset: 2px;
}

.card-image {
  width: 100%;
  height: auto;
  border-radius: 0.55rem;
  border: 1px solid var(--line);
  display: block;
  background: #ede5d9;
}

.card-label {
  margin-top: 0.55rem;
  text-align: center;
  font-size: 0.84rem;
  line-height: 1.25;
  color: #2a211b;
  min-height: 2.2rem;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
}

.modal[aria-hidden="false"] {
  display: grid;
  place-items: center;
}

.modal-scrim {
  position: absolute;
  inset: 0;
  background: rgba(8, 5, 13, 0.74);
  backdrop-filter: blur(3px);
}

.modal-card-wrap {
  position: relative;
  z-index: 2;
  margin: 0;
  width: min(88vw, 520px);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.modal-image {
  width: 100%;
  height: auto;
  border-radius: 1rem;
  box-shadow: var(--shadow);
  border: 2px solid rgba(247, 222, 189, 0.65);
  background: #1a1411;
}

.modal-caption {
  margin-top: 0.85rem;
  color: #f8e3cb;
  text-align: center;
  font-size: 0.95rem;
  max-width: 90%;
}

@media (max-width: 800px) {
  .page {
    padding-inline: 0.75rem;
  }

  .top-nav {
    flex-wrap: wrap;
  }

  .ingredient-table {
    font-size: 0.89rem;
  }

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

  .deck-grid {
    grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
    gap: 0.75rem;
  }

  .card-label {
    font-size: 0.8rem;
  }
}
