:root {
  --bg: #100b14;
  --bg-2: #1a1222;
  --panel: rgba(28, 20, 36, 0.78);
  --ink: #f3ead8;
  --muted: #b7a893;
  --gold: #d4b25a;
  --gold-2: #f0d58a;
  --line: rgba(212, 178, 90, 0.28);
  --bastos: #c45c2a;
  --copas: #3d7ea6;
  --espadas: #7a8aa0;
  --discos: #6f8f4e;
  --mayor: #d4b25a;
  --cs: #c45a5a;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Source Sans 3", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(212, 178, 90, 0.16), transparent 55%),
    radial-gradient(800px 500px at 100% 80%, rgba(90, 40, 80, 0.25), transparent 50%),
    var(--bg);
  min-height: 100vh;
}

.noise {
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='4'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='.6'/%3E%3C/svg%3E");
  z-index: 0;
}

header.hero {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 48px 24px 20px;
}
.kicker {
  letter-spacing: 0.28em;
  text-transform: uppercase;
  font-size: 11px;
  color: var(--gold);
  margin: 0 0 10px;
}
h1 {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 500;
  font-size: clamp(36px, 6vw, 68px);
  margin: 0;
  line-height: 0.95;
}
h1 em { font-style: italic; color: var(--gold-2); }
.lede {
  max-width: 640px;
  margin: 16px auto 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.5;
}
.actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 22px;
}
button, .btn {
  font: inherit;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  padding: 9px 16px;
  border-radius: 999px;
  cursor: pointer;
}
button.primary, .btn.primary {
  background: linear-gradient(180deg, #e3c36d, #b8892d);
  color: #2a1c08;
  border-color: transparent;
  font-weight: 600;
}
button:hover { border-color: var(--gold); }

.wrap {
  position: relative;
  z-index: 1;
  width: min(1080px, calc(100% - 32px));
  margin: 12px auto 64px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
  align-items: start;
}

.board {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 22px 18px 26px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}
.board h2, .reading h2 {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 500;
  margin: 0 0 14px;
  font-size: 28px;
}
.hint { color: var(--muted); font-size: 13px; margin: -8px 0 16px; }

.spread {
  display: grid;
  grid-template-columns: 0.88fr 1.2fr 0.95fr 0.92fr;
  grid-template-areas:
    ". interno . staff"
    "camino momento ancla staff"
    "camino metodo . staff";
  gap: 10px 12px;
  align-items: center;
}
.slot { min-width: 0; }
.slot[data-area="camino"] { grid-area: camino; align-self: center; }
.slot[data-area="interno"] { grid-area: interno; }
.slot[data-area="ancla"] { grid-area: ancla; }
.slot[data-area="metodo"] { grid-area: metodo; }
.slot[data-area="momento"] { grid-area: momento; }
.slot[data-area="staff"] { grid-area: staff; }

.momento-stack {
  display: grid;
  gap: 8px;
}
.staff {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-self: stretch;
}

.card-slot {
  position: relative;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.03), transparent 40%),
    rgba(16, 11, 20, 0.55);
  border-radius: 14px;
  min-height: 78px;
  padding: 8px 10px 10px;
  cursor: pointer;
  transition: border-color .2s, transform .2s;
}
.card-slot:hover, .card-slot.active {
  border-color: var(--gold);
  transform: translateY(-1px);
}
.card-slot.filled { background: rgba(212, 178, 90, 0.08); }
.card-slot.cs { box-shadow: inset 0 0 0 1px rgba(196, 90, 90, 0.45); }
.pos-num {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
}
.pos-title {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 16px;
  margin: 0 0 6px;
  line-height: 1.15;
}
.pos-sub { display: none; }
.picks { display: flex; flex-direction: column; gap: 6px; }
.pick {
  display: flex;
  align-items: center;
  gap: 6px;
}
.pick[hidden] { display: none !important; }
.pick input {
  width: 100%;
  background: rgba(0,0,0,0.28);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 8px;
  padding: 7px 8px;
  font: inherit;
  font-size: 13px;
}
.pick input:focus { outline: 1px solid var(--gold); }
.chip {
  font-size: 11px;
  color: var(--muted);
  min-width: 18px;
}
.add-second, .clear-one {
  background: none;
  border: 0;
  color: var(--gold);
  padding: 0;
  font-size: 12px;
  text-decoration: underline;
  cursor: pointer;
}
.suggestions {
  position: absolute;
  left: 8px;
  right: 8px;
  top: calc(100% - 6px);
  background: #24182d;
  border: 1px solid var(--line);
  border-radius: 10px;
  max-height: 220px;
  overflow: auto;
  z-index: 8;
  display: none;
}
.suggestions.open { display: block; }
.suggestions button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 0;
  padding: 8px 10px;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
}
.suggestions button:hover, .suggestions button[aria-selected="true"] {
  background: rgba(212, 178, 90, 0.16);
}
.sug-meta { color: var(--muted); font-size: 11px; }

.reading {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 22px 18px 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}
.empty-read {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}
.meaning {
  border-top: 1px solid var(--line);
  padding: 14px 0 6px;
}
.meaning h3 {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 22px;
  margin: 0 0 4px;
}
.meaning .where { color: var(--gold); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }
.pair {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(0,0,0,0.22);
}
.pair + .pair { margin-top: 8px; }
.pair .who {
  font-weight: 600;
  margin-bottom: 4px;
}
.pair .meta { color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.pair p { margin: 0; font-size: 14.5px; line-height: 1.45; }
.pair .general { margin-bottom: 8px; color: var(--muted); }
.ahondar-general {
  margin: 0 0 10px;
  color: var(--muted);
}
.ahondar-general ul {
  margin: 0;
  padding-left: 18px;
}
.ahondar-general li {
  font-size: 14px;
  line-height: 1.45;
  margin: 0 0 6px;
}
.ahondar-general li:last-child { margin-bottom: 0; }
.pick input.dup { border-color: var(--cs); }
.pair .pos-meaning { margin-bottom: 10px; }
.extra {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.extra-label {
  color: var(--gold);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.extra ul {
  margin: 0;
  padding-left: 18px;
}
.extra li {
  font-size: 14px;
  line-height: 1.45;
  margin: 0 0 6px;
  color: var(--ink);
}
.extra li:last-child { margin-bottom: 0; }
.badge {
  display: inline-block;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid var(--cs);
  color: #f0b4b4;
  padding: 1px 6px;
  border-radius: 999px;
  margin-left: 6px;
}
.palo-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}
.palo-dot.Bastos { background: var(--bastos); }
.palo-dot.Copas { background: var(--copas); }
.palo-dot.Espadas { background: var(--espadas); }
.palo-dot.Discos { background: var(--discos); }
.palo-dot.Mayor { background: var(--mayor); }

footer {
  position: relative;
  z-index: 1;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 0 16px 40px;
}

@media (max-width: 820px) {
  .spread {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "momento momento"
      "interno ancla"
      "metodo camino"
      "staff staff";
    align-items: stretch;
  }
}

.report {
  background: #fff;
  color: #1a1410;
  padding: 8px 4px 24px;
}
@media screen {
  .report {
    position: absolute;
    left: -12000px;
    top: 0;
    width: 800px;
  }
}
.report .kicker { color: #8a6d22; }
.report h1 {
  color: #1a1410;
  font-size: 34px;
}
.report h2 {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 500;
  font-size: 24px;
  margin: 22px 0 12px;
  color: #1a1410;
}
.report-date {
  margin: 8px 0 0;
  color: #5c5348;
  font-size: 15px;
}
.report-head { text-align: center; margin-bottom: 18px; }
.report-card {
  border: 1px solid #cfc4b0;
  border-radius: 10px;
  padding: 8px 10px;
  background: #fff;
  min-height: 72px;
}
.report-card.filled { background: #faf6ee; }
.report .pos-num { color: #8a6d22; }
.report .pos-title { color: #1a1410; }
.report-drawn { font-size: 13px; line-height: 1.35; }
.report .meaning { border-top-color: #ddd2c0; }
.report .where, .report .extra-label { color: #8a6d22; }
.report .hint, .report .meta, .report .general, .report .ahondar-general, .report .empty-read { color: #5c5348; }
.report .ahondar-general li { color: #5c5348; }
.report .pair { background: #f7f3ea; }
.report .badge { color: #8a3030; border-color: #8a3030; }
.report .extra { border-top-color: #ddd2c0; }
.report .extra li { color: #1a1410; }
.report .meaning { break-inside: avoid; page-break-inside: avoid; }

@media print {
  @page {
    size: A4 portrait;
    margin: 14mm;
  }
  @page :first {
    size: A4 landscape;
    margin: 10mm;
  }
  @page tirada {
    size: A4 landscape;
    margin: 10mm;
  }
  @page lectura {
    size: A4 portrait;
    margin: 14mm;
  }
  html, body {
    background: #fff !important;
    color: #1a1410 !important;
  }
  .noise, .hero, .wrap, footer, .actions {
    display: none !important;
  }
  .report {
    display: block !important;
    position: static;
    padding: 0;
    background: #fff;
    color: #1a1410;
  }
  .report[hidden] { display: block !important; }
  .report-tirada {
    page: tirada;
    break-after: page;
    page-break-after: always;
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  .report-tirada .report-head {
    margin-bottom: 8px;
  }
  .report-tirada h1 {
    font-size: 26px;
  }
  .report-tirada h2 {
    display: none;
  }
  .report-tirada .pos-num {
    display: none;
  }
  .report-tirada .spread {
    flex: 1;
    min-height: 0;
    width: 100%;
    display: grid !important;
    grid-template-columns: 0.88fr 1.2fr 0.95fr 0.92fr !important;
    grid-template-areas:
      ". interno . staff"
      "camino momento ancla staff"
      "camino metodo . staff" !important;
    gap: 14px 18px;
    align-items: stretch;
  }
  .report-tirada .slot {
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }
  .report-tirada .staff,
  .report-tirada .momento-stack {
    flex: 1;
    height: 100%;
    gap: 10px;
  }
  .report-tirada .report-card {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 12px 14px;
  }
  .report-tirada .pos-title {
    font-size: 18px;
    margin: 0 0 8px;
  }
  .report-tirada .report-drawn {
    font-size: 15px;
  }
  .report-reading {
    page: lectura;
    break-before: page;
    page-break-before: always;
  }
  .report-reading > .report-date {
    margin: 0 0 12px;
  }
}
