/* =========================================
   全域設定 Reset
========================================= */
:root {
  --bg-color: #1a1a2e;
  --accent: #ffd700;
  --text-main: #ffffff;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  overflow-x: hidden; /* 禁止水平滾動 */
  font-family: 'Helvetica Neue', Arial, sans-serif;
  background-color: var(--bg-color);
  background-image: radial-gradient(circle at center, #2a2a4e 0%, #1a1a2e 100%);
  color: var(--text-main);
  min-height: 100vh;
}

/* =========================================
   主容器
========================================= */
.main-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 0 60px; /* 手機版左右不留 padding，全靠子元素控制 */
  box-sizing: border-box;
  overflow: hidden; 
}

header {
  text-align: center;
  margin-bottom: 25px;
  width: 100%;
  padding: 0 15px;
  box-sizing: border-box;
}

h1 {
  color: var(--accent);
  margin-bottom: 10px;
  text-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
  font-size: 1.8rem;
}

.subtitle { color: #b0b0b0; font-size: 0.9rem; }

/* =========================================
   輸入與控制區
========================================= */
.input-section {
  width: 90%; /* 寬度 90% */
  max-width: 400px;
  margin-bottom: 20px;
}

input {
  width: 100%;
  padding: 12px;
  border-radius: 50px;
  border: 2px solid #444;
  background: rgba(0,0,0,0.2);
  color: white;
  text-align: center;
  font-size: 16px;
  box-sizing: border-box;
}
input:focus { outline: none; border-color: var(--accent); }

.button-group {
  display: flex;
  gap: 10px;
  margin-bottom: 30px;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
}

.mode-btn {
  padding: 8px 16px;
  border-radius: 30px;
  border: 1px solid #555;
  background: rgba(255,255,255,0.05);
  color: #ccc;
  cursor: pointer;
  transition: all 0.3s;
  font-size: 0.9rem;
  white-space: nowrap;
}

.mode-btn.active {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
  font-weight: bold;
}

/* =========================================
   牌背與按鈕區
========================================= */
.deck-container {
    margin: 20px auto 40px;
    width: 60vw; /* 使用視窗寬度單位 */
    max-width: 220px;
    cursor: pointer;
    text-align: center;
}

.main-back-card {
    width: 100%;
    height: auto;
    display: block;
    filter: drop-shadow(0 10px 15px rgba(0,0,0,0.5));
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-8px); }
    100% { transform: translateY(0px); }
}
.animate-float { animation: float 4s ease-in-out infinite; }

.action-area {
    margin-bottom: 30px;
    width: 100%;
    text-align: center;
}

.cta-button {
  background: linear-gradient(135deg, var(--accent), #ff8e53);
  border: none;
  padding: 12px 0;
  width: 80%;
  max-width: 300px;
  border-radius: 50px;
  color: #000;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
}

#status-text { color: var(--accent); font-weight: bold; margin-top: 10px; }

/* =========================================
   卡片展示區
========================================= */
.cards-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 30px;
  width: 100%;
  margin-top: 20px;
  margin-bottom: 40px;
}

.card-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 200px;
  opacity: 0;
  transform: translateY(20px);
  animation: slideUp 0.6s ease forwards;
}
@keyframes slideUp { to { opacity: 1; transform: translateY(0); } }

.card-title { margin-bottom: 10px; color: #ccc; font-size: 1rem; }

.card-image-box {
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  background: #0f0c29;
  position: relative;
  cursor: pointer;
}

.tarot-img { width: 100%; height: auto; display: block; }
.tarot-img.reversed { transform: rotate(180deg); }

.card-name {
  margin-top: 15px; color: var(--accent);
  font-weight: bold; font-size: 1.1rem; text-align: center;
}

/* =========================================
   【核彈級修復】文字解析區
========================================= */
.hidden { display: none; }

#result-text-area {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.interpretation-box {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255,255,255,0.1);
  
  /* 【絕對暴力設定】 */
  /* 不要 100%，直接設定為螢幕寬度的 85% */
  /* 這樣不管 padding 怎樣，左右一定會有 7.5% 的空隙 */
  width: 85vw; 
  max-width: 800px; /* 電腦版上限 */
  
  margin: 0 auto; /* 強制置中 */
  padding: 20px;
  box-sizing: border-box;
  border-radius: 15px;
  
  text-align: left;
  line-height: 1.8;
  color: #e0e0e0;
  
  /* 【強制換行】針對中文與長文字 */
  white-space: pre-wrap;
  word-break: break-all;      /* 針對 CJK 中文強制斷行 */
  overflow-wrap: break-word;  /* 針對英文長單字 */
}

.interpretation-box h3 {
    color: var(--accent);
    margin-top: 0;
    border-bottom: 1px solid rgba(255,215,0,0.2);
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.reset-btn {
    margin-top: 30px;
    background: transparent;
    border: 2px solid var(--accent);
    color: var(--accent);
    box-shadow: none;
}

.line-btn {
  display: block;
  width: 85vw; /* 也是跟著用 85vw */
  max-width: 300px;
  margin: 30px auto 0;
  background-color: #06C755;
  color: white;
  padding: 12px 0;
  border-radius: 50px;
  text-decoration: none;
  font-weight: bold;
  text-align: center;
}

/* =========================================
   電腦版 / 平板版
========================================= */
@media screen and (min-width: 768px) {
  .main-container { padding: 40px 20px; }
  h1 { font-size: 2.5rem; }
  
  /* 電腦版不需要用 vw，改回固定寬度邏輯 */
  .interpretation-box {
      width: 100%;
      padding: 40px;
  }

  .deck-container { width: 260px; margin-bottom: 60px; }

  .cards-layout {
    flex-direction: row; 
    justify-content: center;
    align-items: flex-start;
    gap: 40px;
  }
  
  .card-wrapper { flex: 1; max-width: 250px; }
}