/* =========================================
   TAROT READER – CSS (đã rút gọn bề ngang controls)
========================================= */

/* ---------- Palette & base ---------- */
:root{
  --tarot-bg:#0b0714;
  --tarot-text:#EADAFD;
  --tarot-white:#fff;
  --tarot-purple-1:#8b5cf6;
  --tarot-purple-2:#6b21a8;
  --tarot-accent:#7b61ff;
  --tarot-border:#c4a6ff;
  --tarot-shadow:rgba(107,33,168,.50);
  --tarot-soft:rgba(118,80,255,.35);
}

/* Scope */
#tarot-app.tarot-theme{
  max-width: 880px;             /* thu gọn tổng thể */
  margin:0 auto;
  padding:32px 16px 48px;
  color:var(--tarot-text);
}

/* ===== Hero (tiêu đề mới) ===== */
#tarot-app .hero{ text-align:center; margin:6px 0 18px; }
#tarot-app .hero-title{
  font-size:28px; font-weight:800; letter-spacing:.06em;
  text-shadow:0 10px 36px var(--tarot-soft);
}
#tarot-app .hero-sub{ font-size:14px; letter-spacing:.18em; opacity:.95; }

/* ===== Controls ===== */
#tarot-app .tarot-filters.pretty{
  display:grid; grid-template-columns:1fr;
  justify-items:center; row-gap:12px;
  margin:16px auto 14px; max-width:640px; /* đồng bộ bề ngang */
}

/* Select + nút cùng bề ngang */
#tarot-app .pretty-select{ position:relative; width:100%; }
#tarot-app .pretty-select select,
#tarot-app .btn-cta{
  width:min(640px, 86vw);       /* rút ngắn */
  box-sizing:border-box;
}

/* Select */
#tarot-app .pretty-select select{
  appearance:none;
  height:54px;
  padding:12px 44px 12px 16px;
  font-weight:800; letter-spacing:.06em;
  border-radius:12px;
  color:#1A1033;
  background:var(--tarot-white);
  border:2px solid rgba(196,166,255,.9);
  box-shadow:0 10px 22px rgba(108,53,255,.25), inset 0 0 0 1px rgba(177,140,255,.18);
}
#tarot-app .pretty-select::after{
  content:"▾"; position:absolute; right:14px; top:50%; transform:translateY(-50%);
  color:var(--tarot-accent); font-size:18px; pointer-events:none;
}
/* Placeholder màu nhạt */
#tarot-app .pretty-select select:has(option[value=""]:checked){ color:#7a6f9a; }

/* CTA button */
#tarot-app .btn-cta{
  height:56px; padding:0 28px; border:0; border-radius:12px; cursor:pointer;
  font-weight:800; letter-spacing:.06em; font-size:16px; color:#fff;
  background:linear-gradient(180deg, var(--tarot-purple-1), var(--tarot-purple-2));
  box-shadow:0 14px 32px var(--tarot-shadow), inset 0 0 0 2px rgba(255,255,255,.12);
}
#tarot-app .btn-cta:disabled{ filter:grayscale(1) brightness(.8); cursor:not-allowed; }

/* Step text */
#tarot-app .step-text{ text-align:center; margin:12px 0 6px; color:#F3EFFF; font-size:16px; font-weight:600; opacity:.95; }

/* ===== Deck area ===== */
#tarot-app #deckArea{ position:relative; height:460px; margin:8px auto; max-width:900px; }
.deck-card{ position:absolute; width:86px; height:130px; border-radius:12px; cursor:pointer;
  box-shadow:0 10px 26px rgba(0,0,0,.35);
  transition:left .8s cubic-bezier(.22,.61,.36,1), top .8s cubic-bezier(.22,.61,.36,1), transform .8s ease, box-shadow .2s ease;
  perspective:900px;
}
.deck-card .card-inner{ width:100%; height:100%; transform-style:preserve-3d; transition:transform .5s ease; }
.card-face{ position:absolute; inset:0; backface-visibility:hidden; border-radius:12px; overflow:hidden; }
.card-face img{ width:100%; height:100%; object-fit:cover; }
.card-face.front{ transform:rotateY(180deg); }
.is-down .card-inner{ transform:rotateY(0); }
.is-up .card-inner{ transform:rotateY(180deg); }

/* Fly card (lá bay) */
.fly-card{ position:absolute; width:168px; height:252px; transition:left 1s ease, top 1s ease, transform .8s ease; perspective:900px; z-index:999; }
.fly-card .inner{ width:100%; height:100%; transform-style:preserve-3d; transition:transform .8s ease; }
.fly-card .front, .fly-card .back{ position:absolute; inset:0; backface-visibility:hidden; border-radius:14px; overflow:hidden; box-shadow:0 18px 36px rgba(0,0,0,.45); }
.fly-card .back{ transform:rotateY(180deg); }

/* Lật lá & xoay ngược */
.fly-card.flipped .inner{ transform:rotateY(180deg); }
.fly-card.is-rev.flipped .inner{ transform:rotateY(180deg) rotate(180deg) !important; }
.fly-card.is-rev .back img{ transform:rotate(180deg); }

/* Spread area */
#tarot-app #spreadArea{ position:relative; min-height:380px; margin-top:4px; text-align:center; }
.slot{ width:168px; height:252px; display:inline-block; margin:0 22px; vertical-align:top; }
.slot-meaning{ width:168px; display:inline-block; margin:10px 22px 0; color:#f2eaff; font-size:15px; line-height:1.45; vertical-align:top; text-shadow:0 2px 14px rgba(0,0,0,.35); }

/* Nút xem ý nghĩa */
.btn-meaning{ margin-top:16px; padding:14px 22px; border:0; border-radius:10px; cursor:pointer; font-weight:800; letter-spacing:.06em; color:#fff;
  background:linear-gradient(180deg,#7c3aed,#5b21b6);
  box-shadow:0 12px 26px rgba(91,33,182,.45), inset 0 0 0 1px rgba(255,255,255,.12);
}

/* Meaning vertical (phần dưới) */
.meaning-vertical{ max-width:1100px; margin:28px auto 60px; padding:0 16px; }
.mv-row{ display:flex; gap:28px; align-items:flex-start; margin:42px 0; }
.mv-card img{ width:180px; height:270px; object-fit:cover; border-radius:14px; box-shadow:0 20px 50px rgba(0,0,0,.35); }
.mv-card img.rev{ transform:rotate(180deg); }
.mv-text{ color:#EADAFD; line-height:1.7; font-size:16px; }
.mv-title{ font-weight:800; letter-spacing:.02em; margin-bottom:8px; opacity:.95; }
.mv-content p{ margin:10px 0; }

@media (max-width:1024px){ #tarot-app #deckArea{ max-width:820px; } }
@media (max-width:768px){
  #tarot-app #deckArea{ height:420px; }
  .mv-row{ flex-direction:column; align-items:center; text-align:left; }
  .mv-card img{ width:160px; height:240px; }
}
@media (max-width:480px){
  #tarot-app #deckArea{ height:400px; }
  .slot{ width:140px; height:210px; margin:0 10px; }
  .slot-meaning{ width:140px; margin:10px 10px 0; font-size:14px; }
  .fly-card{ width:140px; height:210px; }
}
/* Responsive cho mobile */
@media (max-width: 768px) {
  #tarot-app .tarot-cards {
    justify-content: center;
    flex-wrap: nowrap;
    overflow-x: auto;         /* Cho phép vuốt ngang nếu nhiều lá */
    padding: 0 10px;
  }

  #tarot-app .tarot-card {
    flex: 0 0 90px;           /* mỗi lá nhỏ lại */
    height: 150px;
    margin: 0 6px;
  }

  #tarot-app .tarot-card img {
    width: 100%;
    height: auto;
    border-radius: 8px;
  }
}
/* ẨN mọi dòng ý nghĩa dưới 3 lá ở khu spread – chỉ hiện khi vào phần xem ý nghĩa */
#spreadArea .slot-meaning { 
  display: none !important;
}

/* Chống tràn ngang tổng thể */
body, #tarot-app { overflow-x: hidden; }

/* Co kích thước lá bài khi đã bay lên (trường hợp JS set width/height inline) */
@media (max-width: 480px) {
  /* kết quả 3 lá */
  .fly-card { width: 150px !important; height: 225px !important; }
  #tarot-app { padding: 0 8px; }
}
@media (max-width: 360px) {
  .fly-card { width: 140px !important; height: 210px !important; }
}
/* fallback: nếu vì lý do nào đó inline bị gỡ, vẫn ép được */
.fly-card.is-rev.flipped > .inner {
  transform: rotateY(180deg) rotate(180deg) !important;
}
/* đảm bảo ảnh mặt trước của lá ngược luôn xoay đúng chiều */
.fly-card.is-rev .back img { transform: rotate(180deg) !important; transform-origin: 50% 50%; }

/* và khi đã lật ra mặt trước, container vẫn chỉ lật 180° */
.fly-card.flipped > .inner { transform: rotateY(180deg) !important; }
.picked-labels{
  width:100%;
  color:#fff;
  font-size:14px;
  font-weight:600;
  line-height:1.25;
  text-shadow:0 1px 2px rgba(0,0,0,.45);
}
.picked-label{ white-space:nowrap; }

@media (max-width:480px){
  .picked-labels{ font-size:13px; }
}
.fly-card .caption {
  position: absolute;
  top: 100%;           /* ngay dưới lá */
  left: 50%;
  transform: translateX(-50%);
  margin-top: 6px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  text-align: center;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0,0,0,.6);
}
@media (max-width: 480px) {
  .fly-card .caption { font-size: 12px; }
}
/* ========== Accordion 'Hướng dẫn lấy mã code' – phiên bản gọn ========== */
/* Container chỉ là wrapper, không có nền trắng */
.cosmic-accordion{
  width:100%;
  max-width:740px;
  margin:10px auto 0;
}

/* Header: chỉ chữ + caret, nền trong suốt */
.cosmic-accordion .acc-header{
  display:inline-flex;
  align-items:center;
  gap:.4em;
  padding:0;                 /* không tạo box trắng */
  background:transparent;
  border:0;
  cursor:pointer;
  color:#fff;                /* cùng tone với trang */
  font-weight:700;
  font-size:16px;
  line-height:1.2;
}

/* Caret nhỏ nằm sát chữ cuối cùng */
.cosmic-accordion .acc-caret{
  width:8px; height:8px; position:relative; top:1px;
}
.cosmic-accordion .acc-caret::before{
  content:"";
  position:absolute; inset:0; margin:auto;
  width:8px; height:8px;
  border-right:2px solid #fff; border-bottom:2px solid #fff;
  transform:rotate(45deg);
  transition:transform .2s ease;
}
.cosmic-accordion.open .acc-caret::before{ transform:rotate(-135deg); }

/* Body: khi mở mới có hộp trắng */
.cosmic-accordion .acc-body{
  margin-top:10px;
  padding:12px 16px 16px;
  background:#fff;
  color:#222;
  border-radius:10px;
  box-shadow:0 8px 22px rgba(0,0,0,.18);
  line-height:1.6;
}
.cosmic-accordion .acc-body[hidden]{ display:none !important; }
.cosmic-accordion .acc-body ol{ padding-left:18px; margin:6px 0 0; }

@media (max-width:480px){
  .cosmic-accordion .acc-header{ font-size:15px; }
  .cosmic-accordion .acc-body{ font-size:14px; padding:10px 14px 14px; }
}
/* ===== Accordion – fix vị trí caret & màu nền phần thân ===== */

/* Bọc: bỏ nền và shadow của header box cũ */
#tarot-app .cosmic-accordion{
  background: transparent !important;
  box-shadow: none !important;
}

/* Nút tiêu đề: thu về theo chiều nội dung, caret sát chữ */
#tarot-app .cosmic-accordion .acc-header{
  width: auto !important;                  /* <— KHÔNG tràn full width nữa */
  display: inline-flex !important;
  align-items: center;
  gap: 8px;                                /* khoảng cách chữ ↔ caret */
  padding: 0 !important;
  margin: 6px 0 10px !important;
  background: transparent !important;
  border: 0 !important;
  cursor: pointer;
  color: #fff !important;                  /* chữ trắng trên nền tím */
  font-weight: 800;
  font-size: 16px;
}

/* Caret: đi theo chữ (không position: absolute) */
#tarot-app .cosmic-accordion .acc-caret{
  position: static !important;
  width: 12px; height: 12px;
}
#tarot-app .cosmic-accordion .acc-caret::before{
  content: "";
  display: block;
  width: 8px; height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform .2s ease;
}
#tarot-app .cosmic-accordion.open .acc-caret::before{
  transform: rotate(-135deg);
}

/* Phần thân khi xổ xuống: nền xám nhạt + chữ đen */
#tarot-app .cosmic-accordion .acc-body{
  background: #f5f5f5 !important;
  color: #111 !important;
  border-radius: 10px;
  padding: 14px 16px 16px;
  margin-top: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,.08);
}
/* đảm bảo tất cả chữ bên trong là đen (chống CSS cũ ghi đè) */
#tarot-app .cosmic-accordion .acc-body,
#tarot-app .cosmic-accordion .acc-body *{
  color: #111 !important;
}
#tarot-app .cosmic-accordion .acc-body ol{
  margin: 0; padding-left: 20px;
}
#tarot-app .cosmic-accordion .acc-body li{
  margin: 6px 0;
}

/* Mobile nhỏ */
@media (max-width: 480px){
  #tarot-app .cosmic-accordion .acc-header{ font-size: 15px; }
  #tarot-app .cosmic-accordion .acc-body{ font-size: 14px; }
}
/* ===== Accordion – fix vị trí caret & màu nền phần thân ===== */

/* Bọc: bỏ nền và shadow của header box cũ */
#tarot-app .cosmic-accordion{
  background: transparent !important;
  box-shadow: none !important;
}

/* Nút tiêu đề: thu về theo chiều nội dung, caret sát chữ */
#tarot-app .cosmic-accordion .acc-header{
  width: auto !important;                  /* <— KHÔNG tràn full width nữa */
  display: inline-flex !important;
  align-items: center;
  gap: 8px;                                /* khoảng cách chữ ↔ caret */
  padding: 0 !important;
  margin: 6px 0 10px !important;
  background: transparent !important;
  border: 0 !important;
  cursor: pointer;
  color: #fff !important;                  /* chữ trắng trên nền tím */
  font-weight: 800;
  font-size: 16px;
}

/* Caret: đi theo chữ (không position: absolute) */
#tarot-app .cosmic-accordion .acc-caret{
  position: static !important;
  width: 12px; height: 12px;
}
#tarot-app .cosmic-accordion .acc-caret::before{
  content: "";
  display: block;
  width: 8px; height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform .2s ease;
}
#tarot-app .cosmic-accordion.open .acc-caret::before{
  transform: rotate(-135deg);
}

/* Phần thân khi xổ xuống: nền xám nhạt + chữ đen */
#tarot-app .cosmic-accordion .acc-body{
  background: #f5f5f5 !important;
  color: #111 !important;
  border-radius: 10px;
  padding: 14px 16px 16px;
  margin-top: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,.08);
}
/* đảm bảo tất cả chữ bên trong là đen (chống CSS cũ ghi đè) */
#tarot-app .cosmic-accordion .acc-body,
#tarot-app .cosmic-accordion .acc-body *{
  color: #111 !important;
}
#tarot-app .cosmic-accordion .acc-body ol{
  margin: 0; padding-left: 20px;
}
#tarot-app .cosmic-accordion .acc-body li{
  margin: 6px 0;
}

/* Mobile nhỏ */
@media (max-width: 480px){
  #tarot-app .cosmic-accordion .acc-header{ font-size: 15px; }
  #tarot-app .cosmic-accordion .acc-body{ font-size: 14px; }
}
/* Vùng accordion */
.cosmic-accordion { width:100%; max-width:740px; margin:14px auto 0; }

/* Header chỉ là chữ, không đẩy mũi tên sang mép phải */
.cosmic-accordion .acc-header{
  background:transparent; border:0; cursor:pointer; padding:0;
  color:#fff; font-weight:800; font-size:20px; letter-spacing:.02em;
}

/* Neo ngay chữ "LẤY" để đặt mũi tên */
.cosmic-accordion .acc-anchor{
  position:relative; display:inline-block;
  padding-bottom:8px; /* có khoảng trống cho mũi tên */
}

/* Mũi tên nằm NGAY BÊN DƯỚI chữ "LẤY" */
.cosmic-accordion .acc-anchor::after{
  content:"▾";
  position:absolute; left:50%; top:100%;
  transform:translateX(-50%);
  font-size:14px; line-height:1; color:#fff;
  transition:transform .2s ease;
}

/* Khi mở -> mũi tên xoay ngược */
.cosmic-accordion.open .acc-anchor::after{
  transform:translateX(-50%) rotate(180deg);
}

/* Thân xổ xuống: nền xám nhạt, chữ đen (ép thắng) */
.cosmic-accordion .acc-body{
  margin-top:12px;
  padding:14px 18px;
  background:#f1f3f5 !important;   /* xám nhạt */
  color:#111 !important;            /* chữ đen */
  border-radius:10px;
  box-shadow:0 6px 18px rgba(0,0,0,.15);
}
.cosmic-accordion .acc-body ol{ margin:6px 0 0; padding-left:22px; }
/* Nút mở/đóng */
.guide-toggle{
  display:inline-block;
  padding:10px 16px;
  border-radius:10px;
  border:1px solid rgba(255,255,255,.25);
  background:transparent;
  color:#fff;
  font-weight:700;
  letter-spacing:.5px;
  cursor:pointer;
}
.guide-toggle:hover{ border-color:rgba(255,255,255,.45); }

/* Ẩn/hiện khối hướng dẫn */
.code-guide.is-hidden{ display:none !important; }
.code-guide.is-hidden { display: none !important; }
/* Ẩn “phần 1” cũ nếu theme còn giữ */
#tarot-app .step-text { display: none !important; }
/* Khối nhập code dưới phần ý nghĩa */
.cosmic-wrap { font-size: 18px; line-height: 1.7; }
.cosmic-intro { font-size: 20px; font-weight: 600; margin-bottom: 8px; }
.cosmic-row .btn-meaning { font-size: 16px; }
.cqr-heading{margin:4px 0 10px;font-size:22px;line-height:1.3;font-weight:800;color:#fff;text-align:left}
/* === Meaning list (3 lá) — to hơn & căn trái === */
.meaning-vertical {
  max-width: 1100px;
  margin: 32px auto 20px;
  padding: 0 16px;
  text-align: left;              /* bỏ căn giữa tổng */
}

.meaning-vertical .mv-row {
  display: flex;
  align-items: flex-start;
  gap: 22px;
  margin: 36px 0;
}

.meaning-vertical .mv-card {
  flex: 0 0 180px;               /* rộng mặc định cho ảnh lá bài */
}

.meaning-vertical .mv-card img {
  width: 100%;
  height: auto;                  /* giữ đúng tỉ lệ, không bị “ốm” */
  display: block;
  border-radius: 14px;           /* tuỳ style của bạn */
}

/* Text bên phải: căn trái hoàn toàn */
.meaning-vertical .mv-text {
  flex: 1;
  text-align: left;
}

.meaning-vertical .mv-title {
  font-size: 28px;
  line-height: 1.3;
  font-weight: 700;
  margin: 0 0 10px;
  text-align: left;
}

.meaning-vertical .mv-content {
  font-size: 18px;
  line-height: 1.85;
  text-align: left;
}

/* Mobile tối ưu */
@media (max-width: 640px) {
  .meaning-vertical .mv-row {
    gap: 16px;
  }
  .meaning-vertical .mv-card {
    flex-basis: 120px;           /* ảnh to hơn di động nhưng vừa mắt */
  }
  .meaning-vertical .mv-title { font-size: 22px; }
  .meaning-vertical .mv-content { font-size: 16.5px; line-height: 1.75; }
}

/* Tablet */
@media (min-width: 641px) and (max-width: 1024px) {
  .meaning-vertical .mv-card { flex-basis: 160px; }
  .meaning-vertical .mv-title { font-size: 24px; }
  .meaning-vertical .mv-content { font-size: 17.5px; }
}
#codeGuideWrap .btn-restart:hover{
  opacity:.95; transform: translateY(-1px);
}
