/* ==================== Three-Card Tarot — 9:16 portrait ==================== */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

html, body {
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  background: #050308;
  color: #f0e8d8;
  font-family: 'Cormorant Garamond', 'Georgia', serif;
  -webkit-font-smoothing: antialiased;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* ---------- 9:16 ASPECT RATIO CONTAINER ---------- */

#app {
  width: 100%;
  height: 100dvh;
  max-width: calc(100dvh * 9 / 16);
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  background: #0a0612;
  overflow: hidden;
  /* Use the RN-injected safe-area vars (env() can read 0 inside the RN WebView). */
  padding-top: var(--sat, env(safe-area-inset-top, 0px));
  padding-bottom: var(--sab, env(safe-area-inset-bottom, 0px));
}

@media (min-aspect-ratio: 9/16) {
  #app {
    border-left: 1px solid rgba(107, 77, 138, 0.2);
    border-right: 1px solid rgba(107, 77, 138, 0.2);
    box-shadow: 0 0 60px rgba(107, 77, 138, 0.08);
  }
}

/* ---------- Screens (scrollable inside the 9:16 container) ---------- */

.screen {
  position: relative;
  width: 100%;
  min-height: 100%;
  padding: 20px 16px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: radial-gradient(ellipse at top, #1a0f2e 0%, #0a0612 50%, #050308 100%);
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.screen::-webkit-scrollbar { width: 4px; }
.screen::-webkit-scrollbar-thumb { background: rgba(107, 77, 138, 0.4); border-radius: 2px; }

/* ---------- Pre-JS splash (shown before main.js runs) ---------- */
#loading-splash {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: #0a0612;
  z-index: 50;
  overflow: hidden;
}
#loading-splash img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
#loading-splash .splash-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(10, 6, 18, 0.25) 0%, rgba(10, 6, 18, 0.55) 70%, rgba(5, 3, 8, 0.85) 100%);
}
#loading-splash .splash-loading {
  position: relative;
  color: rgba(244, 233, 206, 0.7);
  font-size: 12px;
  letter-spacing: 5px;
  font-family: 'Cormorant Garamond', 'Georgia', serif;
  padding-bottom: 60px;
  animation: splash-pulse 1.5s ease-in-out infinite;
}
@keyframes splash-pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* ---------- Starfield ---------- */

.starfield {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(1px 1px at 20% 30%, rgba(255, 220, 180, 0.8), transparent),
    radial-gradient(1px 1px at 60% 70%, rgba(200, 180, 255, 0.6), transparent),
    radial-gradient(1px 1px at 85% 20%, rgba(255, 255, 255, 0.8), transparent),
    radial-gradient(2px 2px at 30% 85%, rgba(255, 220, 180, 0.5), transparent),
    radial-gradient(1px 1px at 50% 50%, rgba(180, 200, 255, 0.7), transparent),
    radial-gradient(1px 1px at 75% 40%, rgba(255, 255, 255, 0.6), transparent),
    radial-gradient(1.5px 1.5px at 15% 60%, rgba(255, 230, 200, 0.7), transparent),
    radial-gradient(1px 1px at 90% 80%, rgba(220, 200, 255, 0.6), transparent);
  background-size: 400px 400px;
  animation: twinkle 8s ease-in-out infinite;
  z-index: 0;
}

@keyframes twinkle {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

/* ---------- Intro ---------- */

.intro-screen {
  justify-content: flex-end;
  padding: 0;
  position: relative;
  overflow: hidden;
}

.intro-hero {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.intro-hero img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

/* Gradient so the bottom area is readable for the subtitle/button */
.intro-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg,
    rgba(10, 6, 18, 0) 0%,
    rgba(10, 6, 18, 0) 45%,
    rgba(10, 6, 18, 0.75) 75%,
    rgba(5, 3, 8, 0.95) 100%);
}

.intro-content {
  text-align: center;
  z-index: 2;
  padding: 32px 22px 44px;
  width: 100%;
  position: relative;
}

.subtitle {
  font-size: 14px;
  font-style: italic;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: #e8d7b5;
  margin-bottom: 20px;
  text-shadow: 0 0 12px rgba(0, 0, 0, 0.7);
}

.intro-body {
  font-size: 17px;
  line-height: 1.5;
  color: #e8d7b5;
  margin-bottom: 22px;
  font-style: italic;
  padding: 0 4px;
  text-shadow: 0 0 12px rgba(0, 0, 0, 0.7);
}

.primary-btn {
  background: linear-gradient(180deg, #3a2653 0%, #1f1430 100%);
  color: #f4e9ce;
  border: 1px solid #6b4d8a;
  padding: 15px 32px;
  font-size: 16px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  font-family: inherit;
  cursor: pointer;
  border-radius: 999px;
  transition: all 0.3s;
  box-shadow: 0 0 20px rgba(107, 77, 138, 0.3);
  min-height: 44px;
}

.primary-btn:hover, .primary-btn:active {
  background: linear-gradient(180deg, #4d3570 0%, #2a1a42 100%);
  box-shadow: 0 0 30px rgba(107, 77, 138, 0.6);
}

.secondary-btn {
  background: transparent;
  color: #c9b590;
  border: 1px solid #6b4d8a;
  padding: 14px 26px;
  font-size: 14px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  font-family: inherit;
  cursor: pointer;
  border-radius: 999px;
  transition: all 0.25s;
  min-height: 44px;
}

.secondary-btn:hover, .secondary-btn:active {
  color: #f4e9ce;
  background: rgba(107, 77, 138, 0.2);
  border-color: #8a6ba8;
}

.reveal-actions { flex-wrap: wrap; }

/* ---------- Cost pill / wallet icon ---------- */

.cost-note {
  font-size: 13px;
  line-height: 1.5;
  color: #a89780;
  margin: -6px 0 18px;
  padding: 0 10px;
  font-style: italic;
  text-shadow: 0 0 12px rgba(0, 0, 0, 0.7);
}

.primary-btn.with-cost {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 22px;
}

.primary-btn.with-cost .btn-label {
  letter-spacing: 3px;
}

.cost-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.5);
  padding: 4px 10px;
  border-radius: 999px;
  color: #22C55E;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1px;
}

.wallet-icon {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

/* ---------- Spend-tokens modal ---------- */

.spend-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 3, 8, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fade-in 0.2s ease-out;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.spend-modal {
  background: linear-gradient(180deg, #1a0f2e 0%, #0a0612 100%);
  border: 1px solid #6b4d8a;
  border-radius: 8px;
  padding: 24px 22px;
  max-width: 280px;
  width: 100%;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.7), 0 0 30px rgba(107, 77, 138, 0.3);
  animation: modal-in 0.25s ease-out;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.spend-modal.simple .spend-cost-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 10px;
}

.spend-modal.simple .spend-cost-num {
  font-size: 36px;
  font-weight: 600;
  color: #22C55E;
  letter-spacing: 0;
  line-height: 1;
}

.spend-continue {
  font-size: 20px;
  font-weight: 300;
  letter-spacing: 2px;
  color: #f4e9ce;
  margin-bottom: 20px;
  font-family: inherit;
}

.spend-error {
  font-size: 14px;
  color: #f0c8c8;
  background: rgba(160, 60, 80, 0.2);
  border: 1px solid #a03c50;
  padding: 9px 13px;
  border-radius: 4px;
  margin-bottom: 14px;
  font-style: italic;
  line-height: 1.4;
}

.spend-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.spend-actions .primary-btn,
.spend-actions .secondary-btn {
  flex: 1;
  min-width: 120px;
  padding: 13px 18px;
  font-size: 14px;
  letter-spacing: 2px;
  min-height: 44px;
}

.spend-actions .primary-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ---------- Tarot Diary ---------- */

.mode-btn-diary {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.diary-count {
  display: inline-block;
  padding: 2px 7px;
  background: rgba(107, 77, 138, 0.5);
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.5px;
  color: #f4e9ce;
  line-height: 1.4;
}

.diary-screen {
  justify-content: flex-start;
  padding: 18px 14px 40px;
}

.diary-header {
  display: flex;
  align-items: center;
  width: 100%;
  margin-bottom: 18px;
  z-index: 1;
}

.diary-header h2 {
  flex: 1;
  text-align: center;
  font-size: 22px;
  font-weight: 300;
  letter-spacing: 4px;
  color: #f4e9ce;
  text-transform: uppercase;
}

.icon-btn {
  background: transparent;
  border: none;
  color: #c9b590;
  font-size: 26px;
  width: 44px;
  height: 44px;
  cursor: pointer;
  border-radius: 50%;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover {
  background: rgba(107, 77, 138, 0.2);
  color: #f4e9ce;
}

.diary-count-header {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #8a7a65;
  font-size: 15px;
  letter-spacing: 1px;
}

.diary-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #a89780;
  padding: 40px 20px;
  z-index: 1;
}

.diary-empty p {
  font-size: 17px;
  line-height: 1.5;
  margin-bottom: 8px;
}

.diary-empty-hint {
  font-size: 13px !important;
  font-style: italic;
  color: #6b5d4a;
}

.diary-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1;
}

.diary-entry {
  display: block;
  width: 100%;
  text-align: left;
  background: rgba(26, 15, 46, 0.6);
  border: 1px solid rgba(107, 77, 138, 0.4);
  border-left: 3px solid #6b4d8a;
  border-radius: 4px;
  padding: 12px 14px;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  transition: all 0.2s;
}

.diary-entry:hover {
  background: rgba(58, 38, 83, 0.5);
  border-left-color: #c9b590;
  transform: translateX(2px);
}

.diary-date {
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #8a7a65;
  margin-bottom: 10px;
}

.diary-cards {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  font-size: 14px;
  color: #e0d0b5;
  line-height: 1.3;
}

.diary-card-item {
  display: inline-flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0;
}

.diary-card-pos {
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #c9b590;
}

.diary-card-name {
  font-size: 14px;
  color: #e0d0b5;
  line-height: 1.25;
}

.diary-card-name em {
  color: #a03c50;
  font-style: italic;
  font-size: 12px;
}

.diary-sep {
  color: #6b4d8a;
  font-size: 14px;
  padding: 0 2px;
  align-self: center;
}

/* ---------- Deck Shop ---------- */

.shop-screen {
  justify-content: flex-start;
  padding: 18px 14px 40px;
}

.shop-balance {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.4);
  border-radius: 999px;
  font-size: 14px;
  color: #22C55E;
  font-weight: 600;
  min-width: 44px;
  min-height: 32px;
  justify-content: center;
}

.shop-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
  z-index: 1;
  padding-bottom: 20px;
}

.deck-tile {
  background: linear-gradient(180deg, rgba(26, 15, 46, 0.7) 0%, rgba(10, 6, 18, 0.7) 100%);
  border: 1px solid var(--deck-border, #6b4d8a);
  border-radius: 8px;
  padding: 16px 16px 18px;
  box-shadow: 0 0 24px rgba(107, 77, 138, 0.15);
  transition: box-shadow 0.3s, transform 0.2s;
}

.deck-tile.active {
  box-shadow: 0 0 32px color-mix(in srgb, var(--deck-border) 40%, transparent), inset 0 0 20px color-mix(in srgb, var(--deck-border) 10%, transparent);
}

.deck-tile-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.deck-name {
  font-size: 22px;
  font-weight: 300;
  letter-spacing: 2px;
  color: var(--deck-border, #f4e9ce);
  text-transform: uppercase;
  flex: 1;
  line-height: 1.2;
}

.deck-badge {
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.5);
  color: #22C55E;
  font-weight: 600;
}

.deck-tagline {
  font-size: 13px;
  font-style: italic;
  letter-spacing: 1.5px;
  color: #a89780;
  margin-bottom: 14px;
}

.deck-previews {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  justify-content: center;
}

.deck-preview-card {
  flex: 1;
  max-width: 80px;
  aspect-ratio: 5 / 8;
  background: linear-gradient(180deg, #f4e9ce 0%, #e8d7b5 100%);
  border: 1.5px solid;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 4px;
  gap: 4px;
  color: #3a2653;
}

.deck-preview-name {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-align: center;
  line-height: 1.1;
  color: #3a2653;
}

.deck-preview-symbol {
  font-size: 22px;
  color: #6b4d8a;
  display: flex;
  align-items: center;
  justify-content: center;
}
.deck-preview-symbol svg { color: #6b4d8a; width: 26px; height: 26px; }

.deck-description {
  font-size: 14px;
  line-height: 1.45;
  color: #d6c8b0;
  margin-bottom: 16px;
}

.deck-action {
  display: flex;
  justify-content: center;
}

.deck-action .primary-btn,
.deck-action .secondary-btn {
  flex: 1;
  max-width: none;
}

.deck-status {
  font-size: 13px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: #22C55E;
  padding: 12px 0;
  text-align: center;
  font-weight: 600;
}

/* Mode toggle: shop button */
.mode-btn-shop {
  /* uses same .mode-btn base styling; no customization needed */
}

.mode-btn-disabled,
.mode-btn-disabled:hover {
  opacity: 0.3;
  cursor: not-allowed;
  color: #5a4a40;
}

.coming-soon-badge {
  display: inline-block;
  margin-left: 4px;
  padding: 2px 7px;
  background: rgba(90, 74, 64, 0.3);
  border: 1px solid rgba(90, 74, 64, 0.5);
  border-radius: 999px;
  font-size: 10px;
  letter-spacing: 0.5px;
  color: #6b5d4a;
  font-weight: normal;
  text-transform: none;
  line-height: 1.4;
}

/* Intro: active deck indicator */
.active-deck-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 13px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #a89780;
  text-shadow: 0 0 12px rgba(0, 0, 0, 0.7);
}

.active-deck-label {
  color: #8a7a65;
}

.active-deck-name {
  background: rgba(10, 6, 18, 0.4);
  border: 1px solid var(--deck-border, #6b4d8a);
  color: var(--deck-border, #f4e9ce);
  border-radius: 999px;
  padding: 6px 12px;
  font-family: inherit;
  font-size: 13px;
  letter-spacing: 1.5px;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 32px;
}

.active-deck-name:not(:disabled):hover {
  background: rgba(10, 6, 18, 0.7);
  box-shadow: 0 0 12px color-mix(in srgb, var(--deck-border) 40%, transparent);
}

.active-deck-name:disabled { cursor: default; }

.cycle-hint {
  font-size: 10px;
  opacity: 0.7;
  margin-left: 2px;
}

/* Deck reveal flash after purchase */
.deck-reveal-flash {
  position: absolute;
  inset: 0;
  z-index: 25;
  background: rgba(5, 3, 8, 0.9);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: reveal-fade 2s ease-out forwards;
  pointer-events: none;
}

.deck-reveal-inner {
  text-align: center;
  padding: 40px;
  border: 2px solid var(--deck-border, #6b4d8a);
  border-radius: 12px;
  box-shadow: 0 0 60px color-mix(in srgb, var(--deck-border) 50%, transparent);
  animation: reveal-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}

.deck-reveal-label {
  font-size: 11px;
  letter-spacing: 6px;
  text-transform: uppercase;
  color: var(--deck-border, #f4e9ce);
  opacity: 0.8;
  margin-bottom: 10px;
}

.deck-reveal-name {
  font-size: 24px;
  font-weight: 300;
  letter-spacing: 3px;
  color: var(--deck-border, #f4e9ce);
  text-transform: uppercase;
}

@keyframes reveal-fade {
  0%   { opacity: 0; }
  15%  { opacity: 1; }
  75%  { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes reveal-pop {
  from { transform: scale(0.7); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

/* ---------- Card art rendering (deck-aware) ---------- */

.card-back.has-art,
.card-face.has-art {
  padding: 0;
}

.card-back-img,
.card-face-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
}

.card-face.has-art .face-fallback,
.card-back.has-art .back-fallback {
  display: none;
  position: absolute;
  inset: 0;
}

/* When <img> errors out, the parent gets .art-missing — show fallback */
.card-back.has-art.art-missing .back-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.card-face.has-art.art-missing .face-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 10px 6px;
}

.card-face.has-art.art-missing .face-fallback.reversed {
  transform: rotate(180deg);
}

/* ---------- Drawing ---------- */

.drawing-screen {
  justify-content: flex-start;
  padding-top: 24px;
}

/* Auto vertical margins on the card row eat any spare space above
   and below, placing the cards at the vertical center of the screen
   between the header (pinned top) and the action row (pinned bottom). */
.drawing-screen .cards-row {
  margin-top: auto;
  margin-bottom: auto;
}

.drawing-screen .action-row {
  margin-bottom: 12px;
}

.drawing-header {
  text-align: center;
  margin: 8px 0 20px;
  z-index: 1;
  padding: 0 12px;
}

.drawing-title {
  font-size: 24px;
  font-weight: 300;
  letter-spacing: 2px;
  color: #f4e9ce;
  margin-bottom: 8px;
  line-height: 1.2;
}

.drawing-sub {
  font-size: 14px;
  font-style: italic;
  color: #a89780;
  letter-spacing: 1px;
  line-height: 1.4;
}

/* Cards horizontal — three across, fit to container width */
.cards-row {
  display: flex;
  flex-direction: row;
  gap: 8px;
  justify-content: center;
  align-items: flex-start;
  margin: 10px 0 22px;
  z-index: 1;
  width: 100%;
  padding: 0 8px;
}

.card-slot {
  flex: 1 1 0;
  min-width: 0;
  max-width: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.card-slot.empty { opacity: 0.4; }

.card-slot.clickable .card {
  cursor: pointer;
  animation: breathe 2.5s ease-in-out infinite;
}

.card-slot:focus {
  outline: none;
}

.card-slot.clickable:focus-visible .card {
  outline: 2px solid #c9b590;
  outline-offset: 4px;
  border-radius: 8px;
}

/* Respect users who've asked the system to reduce motion:
   - disable starfield twinkle, breathe, and dots animations
   - keep the card flip but make it instant
   - disable pulsing tap hint */
@media (prefers-reduced-motion: reduce) {
  .starfield { animation: none; }
  .card-slot.clickable .card { animation: none; }
  .card-inner { transition: none; }
  .tap-hint { animation: none; }
  .dots { animation: none; }
  .primary-btn { transition: none; }
}

@keyframes breathe {
  0%, 100% { transform: scale(1); box-shadow: 0 0 20px rgba(200, 160, 100, 0.2); }
  50% { transform: scale(1.03); box-shadow: 0 0 35px rgba(200, 160, 100, 0.5); }
}

.position-label {
  font-size: 13px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: #c9b590;
  font-weight: 500;
  text-align: center;
}

.position-sub {
  font-size: 13px;
  letter-spacing: 0.5px;
  color: #8a7a65;
  font-style: italic;
  text-align: center;
  line-height: 1.3;
}

.slot-placeholder {
  width: 100%;
  aspect-ratio: 5 / 8;
  border: 1px dashed #4a3a60;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #4a3a60;
  font-size: 24px;
}

/* ---------- Card flip ---------- */

.card {
  width: 100%;
  aspect-ratio: 5 / 8;
  perspective: 800px;
  position: relative;
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.85s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
}

.card.flipped .card-inner { transform: rotateY(180deg); }

.card-back, .card-face {
  position: absolute;
  inset: 0;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-radius: 6px;
  overflow: hidden;
}

.card-back {
  background: linear-gradient(135deg, #3a2653 0%, #1f1430 50%, #2a1a42 100%);
  border: 2px solid #6b4d8a;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6);
}

.back-pattern {
  width: 86%;
  height: 90%;
  border: 1px solid #8a6ba8;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, rgba(139, 107, 168, 0.2) 0%, transparent 70%);
}

.back-ornament {
  width: 36px;
  height: 36px;
  border: 1px solid #c9b590;
  transform: rotate(45deg);
  position: relative;
}

.back-ornament::before, .back-ornament::after {
  content: '';
  position: absolute;
  inset: 5px;
  border: 1px solid #8a6ba8;
}
.back-ornament::after {
  inset: 11px;
  border-color: #c9b590;
  border-radius: 50%;
}

.card-face {
  background: linear-gradient(180deg, #f4e9ce 0%, #e8d7b5 100%);
  color: #3a2653;
  transform: rotateY(180deg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 10px 6px;
  border: 2px solid #c9b590;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6), inset 0 0 14px rgba(107, 77, 138, 0.12);
}

.card-face.reversed { transform: rotateY(180deg) rotate(180deg); }

.card-name {
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  letter-spacing: 0.3px;
  color: #3a2653;
  line-height: 1.15;
  padding: 0 2px;
}

.card-arcana {
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #8a6ba8;
  font-style: italic;
}

.card-symbol {
  font-size: 44px;
  color: #6b4d8a;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 2px 0;
}
.card-symbol svg { color: #6b4d8a; width: 56px; height: 56px; }

.card-keywords {
  font-size: 11px;
  text-align: center;
  color: #5a4373;
  font-style: italic;
  line-height: 1.3;
  padding: 0 3px;
  max-height: 44px;
  overflow: hidden;
}

.card-orientation {
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #8a6ba8;
  font-weight: 600;
}

.tap-hint {
  font-size: 12px;
  color: #c9b590;
  font-style: italic;
  letter-spacing: 1px;
  animation: pulse 1.8s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* ---------- Action row ---------- */

.action-row {
  margin: 14px 0 6px;
  display: flex;
  gap: 12px;
  justify-content: center;
  z-index: 1;
}

.synthesizing {
  font-size: 15px;
  font-style: italic;
  color: #c9b590;
  letter-spacing: 1.5px;
  padding: 12px 20px;
  text-align: center;
}

.dots { display: inline-block; animation: dots 1.4s infinite; }

@keyframes dots {
  0%, 20% { opacity: 0.2; }
  50% { opacity: 1; }
  100% { opacity: 0.2; }
}

/* ---------- Reveal ---------- */

.reveal-screen {
  justify-content: flex-start;
  padding: 20px 14px 40px;
}

.reveal-header {
  text-align: center;
  margin: 6px 0 16px;
  z-index: 1;
}

.reveal-header h2 {
  font-size: 26px;
  font-weight: 300;
  letter-spacing: 3px;
  color: #f4e9ce;
  margin-bottom: 10px;
}

.reveal-summary {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.badge {
  background: rgba(107, 77, 138, 0.3);
  border: 1px solid #6b4d8a;
  color: #e0d0b5;
  padding: 4px 10px;
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  border-radius: 2px;
  white-space: nowrap;
}

.badge.reversed { background: rgba(160, 60, 80, 0.25); border-color: #a03c50; color: #f0c8c8; }
.badge.pair { background: rgba(180, 140, 60, 0.25); border-color: #b48c3c; color: #f0e0b0; }

.cards-row.small { gap: 6px; margin-bottom: 18px; }

.mini-card {
  background: linear-gradient(180deg, #f4e9ce 0%, #e8d7b5 100%);
  color: #3a2653;
  border: 1px solid #c9b590;
  border-radius: 5px;
  padding: 8px 6px;
  flex: 1;
  max-width: 110px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.mini-card.reversed { border-color: #a03c50; }

.mc-position {
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #8a6ba8;
  margin-bottom: 4px;
}

.mc-name {
  font-size: 13px;
  font-weight: 600;
  color: #3a2653;
  line-height: 1.15;
  margin-bottom: 4px;
}

.mc-orientation {
  font-size: 9px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: #8a6ba8;
}

/* ---------- Per-card readings ---------- */

.per-card-readings {
  width: 100%;
  margin: 0 0 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 1;
  padding: 0 4px;
}

.per-card {
  background: rgba(26, 15, 46, 0.5);
  border-left: 2px solid #6b4d8a;
  padding: 10px 14px;
  border-radius: 2px;
}

.pc-position {
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #c9b590;
  margin-bottom: 6px;
  font-weight: 500;
}

.pc-text {
  font-size: 16px;
  line-height: 1.55;
  color: #e0d0b5;
  font-style: italic;
}

/* ---------- Synthesis ---------- */

.synthesis {
  width: 100%;
  margin: 0 0 22px;
  background: linear-gradient(180deg, rgba(58, 38, 83, 0.4) 0%, rgba(26, 15, 46, 0.6) 100%);
  border: 1px solid #6b4d8a;
  border-radius: 4px;
  padding: 18px 16px 22px;
  z-index: 1;
  box-shadow: 0 0 30px rgba(107, 77, 138, 0.2);
}

.synthesis h3 {
  font-size: 18px;
  font-weight: 300;
  letter-spacing: 2.5px;
  color: #f4e9ce;
  margin-bottom: 16px;
  text-align: center;
  text-transform: uppercase;
  line-height: 1.3;
}

.synthesis p {
  font-size: 16px;
  line-height: 1.6;
  color: #e0d0b5;
  margin-bottom: 14px;
}

.synthesis p:last-child {
  margin-bottom: 0;
  font-style: italic;
  color: #f4e9ce;
}

/* ---------- Mode toggle ---------- */

.mode-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 16px 0 18px;
  padding: 0;
  background: transparent;
  border: none;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 100%;
}

.mode-label {
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #a89780;
  margin-right: 2px;
}

/* All four pills share the same purple filled button style. The active
   reading-style button (Simple / Poetic) just gets a brighter gold border
   as its "selected" indicator. All are clickable. */
.mode-btn {
  background: linear-gradient(180deg, #3a2653 0%, #1f1430 100%);
  color: #f4e9ce;
  border: 1px solid rgba(107, 77, 138, 0.6);
  padding: 10px 16px;
  font-size: 12px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-family: inherit;
  cursor: pointer;
  border-radius: 999px;
  transition: all 0.25s;
  min-height: 40px;
  box-shadow: 0 0 12px rgba(107, 77, 138, 0.2);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.mode-btn:hover, .mode-btn:active {
  background: linear-gradient(180deg, #4d3570 0%, #2a1a42 100%);
  box-shadow: 0 0 18px rgba(107, 77, 138, 0.4);
}

.mode-btn.active {
  border-color: #c9b590;
  box-shadow: inset 0 0 8px rgba(201, 181, 144, 0.25), 0 0 14px rgba(201, 181, 144, 0.2);
}

.reveal-header .mode-toggle { margin: 10px 0 4px; }

/* ---------- Very small screens (older/small phones) ---------- */

@media (max-height: 640px) {
  .title { font-size: 32px; margin-bottom: 6px; }
  .subtitle { margin-bottom: 16px; }
  .intro-body { font-size: 16px; margin-bottom: 18px; }
  .drawing-title { font-size: 20px; }
}
