/* ===========================
   AI SYNC CLUB — 타로 페이지
   =========================== */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg:             #0a0a0a;
  --surface:        #111111;
  --line:           #2a2a2a;
  --line-bright:    #444444;
  --text-primary:   #f0f0f0;
  --text-secondary: #666666;
  --text-dim:       #333333;
  --accent:         #c8ff00;

  --font-mono: 'JetBrains Mono', monospace;
  --font-sans: 'Inter', sans-serif;

  --t-fast: 120ms;
  --t-mid:  220ms;
}

:root[data-theme="light"] {
  --bg:             #f5f5f2;
  --surface:        #ffffff;
  --line:           #e0e0dc;
  --line-bright:    #cccccc;
  --text-primary:   #111111;
  --text-secondary: #555555;
  --text-dim:       #aaaaaa;
  --accent:         #4a7a00;
}

/* ── 기본 레이아웃 ── */

body {
  background-color: var(--bg);
  font-family: var(--font-sans);
  color: var(--text-primary);
  min-height: 100vh;
  transition: background-color var(--t-mid), color var(--t-mid);
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
}

.page {
  position: relative;
  z-index: 1;
  max-width: 760px;
  margin: 0 auto;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* ── 헤더 & 푸터 ── */

.site-header,
.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  transition: background-color var(--t-mid), border-color var(--t-mid);
}

.site-footer {
  border-bottom: none;
  border-top: 1px solid var(--line);
  margin-top: auto;
}

.header-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  border: 1px solid var(--line-bright);
}

.header-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.4em;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.footer-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.3em;
  color: var(--text-dim);
  text-transform: lowercase;
}

/* ── 헤더 액션 그룹 ── */

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.run-log-btn {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.2em;
  color: var(--accent);
  background: none;
  border: 1px solid var(--accent);
  padding: 4px 9px;
  cursor: pointer;
  text-transform: uppercase;
  transition: background var(--t-fast), color var(--t-fast);
  line-height: 1.4;
}

.run-log-btn:hover {
  background: var(--accent);
  color: var(--bg);
}

/* ── 테마 토글 ── */

.theme-toggle {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.3em;
  color: var(--text-secondary);
  background: none;
  border: 1px solid var(--line-bright);
  padding: 4px 9px;
  cursor: pointer;
  text-transform: uppercase;
  transition: color var(--t-fast), border-color var(--t-fast);
  line-height: 1.4;
}

.theme-toggle:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

/* ── 타로 메인 ── */

.tarot-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 64px 48px 72px;
}

/* ── 인트로 ── */

.tarot-intro {
  display: flex;
  flex-direction: column;
  gap: 28px;
  transition: opacity var(--t-mid);
}

.tarot-intro.hidden {
  display: none;
}

.tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.3em;
  color: var(--accent);
  border: 1px solid rgba(200, 255, 0, 0.3);
  padding: 4px 12px;
  align-self: flex-start;
}

:root[data-theme="light"] .tag {
  border-color: rgba(74, 122, 0, 0.3);
}

.tarot-page-title {
  font-family: var(--font-mono);
  font-size: clamp(56px, 12vw, 96px);
  font-weight: 300;
  line-height: 0.95;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.tarot-page-desc {
  font-size: 15px;
  font-weight: 300;
  line-height: 1.85;
  color: var(--text-secondary);
}

.btn-read {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.3em;
  color: var(--accent);
  background: none;
  border: 1px solid var(--accent);
  padding: 14px 36px;
  cursor: pointer;
  align-self: flex-start;
  text-transform: uppercase;
  margin-top: 8px;
  transition: background var(--t-fast), color var(--t-fast);
}

.btn-read:hover {
  background: var(--accent);
  color: var(--bg);
}

/* ── 리딩 결과 영역 ── */

.tarot-reading {
  display: flex;
  flex-direction: column;
  gap: 40px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s;
}

.tarot-reading.visible {
  opacity: 1;
  pointer-events: all;
}

.tarot-reading-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.2em;
  transition: opacity var(--t-mid);
}

/* ── 카드 플립 ── */

.tarot-cards-row {
  display: flex;
  gap: 16px;
  justify-content: center;
}

.tc-wrap {
  perspective: 1000px;
  flex: 1;
  max-width: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.tc-inner {
  width: 100%;
  aspect-ratio: 2 / 3;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.tc-wrap.flipped .tc-inner {
  transform: rotateY(180deg);
}

.tc-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-bright);
  transition: border-color var(--t-mid);
}

.tc-back {
  background: var(--surface);
  background-image:
    repeating-linear-gradient(45deg,
      var(--line) 0px, var(--line) 1px,
      transparent 1px, transparent 10px);
}

.tc-back-symbol {
  font-size: 22px;
  color: var(--line-bright);
}

.tc-front {
  transform: rotateY(180deg);
  background: var(--surface);
  padding: 0;
  overflow: hidden;
  justify-content: flex-start;
}

.tc-img {
  width: 100%;
  flex: 1;
  object-fit: cover;
  object-position: top center;
  display: block;
  min-height: 0;
}

.tc-card-label {
  padding: 6px 8px 7px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 1px;
  transition: background-color var(--t-mid);
  flex-shrink: 0;
  width: 100%;
}

.tc-num {
  font-family: var(--font-mono);
  font-size: 8px;
  color: var(--text-dim);
  letter-spacing: 0.2em;
}

.tc-name {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: 0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tc-pos-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.3em;
  color: var(--text-dim);
  text-transform: uppercase;
}

/* ── 운세 텍스트 ── */

.tarot-fortune {
  display: flex;
  flex-direction: column;
  gap: 20px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.5s, transform 0.5s;
}

.tarot-fortune.visible {
  opacity: 1;
  transform: translateY(0);
}

.fortune-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-left: 16px;
  border-left: 2px solid var(--accent);
}

.fortune-pos {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.35em;
  color: var(--accent);
  text-transform: uppercase;
}

.fortune-card-name {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.fortune-text {
  font-size: 14px;
  font-weight: 300;
  line-height: 1.8;
  color: var(--text-secondary);
}

.fortune-summary {
  padding: 20px;
  border: 1px solid var(--line);
  font-size: 14px;
  font-weight: 300;
  line-height: 1.85;
  color: var(--text-secondary);
  font-style: italic;
  background: var(--bg);
  transition: background-color var(--t-mid), border-color var(--t-mid);
}

/* ── 로또 섹션 ── */

.lotto-section {
  border-top: 1px solid var(--line);
  padding-top: 32px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.5s 0.2s, transform 0.5s 0.2s;
}

.lotto-section.visible {
  opacity: 1;
  transform: translateY(0);
}

.lotto-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.lotto-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.4em;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.btn-lotto-refresh {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text-secondary);
  background: none;
  border: 1px solid var(--line-bright);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color var(--t-fast), border-color var(--t-fast);
  border-radius: 0;
}

.btn-lotto-refresh:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

.lotto-games {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lotto-game {
  display: flex;
  align-items: center;
  gap: 14px;
}

.lotto-game-num {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  width: 32px;
  flex-shrink: 0;
}

.lotto-balls {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.lotto-ball {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  flex-shrink: 0;
}

/* 번호대별 공식 색상 */
.lotto-ball.r1  { background: #f5c315; color: #333; }  /* 1-10  노랑 */
.lotto-ball.r11 { background: #4b82f0; color: #fff; }  /* 11-20 파랑 */
.lotto-ball.r21 { background: #e04040; color: #fff; }  /* 21-30 빨강 */
.lotto-ball.r31 { background: #6e6e6e; color: #fff; }  /* 31-40 회색 */
.lotto-ball.r41 { background: #43a86e; color: #fff; }  /* 41-45 초록 */

.running-banner {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  border: 1px solid rgba(200, 255, 0, 0.25);
  padding: 13px 16px;
  letter-spacing: 0.04em;
  margin-top: 6px;
  transition: border-color var(--t-mid);
}

:root[data-theme="light"] .running-banner {
  border-color: rgba(74, 122, 0, 0.3);
}

/* ── 다시 뽑기 버튼 ── */

.btn-retry {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.3em;
  color: var(--text-secondary);
  background: none;
  border: 1px solid var(--line-bright);
  padding: 12px 24px;
  cursor: pointer;
  align-self: center;
  transition: color var(--t-fast), border-color var(--t-fast);
  text-transform: uppercase;
}

.btn-retry:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

/* ── 뜀박질 입력 섹션 ── */

.runner-section {
  border-bottom: 1px solid var(--line);
  padding: 64px 48px 72px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  transition: border-color var(--t-mid);
}

.runner-tag {
  border-color: rgba(34, 197, 94, 0.35);
  color: #22c55e;
}

:root[data-theme="light"] .runner-tag {
  border-color: rgba(22, 163, 74, 0.35);
  color: #16a34a;
}

.runner-title {
  font-family: var(--font-mono);
  font-size: clamp(44px, 10vw, 80px);
  font-weight: 300;
  line-height: 0.95;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.runner-desc {
  font-size: 15px;
  font-weight: 300;
  line-height: 1.85;
  color: var(--text-secondary);
}

/* ── 러닝 폼 ── */

.run-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.run-form-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.run-form-label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.35em;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.run-form-input {
  background: var(--bg);
  border: 1px solid var(--line-bright);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 300;
  padding: 11px 14px;
  outline: none;
  width: 100%;
  border-radius: 0;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color var(--t-fast), background-color var(--t-mid);
}

.run-form-input::placeholder {
  color: var(--text-dim);
}

.run-form-input:focus {
  border-color: var(--accent);
}

/* date input 캘린더 아이콘 색상 */
:root[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
}

.run-form-status {
  min-height: 20px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  transition: color var(--t-fast);
}

.run-form-status.ok  { color: var(--accent); }
.run-form-status.err { color: #e04040; }

.run-form-submit {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.25em;
  color: var(--bg);
  background: var(--accent);
  border: none;
  padding: 14px;
  cursor: pointer;
  text-transform: uppercase;
  transition: opacity var(--t-fast);
  margin-top: 4px;
}

.run-form-submit:hover  { opacity: 0.85; }
.run-form-submit:disabled { opacity: 0.4; cursor: not-allowed; }

.run-submit-green {
  background: #22c55e;
  color: #fff;
}
.run-submit-green:hover { background: #16a34a; opacity: 1; }

/* ── 애니메이션 ── */

@keyframes slideUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── 반응형 ── */

@media (max-width: 600px) {
  .tarot-main      { padding: 48px 24px 56px; }
  .runner-section  { padding: 48px 24px 56px; }
  .tarot-cards-row { gap: 8px; }
  .tc-name         { font-size: 9px; }
  .lotto-ball      { width: 30px; height: 30px; font-size: 10px; }
  .lotto-balls     { gap: 5px; }
}
