/* ============================================================
   tarot.css — Mystical purple/gold dark theme
   ============================================================ */

:root {
  --font-heading: 'Be Vietnam Pro', sans-serif;
  --font-body:    'Be Vietnam Pro', sans-serif;
  --bg:           #0d0a1f;
  --bg-surface:   rgba(255,255,255,0.05);
  --bg-glass:     rgba(255,255,255,0.08);
  --text:         #f0eeff;
  --muted:        rgba(240,238,255,0.45);
  --border:       rgba(192,132,252,0.2);
  --purple:       #c084fc;
  --purple-dim:   rgba(192,132,252,0.35);
  --gold:         #d4a642;
  --gold-dim:     rgba(212,166,66,0.35);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
button, input, textarea, select, a { touch-action: manipulation; }
html { font-size: 16px; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(120,60,200,0.18) 0%, transparent 55%),
    radial-gradient(ellipse at 80% 100%, rgba(60,0,120,0.15) 0%, transparent 55%);
  color: var(--text);
  min-height: 100dvh;
  overflow-x: hidden;
}
a { text-decoration: none; color: inherit; }

/* ---- Header ---- */
.t-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 12px 16px;
  background: rgba(13,10,31,0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.btn-back {
  font-size: 13px;
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 8px;
  transition: color 0.2s, background 0.2s;
  justify-self: start;
}
.btn-back:hover { color: var(--text); background: var(--bg-surface); }
.t-header-title {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 800;
  color: var(--purple);
  text-shadow: 0 0 12px var(--purple-dim);
}
.btn-ghost {
  font-size: 13px;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  transition: color 0.2s, background 0.2s;
}
.btn-ghost:hover { color: var(--text); background: var(--bg-surface); }

/* ---- Screens ---- */
.screen {
  display: none;
  min-height: calc(100dvh - 50px);
}
.screen.active { display: block; }
.screen-inner {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 16px 40px;
  transition: max-width 0.3s ease;
}
.screen-inner.center {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* ---- Hero (spread chooser) ---- */
.t-hero { text-align: center; margin-bottom: 32px; }
.t-orb {
  font-size: 72px;
  display: block;
  animation: orb-float 4s ease-in-out infinite;
  filter: drop-shadow(0 0 24px rgba(192,132,252,0.5));
}
@keyframes orb-float {
  0%,100% { transform: translateY(0) scale(1); filter: drop-shadow(0 0 20px rgba(192,132,252,0.4)); }
  50%      { transform: translateY(-12px) scale(1.04); filter: drop-shadow(0 0 36px rgba(192,132,252,0.7)); }
}
.t-title {
  font-family: var(--font-heading);
  font-size: clamp(36px, 10vw, 56px);
  font-weight: 900;
  background: linear-gradient(135deg, #fff 20%, var(--purple) 60%, var(--gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 8px 0 10px;
}
.t-subtitle { font-size: 14px; color: var(--muted); line-height: 1.6; }

/* ---- Spread buttons ---- */
.spread-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}
.spread-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--bg-glass);
  cursor: pointer;
  color: var(--text);
  text-align: left;
  transition: all 0.25s ease;
  -webkit-tap-highlight-color: transparent;
}
.spread-btn:hover, .spread-btn:active {
  border-color: var(--purple);
  background: rgba(192,132,252,0.1);
  box-shadow: 0 0 20px rgba(192,132,252,0.2);
  transform: translateY(-2px);
}
.spread-icon { font-size: 24px; flex-shrink: 0; }
.spread-name { font-family: var(--font-heading); font-size: 18px; font-weight: 800; flex: 1; }
.spread-desc { font-size: 12px; color: var(--muted); }
.t-footer-note { text-align: center; font-size: 11px; color: var(--muted); letter-spacing: 1px; }

/* ---- Shuffle screen ---- */
.shuffle-prompt {
  font-size: 15px;
  color: var(--muted);
  margin-bottom: 32px;
  font-style: italic;
}
.deck-visual {
  position: relative;
  width: 130px;
  height: 200px;
  cursor: pointer;
  margin-bottom: 16px;
  -webkit-tap-highlight-color: transparent;
}
.deck-card {
  position: absolute;
  width: 110px;
  height: 175px;
  border-radius: 12px;
  background: linear-gradient(145deg, #2d1b5e, #1a0f3d);
  border: 1.5px solid rgba(192,132,252,0.4);
  left: 50%;
  top: 50%;
  transform-origin: center center;
  transition: transform 0.35s cubic-bezier(.34,1.56,.64,1);
}
.deck-card::after {
  content: '🔮';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 32px;
  opacity: 0.4;
}
.dc-1 { transform: translate(-50%, -50%) rotate(-3deg); box-shadow: 0 8px 30px rgba(192,132,252,0.25); }
.dc-2 { transform: translate(-50%, -50%) rotate(0deg) translateY(-4px); }
.dc-3 { transform: translate(-50%, -50%) rotate(3deg) translateY(-8px); }

.deck-visual:active .dc-1 { transform: translate(-50%, -50%) rotate(-12deg) translateX(-30px); }
.deck-visual:active .dc-3 { transform: translate(-50%, -50%) rotate(12deg) translateX(30px); }

.shuffle-hint { font-size: 13px; color: var(--muted); margin-bottom: 20px; }
.shuffle-progress { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 24px; }
.shuffle-dots { display: flex; gap: 8px; }
.sdot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  transition: all 0.3s ease;
}
.sdot.done { background: var(--purple); border-color: var(--purple); box-shadow: 0 0 8px var(--purple-dim); }
#shuffle-count-text { font-size: 13px; color: var(--muted); }

/* ---- Primary button ---- */
.btn-tarot-primary {
  width: 100%;
  padding: 16px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, #7c3aed, #9333ea, #c084fc);
  color: #fff;
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 0 24px rgba(192,132,252,0.4), 0 4px 16px rgba(0,0,0,0.4);
  transition: all 0.25s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn-tarot-primary:hover { transform: translateY(-2px); box-shadow: 0 0 36px rgba(192,132,252,0.55), 0 8px 24px rgba(0,0,0,0.4); }
.btn-tarot-primary:active { transform: scale(0.97); }

/* ---- Secondary button (subtle, for reset/new reading) ---- */
.btn-tarot-secondary {
  display: block;
  width: auto;
  min-width: 200px;
  margin: 32px auto 0;
  padding: 12px 24px;
  border-radius: 12px;
  border: 1.5px solid rgba(255,255,255,0.15);
  background: transparent;
  color: rgba(255,255,255,0.45);
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.22s ease;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
}
.btn-tarot-secondary:hover {
  border-color: rgba(192,132,252,0.5);
  color: #c084fc;
  background: rgba(192,132,252,0.07);
  transform: translateY(-1px);
}
.btn-tarot-secondary:active { transform: scale(0.98); }

/* ---- Reading screen ---- */
.spread-label {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 20px;
}
.cards-layout {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 32px;
  isolation: isolate; /* contain 3D card stacking contexts */
}

/* Individual drawn card (3D Flip container) */
.drawn-card {
  position: relative;
  width: 110px;
  height: 176px;
  perspective: 1000px;
  cursor: pointer;
  margin-bottom: 24px;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.2s ease;
}
.drawn-card:hover { transform: translateY(-4px); }

.dc-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
}
.drawn-card.revealed .dc-card-inner {
  transform: rotateY(180deg);
}

.dc-card-back, .dc-card-front {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 10px;
  border: 1.5px solid rgba(192,132,252,0.3);
  box-shadow: 0 6px 20px rgba(0,0,0,0.5);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Card Back Design */
.dc-card-back {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(212,166,66,0.15) 0%, transparent 60%),
    radial-gradient(ellipse at 50% 100%, rgba(192,132,252,0.18) 0%, transparent 60%),
    linear-gradient(145deg, #2d1b5e, #1a0f3d);
  color: var(--purple);
  position: relative;
}
.dc-card-back::before {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 8px;
  pointer-events: none;
  border: 0.5px solid rgba(212, 166, 66, 0.25);
  z-index: 1;
}
.dc-card-back::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 8px;
  pointer-events: none;
  background: linear-gradient(
    135deg,
    transparent 40%,
    rgba(255, 255, 255, 0.06) 45%,
    rgba(255, 255, 255, 0.15) 50%,
    rgba(255, 255, 255, 0.06) 55%,
    transparent 60%
  );
  background-size: 250% 250%;
  background-position: 200% 0;
  transition: background-position 0.6s ease;
  z-index: 2;
}
.drawn-card:hover .dc-card-back::after {
  background-position: -50% 0;
}
.dc-back-pattern {
  width: 78%;
  height: auto;
  filter: drop-shadow(0 0 10px rgba(192,132,252,0.55));
  animation: pulse-glow 3s infinite ease-in-out;
}
@keyframes pulse-glow {
  0%, 100% { transform: scale(1) rotate(0deg);    opacity: 0.85; filter: drop-shadow(0 0 6px rgba(192,132,252,0.45)); }
  50%      { transform: scale(1.04) rotate(0.5deg); opacity: 1;    filter: drop-shadow(0 0 14px rgba(192,132,252,0.8)); }
}

/* Card Front Design */
.dc-card-front {
  background: #0d0a1f;
  transform: rotateY(180deg);
  border-color: var(--gold);
}
.dc-card-front.reversed img {
  transform: rotate(180deg);
}
.dc-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.drawn-card.active-card .dc-card-front {
  border-color: #fff;
  box-shadow: 0 0 20px rgba(192,132,252,0.6), 0 6px 20px rgba(0,0,0,0.6);
}

.dc-symbol { font-size: 28px; }
.dc-vn-name {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(13, 10, 31, 0.85);
  color: var(--gold);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  padding: 6px 4px;
  backdrop-filter: blur(4px);
  border-top: 1px solid rgba(212,166,66,0.25);
  line-height: 1.2;
}
.dc-position-label {
  position: absolute;
  bottom: -24px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  pointer-events: none;
}
.dc-reveal-hint {
  font-size: 8px;
  color: rgba(192,132,252,0.5);
  margin-top: 4px;
}

/* ---- Reading detail ---- */
.reading-detail {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px;
  backdrop-filter: blur(12px);
  animation: slide-up 0.35s ease;
}
@keyframes slide-up {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
.reading-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}
.detail-symbol { font-size: 48px; flex-shrink: 0; }
.detail-position {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--purple);
  font-weight: 700;
  margin-bottom: 2px;
}
.detail-name {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 900;
  color: #fff;
}
.detail-number { font-size: 11px; color: var(--muted); margin-top: 2px; }
.detail-orientation {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  flex-shrink: 0;
}
.detail-orientation.upright {
  background: rgba(74,222,128,0.15);
  color: #4ade80;
  border: 1px solid rgba(74,222,128,0.3);
}
.detail-orientation.reversed {
  background: rgba(251,113,133,0.15);
  color: #fb7185;
  border: 1px solid rgba(251,113,133,0.3);
}

.detail-keywords {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.keyword-tag {
  font-size: 10px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  background: rgba(192,132,252,0.12);
  border: 1px solid rgba(192,132,252,0.25);
  color: var(--purple);
}
.detail-meaning {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
  margin-bottom: 14px;
}
.detail-advice-box {
  background: rgba(212,166,66,0.08);
  border: 1px solid rgba(212,166,66,0.25);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 10px;
}
.advice-label { font-size: 11px; font-weight: 700; color: var(--gold); display: block; margin-bottom: 6px; }
.detail-advice { font-size: 13px; color: var(--text); font-style: italic; line-height: 1.6; }
.detail-element { font-size: 12px; color: var(--muted); text-align: right; }

/* ---- Question input ---- */
.question-box {
  width: 100%;
  margin-bottom: 20px;
}
.question-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--purple);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}
.question-input {
  width: 100%;
  background: rgba(192,132,252,0.06);
  border: 1.5px solid rgba(192,132,252,0.25);
  border-radius: 12px;
  padding: 12px 14px;
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--text);
  resize: none;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.question-input::placeholder { color: rgba(255, 255, 255, 0.35) !important; opacity: 1; }
.question-input:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(192,132,252,0.12);
}
.suggested-questions {
  width: 100%;
  margin-top: 10px;
  margin-bottom: 4px;
  text-align: left;
}
.sq-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  display: block;
  margin-bottom: 6px;
}
.sq-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.sq-tag {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 12px;
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
}
.sq-tag:hover {
  background: rgba(192, 132, 252, 0.15);
  border-color: var(--purple);
  color: #fff;
  transform: translateY(-1px);
}
.sq-tag:active {
  transform: translateY(0);
}
.question-hint { font-size: 11px; color: var(--muted); margin-top: 6px; }

/* ---- AI Section ---- */
.ai-section {
  width: 100%;
  background: rgba(192,132,252,0.05);
  border: 1px solid rgba(192,132,252,0.2);
  border-radius: 18px;
  padding: 18px;
  margin-bottom: 12px;
}
.ai-section.gemini-glow-border {
  background-image: linear-gradient(#100a1c, #100a1c), 
                    linear-gradient(90deg, #4285f4, #9b72ff, #d96570, #f48b36, #4285f4) !important;
}
.ai-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}
.ai-icon { font-size: 28px; flex-shrink: 0; }
.ai-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--purple);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}
.ai-question-display {
  font-size: 13px;
  color: var(--text);
  font-style: italic;
  line-height: 1.4;
}
.ai-response {
  min-height: 48px;
  margin-bottom: 14px;
}
.ai-loading {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 0;
}
.ai-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--purple);
  animation: ai-pulse 1.2s ease-in-out infinite;
}
.ai-dot:nth-child(2) { animation-delay: 0.2s; }
.ai-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes ai-pulse {
  0%,100% { opacity: 0.3; transform: scale(0.8); }
  50%      { opacity: 1;   transform: scale(1.1); }
}
.ai-loading-text { font-size: 13px; color: var(--muted); margin-left: 4px; }
.ai-text {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text);
  white-space: pre-wrap;
}
.ai-error { font-size: 13px; color: #fb7185; }

.btn-ask-ai {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  border: 1.5px solid rgba(192,132,252,0.4);
  background: rgba(192,132,252,0.1);
  color: var(--purple);
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn-ask-ai:hover {
  background: rgba(192,132,252,0.18);
  border-color: var(--purple);
  box-shadow: 0 0 16px rgba(192,132,252,0.25);
}
.btn-ask-ai:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---- Hold-to-shuffle ---- */
.hold-progress-track {
  width: 160px;
  height: 4px;
  background: rgba(192,132,252,0.15);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 20px;
}
.hold-progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 2px;
  background: linear-gradient(90deg, #7c3aed, #c084fc);
  box-shadow: 0 0 8px rgba(192,132,252,0.5);
  transition: width 0.3s ease;
}
@keyframes hold-glow {
  0%,100% { filter: drop-shadow(0 0 10px rgba(192,132,252,0.35)); }
  50%      { filter: drop-shadow(0 0 28px rgba(192,132,252,0.8)); }
}
.deck-visual.holding { animation: hold-glow 0.7s ease-in-out infinite; }
.deck-visual.shuffle-done .deck-card {
  border-color: var(--gold);
  box-shadow: 0 0 20px rgba(212,166,66,0.35), 0 4px 16px rgba(0,0,0,0.5);
}

/* ---- AI Chat ---- */
.ai-chat-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 10px;
  padding-right: 2px;
}
.chat-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.75;
  word-break: break-word;
  max-width: 88%;
  animation: bubble-in 0.25s ease;
}
/* Markdown styling inside chat bubbles */
.chat-bubble h1, .chat-bubble h2, .chat-bubble h3, .chat-bubble .chat-heading {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  color: var(--purple);
  margin-top: 12px;
  margin-bottom: 6px;
}
.chat-bubble h1:first-child, .chat-bubble h2:first-child, .chat-bubble h3:first-child, .chat-bubble .chat-heading:first-child {
  margin-top: 0;
}
.chat-bubble p, .chat-bubble .chat-p {
  margin-bottom: 8px;
  line-height: 1.6;
}
.chat-bubble p:last-child, .chat-bubble .chat-p:last-child {
  margin-bottom: 0;
}
.chat-bubble ul, .chat-bubble .chat-list {
  margin-left: 18px;
  margin-bottom: 8px;
  list-style-type: disc;
}
.chat-bubble li {
  margin-bottom: 4px;
  line-height: 1.5;
}
.chat-bubble hr, .chat-bubble .chat-hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 12px 0;
}
.chat-bubble .chat-break {
  height: 8px;
}
@keyframes bubble-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.chat-user {
  align-self: flex-end;
  background: rgba(192,132,252,0.14);
  border: 1px solid rgba(192,132,252,0.28);
  color: var(--text);
}
.chat-ai {
  align-self: flex-start;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  color: var(--text);
}
.chat-bubble.chat-error {
  background: rgba(251,113,133,0.08);
  border-color: rgba(251,113,133,0.3);
  color: #fb7185;
}
.btn-retry {
  border: 1.5px solid rgba(251,113,133,0.4);
  background: rgba(251,113,133,0.08);
  color: #fb7185;
  font-family: var(--font-heading);
}
.btn-retry:hover { background: rgba(251,113,133,0.18); color: #fda4af; transform: translateY(-1px); }
.ai-loading {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 0 10px;
}
.ai-chat-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 6px;
}
.ai-chat-input {
  flex: 1;
  background: rgba(255,255,255,0.05);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--text);
  outline: none;
  min-width: 0;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.ai-chat-input::placeholder { color: rgba(255, 255, 255, 0.35) !important; opacity: 1; }
.ai-chat-input:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(192,132,252,0.1);
}
.ai-chat-input:disabled { opacity: 0.5; }
.btn-chat-send {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, #7c3aed, #c084fc);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(192,132,252,0.4);
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.btn-chat-send:hover { opacity: 0.9; transform: scale(1.06); }
.btn-chat-send:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

/* ---- Utilities ---- */
.hidden { display: none !important; }

/* ============================================================
   Responsive Redesign for Tablet and Desktop
   ============================================================ */

@media (min-width: 768px) {
  .screen-inner {
    max-width: 720px;
    padding: 32px 24px 60px;
  }
  
  /* Spread choices row */
  .spread-options {
    flex-direction: row;
    gap: 16px;
  }
  .spread-btn {
    flex: 1;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 24px 16px;
    gap: 10px;
  }
  .spread-icon {
    font-size: 36px;
  }
  .spread-name {
    font-size: 20px;
  }
  .spread-desc {
    font-size: 13px;
  }

  /* Deck scale up */
  .deck-visual {
    width: 170px;
    height: 270px;
    margin-bottom: 24px;
  }
  .deck-card {
    width: 150px;
    height: 240px;
  }
  .deck-card::after {
    font-size: 48px;
  }
  .hold-progress-track {
    width: 200px;
    height: 6px;
  }

  /* Cards scale up */
  .drawn-card {
    width: 150px;
    height: 240px;
    margin-bottom: 32px;
  }
  .dc-card-back, .dc-card-front {
    border-radius: 14px;
    border-width: 2px;
  }
  .dc-back-pattern {
    font-size: 40px;
  }
  .dc-vn-name {
    font-size: 13px;
    padding: 7px 4px;
    border-top-width: 1.5px;
  }
  .dc-position-label {
    bottom: -28px;
    font-size: 12px;
  }
  .cards-layout {
    gap: 20px;
    margin-bottom: 32px;
  }
}

@media (min-width: 1024px) {
  .screen-inner {
    max-width: 1000px;
  }
  
  /* Desktop reading screen: normal block flow (avoids backdrop-filter stacking context issues) */
  #screen-reading .screen-inner {
    max-width: 1100px;
  }

  #screen-reading .spread-label {
    text-align: center;
    margin-bottom: 24px;
  }

  #screen-reading #cards-layout {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: center;
    gap: 24px;
    margin-bottom: 40px;
  }

  #screen-reading #reading-detail {
    max-width: 760px;
    margin: 0 auto 24px;
  }

  #screen-reading #ai-section {
    max-width: 760px;
    margin: 0 auto;
  }

  #screen-reading #btn-new-reading {
    display: block;
    margin: 24px auto 0;
  }

  /* Make Tarot cards larger on desktop */
  .drawn-card {
    width: 190px;
    height: 304px;
  }
  
  .dc-back-pattern {
    font-size: 48px;
  }
  
  .dc-vn-name {
    font-size: 14px;
    padding: 9px 4px;
  }
  
  /* Header styling adjust */
  .t-header {
    padding: 16px 32px;
  }
  .t-header-title {
    font-size: 20px;
  }
  .btn-back, .btn-ghost {
    font-size: 14px;
    padding: 8px 14px;
  }
}

@media (min-width: 1200px) {
  .screen-inner {
    max-width: 1160px;
  }
  #screen-reading .screen-inner {
    max-width: 1200px;
  }
  .drawn-card {
    width: 210px;
    height: 336px;
  }
}

/* ---- History modal — tarot theme overrides (structure in common.css) ---- */
.history-backdrop { background: rgba(5, 2, 18, 0.7); backdrop-filter: blur(8px); }
.history-modal {
  background: #1a1331;
  border: 1px solid var(--border);
  border-bottom: none;
  box-shadow: 0 -8px 32px rgba(120, 60, 200, 0.25);
}
@media (min-width: 640px) {
  .history-modal { border-bottom: 1px solid var(--border); }
}
.history-header { border-bottom: 1px solid var(--border); }
.history-title {
  font-family: var(--font-heading);
  color: var(--purple);
  text-shadow: 0 0 12px var(--purple-dim);
}
.history-close { color: var(--muted); }
.history-close:hover { background: rgba(192,132,252,0.12); color: var(--text); }
.history-empty { color: var(--muted); }
.history-item {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
}
.history-card {
  display: inline-block;
  padding: 3px 10px; border-radius: 20px;
  background: rgba(192,132,252,0.12);
  border: 1px solid var(--purple-dim);
  color: var(--purple);
  font-size: 12px; font-weight: 600;
}
.history-question { color: var(--text); opacity: 0.85; }
.history-time { color: var(--muted); }
.history-clear {
  border: 1px solid rgba(251,113,133,0.3);
  background: rgba(251,113,133,0.08);
  color: #fb7185;
}
.history-clear:hover { background: rgba(251,113,133,0.18); }
