:root {
  --bg-deep: #090b12;
  --bg-panel: #121626;
  --bg-panel-elevated: #191f35;
  --border-subtle: #283050;
  --gold: #d4af37;
  --gold-soft: #f3e5ab;
  --text-main: #eef1ff;
  --text-muted: #939ec2;
  --accent-fire: #e05a47;
  --accent-water: #4a90e2;
  --accent-air: #a3b8cc;
  --accent-earth: #6ab04c;
  --reversed-tint: #d97b66;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg-deep);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

.cosmos-bg {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 18% 15%, rgba(212, 175, 55, 0.08), transparent 36%),
    radial-gradient(circle at 82% 20%, rgba(88, 101, 242, 0.1), transparent 40%),
    radial-gradient(circle at 50% 85%, rgba(168, 85, 247, 0.07), transparent 45%);
  pointer-events: none;
  z-index: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: rgba(9, 11, 18, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.brand-glyph {
  font-size: 24px;
  color: var(--gold);
}

.brand-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--gold-soft);
}

.brand-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.nav-tabs {
  display: flex;
  gap: 8px;
}

.nav-tab {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.nav-tab:hover {
  color: var(--text-main);
}

.nav-tab.active {
  color: var(--gold-soft);
  border-color: rgba(212, 175, 55, 0.45);
  background: rgba(212, 175, 55, 0.1);
}

.llm-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-panel-elevated);
  border: 1px solid rgba(212, 175, 55, 0.4);
  color: var(--gold-soft);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.2s;
}

.llm-pill:hover {
  border-color: var(--gold);
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.25);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4cd137;
  box-shadow: 0 0 6px #4cd137;
}

.container {
  position: relative;
  z-index: 1;
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px 20px 64px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* Stepper */
.stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 24px;
}

.step-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--text-muted);
}

.step-item span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  font-size: 12px;
}

.step-item.active {
  color: var(--gold-soft);
  font-weight: 600;
}

.step-item.active span {
  background: var(--gold);
  color: #090b12;
  border-color: var(--gold);
}

.step-line {
  width: 48px;
  height: 1px;
  background: var(--border-subtle);
}

.stage-view {
  display: none;
}

.stage-view.active {
  display: block;
}

.card-panel {
  background: rgba(18, 22, 38, 0.9);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 26px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.4);
}

.section-title {
  font-size: 24px;
  color: var(--gold-soft);
  text-align: center;
  margin-bottom: 6px;
}

.section-desc {
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 20px;
}

.topic-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-bottom: 18px;
}

.topic-chip {
  background: var(--bg-panel-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 7px 15px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.18s;
}

.topic-chip.active,
.topic-chip:hover {
  border-color: var(--gold);
  color: var(--gold-soft);
  background: rgba(212, 175, 55, 0.12);
}

.question-box {
  max-width: 780px;
  margin: 0 auto 28px;
}

.question-box textarea {
  width: 100%;
  background: #0c0f1c;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  color: var(--text-main);
  padding: 14px 16px;
  font-size: 15px;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
}

.question-box textarea:focus {
  border-color: var(--gold);
}

.quick-prompts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-muted);
}

.prompt-tag {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}

.prompt-tag:hover {
  color: var(--gold-soft);
  border-color: rgba(212, 175, 55, 0.4);
}

.sub-heading {
  font-size: 17px;
  color: var(--gold-soft);
  margin-bottom: 14px;
}

.muted-hint {
  font-size: 12.5px;
  font-weight: 400;
  color: var(--text-muted);
}

.spread-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 26px;
}

.spread-card {
  background: var(--bg-panel-elevated);
  border: 1.5px solid var(--border-subtle);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.spread-card:hover {
  border-color: rgba(212, 175, 55, 0.5);
  transform: translateY(-2px);
}

.spread-card.selected {
  border-color: var(--gold);
  background: linear-gradient(160deg, rgba(212, 175, 55, 0.14), rgba(25, 31, 53, 0.95));
  box-shadow: 0 0 18px rgba(212, 175, 55, 0.18);
}

.spread-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.spread-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--text-main);
}

.spread-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 99px;
  background: rgba(212, 175, 55, 0.15);
  color: var(--gold-soft);
}

.spread-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.spread-positions-tag {
  font-size: 11.5px;
  color: #b8c2e0;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
  padding-top: 8px;
}

.action-bar {
  display: flex;
  justify-content: center;
  margin-top: 16px;
}

.btn-primary {
  background: linear-gradient(135deg, #d4af37, #b5891c);
  color: #090b12;
  font-weight: 700;
  border: none;
  padding: 10px 22px;
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-large {
  padding: 13px 32px;
  font-size: 15.5px;
}

.btn-secondary {
  background: var(--bg-panel-elevated);
  color: var(--gold-soft);
  border: 1px solid rgba(212, 175, 55, 0.4);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
}

.btn-secondary:hover {
  border-color: var(--gold);
  background: rgba(212, 175, 55, 0.12);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
}

.btn-ghost:hover {
  color: var(--text-main);
  border-color: var(--text-muted);
}

.btn-link {
  background: none;
  border: none;
  color: var(--gold);
  text-decoration: underline;
  cursor: pointer;
  font-size: 13px;
  margin-left: 8px;
}

.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
}

/* Draw Stage */
.draw-header,
.reading-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.topic-badge {
  display: inline-block;
  font-size: 11.5px;
  color: var(--gold);
  border: 1px solid rgba(212, 175, 55, 0.4);
  padding: 2px 10px;
  border-radius: 99px;
  margin-bottom: 4px;
}

.draw-question {
  font-size: 19px;
  color: var(--text-main);
}

.fair-banner {
  background: #0c0f1d;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 18px;
  font-size: 12.5px;
}

.fair-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.fair-row:last-child {
  margin-bottom: 0;
}

.fair-label {
  color: var(--text-muted);
}

.seed-input {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  color: var(--gold-soft);
  padding: 4px 10px;
  border-radius: 6px;
  font-family: monospace;
  font-size: 12px;
  width: 260px;
}

.draw-instruction {
  text-align: center;
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.draw-instruction strong {
  color: var(--gold-soft);
}

.picked-slots-bar {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.slot-pill {
  min-width: 135px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px dashed var(--border-subtle);
  background: rgba(12, 15, 28, 0.7);
  text-align: center;
  font-size: 12.5px;
}

.slot-pill.filled {
  border-style: solid;
  border-color: var(--gold);
  background: rgba(212, 175, 55, 0.12);
}

.slot-pill-role {
  color: var(--text-muted);
  font-size: 11px;
}

.slot-pill-val {
  color: var(--gold-soft);
  font-weight: 600;
  margin-top: 2px;
}

.fan-wrapper {
  padding: 16px 8px 24px;
  overflow-x: auto;
}

.fan-deck {
  display: grid;
  grid-template-columns: repeat(26, minmax(34px, 1fr));
  gap: 6px;
  max-width: 1080px;
  margin: 0 auto;
}

.deck-card-back {
  height: 68px;
  border-radius: 6px;
  background: linear-gradient(145deg, #1b223b, #0e1222);
  border: 1px solid rgba(212, 175, 55, 0.45);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  transition: transform 0.16s, border-color 0.16s, box-shadow 0.16s;
  font-size: 10px;
  color: rgba(212, 175, 55, 0.75);
}

.deck-card-back:hover {
  transform: translateY(-7px);
  border-color: var(--gold);
  box-shadow: 0 6px 14px rgba(212, 175, 55, 0.25);
}

.deck-card-back.picked {
  transform: translateY(-10px);
  background: linear-gradient(145deg, #d4af37, #9c7a19);
  color: #090b12;
  font-weight: 700;
  border-color: #fff;
}

/* Reading Stage */
.reading-top-btns {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.disclaimer-banner {
  background: rgba(224, 90, 71, 0.14);
  border: 1px solid var(--accent-fire);
  color: #ffd3cc;
  padding: 10px 16px;
  border-radius: 10px;
  margin-bottom: 18px;
  font-size: 13px;
}

.hidden {
  display: none !important;
}

.spread-stage-grid {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}

/* 3D Tarot Card Flip */
.tarot-card-slot {
  width: 210px;
  perspective: 1100px;
}

.slot-header {
  text-align: center;
  margin-bottom: 8px;
}

.slot-pos-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--gold-soft);
}

.slot-pos-role {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.flip-card-inner {
  position: relative;
  width: 210px;
  height: 330px;
  transition: transform 0.65s cubic-bezier(0.22, 1, 0.36, 1);
  transform-style: preserve-3d;
  cursor: pointer;
}

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

.card-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.55);
}

.card-face-back {
  background: radial-gradient(circle at 50% 50%, #1e2544, #0d101f);
  border: 2px solid var(--gold);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.card-back-ornament {
  width: 150px;
  height: 250px;
  border: 1px dashed rgba(212, 175, 55, 0.45);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--gold);
}

.card-back-ornament .star-ring {
  font-size: 36px;
}

.card-back-hint {
  font-size: 12px;
  color: var(--gold-soft);
  margin-top: 8px;
}

.card-face-front {
  transform: rotateY(180deg);
  background: linear-gradient(170deg, #171c30, #0d101d);
  border: 2px solid var(--gold);
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.card-face-front.is-reversed {
  border-color: var(--reversed-tint);
}

.card-top-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
  color: var(--text-muted);
}

.card-roman {
  font-weight: 700;
  color: var(--gold-soft);
}

.card-art-box {
  position: relative;
  height: 128px;
  margin: 8px 0;
  border-radius: 10px;
  background: radial-gradient(circle at 50% 40%, rgba(212, 175, 55, 0.16), rgba(9, 11, 18, 0.85));
  border: 1px solid rgba(212, 175, 55, 0.25);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px;
  text-align: center;
}

.card-art-box.reversed-art .art-glyph {
  transform: rotate(180deg);
}

.art-glyph {
  font-size: 38px;
  margin-bottom: 4px;
  transition: transform 0.3s;
}

.art-symbolism {
  font-size: 10.5px;
  color: #b4bee0;
  line-height: 1.35;
}

.card-title-block {
  text-align: center;
}

.card-name-zh {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}

.card-orientation-badge {
  display: inline-block;
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 99px;
  margin-top: 3px;
  background: rgba(212, 175, 55, 0.16);
  color: var(--gold-soft);
}

.is-reversed .card-orientation-badge {
  background: rgba(217, 123, 102, 0.2);
  color: #ff9f89;
}

.card-keywords {
  font-size: 11px;
  color: var(--gold-soft);
  text-align: center;
  margin: 6px 0 4px;
}

.card-meaning-snippet {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Reading Two Columns */
.reading-columns {
  display: grid;
  grid-template-columns: 390px 1fr;
  gap: 20px;
  align-items: start;
}

@media (max-width: 960px) {
  .reading-columns {
    grid-template-columns: 1fr;
  }
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.panel-header h3 {
  font-size: 16px;
  color: var(--gold-soft);
}

.latency-tag {
  font-size: 11px;
  color: #4cd137;
  background: rgba(76, 209, 55, 0.1);
  border: 1px solid rgba(76, 209, 55, 0.3);
  padding: 2px 8px;
  border-radius: 99px;
}

.instant-headline {
  font-size: 14px;
  color: var(--text-main);
  background: rgba(212, 175, 55, 0.09);
  border-left: 3px solid var(--gold);
  padding: 10px 12px;
  border-radius: 6px;
  margin-bottom: 16px;
}

.element-bars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.el-pill {
  background: #0d101d;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 8px;
  text-align: center;
  font-size: 12px;
}

.el-pill strong {
  display: block;
  font-size: 15px;
  color: var(--gold-soft);
}

.rule-block {
  margin-bottom: 14px;
  font-size: 13px;
}

.rule-title {
  font-weight: 600;
  color: var(--gold-soft);
  margin-bottom: 4px;
}

.interactions-list {
  padding-left: 18px;
  color: var(--text-muted);
  font-size: 12.5px;
}

.fair-verify-box {
  margin-top: 16px;
  background: #0b0e1a;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
}

.fair-verify-box summary {
  cursor: pointer;
  color: var(--gold-soft);
  font-weight: 600;
}

.verify-body {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  word-break: break-all;
  color: var(--text-muted);
}

.verify-pass {
  color: #4cd137;
  font-weight: 600;
  margin-top: 4px;
}

/* AI Stream Output */
.ai-output {
  min-height: 220px;
  font-size: 14.5px;
  line-height: 1.75;
  color: #e5e9f7;
}

.ai-output h2,
.ai-output h3 {
  color: var(--gold-soft);
  margin: 16px 0 8px;
  font-size: 16px;
}

.ai-output p {
  margin-bottom: 10px;
}

.ai-output ul,
.ai-output ol {
  padding-left: 20px;
  margin-bottom: 12px;
}

.skeleton-loader {
  color: var(--text-muted);
  font-style: italic;
  padding: 20px 0;
}

/* Followup Q&A */
.followup-section {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border-subtle);
}

.followup-section h4,
.journal-save-box h4 {
  font-size: 14px;
  color: var(--gold-soft);
  margin-bottom: 10px;
}

.followup-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.chat-bubble {
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13.5px;
}

.chat-bubble.user {
  background: rgba(212, 175, 55, 0.14);
  border: 1px solid rgba(212, 175, 55, 0.35);
  align-self: flex-end;
}

.chat-bubble.assistant {
  background: #0d101f;
  border: 1px solid var(--border-subtle);
}

.followup-input-row,
.journal-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.followup-input-row input,
.journal-row input,
.journal-row select {
  flex: 1;
  min-width: 180px;
  background: #0b0e1a;
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13.5px;
}

.journal-save-box {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px dashed var(--border-subtle);
}

.save-feedback {
  font-size: 12px;
  color: #4cd137;
  margin-top: 6px;
  display: inline-block;
}

/* Journal & Encyclopedia */
.journal-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.journal-item {
  background: var(--bg-panel-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.encyclopedia-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.enc-card {
  background: var(--bg-panel-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 14px;
  font-size: 12.5px;
}

.enc-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--gold-soft);
  margin-bottom: 4px;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  background: var(--bg-panel);
  border: 1px solid var(--gold);
  border-radius: 16px;
  max-width: 520px;
  width: 100%;
  padding: 24px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.modal-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 12.5px;
  color: var(--gold-soft);
  margin-bottom: 6px;
}

.form-group select,
.form-group input {
  width: 100%;
  background: #0b0e1a;
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13.5px;
}

.mt-6 {
  margin-top: 6px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 18px;
}


/* Auth Pill & Badge */
.auth-status-container {
  display: flex;
  align-items: center;
}

.auth-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(212, 175, 55, 0.12);
  border: 1px solid rgba(212, 175, 55, 0.4);
  color: #f7e7b4;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.auth-pill:hover {
  background: rgba(212, 175, 55, 0.25);
  border-color: var(--gold);
}

.auth-user-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(16, 42, 34, 0.7);
  border: 1px solid #2ecc71;
  color: #a3e9c0;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
}

.auth-user-quota {
  background: rgba(46, 204, 113, 0.2);
  color: #2ecc71;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

.btn-logout {
  background: none;
  border: none;
  color: #8fa0b5;
  cursor: pointer;
  padding: 0 4px;
  font-size: 13px;
  transition: color 0.2s ease;
}

.btn-logout:hover {
  color: #ff6b6b;
}

/* Tier Banner in LLM Modal */
.llm-tier-banner {
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 14px;
  font-size: 12.5px;
  line-height: 1.45;
}

.llm-tier-banner.bfi {
  background: rgba(46, 204, 113, 0.12);
  border: 1px solid rgba(46, 204, 113, 0.35);
  color: #a3e9c0;
}

.llm-tier-banner.byok {
  background: rgba(212, 175, 55, 0.12);
  border: 1px solid rgba(212, 175, 55, 0.35);
  color: #f7e7b4;
}

.llm-tier-banner.guest {
  background: rgba(231, 76, 60, 0.12);
  border: 1px solid rgba(231, 76, 60, 0.35);
  color: #ff8a75;
}

/* Auth Modal Tabs */
.auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 8px;
}

.auth-tab-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.auth-tab-btn.active {
  color: var(--gold);
  background: rgba(212, 175, 55, 0.12);
  font-weight: 600;
}

.auth-tab-content {
  display: none;
}

.auth-tab-content.active {
  display: block;
}

.auth-msg {
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
}

.auth-msg.error {
  background: rgba(231, 76, 60, 0.15);
  border: 1px solid rgba(231, 76, 60, 0.4);
  color: #ff8a75;
}

.auth-msg.success {
  background: rgba(46, 204, 113, 0.15);
  border: 1px solid rgba(46, 204, 113, 0.4);
  color: #a3e9c0;
}

/* Quota Gate Alert Options */
.quota-gate-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.quota-option-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #0f1424;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  color: var(--text-main);
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
}

.quota-option-btn:hover {
  border-color: var(--gold);
  background: rgba(212, 175, 55, 0.08);
}

.quota-opt-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--gold);
}

.quota-opt-desc {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.btn-secondary {
  background: #192036;
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
}

.btn-secondary:hover {
  border-color: var(--gold);
}

/* === Classical Esoteric Ritual Additions === */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lang-pill {
  background: var(--bg-panel-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
}

.lang-pill:hover {
  border-color: var(--gold);
  color: var(--gold-soft);
}

.sound-pill {
  background: var(--bg-panel-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
}

.sound-pill:hover {
  border-color: var(--gold);
  color: var(--gold-soft);
}

.altar-status-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

@media (max-width: 760px) {
  .altar-status-bar {
    grid-template-columns: repeat(2, 1fr);
  }
}

.altar-corner-pill {
  background: rgba(18, 22, 38, 0.85);
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: 10px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}

.altar-corner-icon {
  font-size: 22px;
  filter: drop-shadow(0 0 6px rgba(212, 175, 55, 0.4));
}

.altar-corner-dir {
  color: var(--text-muted);
  font-size: 11px;
}

.altar-corner-name {
  color: var(--gold-soft);
  font-weight: 600;
}

.ritual-block {
  margin-bottom: 26px;
  padding-bottom: 24px;
  border-bottom: 1px dashed var(--border-subtle);
}

.ritual-block.no-border {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.ritual-step-badge {
  display: inline-block;
  font-size: 11.5px;
  letter-spacing: 0.5px;
  color: var(--gold);
  background: rgba(212, 175, 55, 0.12);
  border: 1px solid rgba(212, 175, 55, 0.35);
  padding: 3px 12px;
  border-radius: 99px;
  margin-bottom: 12px;
}

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

.altar-quadrant {
  background: var(--bg-panel-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 14px;
}

.quadrant-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--gold-soft);
  margin-bottom: 2px;
}

.quadrant-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.talisman-options {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.talisman-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  text-align: left;
  background: #0d101f;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.18s;
}

.talisman-btn:hover {
  border-color: rgba(212, 175, 55, 0.5);
}

.talisman-btn.active {
  border-color: var(--gold);
  background: rgba(212, 175, 55, 0.15);
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.15);
}

.talisman-icon {
  font-size: 20px;
}

.talisman-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--gold-soft);
}

.talisman-desc {
  font-size: 11px;
  color: var(--text-muted);
}

/* Breathwork Widget */
.breath-widget {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: rgba(12, 15, 28, 0.75);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 14px 20px;
  max-width: 680px;
  margin: 0 auto 20px;
}

.breath-orb {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(212, 175, 55, 0.35), rgba(212, 175, 55, 0.05));
  border: 1.5px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--gold-soft);
  flex-shrink: 0;
  animation: breathPulse 8s ease-in-out infinite;
}

@keyframes breathPulse {
  0%, 100% {
    transform: scale(0.86);
    box-shadow: 0 0 8px rgba(212, 175, 55, 0.2);
  }
  50% {
    transform: scale(1.14);
    box-shadow: 0 0 26px rgba(212, 175, 55, 0.55);
  }
}

.breath-text {
  font-size: 13px;
  color: var(--text-muted);
}

.breath-text strong {
  color: var(--gold-soft);
}

/* Act II: Knocking, Swirling & 3-Pile Cut */
.ritual-trio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.ritual-mini-card {
  background: var(--bg-panel-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.ritual-mini-card.done {
  border-color: rgba(76, 209, 55, 0.55);
}

.mini-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.mini-step-num {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--gold-soft);
}

.mini-status {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 99px;
  background: rgba(212, 175, 55, 0.14);
  color: var(--gold-soft);
}

.mini-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.knock-deck-btn {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  background: linear-gradient(145deg, #1b223b, #0e1222);
  border: 1.5px solid var(--gold);
  color: var(--gold-soft);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.12s, box-shadow 0.2s;
}

.knock-deck-btn:active {
  transform: scale(0.96);
}

.swirl-pad {
  height: 54px;
  border-radius: 10px;
  background: radial-gradient(circle at 50% 50%, rgba(212, 175, 55, 0.16), #0b0e1a);
  border: 1px dashed var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--gold-soft);
  cursor: grab;
  user-select: none;
}

.three-piles-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.pile-btn {
  background: #0d101f;
  border: 1px solid rgba(212, 175, 55, 0.45);
  color: var(--text-main);
  padding: 8px 6px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.16s;
}

.pile-btn.picked {
  background: var(--gold);
  color: #090b12;
  font-weight: 700;
}

.cut-order-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
  text-align: center;
}

/* Act III: Progressive Card-by-Card Flip */
.flip-progress-banner {
  background: linear-gradient(90deg, rgba(212, 175, 55, 0.16), rgba(25, 31, 53, 0.9));
  border: 1px solid rgba(212, 175, 55, 0.45);
  color: var(--gold-soft);
  padding: 10px 16px;
  border-radius: 10px;
  margin-bottom: 18px;
  font-size: 13.5px;
  text-align: center;
  font-weight: 600;
}

.tarot-card-slot.next-to-flip .card-face-back {
  box-shadow: 0 0 22px rgba(212, 175, 55, 0.55);
  border-color: #fff;
}

.single-cards-stage {
  margin-bottom: 22px;
}

.progressive-cards-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.prog-card-item {
  background: var(--bg-panel-elevated);
  border: 1px solid rgba(212, 175, 55, 0.4);
  border-left: 4px solid var(--gold);
  border-radius: 10px;
  padding: 14px 16px;
  animation: fadeInSlide 0.35s ease-out;
}

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

.prog-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.prog-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--gold-soft);
}

.prog-card-role {
  font-size: 12px;
  color: var(--text-muted);
}

.prog-card-body {
  font-size: 13.5px;
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.prog-bridge {
  font-size: 12px;
  color: #b4bee0;
  background: rgba(255, 255, 255, 0.03);
  padding: 6px 10px;
  border-radius: 6px;
  margin-top: 4px;
}

.locked-synthesis {
  opacity: 0.48;
  filter: grayscale(0.35);
  transition: opacity 0.4s, filter 0.4s;
}

.locked-synthesis.unlocked {
  opacity: 1;
  filter: none;
}


/* === Authentic 1909 Rider-Waite-Smith Card Artwork === */
.tarot-card-slot {
  width: 224px;
}

.flip-card-inner {
  width: 224px;
  height: 390px;
}

.card-rws-frame {
  flex: 1;
  margin: 6px 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1.5px solid rgba(212, 175, 55, 0.55);
  background: #090b12;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rws-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}

.img-reversed {
  transform: rotate(180deg);
}

.prog-card-with-thumb {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.prog-thumb-wrap {
  width: 86px;
  flex-shrink: 0;
  border-radius: 6px;
  overflow: hidden;
  border: 1.5px solid var(--gold);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.45);
}

.prog-thumb-img {
  width: 100%;
  height: auto;
  display: block;
}

.prog-card-content {
  flex: 1;
  min-width: 0;
}

.encyclopedia-grid {
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
}

.enc-card-with-img {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.enc-card-img {
  width: 84px;
  border-radius: 6px;
  border: 1px solid rgba(212, 175, 55, 0.5);
  flex-shrink: 0;
}


/* === 7-Scene Single-Focus Ceremonial Stage === */
.ritual-hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 880px;
  margin: 0 auto 18px;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(18, 22, 38, 0.78);
  border: 1px solid var(--border-subtle);
  font-size: 12px;
}

.hud-elements {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.hud-el-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-muted);
}

.hud-el-item.placed {
  color: var(--gold-soft);
}

.hud-progress {
  color: var(--gold);
  font-weight: 600;
}

.ritual-scene {
  display: none;
  animation: sceneFadeIn 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.ritual-scene.active {
  display: block;
}

@keyframes sceneFadeIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.scene-stage {
  max-width: 760px;
  margin: 0 auto;
  background: radial-gradient(circle at 50% 0%, rgba(212, 175, 55, 0.09), rgba(18, 22, 38, 0.94) 65%);
  border: 1px solid rgba(212, 175, 55, 0.32);
  border-radius: 22px;
  padding: 36px 32px;
  text-align: center;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.65);
}

.scene-stage.wide-stage {
  max-width: 1180px;
}

.scene-eyebrow {
  display: inline-block;
  font-size: 12px;
  letter-spacing: 1.5px;
  color: var(--gold);
  background: rgba(212, 175, 55, 0.12);
  border: 1px solid rgba(212, 175, 55, 0.38);
  padding: 4px 14px;
  border-radius: 999px;
  margin-bottom: 14px;
}

.scene-title {
  font-size: 25px;
  color: var(--gold-soft);
  margin-bottom: 8px;
}

.scene-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto 26px;
}

/* Scene 1: Velvet Altar Circle */
.velvet-altar-circle {
  position: relative;
  width: 310px;
  height: 310px;
  margin: 0 auto 28px;
  border-radius: 50%;
  background: radial-gradient(circle, #1c223d 0%, #0d1021 72%);
  border: 2px solid rgba(212, 175, 55, 0.5);
  box-shadow: inset 0 0 36px rgba(0, 0, 0, 0.8), 0 0 30px rgba(212, 175, 55, 0.14);
}

.altar-center-sigil {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
  color: rgba(212, 175, 55, 0.25);
  pointer-events: none;
}

.altar-pedestal {
  position: absolute;
  width: 96px;
  padding: 8px 6px;
  border-radius: 12px;
  background: rgba(11, 14, 26, 0.9);
  border: 1px dashed rgba(212, 175, 55, 0.4);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  transition: all 0.25s;
}

.altar-pedestal.active-focus {
  border-style: solid;
  border-color: #fff;
  box-shadow: 0 0 18px rgba(212, 175, 55, 0.65);
  transform: scale(1.06);
}

.altar-pedestal.placed {
  border-style: solid;
  border-color: var(--gold);
  background: rgba(212, 175, 55, 0.16);
}

.pos-north { top: 12px; left: calc(50% - 48px); }
.pos-south { bottom: 12px; left: calc(50% - 48px); }
.pos-east  { right: 10px; top: calc(50% - 38px); }
.pos-west  { left: 10px; top: calc(50% - 38px); }

.ped-dir { font-size: 10px; color: var(--text-muted); }
.ped-icon { font-size: 22px; }
.ped-name { font-size: 11px; color: var(--gold-soft); font-weight: 600; }

.talisman-choice-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  max-width: 620px;
  margin: 0 auto 20px;
}

@media (max-width: 640px) {
  .talisman-choice-row {
    grid-template-columns: 1fr;
  }
}

.talisman-choice-card {
  background: var(--bg-panel-elevated);
  border: 1.5px solid var(--border-subtle);
  border-radius: 14px;
  padding: 16px 12px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.talisman-choice-card:hover {
  border-color: var(--gold);
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(212, 175, 55, 0.2);
}

.talisman-choice-card .t-icon {
  font-size: 32px;
}

.talisman-choice-card .t-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--gold-soft);
}

.talisman-choice-card .t-desc {
  font-size: 12px;
  color: var(--text-muted);
}

/* Scene 2: Breath Orb & Compact Spreads */
.breath-orb-large {
  width: 118px;
  height: 118px;
  margin: 0 auto 24px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(212, 175, 55, 0.38), rgba(212, 175, 55, 0.04));
  border: 2px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--gold-soft);
  animation: breathPulse 8s ease-in-out infinite;
}

.intention-input-wrap {
  max-width: 600px;
  margin: 0 auto 22px;
}

.intention-input-wrap textarea {
  width: 100%;
  background: #0b0e1b;
  border: 1.5px solid var(--border-subtle);
  border-radius: 12px;
  color: var(--text-main);
  padding: 14px 16px;
  font-size: 15px;
  text-align: center;
  outline: none;
}

.intention-input-wrap textarea:focus {
  border-color: var(--gold);
}

.spread-Carousel-wrap {
  max-width: 640px;
  margin: 0 auto 24px;
}

.compact-label {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.spread-compact-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
}

.spread-pill-btn {
  background: var(--bg-panel-elevated);
  border: 1.5px solid var(--border-subtle);
  color: var(--text-main);
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.18s;
}

.spread-pill-btn.active {
  border-color: var(--gold);
  background: rgba(212, 175, 55, 0.18);
  color: var(--gold-soft);
  font-weight: 600;
}

.selected-spread-desc {
  font-size: 12.5px;
  color: var(--gold-soft);
}

/* Scene 3: 3D Deck Knocking */
.knock-altar-center {
  position: relative;
  height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
}

.deck-3d-stack {
  position: relative;
  width: 162px;
  height: 242px;
  border-radius: 14px;
  background: radial-gradient(circle at 50% 45%, #232b4d, #0d1020);
  border: 2px solid var(--gold);
  box-shadow:
    0 6px 0 #8a6d1b,
    0 12px 0 #161b30,
    0 14px 0 #8a6d1b,
    0 24px 40px rgba(0, 0, 0, 0.75);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  transition: transform 0.14s;
}

.deck-3d-stack:active,
.deck-3d-stack.knock-anim {
  transform: translateY(6px) scale(0.97);
}

.deck-top-ornament {
  font-size: 48px;
  color: var(--gold);
  margin-bottom: 12px;
}

.deck-knock-prompt {
  font-size: 13px;
  color: var(--gold-soft);
  font-weight: 600;
}

.knock-ripple {
  position: absolute;
  width: 180px;
  height: 250px;
  border-radius: 18px;
  border: 2px solid var(--gold);
  opacity: 0;
  pointer-events: none;
}

.knock-ripple.burst {
  animation: rippleOut 0.65s ease-out;
}

@keyframes rippleOut {
  0% {
    transform: scale(0.95);
    opacity: 0.9;
  }
  100% {
    transform: scale(1.45);
    opacity: 0;
  }
}

.knock-dots {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 22px;
}

.knock-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1.5px solid var(--gold);
  background: transparent;
  transition: all 0.2s;
}

.knock-dot.filled {
  background: var(--gold);
  box-shadow: 0 0 12px var(--gold);
}

.fair-hash-whisper {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* Scene 4: Vortex Table */
.vortex-table {
  position: relative;
  height: 290px;
  max-width: 620px;
  margin: 0 auto 24px;
  border-radius: 18px;
  background: radial-gradient(circle at 50% 50%, #1d2442 0%, #0b0e1b 78%);
  border: 1.5px dashed rgba(212, 175, 55, 0.5);
  overflow: hidden;
  cursor: grab;
  user-select: none;
}

.vortex-cards-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.vortex-mini-card {
  position: absolute;
  width: 44px;
  height: 70px;
  left: calc(50% - 22px);
  top: calc(50% - 35px);
  border-radius: 5px;
  background: linear-gradient(145deg, #222a4c, #101426);
  border: 1px solid rgba(212, 175, 55, 0.65);
  transition: transform 0.28s ease-out;
}

.vortex-center-hint {
  position: absolute;
  bottom: 14px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 13px;
  color: var(--gold-soft);
  pointer-events: none;
}

/* Scene 5: Left-Hand 3-Pile Stage */
.three-piles-stage {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  max-width: 600px;
  margin: 0 auto 22px;
}

.cut-pile-card {
  position: relative;
  background: radial-gradient(circle at 50% 30%, #202847, #0e1222);
  border: 2px solid rgba(212, 175, 55, 0.45);
  border-radius: 16px;
  padding: 28px 14px;
  cursor: pointer;
  transition: all 0.22s;
  box-shadow: 0 8px 0 #7b6118, 0 14px 26px rgba(0, 0, 0, 0.55);
}

.cut-pile-card:hover {
  transform: translateY(-4px);
  border-color: var(--gold);
}

.cut-pile-card.picked {
  border-color: #fff;
  background: linear-gradient(145deg, rgba(212, 175, 55, 0.28), #171d36);
  transform: translateY(4px);
}

.pile-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 11px;
  font-weight: 700;
  color: #090b12;
  background: var(--gold);
  padding: 2px 8px;
  border-radius: 99px;
  display: none;
}

.cut-pile-card.picked .pile-badge {
  display: inline-block;
}

.pile-symbol { font-size: 36px; margin-bottom: 8px; }
.pile-title { font-size: 15px; font-weight: 700; color: var(--gold-soft); }
.pile-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }
.cut-status-line { font-size: 13.5px; color: var(--gold-soft); }

/* Scene 7: Focused Single-Card Spotlight */
.tarot-card-slot.active-spotlight .flip-card-inner {
  box-shadow: 0 0 28px rgba(212, 175, 55, 0.75);
}

.single-card-spotlight {
  max-width: 860px;
  margin: 10px auto 28px;
  background: linear-gradient(160deg, rgba(25, 31, 53, 0.96), rgba(12, 15, 28, 0.98));
  border: 1.5px solid var(--gold);
  border-radius: 18px;
  padding: 24px;
  text-align: left;
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.6);
  animation: sceneFadeIn 0.35s ease-out;
}

.spotlight-grid {
  display: grid;
  grid-template-columns: 168px 1fr;
  gap: 24px;
  align-items: center;
}

@media (max-width: 680px) {
  .spotlight-grid {
    grid-template-columns: 1fr;
    justify-items: center;
  }
}

.spotlight-img-frame {
  width: 168px;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid var(--gold);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.65);
}

.spotlight-img-frame img {
  width: 100%;
  display: block;
}

.spotlight-actions {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.synthesis-divider {
  margin: 30px 0 22px;
  text-align: center;
  position: relative;
}

.synthesis-divider span {
  background: var(--bg-panel-elevated);
  border: 1px solid var(--gold);
  color: var(--gold-soft);
  padding: 6px 20px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 700;
}

.scene-footer-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
  flex-wrap: wrap;
}

/* ==========================================================================
   MULTI-DEVICE RESPONSIVE SYSTEM (Mobile / Tablet / Small Desktop / Touch)
   ========================================================================== */

/* Universal Safe Area & Touch Optimizations */
html, body {
  max-width: 100vw;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

button, input, select, textarea {
  font-family: inherit;
  touch-action: manipulation;
}

/* TABLET BREAKPOINT (<= 960px) */
@media (max-width: 960px) {
  .container {
    padding: 16px 16px 64px;
  }

  .reading-columns {
    grid-template-columns: 1fr;
  }
}

/* MOBILE LANDSCAPE & PHONES (<= 768px) */
@media (max-width: 768px) {
  .topbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    padding: max(8px, env(safe-area-inset-top)) 12px 10px;
    gap: 8px 10px;
  }

  .brand {
    order: 1;
    gap: 8px;
  }

  .brand-glyph {
    font-size: 20px;
  }

  .brand-title {
    font-size: 14px;
    letter-spacing: 1px;
  }

  .brand-sub {
    display: none;
  }

  .topbar-actions {
    order: 2;
    margin-left: auto;
    gap: 6px;
  }

  .lang-pill,
  .sound-pill,
  .llm-pill,
  .auth-pill {
    padding: 5px 8px;
    font-size: 11px;
    gap: 4px;
    border-radius: 999px;
    white-space: nowrap;
  }

  .auth-user-badge {
    padding: 4px 8px;
    gap: 4px;
    font-size: 11px;
  }

  .auth-user-email {
    max-width: 85px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Segmented Mobile Tabs */
  .nav-tabs {
    order: 3;
    width: 100%;
    margin-top: 2px;
    display: flex;
    background: rgba(18, 22, 38, 0.95);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 3px;
    gap: 3px;
  }

  .nav-tab {
    flex: 1;
    text-align: center;
    padding: 6px 4px;
    font-size: 11.5px;
    border-radius: 8px;
    white-space: nowrap;
  }

  .container {
    padding: 12px 10px 60px;
  }

  .scene-stage {
    padding: 0 2px;
  }

  .scene-title {
    font-size: 19px;
    line-height: 1.35;
    margin-bottom: 6px;
  }

  .scene-subtitle {
    font-size: 13px;
    line-height: 1.45;
    margin-bottom: 18px;
  }

  /* Scene 6: Responsive 78-Card Mosaic Deck (No horizontal overflow!) */
  .fan-deck {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
    gap: 5px;
    max-width: 100%;
    margin: 0 auto;
  }

  .deck-card-back {
    height: 58px;
    font-size: 9px;
    border-radius: 6px;
  }

  .picked-slots-bar {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 4px 2px 10px;
    justify-content: flex-start;
  }

  .slot-pill {
    flex-shrink: 0;
    min-width: 76px;
    padding: 6px 8px;
  }

  /* Scene 7: Reveal & Grand Synthesis */
  .reading-header-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .draw-question {
    font-size: 16px;
    line-height: 1.4;
  }

  .reading-top-btns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
  }

  .reading-top-btns .btn-primary,
  .reading-top-btns .btn-secondary,
  .reading-top-btns .btn-ghost {
    width: 100%;
    text-align: center;
    justify-content: center;
    padding: 10px 8px;
    font-size: 12px;
  }

  .spread-stage-grid {
    gap: 12px;
    margin-bottom: 18px;
  }

  .tarot-card-slot {
    width: min(175px, 44vw);
    perspective: 900px;
  }

  .flip-card-inner {
    width: min(175px, 44vw);
    height: 280px;
  }

  .card-art-box {
    height: 98px;
    margin: 4px 0;
    padding: 4px;
  }

  .art-glyph {
    font-size: 26px;
  }

  .art-symbolism {
    font-size: 9px;
    line-height: 1.25;
  }

  .card-name-zh {
    font-size: 13.5px;
  }

  .card-name-en {
    font-size: 10px;
  }

  .card-keywords {
    font-size: 9px;
  }

  .single-card-spotlight {
    padding: 16px 12px;
    border-radius: 14px;
    margin-bottom: 20px;
  }

  .spotlight-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .spotlight-img-frame {
    width: 120px;
    margin: 0 auto;
  }

  .spotlight-actions {
    justify-content: stretch;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .spotlight-actions button {
    width: 100%;
    text-align: center;
    justify-content: center;
  }

  .card-panel {
    padding: 16px 12px;
    border-radius: 14px;
  }

  .followup-input-row {
    flex-direction: column;
    gap: 8px;
  }

  .followup-input-row input {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
  }

  .followup-input-row button {
    width: 100%;
    padding: 10px;
    font-size: 13px;
  }

  .journal-row {
    flex-direction: column;
    gap: 8px;
  }

  .journal-row input,
  .journal-row select,
  .journal-row button {
    width: 100%;
    padding: 10px 12px;
    font-size: 13px;
  }

  /* Encyclopedia Grid */
  .encyclopedia-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
  }

  .filter-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }
}

/* NARROW PHONE BREAKPOINT (<= 480px, e.g. iPhone SE / 13 / 14 / 15 / Android) */
@media (max-width: 480px) {
  /* Scene 1: Velvet Altar Scaling */
  .velvet-altar-circle {
    width: min(280px, 86vw);
    height: min(280px, 86vw);
    margin: 0 auto 18px;
  }

  .altar-center-sigil {
    font-size: 30px;
  }

  .altar-pedestal {
    width: 74px;
    padding: 5px 3px;
    border-radius: 10px;
  }

  .pos-north { top: 8px; left: calc(50% - 37px); }
  .pos-south { bottom: 8px; left: calc(50% - 37px); }
  .pos-east  { right: 5px; top: calc(50% - 30px); }
  .pos-west  { left: 5px; top: calc(50% - 30px); }

  .ped-dir { font-size: 8.5px; }
  .ped-icon { font-size: 16px; }
  .ped-name { font-size: 9.5px; }

  .talisman-choice-row {
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
    margin: 0 auto 16px;
    max-width: 100%;
  }

  .talisman-choice-card {
    padding: 10px 4px;
    border-radius: 10px;
    gap: 4px;
  }

  .talisman-choice-card .t-icon {
    font-size: 22px;
  }

  .talisman-choice-card .t-name {
    font-size: 11px;
  }

  .talisman-choice-card .t-desc {
    font-size: 9px;
    line-height: 1.25;
  }

  /* Scene 2: Breath & Prompts */
  .breath-orb-large {
    width: 105px;
    height: 105px;
    font-size: 12px;
    margin: 0 auto 14px;
  }

  .topic-row {
    gap: 5px;
  }

  .topic-chip {
    padding: 5px 9px;
    font-size: 11.5px;
  }

  .prompt-tag {
    font-size: 10.5px;
    padding: 4px 7px;
  }

  .spread-compact-row {
    display: flex;
    gap: 5px;
    overflow-x: auto;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
  }

  .spread-compact-pill {
    flex-shrink: 0;
    padding: 5px 10px;
    font-size: 11.5px;
  }

  /* Scene 3: Knock */
  .deck-3d-stack {
    width: 105px;
    height: 150px;
  }

  .deck-knock-prompt {
    font-size: 11.5px;
  }

  /* Scene 4: Vortex Swirl */
  .vortex-table {
    height: 220px;
    max-width: 100%;
    border-radius: 14px;
    margin: 0 auto 16px;
    touch-action: none;
  }

  /* Scene 5: Three Piles Cut */
  .three-piles-stage {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    max-width: 100%;
    margin: 0 auto 16px;
  }

  .cut-pile-card {
    padding: 12px 4px;
    border-radius: 10px;
  }

  .pile-symbol {
    font-size: 24px;
    margin-bottom: 3px;
  }

  .pile-title {
    font-size: 11.5px;
  }

  .pile-sub {
    font-size: 8.5px;
    line-height: 1.2;
  }

  /* Modals as Mobile Sheets */
  .modal-backdrop {
    padding: 8px;
    align-items: flex-end;
  }

  .modal-card {
    width: 100%;
    max-width: 100%;
    max-height: 88vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 18px 14px;
    border-radius: 18px 18px 6px 6px;
  }

  .auth-tabs {
    display: flex;
    gap: 4px;
  }

  .auth-tab-btn {
    flex: 1;
    padding: 8px 3px;
    font-size: 10.5px;
    text-align: center;
  }

  .modal-footer button {
    width: 100%;
    padding: 12px;
    font-size: 13.5px;
  }
}
