/* =========================================================================
   Galaxy Tarot Web — Authentic App-Inspired Design System
   Starfield Dark Theme & Light Sky Theme · Gilded Card Edges · 3D Card Flips
   Supports all 16 app locales including RTL (Arabic & Shahmukhi Punjabi)
   ========================================================================= */

:root {
  --bg: #080d17;
  --bg-2: #0d1424;
  --surface: rgba(12, 19, 34, 0.80);
  --surface-strong: rgba(11, 17, 30, 0.94);
  --surface-elev: rgba(20, 31, 52, 0.84);
  --steel: #4e89b4;
  --steel-deep: #346c96;
  --sky: #8fb8d9;
  --gold: #e6c269;
  --sun: #f5c533;
  --text: #eef2f8;
  --muted: #9aa9be;
  --line: rgba(143, 184, 217, 0.20);
  --line-strong: rgba(143, 184, 217, 0.38);
  --gold-line: rgba(230, 194, 105, 0.34);
  --card-edge: rgba(242, 240, 235, 0.72);
  --card-edge-bottom: #e6e3da;
  --card-edge-glow: rgba(255, 255, 255, 0.32);
  --card-radius: 3.4% / 1.97%;
  --card-shadow: 0 20px 44px rgba(0, 0, 0, 0.58);
  --bg-img: url("../images/background.jpg");
  --bg-scrim: radial-gradient(circle at 50% 25%, rgba(44, 86, 128, 0.24), rgba(6, 10, 18, 0.62) 70%);

  --display: "Lexend", "Inter", system-ui, sans-serif;
  --body: "Inter", system-ui, -apple-system, sans-serif;
  --topbar-h: 64px;
  --radius: 18px;
}

html[data-theme="light"] {
  --bg: #dce8f2;
  --bg-2: #edf3f8;
  --surface: rgba(246, 249, 252, 0.86);
  --surface-strong: rgba(250, 252, 255, 0.96);
  --surface-elev: rgba(255, 255, 255, 0.90);
  --steel: #2f6889;
  --steel-deep: #214e68;
  --sky: #2f6889;
  --gold: #b6881f;
  --sun: #d49b1a;
  --text: #162030;
  --muted: #4b5c72;
  --line: rgba(47, 104, 137, 0.20);
  --line-strong: rgba(47, 104, 137, 0.38);
  --gold-line: rgba(182, 136, 31, 0.36);
  --card-edge: rgba(255, 255, 255, 0.92);
  --card-edge-bottom: #d8d5cc;
  --card-edge-glow: rgba(47, 104, 137, 0.28);
  --card-shadow: 0 16px 34px rgba(17, 36, 56, 0.22);
  --bg-img: url("../images/background_light.webp");
  --bg-scrim: radial-gradient(circle at 50% 20%, rgba(255, 255, 255, 0.28), rgba(210, 228, 242, 0.45) 75%);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; min-width: 0; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.6 var(--body);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}
body.modal-open { overflow: hidden; }
button, a, summary, [role="button"] { -webkit-tap-highlight-color: transparent; }
img { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--sky); }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--sun);
  outline-offset: 2px;
}

.cosmic-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--bg-scrim), var(--bg-img) center / cover no-repeat;
  transition: background 0.35s ease;
}

/* ---------- Typography ---------- */
h1, h2, h3 { font-family: var(--display); font-weight: 500; letter-spacing: -0.02em; margin: 0; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font: 600 0.74rem/1 var(--body); letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--sky);
}
.eyebrow svg, .star-accent { width: 13px; height: 13px; color: var(--sun); flex: none; }
html[data-script="cjk"] .eyebrow,
html[data-script="indic"] .eyebrow,
html[data-script="arabic"] .eyebrow { letter-spacing: 0; text-transform: none; font-size: 0.88rem; }
html[data-script="arabic"] body,
html[data-script="indic"] body { line-height: 1.75; }

/* ---------- Top Navigation Bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--topbar-h);
  background: var(--surface);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1280px; margin: 0 auto; height: 100%;
  padding: 0 20px;
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center; gap: 16px;
}
.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; justify-self: start; }
.brand-link { display: inline-flex; align-items: center; line-height: 0; }
.brand-link img { height: 30px; width: auto; }
.primary-nav { display: flex; align-items: center; justify-content: center; gap: 6px; justify-self: center; }
.nav-pill {
  background: transparent; border: 1px solid transparent;
  padding: 8px 15px; border-radius: 999px;
  font: 500 0.9rem/1 var(--body); color: var(--muted);
  cursor: pointer; transition: color .2s, background .2s, border-color .2s;
  white-space: nowrap;
}
.nav-pill:hover { color: var(--text); background: rgba(143, 184, 217, 0.10); }
.nav-pill.active {
  color: #fff; background: var(--steel);
  border-color: rgba(255, 255, 255, 0.28);
}
.topbar-right { display: flex; align-items: center; gap: 8px; justify-self: end; }

.icon-btn {
  width: 38px; height: 38px; border-radius: 50%;
  display: inline-grid; place-items: center;
  background: rgba(143, 184, 217, 0.08);
  border: 1px solid var(--line);
  color: var(--text); cursor: pointer;
  font-size: 1.25rem; line-height: 1;
  transition: border-color .2s, background .2s, transform .2s;
}
.icon-btn:hover { border-color: var(--sky); background: rgba(143, 184, 217, 0.18); }
.icon-btn svg { width: 18px; height: 18px; }
[dir="rtl"] .back-btn svg { transform: scaleX(-1); }

/* Language dropdown */
.lang-picker { position: relative; }
.lang-picker summary {
  list-style: none; display: inline-flex; align-items: center; gap: 6px;
  height: 38px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(143, 184, 217, 0.08);
  color: var(--text); cursor: pointer;
  font: 600 0.78rem/1 var(--body); letter-spacing: 0.05em;
}
.lang-picker summary::-webkit-details-marker { display: none; }
.lang-picker summary svg { width: 15px; height: 15px; color: var(--sky); }
.lang-picker summary:hover, .lang-picker[open] summary { border-color: var(--sky); }
.lang-picker ul {
  position: absolute; inset-inline-end: 0; top: calc(100% + 8px); z-index: 60;
  margin: 0; padding: 8px; list-style: none;
  width: min(312px, calc(100vw - 24px));
  max-height: min(68dvh, 430px);
  overflow-y: auto;
  overscroll-behavior: contain;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px;
  background: var(--surface-strong); border: 1px solid var(--line-strong);
  border-radius: 16px; box-shadow: 0 24px 56px rgba(0, 0, 0, 0.55);
}
.lang-picker li a {
  display: block; padding: 8px 11px; border-radius: 10px;
  text-decoration: none; color: var(--muted); font-size: 0.88rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lang-picker li a:hover { background: rgba(143, 184, 217, 0.12); color: var(--text); }
.lang-picker li a[aria-current="true"] { background: rgba(78, 137, 180, 0.28); color: var(--text); font-weight: 600; }

.tarot-footer {
  border-top: 1px solid var(--line);
  padding: 14px 20px max(14px, env(safe-area-inset-bottom));
  background: var(--surface);
  backdrop-filter: blur(12px);
}
.tarot-footer-inner {
  max-width: 1240px; margin: 0 auto;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 12px;
  font-size: 0.84rem; color: var(--muted);
}
.tarot-footer-inner a { color: var(--sky); text-decoration: none; }
.tarot-footer-inner a:hover { text-decoration: underline; }
.footer-sep { opacity: 0.45; }

/* ---------- Buttons ---------- */
.gt-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 26px; border-radius: 999px;
  background: linear-gradient(180deg, rgba(84, 144, 189, 0.94), rgba(55, 108, 149, 0.96));
  color: #fff; border: 1.5px solid rgba(255, 255, 255, 0.78);
  font: 500 0.98rem/1 var(--display); letter-spacing: 0.01em;
  text-decoration: none; cursor: pointer;
  box-shadow: 0 10px 26px rgba(10, 26, 46, 0.38);
  transition: transform .2s ease, box-shadow .2s ease, filter .2s ease, border-color .2s;
}
.gt-btn:hover { transform: translateY(-2px); filter: brightness(1.07); border-color: #fff; }
.gt-btn:active { transform: translateY(0); }
.gt-btn.secondary {
  background: var(--surface-elev);
  color: var(--text);
  border: 1px solid var(--line-strong);
  box-shadow: none;
}
.gt-btn.secondary:hover { border-color: var(--sky); background: rgba(143, 184, 217, 0.16); }
.gt-btn.gold {
  background: linear-gradient(135deg, #c99d3b, #8b6516);
  border-color: rgba(255, 238, 186, 0.85);
}
.gt-btn.sm { min-height: 38px; padding: 0 16px; font-size: 0.86rem; }
.gt-btn svg { width: 17px; height: 17px; flex: none; }

/* ---------- Main App Stage ---------- */
.app-stage {
  position: relative;
  z-index: 1;
  flex: 1;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px 20px 52px;
  display: flex;
  flex-direction: column;
}
.view-enter { animation: viewFade 0.28s ease; }
@keyframes viewFade {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* ---------- HOME SCREEN (Iconic Galaxy Tarot Centered Starfield) ---------- */
.home-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  padding: 24px 0 16px;
  min-height: calc(100dvh - var(--topbar-h) - 96px);
}
.home-orbit {
  position: absolute;
  width: 560px;
  aspect-ratio: 1;
  color: var(--sky);
  opacity: 0.13;
  pointer-events: none;
  animation: orbitSpin 180s linear infinite;
}
@keyframes orbitSpin { to { transform: rotate(360deg); } }

.home-flank {
  position: absolute;
  width: 176px;
  border-radius: var(--card-radius);
  border: 1.5px solid var(--card-edge);
  box-shadow: var(--card-shadow);
  pointer-events: none;
  opacity: 0.88;
  transition: transform 0.6s ease;
}
.home-flank.left  { left: 5%; top: 22%; transform: rotate(-11deg); }
.home-flank.right { right: 5%; top: 24%; transform: rotate(10deg); }

.home-center {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 440px;
  width: 100%;
}
.home-logo {
  width: 310px;
  height: auto;
  margin-bottom: 10px;
  filter: drop-shadow(0 12px 32px rgba(78, 137, 180, 0.32));
}
.home-tagline {
  margin-bottom: 32px;
}
.home-menu {
  width: 100%;
  max-width: 286px;
  display: flex;
  flex-direction: column;
  gap: 13px;
}
.home-menu .gt-btn {
  width: 100%;
  min-height: 54px;
  font-size: 1.04rem;
}
.home-menu .gt-btn.home-primary {
  background: linear-gradient(135deg, #5696c4 0%, #366f9a 100%);
  border-color: rgba(255, 255, 255, 0.92);
  box-shadow: 0 12px 32px rgba(78, 137, 180, 0.36);
}
.home-footer-bar {
  margin-top: 42px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px 22px;
  font-size: 0.85rem;
  color: var(--muted);
}
.home-footer-bar a {
  display: inline-flex; align-items: center; gap: 6px;
  text-decoration: none; color: var(--sky); font-weight: 500;
}
.home-footer-bar a svg { width: 14px; height: 14px; }

/* ---------- Section Header Bar ---------- */
.view-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.view-head h1 { font-size: clamp(1.65rem, 3vw, 2.35rem); margin-top: 6px; }
.view-head p { color: var(--muted); margin: 6px 0 0; max-width: 56ch; }

/* ---------- Pull a Card Stage ---------- */
.pull-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 12px 0;
}
.ritual-controls-slot {
  display: flex;
  justify-content: center;
}
.pull-reverse-pill {
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.pull-stage {
  display: grid;
  grid-template-columns: auto minmax(0, 460px);
  align-items: center;
  justify-content: center;
  gap: 36px;
  width: 100%;
  max-width: 860px;
}
.pull-stage.unflipped {
  grid-template-columns: 1fr;
  justify-items: center;
}
.pull-prompt {
  color: var(--muted);
  font-size: 0.96rem;
  text-align: center;
}

/* 3D Flip Card Component */
.tarot-card-3d {
  perspective: 1200px;
  cursor: pointer;
  user-select: none;
  position: relative;
  touch-action: manipulation;
}
.tarot-card-3d.hero-size {
  width: min(274px, 68vw);
  aspect-ratio: 710 / 1226;
}
.tarot-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.58s cubic-bezier(0.22, 1, 0.36, 1);
  border-radius: var(--card-radius);
}
.tarot-card-3d.flipped .tarot-card-inner { transform: rotateY(180deg); }
.tarot-card-3d.flipped.settled { perspective: none; }
.tarot-card-3d.flipped.settled .tarot-card-inner {
  transform: none;
  transform-style: flat;
  transition: none;
}
.tarot-card-3d.flipped.settled .tarot-face.back { display: none; }
.tarot-card-3d.flipped.settled .tarot-face.front {
  transform: none;
  backface-visibility: visible;
  -webkit-backface-visibility: visible;
}
@media (hover: hover) {
  .tarot-card-3d:not(.flipped):hover .tarot-card-inner {
    transform: translateY(-6px) rotateX(4deg) rotateY(-4deg);
  }
}
.tarot-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: var(--card-radius);
  overflow: hidden;
  box-shadow: var(--card-shadow);
  border: 1.5px solid var(--card-edge);
  background: #0d1626;
}
.tarot-face img { width: 100%; height: 100%; object-fit: cover; }
.tarot-face.front { transform: rotateY(180deg); }
.tarot-face.front.reversed img { transform: rotate(180deg); }
.tarot-face.back::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.12) 0%, transparent 48%, rgba(255, 255, 255, 0.06) 100%);
  pointer-events: none;
}

.pull-result-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 26px;
  backdrop-filter: blur(14px);
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: viewFade 0.4s ease;
}
.pull-result-panel h2 { font-size: 1.65rem; }
.pill-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: 999px;
  font: 600 0.75rem/1.2 var(--body); letter-spacing: 0.06em; text-transform: uppercase;
  background: rgba(78, 137, 180, 0.22); color: var(--sky);
  border: 1px solid var(--line-strong);
  width: fit-content;
}
.pill-badge.reversed {
  background: rgba(214, 132, 82, 0.22); color: #f2b788; border-color: rgba(242, 183, 136, 0.38);
}
.pill-badge.gold {
  background: rgba(230, 194, 105, 0.16); color: var(--gold); border-color: var(--gold-line);
}
.keywords-line { color: var(--sky); font-weight: 500; font-size: 0.96rem; }
.pull-result-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }

/* ---------- Begin Reading & Split Deck Configurator ---------- */
.begin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 28px;
  align-items: start;
}
.glass-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 24px;
  backdrop-filter: blur(14px);
}
.spread-preview-box {
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: 360px;
  display: grid;
  place-items: center;
  padding: 16px;
  border-radius: 16px;
  background: rgba(6, 10, 18, 0.50);
  border: 1px solid var(--line);
  margin-bottom: 18px;
}
html[data-theme="light"] .spread-preview-box { background: rgba(47, 104, 137, 0.07); }
.spread-preview-box svg { width: 100%; height: 100%; max-height: 320px; }

.pos-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 290px;
  overflow-y: auto;
  padding-inline-end: 4px;
}
.pos-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 12px;
  background: rgba(143, 184, 217, 0.06);
  border: 1px solid var(--line);
  transition: border-color .2s;
}
.pos-row.highlight { border-color: var(--gold); background: rgba(230, 194, 105, 0.10); }
.pos-num {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: var(--steel); color: #fff;
  font: 600 0.78rem/1 var(--body);
}
.pos-info { flex: 1; min-width: 0; }
.pos-info strong { display: block; font-size: 0.9rem; }
.pos-info span { display: block; font-size: 0.8rem; color: var(--muted); }

/* Form fields & Switches */
.form-stack { display: flex; flex-direction: column; gap: 18px; }
.field-label {
  display: block; font-size: 0.82rem; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--sky);
  margin-bottom: 8px;
}
.text-input {
  width: 100%; min-height: 76px; padding: 12px 14px;
  border-radius: 14px; resize: vertical;
  background: rgba(6, 10, 18, 0.48);
  border: 1px solid var(--line);
  font-size: 0.95rem;
}
html[data-theme="light"] .text-input { background: rgba(255, 255, 255, 0.85); }
.text-input:focus { border-color: var(--sky); outline: none; }

.switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 12px 14px; border-radius: 14px;
  background: rgba(143, 184, 217, 0.06); border: 1px solid var(--line);
  cursor: pointer;
}
.switch-row input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  width: 44px; height: 24px; border-radius: 999px;
  background: rgba(143, 184, 217, 0.26); position: relative; cursor: pointer;
  transition: background .2s; flex: none;
}
.switch-row input[type="checkbox"]::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  transition: transform .2s;
}
.switch-row input[type="checkbox"]:checked { background: var(--steel); }
.switch-row input[type="checkbox"]:checked::after { transform: translateX(20px); }

.begin-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.begin-actions .gt-btn { flex: 1 1 190px; }

/* ---------- SHUFFLE, CUT & SELECT RITUAL STAGES (App-Authentic) ---------- */
.ritual-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  min-height: calc(100dvh - var(--topbar-h) - 106px);
  gap: 14px;
  padding: 6px 0 4px;
  --edge-rim: var(--card-edge);
  --edge-bottom: var(--card-edge-bottom);
  --edge-glow: var(--card-edge-glow);
}

.ritual-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 5;
}
.ritual-pill {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 8px 18px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line-strong);
  backdrop-filter: blur(14px);
  font-size: 0.9rem; font-weight: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.24);
}
.ritual-pill-meta { color: var(--muted); font-weight: 400; }
.ritual-hint {
  color: var(--muted);
  font-size: 0.88rem;
  min-height: 1.4em;
  transition: opacity 0.2s ease;
}

.ritual-shuffle-stage {
  min-height: calc(100dvh - var(--topbar-h) - 84px);
  gap: 32px;
  padding: 18px 0 18px;
}
.shuffle-top-hint {
  margin-bottom: 6px;
}
.shuffle-top-hint .ritual-hint {
  font-size: 0.92rem;
}

/* ---------- SHUFFLE 36-CARD PHYSICAL STACK ---------- */
.deck-arena {
  flex: 1;
  width: 100%;
  display: grid;
  place-items: center;
  position: relative;
  min-height: 490px;
  padding: 34px 0;
  overflow: visible;
}
.deck-aura {
  position: absolute;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(78, 137, 180, 0.20) 0%, rgba(230, 194, 105, 0.08) 38%, transparent 70%);
  pointer-events: none;
  filter: blur(18px);
  transition: transform 0.45s ease, opacity 0.45s ease;
}
html[data-theme="light"] .deck-aura {
  background: radial-gradient(circle, rgba(47, 104, 137, 0.16) 0%, rgba(255, 255, 255, 0.34) 46%, transparent 72%);
}

.shuffle-deck-layer,
.cut-arena-layer {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
}

.shuffle-deck {
  position: relative;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  will-change: transform;
  transform-origin: center center;
}
.shuffle-deck:hover .shuffle-card:last-child {
  box-shadow:
    0 26px 52px rgba(0, 0, 0, 0.62),
    0 0 28px var(--edge-glow);
}
.shuffle-deck.is-shuffling {
  cursor: grabbing;
}

.shuffle-card {
  position: absolute;
  inset: 0;
  border-radius: var(--card-radius);
  overflow: hidden;
  border: 1.5px solid var(--edge-rim);
  border-bottom: 2.5px solid var(--edge-bottom);
  background: #0d1626;
  will-change: transform;
  pointer-events: none;
  backface-visibility: hidden;
}
.shuffle-card:first-child {
  box-shadow: 0 28px 56px rgba(0, 0, 0, 0.68), 0 10px 22px rgba(0, 0, 0, 0.45);
}
.shuffle-card:last-child {
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.38);
  transition: box-shadow 0.28s ease;
}
.shuffle-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

/* ---------- CUT 3-PILE PHYSICAL RESTACK ARENA ---------- */
.cut-arena {
  position: relative;
  user-select: none;
  -webkit-user-select: none;
}
.cut-slot-target {
  position: absolute;
  border-radius: var(--card-radius);
  border: 1.5px dashed transparent;
  background: transparent;
  cursor: default;
  touch-action: manipulation;
  transition: border-color 0.24s ease, background 0.24s ease;
  z-index: 1;
}
.cut-arena.has-lifted-pile .cut-slot-target {
  border-color: rgba(143, 184, 217, 0.30);
  background: rgba(143, 184, 217, 0.04);
  cursor: pointer;
}
.cut-arena.has-lifted-pile .cut-slot-target:hover {
  border-color: var(--gold);
  background: rgba(230, 194, 105, 0.10);
}

.cut-pile-stack {
  position: absolute;
  cursor: pointer;
  touch-action: manipulation;
  will-change: transform;
  transform-origin: center center;
}
.cut-stack-card {
  position: absolute;
  inset: 0;
  border-radius: var(--card-radius);
  overflow: hidden;
  border: 1.5px solid var(--edge-rim);
  border-bottom: 2.2px solid var(--edge-bottom);
  background: #0d1626;
  pointer-events: none;
  transition: border-color 0.2s ease, box-shadow 0.22s ease;
}
.cut-stack-card:first-child {
  box-shadow: 0 22px 42px rgba(0, 0, 0, 0.58), 0 6px 14px rgba(0, 0, 0, 0.36);
}
.cut-stack-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}
.cut-pile-stack:hover:not(.is-selected):not(.is-gliding) .cut-stack-card:last-child {
  border-color: rgba(255, 255, 255, 0.94);
  box-shadow: 0 0 20px var(--edge-glow);
}
.cut-pile-stack.is-selected .cut-stack-card:first-child {
  box-shadow: 0 38px 66px rgba(0, 0, 0, 0.72), 0 0 30px rgba(143, 184, 217, 0.36);
}
.cut-pile-stack.is-selected .cut-stack-card:last-child {
  border-color: #ffffff;
  box-shadow: 0 0 22px rgba(255, 255, 255, 0.38);
}
.cut-pile-stack.is-gliding .cut-stack-card:first-child {
  box-shadow: 0 34px 58px rgba(0, 0, 0, 0.64);
}
.cut-pile-stack.is-stacked-complete .cut-stack-card:last-child {
  border-color: #ffffff;
  box-shadow: 0 0 24px rgba(143, 184, 217, 0.38);
}
.cut-pile-stack.pile-thump {
  animation: pileThump 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes pileThump {
  0%   { transform: scale(1); }
  45%  { transform: scale(0.97); }
  100% { transform: scale(1); }
}

/* App-authentic translucent bottom action bar (CUT | DRAW / DRAW REMAINING) */
.ritual-bar {
  width: min(460px, 100%);
  display: grid;
  grid-template-columns: 1fr 1px 1fr;
  align-items: center;
  background: var(--surface-strong);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  overflow: hidden;
  backdrop-filter: blur(16px);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.44);
  z-index: 6;
}
.ritual-bar.single {
  grid-template-columns: 1fr;
  width: min(300px, 100%);
}
.ritual-bar-btn {
  border: 0;
  background: transparent;
  padding: 15px 18px;
  font: 500 0.92rem/1 var(--display);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text);
  cursor: pointer;
  touch-action: manipulation;
  transition: background .2s, color .2s;
}
.ritual-bar-btn:hover { background: rgba(143, 184, 217, 0.16); color: #fff; }
html[data-theme="light"] .ritual-bar-btn:hover { color: var(--steel-deep); }
.ritual-bar-sep { width: 1px; height: 24px; background: var(--line-strong); }

/* ---------- SELECT CARDS (Desktop 2-Row Landscape Spread + 2-Stage Flight) ---------- */
.ritual-select-stage {
  gap: 10px;
}
.select-top-header {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.select-pos-desc {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
  max-width: min(620px, 92vw);
  text-align: center;
  padding: 0 8px;
}
.select-pos-desc.is-refresh {
  animation: posDescFade 0.28s ease;
}
@keyframes posDescFade {
  from { opacity: 0.25; transform: translateY(3px); }
  to   { opacity: 1; transform: none; }
}
.select-subdeck-wrap:empty { display: none; }

.select-arena {
  position: relative;
  flex: 1;
  width: 100%;
  min-height: 462px;
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  overflow: visible;
}
.select-stage-frame {
  position: relative;
}
.select-cards-canvas {
  position: relative;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  transition: opacity 0.22s ease, transform 0.24s cubic-bezier(0.4, 0, 0.2, 1);
}
.select-cards-canvas.is-sweeping-out {
  opacity: 0;
  transform: translate3d(-44px, 18px, 0) scale(0.96);
  pointer-events: none;
}

.select-card {
  position: absolute;
  padding: 0;
  border-radius: var(--card-radius);
  overflow: hidden;
  border: 1.5px solid var(--edge-rim);
  border-bottom: 2px solid var(--edge-bottom);
  background: #0d1626;
  box-shadow: -3px 8px 18px rgba(0, 0, 0, 0.48);
  cursor: pointer;
  will-change: transform, opacity;
  transition:
    transform 0.18s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.16s ease,
    box-shadow 0.18s ease,
    opacity 0.22s ease;
}
html[data-theme="light"] .select-card {
  box-shadow: -2px 6px 14px rgba(17, 36, 56, 0.24);
}
.select-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

/* Portrait sideways cards (exact match to Android SelectCardsLayout portrait 2-column fan) */
.select-card.is-sideways {
  border-radius: 1.97% / 3.4%;
  border-bottom: 1.5px solid var(--edge-rim);
  border-right: 2px solid var(--edge-bottom);
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.46);
}
html[data-theme="light"] .select-card.is-sideways {
  box-shadow: 0 4px 12px rgba(17, 36, 56, 0.22);
}
.select-card.is-sideways img {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--card-short, 100%);
  height: var(--card-long, 100%);
  max-width: none;
  max-height: none;
  transform: translate(-50%, -50%) rotate(90deg);
  object-fit: cover;
}

/* Crisp opaque diagonal upper-left deal-in wave matching SelectCardsActivity.moveIn() */
@keyframes selectCardDealIn {
  0% {
    transform: translate3d(var(--deal-x, -560px), var(--deal-y, -480px), 0);
    opacity: 0;
  }
  4% {
    opacity: 1;
  }
  100% {
    transform: translate3d(0, 0, 0);
    opacity: 1;
  }
}
.select-card.is-dealing-wave {
  animation-name: selectCardDealIn;
  animation-timing-function: cubic-bezier(0.16, 0.84, 0.28, 1);
  animation-fill-mode: backwards;
  pointer-events: none;
}

/* Tactile hover / glide lift (SelectCardsActivity.selectCardAnimationNew) */
.select-card.is-hovered {
  transform: translate3d(0, -16px, 0) scale(1.03);
  border-color: #ffffff;
  box-shadow:
    0 20px 36px rgba(0, 0, 0, 0.64),
    0 0 22px rgba(143, 184, 217, 0.42);
}
.select-card.is-sideways.is-hovered {
  transform: translate3d(-8px, -8px, 0) scale(1.025);
  border-color: #ffffff;
  box-shadow:
    6px 14px 28px rgba(0, 0, 0, 0.62),
    0 0 20px rgba(143, 184, 217, 0.42);
}
.select-card.is-selecting {
  transition: none !important;
  border-color: #ffffff;
  box-shadow:
    0 28px 50px rgba(0, 0, 0, 0.72),
    0 0 28px rgba(255, 255, 255, 0.38);
  pointer-events: none;
}
/* Real physical empty gap left where the card was pulled */
.select-card.is-taken {
  visibility: hidden;
  pointer-events: none;
}

.select-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: min(1128px, calc(100% - 48px));
  z-index: 6;
}
.select-footer .ritual-bar.single {
  align-self: flex-end;
  width: min(250px, 100%);
}
.drawn-tray {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.drawn-slot {
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  transition: all 0.2s ease;
}
.drawn-slot.filled {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(230, 194, 105, 0.14);
}
.drawn-slot.current {
  border-color: var(--sky);
  color: var(--text);
  background: rgba(78, 137, 180, 0.30);
  box-shadow: 0 0 12px rgba(143, 184, 217, 0.22);
}

/* ---------- READING TABLE ---------- */
.reading-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 36px;
  margin-bottom: 18px;
}
.reading-question {
  font-style: italic;
  color: var(--sky);
  font-size: 0.96rem;
  margin-top: 4px;
}
.reading-table-shell {
  width: 100%;
  min-height: 460px;
  padding: 24px 16px;
  border-radius: 24px;
  background: rgba(8, 13, 23, 0.42);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  overflow: auto;
}
html[data-theme="light"] .reading-table-shell { background: rgba(255, 255, 255, 0.42); }
.reading-canvas {
  position: relative;
  flex: none;
}
.spread-slot {
  position: absolute;
  cursor: pointer;
}
.spread-slot .tarot-card-3d {
  width: 100%;
  height: 100%;
}
.spread-slot.sideways .tarot-card-3d {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) rotate(90deg);
}

/* Interactive Spread Position Cards beneath the Reading Table */
.reading-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.reading-summary-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  backdrop-filter: blur(12px);
  text-align: start;
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color .2s, background .2s, transform .2s;
}
.reading-summary-card:hover {
  border-color: var(--sky);
  background: var(--surface-elev);
}
.reading-summary-card.is-revealed {
  border-color: var(--gold-line);
}
.reading-summary-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.reading-summary-pos {
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sky);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.reading-summary-title {
  font: 500 0.94rem/1.3 var(--display);
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.reading-summary-sub {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.reading-summary-card .pill-badge {
  font-size: 0.66rem;
  padding: 3px 8px;
  flex: none;
}

/* ---------- CARD INSPECTOR DRAWER / MODAL ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(4, 7, 14, 0.82);
  backdrop-filter: blur(8px);
  display: grid; place-items: center;
  padding: 18px;
}
.modal-backdrop[hidden] { display: none; }

.drawer-backdrop { padding: 0; place-items: stretch end; }
.card-drawer {
  width: min(640px, 100vw);
  height: 100dvh;
  background: var(--surface-strong);
  border-inline-start: 1px solid var(--line-strong);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: drawerIn 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes drawerIn {
  from { transform: translateX(36px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}
[dir="rtl"] .card-drawer { animation-name: drawerInRtl; }
@keyframes drawerInRtl {
  from { transform: translateX(-36px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

.drawer-top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.drawer-top h2 { font-size: 1.28rem; }
.drawer-hero {
  display: flex; align-items: center; gap: 18px;
  padding: 18px 20px 14px;
  background: radial-gradient(circle at 20% 30%, rgba(78, 137, 180, 0.20), transparent 65%);
}
.drawer-thumb-btn {
  position: relative;
  width: 92px; aspect-ratio: 710 / 1226; flex: none;
  padding: 0; border-radius: var(--card-radius); overflow: hidden;
  border: 1.5px solid var(--card-edge); cursor: zoom-in;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.45);
  background: #0d1626;
}
.drawer-thumb-btn img { width: 100%; height: 100%; object-fit: cover; }
.drawer-thumb-btn.reversed img { transform: rotate(180deg); }
.drawer-hero-meta { display: flex; flex-direction: column; gap: 8px; min-width: 0; }

.drawer-tabs {
  display: flex; gap: 4px; overflow-x: auto;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.drawer-tabs::-webkit-scrollbar { display: none; }
.drawer-tab {
  border: 0; background: transparent; color: var(--muted);
  padding: 12px 14px; font: 500 0.88rem/1 var(--body);
  border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap;
  flex: none;
}
.drawer-tab:hover { color: var(--text); }
.drawer-tab.active { color: var(--text); border-bottom-color: var(--gold); }

.drawer-body {
  flex: 1; overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 20px;
  display: flex; flex-direction: column; gap: 20px;
}
.meaning-block h3 {
  font-size: 0.78rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--sky); margin-bottom: 8px;
}
.meaning-block p { color: var(--text); line-height: 1.72; }
.meaning-bullets {
  margin: 0; padding: 0; list-style: none;
  display: flex; flex-direction: column; gap: 10px;
}
.meaning-bullets li {
  padding-inline-start: 16px; position: relative; line-height: 1.65;
}
.meaning-bullets li::before {
  content: "✦"; position: absolute; inset-inline-start: 0; color: var(--gold); font-size: 0.75rem; top: 3px;
}
.affirmation-quote {
  padding: 14px 18px; border-radius: 14px;
  background: rgba(230, 194, 105, 0.10);
  border-inline-start: 3px solid var(--gold);
  font-style: italic;
}

.assoc-meta-grid {
  display: grid;
  grid-template-columns: repeat(var(--meta-cols, 4), minmax(0, 1fr));
  gap: 10px;
}
.assoc-meta-card {
  grid-column: span var(--cell-span, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 8px 14px;
  border-radius: 14px;
  background: rgba(143, 184, 217, 0.08);
  border: 1px solid var(--line);
  text-align: center;
  min-width: 0;
}
.assoc-meta-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--sky);
  line-height: 1.2;
}
.assoc-meta-card img {
  width: min(86px, 100%);
  aspect-ratio: 1;
  height: auto;
  border-radius: 14px;
  object-fit: cover;
  flex: none;
}
.assoc-meta-card span {
  font-size: 0.82rem;
  font-weight: 500;
  text-transform: capitalize;
  line-height: 1.25;
  overflow-wrap: break-word;
  max-width: 100%;
}
.assoc-meta-card.is-multi {
  justify-content: flex-start;
  gap: 10px;
}
.assoc-multi-items {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(var(--sub-cols, 2), minmax(0, 1fr));
  gap: 8px;
  align-items: start;
}
.assoc-multi-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.assoc-group { display: flex; flex-direction: column; gap: 10px; }
.assoc-group-title {
  font-size: 0.74rem; font-weight: 600; letter-spacing: 0.13em; text-transform: uppercase; color: var(--sky);
}
.assoc-chips {
  display: grid; grid-template-columns: repeat(var(--chip-cols, 4), minmax(0, 1fr)); gap: 10px;
}
.assoc-chip {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 8px; border-radius: 14px;
  background: rgba(143, 184, 217, 0.08); border: 1px solid var(--line);
  text-align: center;
  min-width: 0;
}
.assoc-chip img {
  width: min(86px, 100%);
  aspect-ratio: 1;
  height: auto;
  border-radius: 14px;
  object-fit: cover;
  flex: none;
}
.assoc-chip span {
  font-size: 0.8rem;
  text-transform: capitalize;
  line-height: 1.25;
  overflow-wrap: break-word;
  max-width: 100%;
}

/* Cardback Picker Modal */
.modal-panel {
  width: min(580px, calc(100vw - 24px));
  max-height: 86dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--surface-strong);
  border: 1px solid var(--line-strong);
  border-radius: 24px;
  padding: 22px;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px;
}
.modal-head h2 { display: inline-flex; align-items: center; gap: 8px; font-size: 1.2rem; }
.cardback-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.cb-option {
  padding: 6px; border-radius: 12px;
  background: transparent; border: 2px solid transparent;
  cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 6px;
  transition: transform .2s, border-color .2s;
}
.cb-option img {
  width: 100%; aspect-ratio: 710 / 1226; object-fit: cover;
  border-radius: var(--card-radius); box-shadow: 0 8px 18px rgba(0, 0, 0, 0.45);
}
.cb-option span { font-size: 0.74rem; color: var(--muted); text-align: center; line-height: 1.25; }
.cb-option:hover { transform: translateY(-3px); }
.cb-option.active { border-color: var(--gold); background: rgba(230, 194, 105, 0.12); }
.cb-option.active span { color: var(--text); font-weight: 600; }

/* Artwork Zoom Lightbox */
.zoom-backdrop { z-index: 100; }
.zoom-close {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  inset-inline-end: max(16px, env(safe-area-inset-right));
  width: 42px;
  height: 42px;
}
.zoom-stage { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.zoom-stage img {
  max-height: 80dvh; max-width: calc(100vw - 32px); border-radius: var(--card-radius);
  border: 2px solid var(--card-edge); box-shadow: 0 32px 72px rgba(0, 0, 0, 0.75);
}
.zoom-stage img.reversed { transform: rotate(180deg); }
.zoom-stage figcaption {
  color: var(--text); font-family: var(--display); font-size: 1.02rem;
  text-align: center; padding: 0 16px;
}

/* =========================================================================
   RESPONSIVE LAYOUT — TABLET & MOBILE
   ========================================================================= */
@keyframes drawerUp {
  from { transform: translateY(36px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

/* Tablet & Compact Laptop */
@media (max-width: 960px) {
  .topbar-inner { padding: 0 16px; gap: 12px; }
  .app-stage { padding: 22px 16px 40px; }

  .home-orbit { width: min(460px, 84vw); }
  .home-flank { width: 126px; opacity: 0.72; }
  .home-flank.left  { left: 2%; top: 24%; }
  .home-flank.right { right: 2%; top: 26%; }

  .begin-grid { grid-template-columns: 1fr; gap: 20px; }
  .spread-preview-box { aspect-ratio: 16 / 9; max-height: 220px; }
  .pos-list { max-height: none; overflow-y: visible; }

  .pull-stage {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 24px;
  }
  .pull-result-panel { width: 100%; max-width: 560px; }

  .select-footer { width: 100%; }
  .select-footer .ritual-bar.single { align-self: center; width: min(300px, 100%); }
}

/* Small Tablet / Large Phone */
@media (max-width: 720px) {
  .home-flank { display: none; }
  .home-view { overflow: hidden; }

  .reading-table-shell {
    min-height: 240px;
    padding: 18px 12px;
    border-radius: 20px;
    overflow: hidden;
  }
  .reading-summary-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .select-arena { min-height: 300px; }
  .deck-arena { min-height: 320px; padding: 14px 0; }
  .deck-aura { width: min(360px, 86vw); height: min(360px, 86vw); }
}

/* Mobile Phones */
@media (max-width: 640px) {
  :root { --topbar-h: 54px; }

  .topbar {
    height: auto;
    padding-top: env(safe-area-inset-top);
  }
  .topbar-inner {
    height: auto;
    padding: 8px 12px;
    display: flex;
    flex-wrap: wrap;
    row-gap: 8px;
    column-gap: 8px;
  }
  .topbar-left {
    flex: 1 1 auto;
    gap: 6px;
  }
  .topbar-right {
    flex: 0 0 auto;
    gap: 6px;
  }
  .brand-link img {
    height: 24px;
    max-width: 126px;
    object-fit: contain;
  }
  .icon-btn {
    width: 36px;
    height: 36px;
  }
  .icon-btn svg { width: 16px; height: 16px; }
  .lang-picker summary {
    height: 36px;
    padding: 0 10px;
    gap: 5px;
    font-size: 0.75rem;
  }
  .lang-picker summary svg { width: 14px; height: 14px; }

  /* Sleek full-width segmented mode switcher on reading views; hidden on Home where CTAs sit center stage */
  .primary-nav {
    order: 3;
    flex: 1 0 100%;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 3px;
    border-radius: 999px;
    background: rgba(143, 184, 217, 0.08);
    border: 1px solid var(--line);
  }
  html[data-theme="light"] .primary-nav {
    background: rgba(47, 104, 137, 0.08);
  }
  .primary-nav .nav-pill {
    padding: 8px 10px;
    font-size: 0.84rem;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  body[data-view="home"] .primary-nav { display: none; }

  /* Stage & Views */
  .app-stage {
    padding: 14px 12px 24px;
  }
  body[data-view="home"] .app-stage {
    padding: 12px 16px 20px;
  }
  body[data-view="shuffle"] .app-stage,
  body[data-view="select"] .app-stage,
  body[data-view="pull"] .app-stage {
    padding: 10px 12px 18px;
  }

  /* Home Screen */
  .home-view {
    min-height: calc(100dvh - 54px - 84px);
    padding: 16px 0 8px;
  }
  .home-orbit { width: min(360px, 90vw); opacity: 0.14; }
  .home-logo { width: min(244px, 68vw); margin-bottom: 8px; }
  .home-tagline { margin-bottom: 26px; font-size: 0.72rem; }
  .home-menu { max-width: min(304px, 100%); gap: 12px; }
  .home-menu .gt-btn { min-height: 52px; font-size: 1rem; }
  .home-footer-bar {
    margin-top: 28px;
    gap: 8px 16px;
    font-size: 0.82rem;
  }

  /* Section Headings & Cards */
  .view-head { margin-bottom: 16px; gap: 10px; }
  .view-head h1 { font-size: 1.5rem; }
  .glass-panel { padding: 18px 16px; border-radius: 18px; }
  .spread-preview-box {
    aspect-ratio: 16 / 9;
    max-height: 170px;
    padding: 12px;
    margin-bottom: 14px;
  }
  .begin-actions { flex-direction: column; gap: 10px; }
  .begin-actions .gt-btn { flex: none; width: 100%; }

  /* Pull a Card Reveal */
  .pull-view { padding: 6px 0; gap: 16px; }
  .tarot-card-3d.hero-size { width: min(210px, 56vw); }
  .pull-result-panel {
    padding: 20px 16px;
    border-radius: 18px;
    gap: 12px;
  }
  .pull-result-panel h2 { font-size: 1.4rem; }
  .pull-result-actions { flex-direction: column; }
  .pull-result-actions .gt-btn { width: 100%; }

  /* Shuffle, Cut & Select Rituals */
  .ritual-stage {
    min-height: calc(100dvh - 102px - 76px);
    gap: 10px;
    padding: 2px 0 4px;
  }
  .ritual-shuffle-stage {
    min-height: calc(100dvh - 102px - 76px);
    gap: 14px;
    padding: 4px 0 6px;
  }
  .ritual-pill {
    padding: 6px 14px;
    font-size: 0.84rem;
    gap: 7px;
  }
  .ritual-hint { font-size: 0.84rem; padding: 0 8px; }
  .shuffle-top-hint { margin-bottom: 0; }
  .shuffle-top-hint .ritual-hint { font-size: 0.85rem; }
  .deck-arena { min-height: 270px; padding: 8px 0; }
  .ritual-bar { width: 100%; }
  .ritual-bar-btn {
    padding: 14px 12px;
    font-size: 0.84rem;
    letter-spacing: 0.10em;
  }

  .select-arena { min-height: 350px; padding-top: 2px; gap: 6px; }
  .select-pos-desc { font-size: 0.82rem; line-height: 1.32; }
  .select-footer { gap: 8px; }
  .drawn-tray { gap: 6px; }
  .drawn-slot { padding: 4px 10px; font-size: 0.74rem; }

  /* Reading Table */
  .reading-toolbar { margin-bottom: 10px; gap: 10px; }
  .reading-question { font-size: 0.9rem; }
  .reading-table-shell {
    min-height: 200px;
    padding: 16px 10px;
    border-radius: 18px;
  }
  .reading-summary-card { padding: 11px 12px; border-radius: 14px; }

  /* Full Card Meaning Inspector -> Slide-Up Bottom Sheet */
  .modal-backdrop.drawer-backdrop {
    place-items: end stretch;
    padding: 0;
  }
  .card-drawer {
    width: 100%;
    height: 92dvh;
    max-height: 92dvh;
    border-inline-start: 0;
    border-top: 1px solid var(--line-strong);
    border-radius: 22px 22px 0 0;
    animation: drawerUp 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  }
  [dir="rtl"] .card-drawer { animation-name: drawerUp; }
  .drawer-top { padding: 14px 16px; }
  .drawer-top h2 { font-size: 1.15rem; }
  .drawer-hero { padding: 14px 16px 12px; gap: 14px; }
  .drawer-thumb-btn { width: 74px; }
  .drawer-tabs { padding: 0 8px; gap: 2px; }
  .drawer-tab { padding: 11px 9px; font-size: 0.82rem; }
  .drawer-body {
    padding: 14px 10px max(24px, env(safe-area-inset-bottom));
    gap: 14px;
  }
  .assoc-meta-grid {
    gap: 5px;
  }
  .assoc-meta-card {
    padding: 7px 3px 8px;
    gap: 5px;
    border-radius: 12px;
  }
  .assoc-meta-label {
    font-size: 0.58rem;
    letter-spacing: 0.06em;
  }
  .assoc-meta-card img { width: min(76px, 100%); height: auto; border-radius: 10px; }
  .assoc-meta-card span { font-size: 0.72rem; line-height: 1.2; }
  .assoc-multi-items { gap: 5px; }
  .assoc-multi-item { gap: 5px; }
  .assoc-group { gap: 7px; }
  .assoc-group-title { font-size: 0.68rem; }
  .assoc-chips {
    gap: 5px;
  }
  .assoc-chip {
    padding: 7px 3px 8px;
    gap: 5px;
    border-radius: 12px;
  }
  .assoc-chip img { width: min(76px, 100%); height: auto; border-radius: 10px; }
  .assoc-chip span { font-size: 0.72rem; line-height: 1.2; }

  /* Cardback Picker Modal */
  .modal-backdrop { padding: 12px; }
  .modal-panel {
    padding: 18px 16px;
    border-radius: 20px;
  }
  .modal-head { margin-bottom: 14px; }
  .cardback-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  /* Footer */
  .tarot-footer {
    padding: 12px 14px max(12px, env(safe-area-inset-bottom));
  }
  .tarot-footer-inner { font-size: 0.8rem; }
}

/* Compact Phones (<= 390px) */
@media (max-width: 390px) {
  .topbar-inner { padding: 8px 10px; }
  .brand-link img { height: 22px; max-width: 108px; }
  .topbar-right { gap: 4px; }
  .icon-btn { width: 34px; height: 34px; }
  .lang-picker summary { height: 34px; padding: 0 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .home-orbit { animation: none; }
  .view-enter { animation: none; }
}
