/* ========================================
   Karen's Tarot — Stylesheet
   ======================================== */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --font-display: 'Cinzel Decorative', Georgia, serif;
  --font-body: 'Crimson Pro', Georgia, serif;
  --font-mono: 'Space Mono', monospace;

  --bg: #0a0a14;
  --bg-card: #12121f;
  --bg-surface: #1a1a2e;
  --bg-ticker: #0d0d1a;
  --text: #e8e4d9;
  --text-muted: #8a8575;
  --text-faint: #5a5650;
  --accent: #c9a84c;
  --accent-glow: #c9a84c55;
  --accent-bright: #f0d060;
  --purple: #7b5ea7;
  --purple-glow: #7b5ea744;
  --teal: #4f98a3;
  --rose: #c46b8a;
  --card-bg: linear-gradient(145deg, #1e1e35, #16162a);
  --card-face-bg: linear-gradient(145deg, #1a1a30, #0f0f20);

  --radius-sm: 0.375rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;

  --shadow-glow: 0 0 30px rgba(201, 168, 76, 0.15);
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.4);

  --ticker-height: 44px;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  min-height: 100dvh;
  font-family: var(--font-body);
  font-size: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  padding-bottom: calc(var(--ticker-height) + 60px);
  overflow-x: hidden;
}

/* --- Stars Background --- */
.stars {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.star {
  position: absolute;
  width: 2px;
  height: 2px;
  background: #fff;
  border-radius: 50%;
  animation: twinkle var(--dur) ease-in-out infinite;
  opacity: 0;
}
@keyframes twinkle {
  0%, 100% { opacity: 0; }
  50% { opacity: var(--max-o, 0.7); }
}

/* --- Header --- */
.site-header {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid rgba(201, 168, 76, 0.15);
}
.logo-area {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.logo-icon {
  color: var(--accent);
  flex-shrink: 0;
}
.site-title {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 1.2rem + 1vw, 2rem);
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.04em;
  line-height: 1.2;
}
.site-subtitle {
  font-size: clamp(0.7rem, 0.65rem + 0.25vw, 0.85rem);
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 0.15rem;
}
.header-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.sound-toggle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(201, 168, 76, 0.08);
  border: 1px solid rgba(201, 168, 76, 0.2);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.sound-toggle:hover {
  background: rgba(201, 168, 76, 0.15);
}
.streak-badge {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  background: rgba(201, 168, 76, 0.1);
  border: 1px solid rgba(201, 168, 76, 0.25);
  color: var(--accent);
  padding: 0.4rem 0.8rem;
  border-radius: 9999px;
  cursor: default;
  white-space: nowrap;
}

/* --- Main --- */
.main-content {
  position: relative;
  z-index: 10;
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
}

/* --- Karen Status --- */
.karen-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  padding: 0.6rem 1rem;
  background: rgba(79, 152, 163, 0.06);
  border: 1px solid rgba(79, 152, 163, 0.15);
  border-radius: var(--radius-lg);
}
.status-dot {
  width: 8px;
  height: 8px;
  background: #4ade80;
  border-radius: 50%;
  animation: pulse-dot 2s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* --- Card Spread --- */
.card-spread {
  text-align: center;
  margin-bottom: 2.5rem;
}
.spread-title {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 0.9rem + 0.8vw, 1.6rem);
  color: var(--accent);
  margin-bottom: 0.3rem;
  font-weight: 400;
}
.spread-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 2rem;
}
.cards-container {
  display: flex;
  justify-content: center;
  gap: clamp(1rem, 2vw, 2rem);
  flex-wrap: wrap;
}
.card-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}
.position-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-faint);
}

/* --- Card --- */
.card {
  width: clamp(130px, 20vw, 180px);
  height: clamp(210px, 32vw, 290px);
  perspective: 1000px;
  cursor: pointer;
  transition: transform 0.3s ease;
}
.card:hover { transform: translateY(-6px); }
.card.shuffling {
  animation: cardShuffle 0.5s ease;
}
@keyframes cardShuffle {
  0% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-20px) rotate(-3deg); }
  50% { transform: translateY(5px) rotate(2deg); }
  75% { transform: translateY(-10px) rotate(-1deg); }
  100% { transform: translateY(0) rotate(0deg); }
}
.card.flipped .card-inner { transform: rotateY(180deg); }
.card.flipped { cursor: default; }
.card.flipped:hover { transform: translateY(0); }

.card-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}
.card-front, .card-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.card-front {
  background: var(--card-bg);
  border: 1.5px solid rgba(201, 168, 76, 0.3);
  box-shadow: var(--shadow-card), var(--shadow-glow);
}
.card-back-design {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.card-pattern {
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(201, 168, 76, 0.2);
  border-radius: var(--radius-md);
  background:
    repeating-linear-gradient(45deg, transparent, transparent 8px, rgba(201, 168, 76, 0.03) 8px, rgba(201, 168, 76, 0.03) 9px),
    repeating-linear-gradient(-45deg, transparent, transparent 8px, rgba(123, 94, 167, 0.03) 8px, rgba(123, 94, 167, 0.03) 9px);
}
.card-label-back {
  font-size: 2rem;
  color: var(--accent);
  opacity: 0.6;
  z-index: 1;
}

.card-face {
  transform: rotateY(180deg);
  background: var(--card-face-bg);
  border: 1.5px solid rgba(201, 168, 76, 0.25);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem 0.75rem;
  text-align: center;
  gap: 0.4rem;
}
.card-symbol {
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1;
}
.card-name {
  font-family: var(--font-display);
  font-size: clamp(0.6rem, 0.55rem + 0.4vw, 0.8rem);
  color: var(--accent);
  font-weight: 700;
  line-height: 1.2;
}
.card-position-label {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--purple);
  background: rgba(123, 94, 167, 0.1);
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
}
.card-keywords {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.3;
}

/* --- Reading --- */
.reading-section {
  display: none;
  margin-bottom: 2rem;
}
.reading-section.active { display: block; }
.reading-content {
  background: rgba(26, 26, 46, 0.6);
  border: 1px solid rgba(201, 168, 76, 0.15);
  border-radius: var(--radius-xl);
  padding: 1.5rem 2rem;
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text);
  position: relative;
}
.reading-content::before {
  content: '💅';
  position: absolute;
  top: -14px;
  left: 1.5rem;
  font-size: 1.2rem;
}
.reading-content .karen-sig {
  display: block;
  margin-top: 1rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-faint);
  text-align: right;
}

/* --- New Reading Button --- */
.new-reading-btn {
  display: block;
  margin: 0 auto 2rem;
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: var(--accent);
  background: rgba(201, 168, 76, 0.08);
  border: 1px solid rgba(201, 168, 76, 0.25);
  padding: 0.7rem 1.5rem;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.3s ease;
  letter-spacing: 0.03em;
}
.new-reading-btn:hover {
  background: rgba(201, 168, 76, 0.15);
  box-shadow: var(--shadow-glow);
}

/* --- Chat --- */
.chat-toggle {
  position: fixed;
  bottom: calc(var(--ticker-height) + 80px);
  right: 1.5rem;
  z-index: 100;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--purple);
  border: none;
  font-size: 1.4rem;
  box-shadow: 0 4px 20px rgba(123, 94, 167, 0.4);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.chat-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 28px rgba(123, 94, 167, 0.6);
}

.chat-window {
  position: fixed;
  bottom: calc(var(--ticker-height) + 140px);
  right: 1.5rem;
  z-index: 100;
  width: min(360px, calc(100vw - 2rem));
  max-height: 420px;
  background: var(--bg-surface);
  border: 1px solid rgba(201, 168, 76, 0.2);
  border-radius: var(--radius-xl);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.chat-window.open { display: flex; }

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: rgba(123, 94, 167, 0.15);
  border-bottom: 1px solid rgba(123, 94, 167, 0.2);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent);
}
.chat-close {
  font-size: 1.2rem;
  color: var(--text-muted);
  cursor: pointer;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
}
.chat-close:hover { background: rgba(255,255,255,0.1); }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-height: 200px;
  max-height: 280px;
}
.chat-msg {
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  line-height: 1.5;
  max-width: 85%;
  animation: msgPop 0.3s ease;
}
@keyframes msgPop {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.chat-msg.karen {
  background: rgba(123, 94, 167, 0.15);
  border: 1px solid rgba(123, 94, 167, 0.2);
  align-self: flex-start;
  color: var(--text);
}
.chat-msg.user {
  background: rgba(201, 168, 76, 0.12);
  border: 1px solid rgba(201, 168, 76, 0.2);
  align-self: flex-end;
  color: var(--text);
}

.chat-input-area {
  display: flex;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}
.chat-input-area input {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  color: var(--text);
  outline: none;
}
.chat-input-area input:focus { border-color: var(--purple); }
.chat-input-area button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--purple);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s;
}
.chat-input-area button:hover { background: #9070c0; }

/* ========================================
   CNBC-Style Ticker Bar
   ======================================== */
.ticker-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  height: var(--ticker-height);
  background: var(--bg-ticker);
  border-top: 2px solid var(--accent);
  display: flex;
  align-items: center;
  overflow: hidden;
  font-family: var(--font-mono);
}

.ticker-label {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0 1rem;
  height: 100%;
  background: var(--accent);
  color: var(--bg);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  z-index: 1;
}
.ticker-label-icon { font-size: 1rem; }

.ticker-track {
  flex: 1;
  overflow: hidden;
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
}

.ticker-content {
  display: flex;
  align-items: center;
  white-space: nowrap;
  animation: tickerScroll var(--ticker-duration, 120s) linear infinite;
  gap: 0;
}

@keyframes tickerScroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0 1.5rem;
  font-size: 0.75rem;
  color: var(--text);
  white-space: nowrap;
}
.ticker-item .ticker-emoji {
  font-size: 0.9rem;
}
.ticker-sep {
  color: var(--accent);
  opacity: 0.4;
  padding: 0 0.5rem;
  font-size: 0.6rem;
}
.ticker-item.weather { color: var(--teal); }
.ticker-item.news { color: var(--accent-bright); }
.ticker-item.karen-rant { color: var(--rose); }
.ticker-item.karen-happy { color: #4ade80; }
.ticker-item.karen-mood { color: var(--purple); font-style: italic; }

/* --- Karen Lore / About --- */
.karen-lore {
  position: relative;
  z-index: 10;
  max-width: 640px;
  margin: 0 auto 1.5rem;
  padding: 0 1.5rem;
}
.lore-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1rem;
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: var(--text-muted);
  background: rgba(123, 94, 167, 0.06);
  border: 1px solid rgba(123, 94, 167, 0.15);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.3s;
}
.lore-toggle:hover {
  background: rgba(123, 94, 167, 0.12);
  color: var(--text);
}
.lore-arrow {
  font-size: 0.6rem;
  transition: transform 0.3s;
}
.lore-arrow.open { transform: rotate(180deg); }
.lore-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.lore-content.open { max-height: 800px; }
.lore-inner {
  padding: 1.25rem 1rem;
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--text-muted);
}
.lore-inner p { margin-bottom: 0.75rem; max-width: 100%; }
.lore-inner ul {
  margin: 0.5rem 0 1rem 1.25rem;
  list-style: disc;
}
.lore-inner li {
  margin-bottom: 0.35rem;
  font-size: 0.82rem;
  max-width: 100%;
}
.lore-quote {
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--accent);
  font-style: italic;
  text-align: center;
  margin-bottom: 1rem;
}
.lore-sig {
  font-style: italic;
  font-size: 0.8rem;
  color: var(--text-faint);
  text-align: center;
  margin-top: 0.5rem;
}

/* --- Tip Jar --- */
.tip-jar {
  position: relative;
  z-index: 10;
  max-width: 640px;
  margin: 1rem auto 2rem;
  padding: 0 1.5rem;
}
.tip-jar-inner {
  background: linear-gradient(135deg, rgba(123, 94, 167, 0.1), rgba(201, 168, 76, 0.08));
  border: 1px solid rgba(201, 168, 76, 0.2);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}
.tip-jar-icon {
  font-size: 2rem;
  line-height: 1;
}
.tip-jar-text h3 {
  font-family: var(--font-display);
  font-size: clamp(0.85rem, 0.75rem + 0.5vw, 1.1rem);
  color: var(--accent);
  font-weight: 400;
  margin-bottom: 0.2rem;
}
.tip-jar-text p {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
  max-width: 100%;
}
.tip-jar-sol {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
}
.sol-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--purple);
  background: rgba(123, 94, 167, 0.12);
  padding: 0.15rem 0.6rem;
  border-radius: 9999px;
}
.tip-amount {
  font-family: var(--font-mono);
  font-size: clamp(1.1rem, 1rem + 0.5vw, 1.4rem);
  color: var(--accent-bright);
  font-weight: 700;
  letter-spacing: 0.02em;
}
.tip-math {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-faint);
  letter-spacing: 0.03em;
  margin-bottom: 0.2rem;
}
.sol-address-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.75rem;
  max-width: 100%;
  overflow: hidden;
}
.sol-address {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  user-select: all;
  -webkit-user-select: all;
}
.copy-btn {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}
.copy-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--accent);
}
.copy-toast {
  font-size: 0.75rem;
  color: #4ade80;
  opacity: 0;
  transform: translateY(4px);
  transition: all 0.3s ease;
  pointer-events: none;
}
.copy-toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* --- Footer --- */
.site-footer {
  position: relative;
  z-index: 10;
  text-align: center;
  padding: 1.5rem;
  font-size: 0.75rem;
  color: var(--text-faint);
  border-top: 1px solid rgba(201, 168, 76, 0.08);
}
.site-footer a {
  color: var(--text-muted);
  text-decoration: none;
  display: block;
  margin-top: 0.3rem;
}
.site-footer a:hover { color: var(--accent); }

/* --- Mobile --- */
@media (max-width: 600px) {
  .site-header {
    flex-direction: column;
    gap: 0.75rem;
    text-align: center;
    padding: 1rem;
  }
  .logo-area { flex-direction: column; gap: 0.5rem; }
  .cards-container { gap: 0.75rem; }
  .card {
    width: clamp(100px, 26vw, 140px);
    height: clamp(165px, 42vw, 225px);
  }
  .reading-content { padding: 1rem; }
  .chat-window {
    right: 0.5rem;
    bottom: calc(var(--ticker-height) + 80px);
    width: calc(100vw - 1rem);
  }
  .chat-toggle {
    bottom: calc(var(--ticker-height) + 16px);
    right: 0.75rem;
    width: 42px;
    height: 42px;
    font-size: 1.2rem;
  }
  .new-reading-btn {
    margin-right: 60px;
  }
  .ticker-label {
    font-size: 0.55rem;
    padding: 0 0.5rem;
  }
  .ticker-item { font-size: 0.65rem; padding: 0 1rem; }
}
