/* ============================================================
   ARCANA — Tarot Elemental PWA (Estética Nocturna Azul y Oro)
   ============================================================ */
:root {
  --bg-deep: #070b19;
  --bg-surface: #0e1429;
  --bg-surface-2: #151d3b;
  --line: rgba(212, 175, 55, 0.22);
  --line-strong: rgba(235, 200, 95, 0.45);
  --gold: #d4af37;
  --gold-soft: #f0d78c;
  --violet: #7f6eb8;
  --violet-soft: #b2a4e3;
  --suit-salamandras: #d97742;
  --suit-ondinas: #5fa8d3;
  --suit-silfides: #a9c0d8;
  --suit-gnomos: #7da66b;
  --text: #f3efe4;
  --text-muted: #9aa0bc;
  --text-faint: #646a87;
  --danger: #c96a6a;
  --success: #79b88e;

  --font-display: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --font-body: Georgia, "Palatino Linotype", "Book Antiqua", Palatino, serif;
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;

  --radius-s: 8px;
  --radius-m: 14px;
  --radius-l: 22px;
  --shadow-card: 0 14px 32px -10px rgba(0, 0, 0, 0.72);
  --content-max: 640px;

  --dur-fast: 0.18s;
  --dur-med: 0.36s;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

body.no-animations *,
body.reduced-mode * {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
}

body.reduced-mode #starfield,
body.reduced-mode .bg-vignette {
  display: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100vh; min-height: 100dvh; }

body {
  background: var(--bg-deep);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: var(--gold); color: var(--bg-deep); }
button, input, select, textarea { font-family: inherit; }
button { cursor: pointer; transition: transform 0.14s var(--ease), background 0.2s var(--ease), border-color 0.2s var(--ease); }
button:active { transform: scale(0.97); }
a { color: var(--gold-soft); }

:focus-visible {
  outline: 2px solid var(--gold-soft);
  outline-offset: 3px;
  border-radius: 6px;
}

/* Backdrop */
#starfield {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.bg-vignette {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 95% 55% at 50% -10%, rgba(30, 58, 138, 0.28), transparent 65%),
    radial-gradient(ellipse 75% 55% at 50% 110%, rgba(212, 175, 55, 0.11), transparent 65%);
}

/* Shell & Navigation */
.app-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.view-container {
  flex: 1;
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 18px 18px 110px;
}

.view {
  display: none;
  animation: viewIn var(--dur-med) var(--ease);
}
.view.active { display: block; }

@keyframes viewIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.eyebrow {
  font-family: var(--font-ui);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 700;
}

/* Top & Bottom Navigation */
.top-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: rgba(7, 11, 25, 0.84);
  border-bottom: 1px solid var(--line);
  padding: 12px 18px;
}

.top-header-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  padding: 0;
  color: var(--text);
  text-align: left;
}

.brand-mark img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
}

.brand-title {
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 0.14em;
  color: var(--gold-soft);
  line-height: 1.1;
}

.brand-sub {
  font-family: var(--font-ui);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.install-pill {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(212, 175, 55, 0.14);
  color: var(--gold-soft);
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 25;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: rgba(7, 11, 25, 0.92);
  border-top: 1px solid var(--line);
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
}

.bottom-nav-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
}

.nav-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 7px 4px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-s);
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.nav-tab span.icon { font-size: 16px; line-height: 1; }
.nav-tab.active {
  color: var(--gold-soft);
  background: rgba(212, 175, 55, 0.12);
  border-color: var(--line);
}

/* Panels & Cards */
.panel {
  background: linear-gradient(160deg, rgba(16, 24, 51, 0.92), rgba(9, 14, 30, 0.96));
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-card);
}

.hero-card {
  text-align: center;
  padding: 26px 20px;
  background:
    radial-gradient(circle at 50% 0%, rgba(212, 175, 55, 0.16), transparent 60%),
    linear-gradient(160deg, rgba(16, 25, 54, 0.95), rgba(8, 12, 26, 0.98));
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-l);
  margin-bottom: 18px;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 6vw, 38px);
  font-weight: 400;
  letter-spacing: 0.08em;
  margin: 8px 0 6px;
  color: var(--gold-soft);
}

.hero-lead {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.6;
  margin: 0 auto 18px;
  max-width: 52ch;
}

.btn-primary {
  background: linear-gradient(135deg, #e2be52, #b88b22);
  color: #070b19;
  border: none;
  border-radius: var(--radius-m);
  padding: 12px 18px;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.btn-secondary {
  background: rgba(21, 29, 59, 0.9);
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-m);
  padding: 11px 16px;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 13px;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  padding: 8px 12px;
  font-family: var(--font-ui);
  font-size: 12px;
}

.btn-danger {
  background: rgba(201, 106, 106, 0.14);
  color: #f3a6a6;
  border: 1px solid rgba(201, 106, 106, 0.35);
  border-radius: var(--radius-s);
  padding: 8px 12px;
  font-family: var(--font-ui);
  font-size: 12px;
}

/* Spreads & Controls */
.spread-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 10px;
  margin: 12px 0 16px;
}

.spread-option {
  text-align: left;
  background: var(--bg-surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 12px;
  color: var(--text);
}

.spread-option.selected {
  border-color: var(--gold);
  background: rgba(212, 175, 55, 0.15);
  box-shadow: 0 0 0 1px rgba(212, 175, 55, 0.35);
}

.spread-option-title {
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--gold-soft);
  margin-bottom: 4px;
}

.spread-option-meta {
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

.field-group { margin-bottom: 14px; }
.field-label {
  display: block;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  color: var(--gold-soft);
  margin-bottom: 6px;
}

.input-control, .select-control, .textarea-control {
  width: 100%;
  background: var(--bg-deep);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  padding: 10px 12px;
  font-size: 14px;
}

.textarea-control { min-height: 82px; resize: vertical; }

.inline-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* Card Visuals — Uniform Dark Corners & Gold/Night-Blue Frame */
.tarot-card-frame {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: #060914;
  border: 1.5px solid rgba(212, 175, 55, 0.45);
  box-shadow: var(--shadow-card);
  aspect-ratio: 1792 / 2400;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.tarot-card-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  box-shadow:
    inset 0 0 0 3px #070b19,
    inset 0 0 12px rgba(4, 7, 18, 0.75);
}

.tarot-card-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tarot-card-frame.reversed img,
.tarot-card-frame.reversed .card-fallback-art {
  transform: rotate(180deg);
}

.card-fallback-art {
  width: 100%;
  height: 100%;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  text-align: center;
  background:
    radial-gradient(circle at 50% 20%, rgba(212, 175, 55, 0.16), transparent 58%),
    linear-gradient(175deg, #0b132b 0%, #070b19 65%, #050812 100%);
}

.card-num-badge {
  font-family: var(--font-ui);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  border-bottom: 1px solid rgba(212, 175, 55, 0.3);
  padding-bottom: 4px;
  width: 82%;
}

.card-glyph {
  font-size: 28px;
  color: var(--gold-soft);
  text-shadow: 0 0 14px rgba(212, 175, 55, 0.45);
}

.card-name-plate {
  font-family: var(--font-display);
  font-size: 13px;
  line-height: 1.25;
  color: var(--text);
  background: rgba(7, 11, 25, 0.88);
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: 6px;
  padding: 5px 6px;
  width: 92%;
}

.card-element-tag {
  font-family: var(--font-ui);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--violet-soft);
}

/* Interactive Shuffling & Table */
.shuffle-deck-stage {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  padding: 14px 8px;
  background: rgba(6, 10, 22, 0.72);
  border: 1px dashed var(--line);
  border-radius: var(--radius-m);
  margin: 12px 0;
}

.mini-back-card {
  width: 54px;
  height: 92px;
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 50%, rgba(212, 175, 55, 0.24), transparent 70%),
    linear-gradient(160deg, #101d42, #070b19);
  border: 1px solid rgba(212, 175, 55, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold-soft);
  font-size: 16px;
}

.mini-back-card.picked {
  opacity: 0.32;
  transform: scale(0.92);
  border-style: dashed;
}

.table-slots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.slot-box {
  background: rgba(11, 17, 36, 0.85);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.slot-pos-label {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  color: var(--gold-soft);
  margin-bottom: 8px;
  min-height: 28px;
  display: flex;
  align-items: center;
}

.slot-card-wrap {
  width: 100%;
  max-width: 145px;
  cursor: pointer;
}

.slot-meta {
  margin-top: 8px;
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--text-muted);
}

.badge-rev {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10px;
  background: rgba(178, 164, 227, 0.18);
  color: var(--violet-soft);
  border: 1px solid rgba(178, 164, 227, 0.35);
}

/* Interpretation & Esoteric Insights */
.interp-block {
  background: rgba(10, 15, 33, 0.85);
  border-left: 3px solid var(--gold);
  border-radius: 0 var(--radius-s) var(--radius-s) 0;
  padding: 12px 14px;
  margin-bottom: 12px;
}

.interp-title {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold-soft);
  margin: 0 0 6px;
}

.interp-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.62;
  color: var(--text);
}

.chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}

.chip {
  font-family: var(--font-ui);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(212, 175, 55, 0.12);
  border: 1px solid var(--line);
  color: var(--gold-soft);
}

/* Gallery & Filter Tabs */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.filter-btn {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-surface);
  color: var(--text-muted);
}

.filter-btn.active {
  background: rgba(212, 175, 55, 0.18);
  border-color: var(--gold);
  color: var(--gold-soft);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  gap: 12px;
}

.gallery-item {
  background: none;
  border: none;
  padding: 0;
  text-align: center;
  color: var(--text);
}

.gallery-caption {
  margin-top: 6px;
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--text);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(3, 6, 15, 0.84);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop.open { display: flex; }

.modal-dialog {
  width: 100%;
  max-width: 580px;
  max-height: 88vh;
  overflow-y: auto;
  background: linear-gradient(165deg, #111936, #080d1c);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-l);
  padding: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.85);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
  margin-bottom: 14px;
}

.toast {
  position: fixed;
  bottom: 84px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  z-index: 60;
  background: #172247;
  color: var(--gold-soft);
  border: 1px solid var(--gold);
  border-radius: 999px;
  padding: 9px 18px;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
