/* ===== Tarro Theme Variables ===== */
:root {
    --tarro-bg: #1a0533;
    --tarro-card-bg: #2d1b4e;
    --tarro-gold: #f0c040;
    --tarro-purple: #9b59b6;
    --tarro-glow: rgba(155, 89, 182, 0.6);
    --tarro-text: #e8d5f5;
}

body {
    background: linear-gradient(135deg, #0d0221 0%, #1a0533 50%, #0d0221 100%);
    min-height: 100vh;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 60px 16px 40px;
}

body[data-theme="light"] {
    background: linear-gradient(135deg, #2d1b4e 0%, #4a2c7a 50%, #2d1b4e 100%);
}

.tarro-container {
    background: rgba(30, 10, 60, 0.85) !important;
    border: 1px solid rgba(155, 89, 182, 0.4);
    box-shadow: 0 0 30px rgba(155, 89, 182, 0.3), 0 4px 20px rgba(0,0,0,0.5) !important;
    color: #e8d5f5 !important;
    max-width: 800px !important;
    width: 100%;
    margin: 0 auto 2rem;
    backdrop-filter: blur(10px);
}

/* ===== Header ===== */
.tarro-header { margin-bottom: 1.5rem; }
.moon-icon { font-size: 3rem; margin-bottom: 0.5rem; animation: float 3s ease-in-out infinite; }
.tarro-container h1 { color: var(--tarro-gold); font-size: 2rem; margin: 0.3rem 0; text-shadow: 0 0 20px rgba(240,192,64,0.5); }
.tarro-container h2 { color: var(--tarro-gold); text-shadow: 0 0 15px rgba(240,192,64,0.4); }
.subtitle { color: #c9a8e8; font-style: italic; margin: 0.3rem 0 1rem; }

/* ===== Question Section ===== */
.question-section { margin: 1rem 0; text-align: left; }
.question-section label { display: block; color: var(--tarro-gold); margin-bottom: 0.5rem; font-size: 0.95rem; }
.question-section textarea {
    width: 100%; padding: 0.8rem; border-radius: 10px;
    background: rgba(155, 89, 182, 0.15); border: 1px solid rgba(155, 89, 182, 0.5);
    color: #e8d5f5; font-size: 0.95rem; resize: none; box-sizing: border-box;
    transition: border-color 0.3s, box-shadow 0.3s;
}
.question-section textarea:focus { outline: none; border-color: var(--tarro-gold); box-shadow: 0 0 10px rgba(240,192,64,0.3); }
.question-section textarea::placeholder { color: #8a6aaa; }

/* ===== Spread Options ===== */
.spread-select { margin: 1rem 0; }
.spread-select p { color: var(--tarro-gold); margin-bottom: 0.7rem; }
.spread-options { display: flex; gap: 0.8rem; justify-content: center; flex-wrap: wrap; }
.spread-option {
    display: flex; flex-direction: column; align-items: center; padding: 0.8rem 1.2rem;
    border-radius: 12px; border: 2px solid rgba(155, 89, 182, 0.4);
    cursor: pointer; transition: all 0.3s; background: rgba(155, 89, 182, 0.1);
    min-width: 100px;
}
.spread-option:hover { border-color: var(--tarro-gold); background: rgba(240,192,64,0.1); transform: translateY(-2px); }
.spread-option.active { border-color: var(--tarro-gold); background: rgba(240,192,64,0.15); box-shadow: 0 0 15px rgba(240,192,64,0.3); }
.spread-option .spread-icon { font-size: 1.4rem; margin-bottom: 0.3rem; }
.spread-option span { color: #e8d5f5; font-size: 0.9rem; font-weight: 600; }
.spread-option small { color: #9b7abf; font-size: 0.75rem; margin-top: 0.2rem; }

/* ===== Buttons ===== */
.primary-btn {
    background: linear-gradient(135deg, #7b2d8b, #9b59b6);
    color: white; border: none; padding: 0.9rem 2.5rem;
    border-radius: 25px; font-size: 1.1rem; cursor: pointer;
    transition: all 0.3s; display: block; margin: 0 auto;
}
.primary-btn:hover { transform: translateY(-2px); box-shadow: 0 5px 20px rgba(155,89,182,0.5); }
.glow-btn { animation: pulse-glow 2s ease-in-out infinite; }
.secondary-btn {
    background: transparent; color: #c9a8e8; border: 1px solid rgba(155,89,182,0.5);
    padding: 0.6rem 1.5rem; border-radius: 20px; cursor: pointer;
    transition: all 0.3s; display: block; margin: 0 auto; font-size: 0.9rem;
}
.secondary-btn:hover { border-color: var(--tarro-gold); color: var(--tarro-gold); }

/* ===== Card Deck ===== */
.card-deck {
    display: flex; flex-wrap: wrap; gap: 8px;
    justify-content: center; margin: 1.5rem 0; max-height: 400px;
    overflow-y: auto; padding: 10px;
}

.deck-card {
    width: 60px; height: 90px; border-radius: 8px; cursor: pointer;
    background: linear-gradient(135deg, #2d1b4e, #4a2c7a);
    border: 2px solid rgba(155,89,182,0.5);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem; transition: all 0.3s; position: relative;
    overflow: hidden;
}
.deck-card::before {
    content: ''; position: absolute; inset: 3px; border-radius: 5px;
    border: 1px solid rgba(240,192,64,0.3);
    background: repeating-linear-gradient(45deg, transparent, transparent 5px, rgba(155,89,182,0.05) 5px, rgba(155,89,182,0.05) 10px);
}
.deck-card:hover:not(.selected) { transform: translateY(-8px) scale(1.05); border-color: var(--tarro-gold); box-shadow: 0 8px 20px rgba(240,192,64,0.4); }
.deck-card.selected { opacity: 0.4; cursor: not-allowed; transform: none; }
.deck-card .card-back-symbol { font-size: 1.2rem; z-index: 1; }

.pick-progress { color: #c9a8e8; font-size: 0.9rem; margin-top: 0.5rem; }

/* ===== Result Cards ===== */
.result-cards { display: flex; flex-wrap: wrap; gap: 1.5rem; justify-content: center; margin: 1.5rem 0; }

.result-card-item {
    display: flex; flex-direction: column; align-items: center;
    max-width: 200px; animation: revealCard 0.6s ease forwards;
    opacity: 0; transform: rotateY(90deg);
}
.result-card-item .position-label { color: var(--tarro-gold); font-size: 0.8rem; margin-bottom: 0.5rem; font-weight: 600; letter-spacing: 1px; }

.tarot-card-svg {
    width: 130px; height: 220px; border-radius: 10px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.6), 0 0 20px rgba(155,89,182,0.4);
    transition: transform 0.3s;
}
.tarot-card-svg:hover { transform: scale(1.05); }
.tarot-card-svg.reversed { transform: rotate(180deg); }
.tarot-card-svg.reversed:hover { transform: rotate(180deg) scale(1.05); }

.result-card-item .card-name { color: var(--tarro-gold); font-size: 0.9rem; font-weight: 700; margin-top: 0.7rem; text-align: center; }
.result-card-item .card-reversed { color: #e74c3c; font-size: 0.75rem; margin-top: 0.2rem; }
.result-card-item .card-keywords { color: #c9a8e8; font-size: 0.78rem; margin-top: 0.3rem; text-align: center; font-style: italic; }
.result-card-item .card-meaning { color: #e8d5f5; font-size: 0.82rem; margin-top: 0.5rem; text-align: center; line-height: 1.5; }

/* ===== Result Summary ===== */
.result-question { color: #c9a8e8; font-style: italic; margin-bottom: 1rem; font-size: 0.95rem; }
.result-summary {
    background: rgba(155,89,182,0.15); border: 1px solid rgba(155,89,182,0.4);
    border-radius: 12px; padding: 1.2rem; margin-top: 1rem; text-align: left;
}
.result-summary h3 { color: var(--tarro-gold); margin: 0 0 0.8rem; font-size: 1rem; }
.result-summary p { color: #e8d5f5; line-height: 1.7; font-size: 0.9rem; margin: 0; }

/* ===== Animations ===== */
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes pulse-glow {
    0%,100% { box-shadow: 0 0 10px rgba(155,89,182,0.4); }
    50% { box-shadow: 0 0 25px rgba(155,89,182,0.8), 0 0 40px rgba(240,192,64,0.3); }
}
@keyframes revealCard {
    to { opacity: 1; transform: rotateY(0deg); }
}

/* ===== Theme Toggle ===== */
.theme-toggle { position: fixed; top: 15px; right: 15px; z-index: 100; }
.theme-toggle button {
    background: rgba(155,89,182,0.3); color: #e8d5f5; border: 1px solid rgba(155,89,182,0.5);
    padding: 0.4rem 1rem; border-radius: 20px; cursor: pointer; font-size: 0.85rem;
    transition: all 0.3s;
}
.theme-toggle button:hover { background: rgba(155,89,182,0.5); }

/* ===== Scrollbar ===== */
.card-deck::-webkit-scrollbar { width: 6px; }
.card-deck::-webkit-scrollbar-track { background: rgba(155,89,182,0.1); border-radius: 3px; }
.card-deck::-webkit-scrollbar-thumb { background: rgba(155,89,182,0.5); border-radius: 3px; }

@media (max-width: 600px) {
    .deck-card { width: 50px; height: 75px; }
    .tarot-card-svg { width: 110px; height: 185px; }
    .spread-options { gap: 0.5rem; }
    .spread-option { min-width: 80px; padding: 0.6rem 0.8rem; }
}

/* ===== 풍부한 해석 UI ===== */
.result-summary {
  background: rgba(155,89,182,0.12);
  border: 1px solid rgba(155,89,182,0.35);
  border-radius: 14px;
  padding: 1.4rem;
  margin-top: 1.2rem;
  text-align: left;
}

.summary-header { text-align: center; margin-bottom: 1rem; }
.summary-emoji { font-size: 2rem; display: block; margin-bottom: 0.3rem; }
.summary-header h3 { color: var(--tarro-gold); margin: 0.2rem 0; font-size: 1.1rem; }
.summary-question { color: #c9a8e8; font-style: italic; font-size: 0.88rem; margin: 0.3rem 0 0; }

/* 에너지 게이지 */
.energy-gauge { margin: 1rem 0; }
.gauge-label { display: flex; justify-content: space-between; font-size: 0.75rem; color: #9b7abf; margin-bottom: 0.3rem; }
.gauge-bar { height: 10px; background: rgba(155,89,182,0.2); border-radius: 5px; overflow: hidden; }
.gauge-fill { height: 100%; border-radius: 5px; transition: width 1s ease; }
.gauge-score { text-align: center; font-size: 0.8rem; color: #c9a8e8; margin-top: 0.4rem; }

/* 섹션 */
.summary-section { margin: 1rem 0; padding: 0.9rem; background: rgba(0,0,0,0.2); border-radius: 10px; border-left: 3px solid rgba(240,192,64,0.5); }
.section-title { color: var(--tarro-gold); font-size: 0.88rem; font-weight: 700; margin-bottom: 0.6rem; letter-spacing: 0.5px; }
.summary-section p { color: #e8d5f5; font-size: 0.85rem; line-height: 1.7; margin: 0.4rem 0; }
.summary-section strong { color: var(--tarro-gold); }

.advice-section { border-left-color: #2ecc71; background: rgba(46,204,113,0.07); }
.advice-section p { color: #a8e6cf; }

/* 카드 통계 */
.card-stats { display: flex; justify-content: center; gap: 2rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid rgba(155,89,182,0.3); }
.stat-item { display: flex; flex-direction: column; align-items: center; gap: 0.2rem; }
.stat-num { font-size: 1.6rem; font-weight: 700; font-family: Georgia, serif; }
.stat-label { font-size: 0.75rem; color: #9b7abf; }

/* 카드 크기 업 */
.tarot-card-svg { width: 150px; height: 250px; }
.tarot-card-svg.reversed { transform: rotate(180deg); }
.tarot-card-svg.reversed:hover { transform: rotate(180deg) scale(1.05); }

@media (max-width: 600px) {
  .tarot-card-svg { width: 120px; height: 200px; }
  .card-stats { gap: 1.2rem; }
}

/* ===== 주제 선택 버튼 ===== */
.topic-section { margin: 1rem 0; }
.topic-label { color: var(--tarro-gold); margin-bottom: 0.7rem; font-size: 0.95rem; }
.topic-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; }
.topic-btn {
  background: rgba(155,89,182,0.15); border: 1px solid rgba(155,89,182,0.4);
  color: #c9a8e8; border-radius: 20px; padding: 0.5rem 0.3rem;
  font-size: 0.78rem; cursor: pointer; transition: all 0.25s;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.topic-btn:hover { border-color: var(--tarro-gold); color: var(--tarro-gold); transform: translateY(-2px); }
.topic-btn.active { background: rgba(240,192,64,0.2); border-color: var(--tarro-gold); color: var(--tarro-gold); box-shadow: 0 0 10px rgba(240,192,64,0.3); }

/* ===== 덱 선택 ===== */
.deck-select { margin: 0.8rem 0; }
.deck-select p { color: var(--tarro-gold); margin-bottom: 0.5rem; font-size: 0.9rem; }
.deck-options { display: flex; gap: 1.5rem; justify-content: center; }
.deck-radio { color: #c9a8e8; font-size: 0.88rem; cursor: pointer; display: flex; align-items: center; gap: 0.4rem; }
.deck-radio input { accent-color: var(--tarro-gold); }

/* ===== 카드 타입 배지 ===== */
.card-type-badge { font-size: 0.75rem; margin-top: 0.2rem; letter-spacing: 0.5px; }

@media (max-width: 480px) {
  .topic-grid { grid-template-columns: repeat(2, 1fr); }
}
