/* ============================================================
   xinxam.css — Warm Crafted Light Theme (Jade & Gold)
   ============================================================ */

:root {
  --font-heading: 'Be Vietnam Pro', sans-serif;
  --font-body:    'Be Vietnam Pro', sans-serif;

  --bg:           #fbf3e4;
  --bg-2:         #f5e8d8;
  --bg-surface:   #ffffff;
  --bg-glass:     rgba(185, 28, 28, 0.06);
  --text:         #3b2020;
  --text-secondary: #5d4a4a;
  --muted:        #9a8a8a;
  --border:       rgba(90, 30, 25, 0.13);

  --do:         #b91c1c; /* Jade */
  --do-dim:     rgba(185, 28, 28, 0.14);
  --gold:         #d98a0a; /* Warm gold */
  --gold-dim:     rgba(217, 138, 10, 0.16);

  --shadow:       0 6px 22px rgba(20, 70, 50, 0.10);
  --shadow-h:     0 16px 44px rgba(20, 70, 50, 0.16);
  --radius:       22px;
}

*, *::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-color: var(--bg);
  background-image:
    radial-gradient(ellipse 90% 55% at 50% -8%, var(--bg-2) 0%, transparent 70%);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }

/* Neutralize dark-theme ambient glows from common.css on this page */
.gemini-glow-1, .gemini-glow-2, .gemini-glow-3 { display: none !important; }



/* ---- Screens ---- */
.screen { display: none; min-height: calc(100dvh - 58px); }
.screen.active { display: block; animation: screen-fade-in 0.4s ease forwards; }

@keyframes screen-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.screen-inner {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 32px 20px 48px;
}
.screen-inner.center {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* ---- Hero ---- */
.xx-hero { text-align: center; margin-bottom: 28px; }

.yin-yang-anim {
  font-size: 80px;
  display: inline-block;
  animation: yy-spin 20s linear infinite;
  filter: drop-shadow(0 0 16px rgba(16, 185, 129, 0.35));
}
@keyframes yy-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.xx-title {
  font-family: var(--font-heading);
  font-size: clamp(38px, 11vw, 56px);
  font-weight: 900;
  background: linear-gradient(135deg, var(--text) 20%, var(--do) 65%, var(--gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 10px 0 12px;
}
.xx-subtitle { font-size: 13px; color: var(--muted); letter-spacing: 0.5px; }


/* ---- Question box ---- */
.question-box {
  width: 100%;
  background: var(--bg-surface);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  text-align: left;
  box-shadow: var(--shadow);
}
.question-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--do);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.question-input {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  resize: none;
  outline: none;
  transition: all 0.25s ease;
}
.question-input::placeholder {
  color: var(--muted) !important;
  opacity: 1;
}
.question-input:focus {
  border-color: rgba(185, 28, 28, 0.5);
  box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.12);
}
.suggested-questions {
  margin-top: 14px;
}
.sq-label {
  font-size: 11px;
  color: var(--muted);
  display: block;
  margin-bottom: 8px;
}
.sq-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.sq-tag {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 11.5px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.sq-tag:hover {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.3);
  color: var(--text);
  transform: translateY(-1px);
}
.question-hint {
  font-size: 11px;
  color: var(--muted);
  margin-top: 12px;
  text-align: right;
}


/* ---- Buttons ---- */
.btn-xx-primary {
  width: 100%;
  padding: 16px;
  border-radius: 16px;
  border: none;
  background: linear-gradient(135deg, var(--do) 0%, #047857 100%);
  color: #fff;
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.25);
  transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  -webkit-tap-highlight-color: transparent;
}
.btn-xx-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(16, 185, 129, 0.35);
  background: linear-gradient(135deg, #10b981 20%, #059669 100%);
}
.btn-xx-primary:active { transform: scale(0.98); }


/* ---- Lắc điện thoại gieo từng hào ---- */
.shake-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
}
.btn-shake {
  padding: 16px 44px;
  border-radius: 99px;
  border: none;
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: #fff;
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(185, 28, 28, 0.3);
  animation: pulse-shake 1.6s ease-in-out infinite;
}
.btn-shake:active { transform: scale(0.96); }
@keyframes pulse-shake {
  0%, 100% { transform: scale(1); box-shadow: 0 8px 24px rgba(185, 28, 28, 0.3); }
  50%      { transform: scale(1.05); box-shadow: 0 10px 30px rgba(185, 28, 28, 0.45); }
}
.shake-hint {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
}
.shake-hint.no-shake { display: none; }
.shake-status.waiting .shake-status-coin {
  animation: coin-bounce 1s ease-in-out infinite;
}
@keyframes coin-bounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-5px); }
}
@media (prefers-reduced-motion: reduce) {
  .btn-shake, .shake-status.waiting .shake-status-coin { animation: none; }
}


/* ---- Share card actions ---- */
.xx-share-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 32px auto 0;
}
.xx-share-actions .btn-xx-secondary { margin: 0; min-width: 0; }
.xx-share-actions + #btn-new-xam { margin-top: 12px; }
.btn-share-main {
  padding: 14px 28px;
  min-width: 220px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: #fff;
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-share-main:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(185, 28, 28, 0.3);
}

.btn-xx-secondary {
  display: block;
  width: auto;
  min-width: 220px;
  margin: 32px auto 0;
  padding: 14px 28px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg-glass);
  color: var(--text-secondary);
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s ease;
  text-align: center;
  box-shadow: var(--shadow);
}
.btn-xx-secondary:hover {
  background: var(--do-dim);
  border-color: var(--do);
  color: var(--do);
  transform: translateY(-2px);
  box-shadow: var(--shadow-h);
}
.btn-xx-secondary:active { transform: scale(0.98); }

.intro-note { font-size: 11px; color: var(--muted); margin-top: 12px; }


/* ---- AI Section ---- */
.ai-section {
  background: var(--bg-surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 24px;
  box-shadow: var(--shadow);
}
.ai-section.gemini-glow-border {
  background-image: linear-gradient(#ffffff, #ffffff),
                    linear-gradient(90deg, #dc2626, #b91c1c, #d98a0a, #dc2626) !important;
}
.ai-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 14px;
}
.ai-icon { font-size: 28px; }
.ai-label { font-size: 13px; font-weight: 700; color: var(--do); }
.ai-question-display { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.ai-chat-messages {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.chat-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.6;
  max-width: 85%;
  word-break: break-word;
  animation: bubble-in 0.3s ease;
}
@keyframes bubble-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.chat-user {
  align-self: flex-end;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.28);
  color: var(--text);
  border-bottom-right-radius: 4px;
}
.chat-ai {
  align-self: flex-start;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-bottom-left-radius: 4px;
}
.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(--do);
  margin-top: 14px;
  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.65;
}
.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;
}
.chat-bubble.chat-error {
  background: rgba(244, 63, 94, 0.08);
  border-color: rgba(244, 63, 94, 0.3);
  color: #fb7185;
}

.ai-loading {
  display: flex;
  flex-direction: column !important;
  align-items: flex-start !important;
  gap: 8px !important;
  width: 100%;
  padding: 12px 0 0 0;
}
/* Custom Jade & Gold themed loading bar for Cổ Dịch Đại Sư */
.xinxam-theme .gemini-loader {
  background: linear-gradient(90deg, var(--do) 0%, var(--gold) 50%, var(--do) 100%) !important;
  background-size: 200% 100% !important;
  animation: gemini-wave 2s linear infinite !important;
  height: 4px !important;
  margin: 10px 0 4px 0 !important;
}
.ai-loading-text {
  font-size: 13px;
  color: var(--text-secondary);
  margin-left: 4px;
  font-style: italic;
}

.ai-error {
  color: #f43f5e;
  background: rgba(244,63,94,0.06);
  border: 1px solid rgba(244,63,94,0.18);
  padding: 10px;
  border-radius: 8px;
  font-size: 12px;
  margin-bottom: 12px;
}

.ai-chat-row {
  display: flex;
  gap: 10px;
}
.ai-chat-input {
  flex: 1;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  color: var(--text);
  font-size: 13.5px;
  outline: none;
}
.ai-chat-input::placeholder {
  color: var(--muted) !important;
  opacity: 1;
}
.ai-chat-input:focus { border-color: rgba(185, 28, 28, 0.5); box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.12); }
.btn-chat-send {
  background: var(--do);
  border: none;
  color: #fff;
  border-radius: 12px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-chat-send:hover { background: #059669; transform: scale(1.05); }


/* ---- SEO Accordion ---- */
.seo-content {
  width: 100%;
  max-width: 100%;
  margin-top: 64px;
  padding: 24px;
  background: var(--bg-surface);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: left;
}
.seo-section-title {
  font-family: var(--font-heading);
  color: var(--gold);
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 16px;
  position: relative;
  padding-bottom: 8px;
}
.seo-section-title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 40px;
  height: 3px;
  background: var(--do);
  border-radius: 2px;
}
.seo-content h3 {
  font-family: var(--font-heading);
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  margin-top: 24px;
  margin-bottom: 10px;
}
.seo-content p {
  color: var(--text-secondary);
  font-size: 13.5px;
  line-height: 1.65;
  margin-bottom: 14px;
}
.seo-content ul { margin-left: 20px; margin-bottom: 14px; }
.seo-content li {
  color: var(--text-secondary);
  font-size: 13.5px;
  line-height: 1.6;
  margin-bottom: 6px;
}
.seo-content strong { color: var(--gold); }


/* ---- History modal ---- */
.history-backdrop  { background: rgba(40, 30, 10, 0.35); backdrop-filter: blur(8px); }
.history-modal {
  background: var(--bg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-h);
}
.history-header { border-bottom: 1px solid var(--border); }
.history-title  { font-family: var(--font-heading); color: var(--text); }
.history-close  { color: var(--muted); }
.history-close:hover { background: var(--do-dim); color: var(--text); }
.history-empty  { color: var(--muted); }
.history-item {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: all 0.2s ease;
}
.history-item:hover {
  border-color: rgba(16, 185, 129, 0.3);
  transform: translateY(-1px);
}
.history-symbol { font-size: 20px; color: var(--do); }
.history-name {
  font-family: var(--font-heading); font-weight: 700;
  font-size: 14px; color: var(--text);
}
.history-arrow    { color: var(--muted); }
.history-question { color: var(--text-secondary); }
.history-time     { color: var(--muted); }
.history-clear {
  border: 1px solid rgba(244,63,94,0.25);
  background: rgba(244,63,94,0.05);
  color: #fb7185;
}
.history-clear:hover { background: rgba(244,63,94,0.12); }


/* ---------- Chips hỏi nhanh AI ---------- */
.xx-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.xx-chips:empty { display: none; }
.xx-chip {
  border: 1px solid rgba(185, 28, 28, 0.35);
  background: var(--bg-glass);
  color: var(--do);
  border-radius: 99px;
  padding: 7px 13px;
  font-size: 12px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}
.xx-chip:hover { background: var(--do); color: #fff; transform: translateY(-1px); }
.xx-chip:disabled { opacity: 0.45; cursor: default; transform: none; }
.xx-chip.xx-chip-hao {
  border-color: rgba(217, 138, 10, 0.5);
  color: var(--gold);
  background: var(--gold-dim);
}
.xx-chip.xx-chip-hao:hover { background: var(--gold); color: #fff; }


/* ============================================================
   XIN XĂM — phần riêng: ống xăm, thẻ xăm, hạng
   ============================================================ */

/* ---- Màn lắc ống ---- */
.shake-label {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 26px;
}

.xam-tube {
  position: relative;
  width: 150px;
  height: 240px;
  margin: 0 auto 30px;
  transform-origin: 50% 90%;
}
.xam-tube-body {
  position: absolute;
  inset: 46px 0 0 0;
  background: linear-gradient(160deg, #8a4a2a 0%, #6b3418 45%, #53270f 100%);
  border: 2px solid rgba(217, 138, 10, 0.8);
  border-radius: 16px 16px 22px 22px;
  box-shadow: inset 0 -18px 30px rgba(0, 0, 0, 0.25), var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
}
.xam-tube-body::after {
  content: '';
  position: absolute;
  top: 8px; left: 8px; right: 8px; bottom: 8px;
  border: 1px solid rgba(217, 138, 10, 0.45);
  border-radius: 12px 12px 18px 18px;
  pointer-events: none;
}
.xam-tube-text {
  writing-mode: vertical-rl;
  font-size: 34px;
  color: rgba(245, 220, 160, 0.9);
  letter-spacing: 10px;
  user-select: none;
}
.xam-sticks {
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 78%;
  height: 62px;
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
}
.xam-stick {
  width: 11px;
  height: 52px;
  background: linear-gradient(180deg, #e8c98a, #c9a05a);
  border-radius: 6px 6px 0 0;
  border: 1px solid rgba(120, 70, 20, 0.4);
}
.xam-stick.s1 { height: 44px; } .xam-stick.s2 { height: 56px; }
.xam-stick.s3 { height: 48px; } .xam-stick.s4 { height: 58px; }
.xam-stick.s5 { height: 46px; }
.xam-stick.s-out {
  height: 54px;
  background: linear-gradient(180deg, #f5ab2e, #d97706);
  transition: transform 1.1s cubic-bezier(0.2, 0.7, 0.3, 1.2), opacity 0.3s;
}

.xam-tube.shaking { animation: tube-shake 0.42s ease-in-out infinite; }
@keyframes tube-shake {
  0%, 100% { transform: rotate(0deg); }
  25%       { transform: rotate(-9deg); }
  75%       { transform: rotate(9deg); }
}
.xam-tube.stick-out .xam-stick.s-out {
  transform: translateY(-95px) rotate(14deg);
  box-shadow: 0 0 22px rgba(245, 171, 46, 0.75);
}

.shake-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 8px;
}
.shake-status-icon i {
  color: var(--gold);
  font-size: 20px;
}
.shake-status-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0;
}

/* ---- Thẻ xăm kết quả ---- */
.xam-card {
  background: var(--bg-surface);
  border: 1.5px solid rgba(217, 138, 10, 0.55);
  border-radius: var(--radius);
  padding: 26px 22px;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
  position: relative;
}
.xam-card::after {
  content: '';
  position: absolute;
  top: 9px; left: 9px; right: 9px; bottom: 9px;
  border: 1px solid rgba(217, 138, 10, 0.3);
  border-radius: calc(var(--radius) - 8px);
  pointer-events: none;
}
.xam-card.reveal { animation: card-reveal 0.6s cubic-bezier(0.2, 0.8, 0.3, 1.1); }
@keyframes card-reveal {
  from { opacity: 0; transform: translateY(26px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.xam-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.xam-so {
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--do);
}
.xam-hang {
  padding: 5px 16px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  background: #6b7280;
}
.xam-hang.hang-tt { background: linear-gradient(135deg, #f5ab2e, #d97706); }
.xam-hang.hang-tc { background: linear-gradient(135deg, #dc2626, #b91c1c); }
.xam-hang.hang-tb { background: #6b7280; }
.xam-hang.hang-h  { background: #1e3a8a; }
.xam-hang.hang-hh { background: #1f2937; }

.xam-ten {
  font-size: 21px;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 16px;
}
.xam-tho {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 16px 14px;
  margin-bottom: 16px;
  background: rgba(185, 28, 28, 0.05);
  border-left: 3px solid var(--gold);
  border-radius: 0 12px 12px 0;
}
.xam-tho span {
  font-style: italic;
  font-weight: 600;
  font-size: 15.5px;
  color: var(--text);
  line-height: 1.55;
}
.xam-y {
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--text-secondary);
  margin: 0 0 16px;
}
.xam-dienco-box {
  background: var(--bg-2);
  border-radius: 14px;
  padding: 13px 15px;
  margin-bottom: 16px;
}
.xam-dienco-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--gold);
  margin-bottom: 6px;
}
.xam-dienco {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin: 4px 0 0;
}

.xam-linhvuc {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
@media (min-width: 640px) {
  .xam-linhvuc { grid-template-columns: 1fr 1fr; }
}
.lv-item {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
}
.lv-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 800;
  color: var(--do);
  margin-bottom: 4px;
}
.lv-item p {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-secondary);
  margin: 4px 0 0;
}

.xx-disclaimer {
  text-align: center;
  font-size: 11.5px;
  color: var(--muted);
  margin: 22px auto 0;
  max-width: 480px;
}

@media (prefers-reduced-motion: reduce) {
  .xam-tube.shaking, .xam-card.reveal { animation: none; }
  .xam-stick.s-out { transition: none; }
}
