:root {
  --accent-violet: #b38ee6;
  --accent-gold: #e8c468;
  --suit-spade: #8fb8e0;
  --suit-bastoni: #e2a765;
  --suit-coppe: #e08fa5;
  --suit-denari: #e8c468;
}

* {
  box-sizing: border-box;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #f2e8d8;
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: #121212;
}

.app {
  display: flex;
  flex-direction: column;
  max-width: 900px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 84px 18px 24px;
  overflow-x: clip;
  background: #18181a;
  border-left: 1px solid rgba(255, 255, 255, 0.05);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

@media (min-width: 561px) {
  .app {
    padding: 84px 28px 32px;
  }
}

/* ---------- top bar ---------- */

.topbar-fixed {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 20;
  background: rgba(24, 24, 26, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.topbar {
  position: relative;
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 18px;
}

/* site branding in the top bar — not a heading, see .page-title for that */
.wordmark {
  margin: 0;
  font-family: "Playfair Display", serif;
  font-weight: 600;
  letter-spacing: 0.5px;
  font-size: clamp(1.2rem, 2.8vw, 1.6rem);
  color: #fff;
  white-space: nowrap;
  text-decoration: none;
}

/* the page's real <h1> — what the page is, for search and screen readers.
   Kept modest: the wordmark above still carries the visual weight. */
.page-title {
  margin: 4px 0 0;
  font-family: "Playfair Display", serif;
  font-weight: 600;
  font-size: clamp(1.1rem, 3vw, 1.4rem);
  color: var(--accent-gold);
}

/* desktop inline navigation (visible >= 840px; hamburger takes over below) */
.topbar-inline {
  display: none;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.topbar-link {
  padding: 6px 10px;
  border-radius: 6px;
  color: rgba(242, 232, 216, 0.72);
  font-size: 0.86rem;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.2s ease, background 0.2s ease;
}

@media (hover: hover) and (pointer: fine) {
  .topbar-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
  }
}

.topbar-link.active {
  color: #d0b9ff;
  background: rgba(179, 142, 230, 0.16);
}

.topbar-link--lang {
  margin-left: 4px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 0.8rem;
  padding: 4px 9px;
}

.topbar-sep {
  color: rgba(242, 232, 216, 0.28);
  padding: 0 2px;
  user-select: none;
}

@media (min-width: 840px) {
  .topbar-inline {
    display: flex;
  }
  .menu-btn,
  .menu-panel {
    display: none !important;
  }
}

.menu-btn {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  flex: none;
}

.menu-btn span {
  display: block;
  width: 20px;
  height: 2px;
  background: rgba(242, 232, 216, 0.85);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.menu-btn[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.menu-btn[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}
.menu-btn[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 5;
  min-width: 240px;
  background: rgba(14, 12, 22, 0.97);
  border: 1px solid rgba(147, 103, 212, 0.28);
  border-radius: 8px;
  padding: 10px;
  display: grid;
  gap: 4px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

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

.spread-tabs {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tab {
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: rgba(242, 232, 216, 0.7);
  font-size: 0.9rem;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
}

@media (hover: hover) and (pointer: fine) {
  .tab:hover {
    color: #f9f5ff;
  }
}
.tab.active {
  color: #d0b9ff;
  background: rgba(179, 142, 230, 0.16);
}
.tab--all {
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid rgba(147, 103, 212, 0.18);
  border-radius: 0;
  color: rgba(242, 232, 216, 0.5);
}

/* ---------- picker / reveal row ---------- */

.spread-picker {
  display: grid;
  gap: 16px;
  margin: 12px 0 18px;
}

@media (min-width: 680px) {
  .spread-picker {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
  }
}

.spread-picker[hidden],
.reveal-row[hidden] {
  display: none;
}

.picker-row {
  margin: 0;
  padding: 20px;
  border: 1px solid rgba(153, 121, 214, 0.16);
  border-radius: 12px;
  background: rgba(11, 9, 19, 0.55);
  align-items: flex-start;
  gap: 20px;
  transition: border-color 0.2s ease, background 0.2s ease;
}
@media (hover: hover) and (pointer: fine) {
  .picker-row:hover {
    border-color: rgba(232, 196, 104, 0.35);
    background: rgba(18, 15, 30, 0.75);
  }
}

.picker-explore {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.9rem;
}
.picker-explore-link {
  color: var(--accent-gold);
  text-decoration: none;
  font-weight: 500;
}
@media (hover: hover) and (pointer: fine) {
  .picker-explore-link:hover {
    text-decoration: underline;
  }
}

.reveal-row {
  display: flex;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
  margin: 6px 0 18px;
}

.spread-desc {
  flex: 1 1 200px;
  max-width: 640px;
  font-size: 0.96rem;
  line-height: 1.58;
  color: rgba(242, 232, 216, 0.72);
}
.spread-desc strong {
  color: var(--accent-gold);
}

.deck-wrap {
  display: grid;
  place-items: center;
  gap: 10px;
  flex: none;
}
.deck-link {
  text-decoration: none;
  color: inherit;
}

.deck {
  position: relative;
  display: grid;
  place-items: center;
  width: 120px;
  padding: 6px 0;
  cursor: pointer;
}
.deck.disabled {
  cursor: not-allowed;
}

/* Stacked deck layers behind .card-back */
.deck::before,
.deck::after {
  content: "";
  grid-area: 1 / 1;
  width: 86px;
  aspect-ratio: 480 / 789;
  border-radius: 8px;
  background: url("/cards/card_back.svg") center / cover no-repeat;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  transition: transform 0.35s ease, opacity 0.35s ease;
}
.deck::before {
  transform: translate(-4px, 3px) rotate(-3deg);
  opacity: 0.82;
}
.deck::after {
  transform: translate(4px, 2px) rotate(3deg);
  opacity: 0.9;
}

/* Spread-specific card-back arrangements on the landing page */
.deck--two-cards::before {
  display: none;
}
.deck--two-cards::after {
  transform: translate(-10px, 2px) rotate(-7deg);
  opacity: 0.95;
}
.deck--two-cards .card-back {
  transform: translate(8px, 0) rotate(6deg);
}
.deck--timeline::before {
  transform: translate(-14px, 3px) rotate(-8deg);
}
.deck--timeline::after {
  transform: translate(14px, 3px) rotate(8deg);
}
.deck--horseshoe::before {
  transform: translate(-16px, 8px) rotate(-16deg);
}
.deck--horseshoe::after {
  transform: translate(16px, 8px) rotate(16deg);
}
.deck--yes-no::before {
  transform: translate(-9px, 4px) rotate(-6deg);
}
.deck--yes-no::after {
  transform: translate(9px, 4px) rotate(6deg);
}

.deck:focus-visible,
.tab:focus-visible,
.topbar-link:focus-visible,
.visual-card:focus-visible,
.retry-button:focus-visible,
.carousel-btn:focus-visible {
  outline: 2px solid #d0b9ff;
  outline-offset: 3px;
}

.deck-status {
  display: block;
  font-size: 0.76rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: center;
  color: rgba(234, 221, 255, 0.82);
}
.deck-status.error {
  color: rgba(255, 160, 160, 0.92);
}
.deck-status.success {
  color: var(--accent-gold);
}

.retry-button {
  margin-top: 6px;
  padding: 6px 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: #f9f5ff;
  border-radius: 8px;
  font-size: 0.82rem;
  cursor: pointer;
}

.card-back {
  grid-area: 1 / 1;
  position: relative;
  z-index: 1;
  display: block;
  width: 86px;
  aspect-ratio: 480 / 789;
  border-radius: 8px;
  background: url("/cards/card_back.svg") center / cover no-repeat;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  transition: transform 0.35s ease, opacity 0.35s ease, box-shadow 0.35s ease;
}
/* gated to real hover devices: a touch device that also matches this without
   (hover: hover) can leave WebKit waiting for a second tap to "confirm" the
   hover state before it delivers the click — see #deck's click listener */
@media (hover: hover) and (pointer: fine) {
  .deck:hover .card-back {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6);
  }
  .deck:hover::before {
    transform: translate(-8px, 4px) rotate(-6deg);
  }
  .deck:hover::after {
    transform: translate(8px, 3px) rotate(6deg);
  }
}
/* :active fires on touch too, and reliably — this is the tap feedback on a
   touch device, where the :hover above never applies */
.deck:not(.disabled) .card-back:active {
  transform: scale(0.97);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}

/* Shuffle & left-hand cut (la mano del cuore) animation */
@keyframes shuffle-top {
  0% { transform: translate(0, 0) rotate(0deg); }
  30% { transform: translate(-22px, -6px) rotate(-10deg); }
  65% { transform: translate(16px, -4px) rotate(7deg); }
  100% { transform: translate(0, 0) rotate(0deg); }
}
@keyframes shuffle-left {
  0% { transform: translate(-4px, 3px) rotate(-3deg); }
  35% { transform: translate(20px, 2px) rotate(9deg); }
  70% { transform: translate(-18px, 4px) rotate(-8deg); }
  100% { transform: translate(-4px, 3px) rotate(-3deg); }
}
@keyframes shuffle-right {
  0% { transform: translate(4px, 2px) rotate(3deg); }
  35% { transform: translate(-18px, -4px) rotate(-7deg); }
  70% { transform: translate(18px, 3px) rotate(9deg); }
  100% { transform: translate(4px, 2px) rotate(3deg); }
}

.deck.shuffle .card-back {
  animation: shuffle-top 0.82s cubic-bezier(0.4, 0, 0.2, 1);
}
.deck.shuffle::before {
  animation: shuffle-left 0.82s cubic-bezier(0.4, 0, 0.2, 1);
}
.deck.shuffle::after {
  animation: shuffle-right 0.82s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- results ---------- */

.spread {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

/* the small strip of cards above the reading */
.visual-spread {
  display: flex;
  justify-content: center;
  align-items: center;
  /* extra top/bottom room: the active card lifts and scales past the edge */
  padding: 20px 12px 24px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 16px;
}

.spread-shape-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
}

.spread-shape-horseshoe {
  position: relative;
  width: 100%;
  max-width: 560px;
  height: 320px;
  margin: 0 auto;
}
.spread-shape-horseshoe .visual-card {
  position: absolute;
  transform-origin: center bottom;
}
.spread-shape-horseshoe .visual-card:nth-child(1) { bottom: 16px; left: 10%; --rot: -30deg; }
.spread-shape-horseshoe .visual-card:nth-child(2) { bottom: 92px; left: 20%; --rot: -15deg; }
.spread-shape-horseshoe .visual-card:nth-child(3) { bottom: 148px; left: 35%; --rot: -5deg; }
.spread-shape-horseshoe .visual-card:nth-child(4) { bottom: 166px; left: 50%; --tx: -50%; }
.spread-shape-horseshoe .visual-card:nth-child(5) { bottom: 148px; right: 35%; --rot: 5deg; }
.spread-shape-horseshoe .visual-card:nth-child(6) { bottom: 92px; right: 20%; --rot: 15deg; }
.spread-shape-horseshoe .visual-card:nth-child(7) { bottom: 16px; right: 10%; --rot: 30deg; }

.visual-card {
  --tx: 0px;
  --ty: 0px;
  --rot: 0deg;
  --scale: 1;
  position: relative;
  width: 76px;
  aspect-ratio: 480 / 789;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  transform: translateX(var(--tx)) rotate(var(--rot)) translateY(var(--ty)) scale(var(--scale));
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.visual-card img {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  display: block;
}

/* Two-card pair in the visual strip: two fanned cards side by side */
.visual-card--pair {
  width: 104px;
  aspect-ratio: 620 / 789;
  background: none;
  box-shadow: none;
}
.visual-card--pair img {
  position: absolute;
  top: 0;
  width: 72%;
  height: 100%;
  border-radius: 7px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.visual-card--pair img:first-of-type {
  left: 0;
  transform: rotate(-5deg);
}
.visual-card--pair img:last-of-type {
  right: 0;
  transform: rotate(5deg);
}
.visual-card--pair.active {
  outline: none;
  box-shadow: none;
}
.visual-card--pair.active img {
  outline: 2px solid var(--accent-gold);
  box-shadow: 0 8px 24px rgba(232, 196, 104, 0.35);
}

/* Position / Vote badge on visual strip cards */
.visual-card-badge {
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: #1e1b29;
  border: 1px solid rgba(212, 184, 255, 0.35);
  color: rgba(242, 232, 216, 0.9);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}
.visual-card.active .visual-card-badge {
  background: var(--accent-gold);
  border-color: var(--accent-gold);
  color: #141210;
}
.visual-card-badge--yes {
  border-color: rgba(232, 196, 104, 0.6);
  color: var(--accent-gold);
}
.visual-card-badge--no {
  border-color: rgba(255, 255, 255, 0.2);
  color: rgba(242, 232, 216, 0.65);
}

/* a flex item with z-index makes its own stacking context even when static, so
   these must stay well under .topbar-fixed (20) — they only need to beat siblings */
@media (hover: hover) and (pointer: fine) {
  .visual-card:hover {
    --ty: -4px;
    --scale: 1.05;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.6);
    z-index: 1;
  }
  .visual-card--pair:hover {
    box-shadow: none;
  }
}
.visual-card.active {
  --ty: -5px;
  --scale: 1.06;
  box-shadow: 0 12px 30px rgba(232, 196, 104, 0.4);
  outline: 2px solid var(--accent-gold);
  z-index: 2;
}
.visual-card--pair.active {
  box-shadow: none;
  outline: none;
}

/* verdict banner */
.answer-banner {
  text-align: center;
  padding: 20px;
  border: 1px solid rgba(232, 196, 104, 0.5);
  border-radius: 10px;
  background: rgba(232, 196, 104, 0.06);
}
.answer-verdict {
  font-family: "Playfair Display", serif;
  font-size: 2.4rem;
  line-height: 1;
  color: var(--accent-gold);
}
.answer-note {
  margin-top: 8px;
  font-size: 0.85rem;
  color: rgba(242, 232, 216, 0.6);
}

/* the spread-as-a-whole panel */
.overview-panel {
  background: rgba(11, 9, 19, 0.6);
  border: 1px solid rgba(153, 121, 214, 0.16);
  border-radius: 8px;
  padding: 18px 20px;
}
.overview-title {
  margin-bottom: 10px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent-gold);
}
.overview-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 10px;
}
.overview-list li {
  line-height: 1.55;
  color: #e8e1d8;
}

/* save / share a reading */
.copy-link {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  font-size: 0.85rem;
}
.copy-link-feedback {
  color: var(--accent-gold);
}
.copy-link-fallback-note {
  color: rgba(242, 232, 216, 0.6);
}
.copy-link-fallback-input {
  width: min(100%, 360px);
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid rgba(153, 121, 214, 0.3);
  background: rgba(11, 9, 19, 0.6);
  color: #f2e8d8;
  font: inherit;
  text-align: center;
}

/* per-card reading */
.reading-card {
  position: relative;
  padding: 24px;
  border: 1px solid rgba(153, 121, 214, 0.16);
  border-radius: 8px;
  background: rgba(11, 9, 19, 0.7);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.reading-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  border-radius: 6px 6px 0 0;
  background: var(--card-accent, var(--accent-violet));
}
.reading-card .position {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #d0b4ff;
}
.reading-card .position-hint {
  margin-top: 3px;
  font-size: 0.84rem;
  color: rgba(242, 232, 216, 0.58);
  font-style: italic;
}
.card-title-link {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: rgba(208, 180, 255, 0.35);
  text-underline-offset: 3px;
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}
@media (hover: hover) and (pointer: fine) {
  .card-title-link:hover {
    color: var(--accent-gold);
    text-decoration-color: var(--accent-gold);
  }
}
.reading-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: start;
  margin-top: 14px;
}
.reading-images {
  display: flex;
  gap: 10px;
}
.card-view {
  --card-accent: var(--accent-violet);
  display: block;
  text-decoration: none;
}
.card-img {
  width: 92px;
  aspect-ratio: 480 / 789;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transform: translateY(16px) scale(0.96);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.card-img.visible {
  opacity: 1;
  transform: none;
}
.card-text {
  line-height: 1.58;
  color: #e8e1d8;
}
.card-text strong {
  color: var(--accent-gold);
}

/* ---------- carousel ---------- */

.carousel {
  min-width: 0;
}
.carousel-container {
  width: 100%;
  max-width: 700px;
  min-width: 0;
  margin: 0 auto;
  overflow: hidden;
  touch-action: pan-y;
}
.carousel-track {
  display: flex;
  transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}
.carousel-slide {
  flex: 0 0 100%;
  min-width: 0;
  padding: 6px;
}

/* Expanded "Show all" reading mode */
.carousel--all .carousel-container {
  overflow: visible;
}
.carousel--all .carousel-track {
  display: grid;
  gap: 12px;
  transform: none !important;
}
.carousel--all .carousel-slide {
  padding: 2px;
}
.carousel--all .carousel-slide.active-slide .reading-card {
  border-color: rgba(232, 196, 104, 0.5);
  box-shadow: 0 8px 28px rgba(232, 196, 104, 0.14);
}
.carousel--all .carousel-step-group {
  display: none;
}

.carousel-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 14px 20px;
  margin-top: 16px;
}
.carousel-step-group {
  display: flex;
  align-items: center;
  gap: 16px;
}
.carousel-count {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.5);
}
.carousel-btn {
  padding: 9px 18px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.08);
  color: #f2e8d8;
  font-family: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.carousel-btn--toggle {
  border-color: rgba(179, 142, 230, 0.32);
  background: rgba(179, 142, 230, 0.08);
  color: #d8c7f7;
}
@media (hover: hover) and (pointer: fine) {
  .carousel-btn:hover:not(:disabled) {
    background: rgba(232, 196, 104, 0.25);
    border-color: rgba(232, 196, 104, 0.6);
  }
}
.carousel-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ---------- ads (inert until a data-ad-slot is filled; see js/ads.js) ---------- */

.ad-slot {
  display: none;
}
.ad-slot--live {
  display: block;
}

.ad-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(242, 232, 216, 0.32);
}

.ad-slot--end {
  max-width: 728px;
  margin: 30px auto 4px;
  text-align: center;
}
.ad-slot--end .adsbygoogle {
  min-height: 90px; /* reserve space so a filled ad does not shift the footer */
}

/* wide-screen gutter rail: content is 900px, so only when the gutters are roomy */
.ad-rail {
  position: fixed;
  top: 50%;
  right: 24px;
  z-index: 4;
  width: 160px;
  max-height: calc(100vh - 140px);
  transform: translateY(-50%);
  overflow: hidden;
  text-align: center;
}
.ad-rail .adsbygoogle {
  min-height: 600px;
}
@media (max-width: 1439px) {
  .ad-rail.ad-slot--live {
    display: none; /* not enough gutter — no rail below 1440px */
  }
}
@media (min-width: 1760px) {
  .ad-rail {
    width: 300px;
    right: 40px;
  }
}
@media (prefers-reduced-data: reduce) {
  .ad-rail.ad-slot--live {
    display: none;
  }
}

/* ---------- footer ---------- */

.site-footer {
  margin-top: auto;
  padding-top: 24px;
  font-size: 0.78rem;
  line-height: 1.5;
  text-align: center;
  color: rgba(242, 232, 216, 0.45);
}
.site-footer a,
.link-btn {
  color: rgba(224, 200, 255, 0.65);
}
@media (hover: hover) and (pointer: fine) {
  .site-footer a:hover,
  .link-btn:hover {
    color: var(--accent-gold);
  }
}
.link-btn {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  cursor: pointer;
}
.link-btn[hidden] {
  display: none;
}
/* the separator rides with the button, so it disappears when the button is hidden */
.site-footer .link-btn::before {
  content: "·";
  margin: 0 0.5em;
  color: rgba(224, 200, 255, 0.4);
}

/* ---------- prose pages (privacy, etc.) ---------- */

.prose {
  max-width: 640px;
  margin: 24px auto 0;
  line-height: 1.62;
}
.prose h1 {
  font-family: "Playfair Display", serif;
  font-weight: 600;
  font-size: 1.8rem;
}
.prose h2 {
  margin-top: 1.8em;
  font-family: "Playfair Display", serif;
  font-weight: 600;
  font-size: 1.2rem;
  color: var(--accent-gold);
}
.prose h3 {
  margin-top: 1.8em;
  font-size: 1rem;
  color: var(--accent-gold);
}
.prose a {
  color: rgba(224, 200, 255, 0.85);
}
.prose ul,
.prose ol {
  padding-left: 20px;
}
/* anchor targets (e.g. #ordinary-pack) land below the fixed top bar */
.prose h2[id] {
  scroll-margin-top: 80px;
}
/* the ordinary-pack equivalent under a card page's meaning */
.prose .pack-note {
  margin-top: 1.2em;
  font-size: 0.92rem;
  color: rgba(224, 200, 255, 0.7);
}
.prose li {
  margin-bottom: 6px;
}
.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0;
  font-size: 0.92rem;
}
.prose th,
.prose td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  vertical-align: top;
}
.prose th {
  color: var(--accent-gold);
  font-weight: 600;
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.prose td:first-child {
  white-space: nowrap;
}

/* ---------- browsable deck (deck index + card pages) ---------- */

.cardlist-section {
  max-width: 820px;
}
.cardlist-group + .cardlist-group {
  margin-top: 32px;
}
.cardlist-group-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 14px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--suit-accent, var(--accent-gold));
}
.cardlist-group h2 {
  margin: 0;
  font-family: "Playfair Display", serif;
  font-weight: 600;
  font-size: 1.2rem;
  color: var(--suit-accent, var(--accent-gold));
}
.cardlist-group-sub {
  font-size: 0.86rem;
  color: rgba(242, 232, 216, 0.55);
}
.cardlist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
@media (min-width: 640px) {
  .cardlist {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 14px;
  }
}
.cardlist-row {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  background: rgba(11, 9, 19, 0.45);
  text-decoration: none;
  color: inherit;
  transition: background 0.2s ease, border-color 0.2s ease;
}
@media (hover: hover) and (pointer: fine) {
  .cardlist-row:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--suit-accent, rgba(255, 255, 255, 0.16));
  }
}
.cardlist-row img {
  width: 46px;
  aspect-ratio: 480 / 789;
  border-radius: 4px;
  object-fit: cover;
  flex: none;
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.cardlist-row-text {
  display: grid;
  gap: 3px;
}
.cardlist-row-name {
  font-weight: 600;
  color: #f2e8d8;
}
.cardlist-row-meaning {
  font-size: 0.88rem;
  line-height: 1.45;
  color: rgba(242, 232, 216, 0.65);
}

/* Card page sibling suits + prev/next pager */
.card-paired-panel {
  margin-top: 1.4em;
}
.card-siblings {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 1.4em;
}
.card-sibling {
  padding: 5px 11px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(11, 9, 19, 0.5);
  font-size: 0.82rem;
  text-decoration: none;
  color: rgba(242, 232, 216, 0.8);
  transition: border-color 0.2s ease, color 0.2s ease;
}
@media (hover: hover) and (pointer: fine) {
  .card-sibling:hover {
    border-color: var(--card-accent, var(--accent-gold));
    color: #fff;
  }
}
.card-sibling--current {
  border-color: var(--card-accent, var(--accent-gold));
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-weight: 600;
}

.card-pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 1.4em;
  padding-top: 1.1em;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.9rem;
}
.card-pager-link {
  text-decoration: none;
}
.card-actions {
  margin-top: 1.4em;
  font-size: 0.92rem;
}

/* ---------- small screens ---------- */

@media (max-width: 600px) {
  .reveal-row {
    flex-direction: column;
    text-align: center;
    margin: 10px 0 18px;
  }

  .picker-row {
    align-items: center;
  }

  .deck {
    width: 140px;
  }
  .card-back,
  .deck::before,
  .deck::after {
    width: 96px;
  }

  .visual-spread {
    padding: 16px 8px 22px;
    border-radius: 12px;
  }
  .spread-shape-row {
    gap: 10px;
  }

  /* Scaled U-shape arc so the Ferro di Cavallo preserves its shape on phones */
  .spread-shape-horseshoe {
    max-width: 330px;
    height: 196px;
  }
  .spread-shape-horseshoe .visual-card:nth-child(1) { bottom: 8px; left: 4%; --rot: -28deg; }
  .spread-shape-horseshoe .visual-card:nth-child(2) { bottom: 56px; left: 15%; --rot: -14deg; }
  .spread-shape-horseshoe .visual-card:nth-child(3) { bottom: 94px; left: 31%; --rot: -5deg; }
  .spread-shape-horseshoe .visual-card:nth-child(4) { bottom: 106px; left: 50%; --tx: -50%; }
  .spread-shape-horseshoe .visual-card:nth-child(5) { bottom: 94px; right: 31%; --rot: 5deg; }
  .spread-shape-horseshoe .visual-card:nth-child(6) { bottom: 56px; right: 15%; --rot: 14deg; }
  .spread-shape-horseshoe .visual-card:nth-child(7) { bottom: 8px; right: 4%; --rot: 28deg; }

  .spread-shape-row .visual-card,
  .spread-shape-horseshoe .visual-card {
    width: 44px;
  }
  .spread-shape-row .visual-card--pair {
    width: 68px;
  }
  .visual-card-badge {
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    font-size: 0.62rem;
    line-height: 15px;
    bottom: -7px;
  }

  .reading-card {
    padding: 18px;
  }
  .reading-grid {
    grid-template-columns: 1fr;
  }
  .reading-images {
    justify-content: center;
  }
  .card-view {
    justify-self: center;
  }
  .card-img {
    width: 84px;
  }
  .card-text {
    font-size: 1.02rem;
  }
  .answer-verdict {
    font-size: 2rem;
  }

  .prose table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
  .prose td,
  .prose th {
    white-space: normal;
  }
}

@media (prefers-reduced-motion: reduce) {
  .carousel-track,
  .card-img,
  .card-back,
  .deck::before,
  .deck::after,
  .visual-card {
    transition: none;
    animation: none !important;
  }
}
