/* ═══════════════════════════════════════════════════════════════════════════
   ChatGPT in Review — Bento Grid
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --bg: #ffffff;
  --bg-card: #f0f0f0;
  --bg-card-rgb: 240, 240, 240;
  --text: #111111;
  --text-secondary: #666666;
  --text-muted: #999999;
  --border: #e5e5e5;
  --accent: #111111;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  --btn-size: 60px;
  --card-gap: 2px;

  /* Popping color palette */
  --color-coral: #FF6B6B;
  --color-amber: #FFAB40;
  --color-lime: #9CCC65;
  --color-teal: #26C6DA;
  --color-sky: #42A5F5;
  --color-violet: #7E57C2;
  --color-pink: #EC407A;
  --color-orange: #FF7043;

  /* Chart highlight colors */
  --color-hour-peak: #06be43;
  --color-day-peak: #cc75ff;
  --color-month-peak: #f5c842;
}

[data-theme="dark"] {
  --bg: #0a0a0a;
  --bg-card: #1a1a1a;
  --bg-card-rgb: 26, 26, 26;
  --text: #fafafa;
  --text-secondary: #a0a0a0;
  --text-muted: #666666;
  --border: #262626;
  --accent: #fafafa;
}

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

/* ═══════════════════════════════════════════════════════════════════════════
   Shimmer Loading Animation
   ═══════════════════════════════════════════════════════════════════════════ */

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.shimmer {
  display: inline-block;
  background: linear-gradient(
    90deg,
    var(--border) 25%,
    var(--bg) 50%,
    var(--border) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite ease-in-out;
  border-radius: 4px;
}

.shimmer-text {
  width: 120px;
  height: 14px;
}

.shimmer-text-sm {
  width: 60px;
  height: 12px;
}

.shimmer-text-lg {
  width: 180px;
  height: 24px;
}

.shimmer-number {
  width: 100px;
  height: 40px;
  border-radius: 6px;
}

.shimmer-chart {
  width: 100%;
  height: 120px;
  border-radius: 8px;
}

.shimmer-chart-tall {
  height: 200px;
}

.shimmer-msg {
  height: 32px;
  border-radius: 10px;
}

.shimmer-msg-user {
  width: 60%;
  align-self: flex-end;
}

.shimmer-msg-assistant {
  width: 80%;
  align-self: flex-start;
}

.shimmer-topic {
  width: 100%;
  height: 20px;
  margin-bottom: 8px;
}

.shimmer-tarot {
  width: 100%;
  height: 400px;
  border-radius: 8px;
}

.shimmer-nutrition-row {
  width: 100%;
  height: 36px;
  margin-bottom: 4px;
}

.chart-shimmer {
  display: flex;
  align-items: center;
  justify-content: center;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

/* Header */
.header {
  background: var(--bg);
  margin: 0 auto;
  padding: 3rem 1.5rem 2rem;
  text-align: left;
  max-width: 1200px;
}

.logo {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 2.5rem;
  letter-spacing: -0.03em;
  margin: 0;
  margin-left: calc(var(--btn-size) * 0.75);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Bento Grid
   ═══════════════════════════════════════════════════════════════════════════ */

.bento {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--card-gap);
}

.card {
  background: var(--bg-card);
  border: none;
  border-radius: 64px;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Share button */
.share-btn {
  position: absolute;
  top: 0;
  right: 0;
  width: var(--btn-size);
  height: var(--btn-size);
  border: none;
  background: var(--bg-card);
  border-radius: 0;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.share-btn svg {
  width: 20px;
  height: 20px;
  stroke: var(--text-muted);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.card:hover .share-btn {
  opacity: 1;
}

.card-tarot:hover {
  border-top-right-radius: 0;
}

.share-btn:hover svg {
  stroke: var(--text);
}

/* Share button on special background cards */
.card-streak .share-btn {
  background: var(--color-orange);
}

.card-streak .share-btn svg {
  stroke: var(--bg);
}

.card-energy .share-btn {
  background: var(--color-amber);
}

.card-energy .share-btn svg {
  stroke: var(--bg);
}

.card-water .share-btn {
  background: var(--color-sky);
}

.card-water .share-btn svg {
  stroke: var(--bg);
}

.card-emojis .share-btn {
  background: #000000;
}

.card-emojis .share-btn svg {
  stroke: #ffffff;
}

[data-theme="dark"] .card-emojis .share-btn {
  background: #ffffff;
}

[data-theme="dark"] .card-emojis .share-btn svg {
  stroke: #000000;
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(1rem);
  background: var(--accent);
  color: var(--bg);
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 1000;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.card-label {
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.75rem;
  text-align: center;
}

/* Section Headers */
.section-header {
  grid-column: 1 / -1;
  padding: 2rem 0 0.5rem;
  background: var(--bg);
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 0;
  margin-left: calc(var(--btn-size) * 0.75);
  color: var(--text-secondary);
}

.section-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0.25rem 0 0;
}

.card-header {
  display: flex;
  justify-content: center;
  align-items: baseline;
  margin-bottom: 0.75rem;
}

.card-header .card-label {
  margin-bottom: 0;
}

.chart-peak {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Stat Card Typography (standardized)
   Structure: card-label → stat-value → stat-unit → stat-subtitle → stat-note
   ═══════════════════════════════════════════════════════════════════════════ */

/* Main metric value */
.stat-value {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
}

.big-label {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 500;
  margin-left: 0.15em;
}

/* Unit displayed next to or below value */
.stat-unit {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Subtitle - fun comparisons, conversation titles (italic) */
.stat-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 0.5rem;
}

/* Note - source info, small context at bottom */
.stat-note {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: auto;
  padding-top: 0.75rem;
}

/* Legacy aliases (for backwards compatibility, prefer new names) */
.big-number { font-family: var(--font-display); font-size: 2.5rem; font-weight: 700; line-height: 1; letter-spacing: -0.03em; }
.medium-number { font-family: var(--font-display); font-size: 1.5rem; font-weight: 600; line-height: 1.2; letter-spacing: -0.02em; }
.medium-unit { font-size: 0.75rem; color: var(--text-secondary); }
.medium-detail { font-size: 0.75rem; color: var(--text-muted); font-style: italic; margin-top: 0.5rem; }
.card-fun { font-size: 0.8rem; color: var(--text-secondary); margin-top: 1rem; font-style: italic; }
.card-note { font-size: 0.65rem; color: var(--text-muted); margin-top: 1rem; }
.streak-dates { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.5rem; }

.chart-note {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Card Sizes — Desktop Grid
   ═══════════════════════════════════════════════════════════════════════════ */

/* Title card - hidden on desktop */
.card-title {
  display: none;
}

.title-text {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 500;
  letter-spacing: -0.03em;
  text-align: center;
}

/* Section 0 + 1: Intro stack - on desktop, display as grid contents */
.intro-stack {
  display: contents;
}

.card-first {
  grid-column: span 6;
  height: 330px;
}

.card-first .chat {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.card-overview { grid-column: span 6; }

/* Stats stack - on desktop, display as grid contents */
.stats-stack {
  display: contents;
}

.card-longest-convo { grid-column: span 4; }
.card-longest-msg { grid-column: span 4; }
.card-streak {
  grid-column: span 4;
  background: var(--color-orange);
}

.card-streak,
.card-streak .card-label,
.card-streak .stat-value,
.card-streak .stat-subtitle {
  color: var(--bg);
}

/* Section 2: Charts */
/* Chart stacks - on desktop, display as grid contents */
.charts-stack-1,
.charts-stack-2 {
  display: contents;
}

/* Hide mobile day labels on desktop */
.day-labels-mobile {
  display: none;
}

.card-hourly { grid-column: span 6; }
.card-daily { grid-column: span 3; }
.card-monthly { grid-column: span 3; }
.card-timeline { grid-column: span 12; }

/* Timeline chart extends to card edges */
.card-timeline #timeline-chart {
  margin-left: -2rem;
  margin-right: -2rem;
  width: calc(100% + 4rem);
}

/* Section 3: Perspective */
/* Perspective stacks - on desktop, display as grid contents */
.perspective-stack-1,
.perspective-stack-2 {
  display: contents;
}

.card-words { grid-column: span 3; }
.card-pages { grid-column: span 3; }

.card-pages .card-label,
.card-pages .stat-value,
.card-pages .stat-note,
.card-pages .big-label {
  font-family: 'Playfair Display', Georgia, serif;
  font-style: italic;
}

.card-warpeace { grid-column: span 3; }

.card-receipt { grid-column: span 3; }

.card-receipt .card-label,
.card-receipt .stat-value,
.card-receipt .stat-note,
.card-receipt .big-label {
  font-family: "Doto", sans-serif;
  font-optical-sizing: auto;
  font-weight: 700;
  font-variation-settings: "ROND" 0;
}

.card-receipt .stat-note {
  color: var(--text);
}

.card-tokens { grid-column: span 4; }
.card-energy {
  grid-column: span 4;
  background: var(--color-amber);
}

.card-energy,
.card-energy .card-label,
.card-energy .stat-value,
.card-energy .stat-subtitle,
.card-energy .stat-note,
.card-energy .big-label {
  color: var(--bg);
}
.card-water {
  grid-column: span 4;
  background: var(--color-sky);
}

.card-water,
.card-water .card-label,
.card-water .stat-value,
.card-water .stat-subtitle,
.card-water .stat-note,
.card-water .big-label {
  color: var(--bg);
}

/* card-fun and card-note now defined in Stat Card Typography section */

/* Section 4: Topics */
.topics-stack {
  display: contents;
}

.card-topics { grid-column: span 4; }
.card-streamgraph {
  grid-column: span 8;
}

/* Streamgraph chart extends to card edges */
.card-streamgraph #streamgraph-chart {
  margin-left: -2rem;
  margin-right: -2rem;
  width: calc(100% + 4rem);
}

/* Section 5: You and ChatGPT */
.frustration-stack {
  display: contents;
}

.card-frustration { grid-column: span 8; }
.card-wordcloud { grid-column: span 4; }

/* Section: The Vibes - Nutrition/Emoji/Tarot layout */
.vibes-top-stack {
  grid-column: span 12;
  display: flex;
  gap: var(--card-gap);
}

.vibes-right-stack {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--card-gap);
}

.vibes-right-stack .card-nutrition {
  flex: none;
}

.vibes-right-stack .card-emojis {
  flex: 1;
  min-height: 200px;
  position: relative;
  padding: var(--btn-size);
  background: #000000;
}

[data-theme="dark"] .vibes-right-stack .card-emojis {
  background: #ffffff;
}

.card-emojis .card-label {
  position: absolute;
  top: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  background: rgba(0, 0, 0, 0.8);
  color: #ffffff;
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 0;
  white-space: nowrap;
}

[data-theme="dark"] .card-emojis .card-label {
  background: rgba(255, 255, 255, 0.8);
  color: #000000;
}

.vibes-top-stack > .card-tarot {
  flex: 1;
}

/* Legacy Section 6: Tarot, Emojis & Nutrition */
.card-tarot { grid-column: span 6; }

.emoji-nutrition-stack {
  grid-column: span 6;
  display: flex;
  flex-direction: column;
  gap: var(--card-gap);
}

.emoji-nutrition-stack .card-emojis {
  flex-shrink: 0;
}

.emoji-nutrition-stack .card-nutrition {
  flex: 1;
}

.emoji-cloud-wrapper {
  position: absolute;
  top: var(--btn-size);
  left: var(--btn-size);
  right: var(--btn-size);
  bottom: var(--btn-size);
  overflow: hidden;
  border-radius: 0;
}

.emoji-cloud-wrapper canvas {
  display: block;
}


/* ═══════════════════════════════════════════════════════════════════════════
   Section 1: Overview Card
   ═══════════════════════════════════════════════════════════════════════════ */

.card-overview {
  justify-content: space-between;
  text-align: center;
}

.overview-hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.overview-number {
  display: block;
  font-family: var(--font-display);
  font-size: 5.5rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.04em;
}

.overview-label {
  display: block;
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

.overview-label strong {
  color: var(--text);
  font-weight: 600;
}

.overview-breakdown {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
  margin-top: 0.75rem;
}

.overview-stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.overview-val {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
}

.overview-desc {
  font-size: 0.6rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

.overview-divider {
  display: none;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Section 0: First Conversation
   ═══════════════════════════════════════════════════════════════════════════ */

.first-date {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

.chat {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.msg {
  padding: 0.5rem 0.75rem;
  border-radius: 10px;
  font-size: 0.8rem;
  max-width: 90%;
}

.msg.user {
  background: var(--accent);
  color: var(--bg);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.msg.assistant {
  background: var(--border);
  color: var(--text);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.first-duration {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Section 2: Charts
   ═══════════════════════════════════════════════════════════════════════════ */

/* Chart containers */
#hour-chart,
#month-chart {
  height: 120px;
}

#day-chart {
  flex: 1;
  min-height: 120px;
}

#timeline-chart {
  flex: 1;
  min-height: 250px;
}

/* Chart labels - horizontal (below chart) */
.chart-labels-h {
  display: flex;
  justify-content: space-between;
  margin-top: 0.35rem;
  font-size: 0.6rem;
  color: var(--text-muted);
}

/* Chart labels - vertical (left of chart, rendered by D3 in day chart) */
.chart-labels-v {
  font-size: 0.6rem;
  color: var(--text-muted);
}

/* streak-dates now defined in Stat Card Typography section */

/* ═══════════════════════════════════════════════════════════════════════════
   Section 3: Perspective
   ═══════════════════════════════════════════════════════════════════════════ */

.word-comparisons {
  display: flex;
  gap: 1.5rem;
  margin-top: 1rem;
}

.comp {
  display: flex;
  flex-direction: column;
}

.comp-val {
  font-size: 1rem;
  font-weight: 600;
}

.comp-lbl {
  font-size: 0.65rem;
  color: var(--text-muted);
}

.receipt-metric {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.receipt-compare {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.env-compare {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

.env-source {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 0.25rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Section 4: Topics
   ═══════════════════════════════════════════════════════════════════════════ */

.topic-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.topic {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.8rem;
}

.topic-rank {
  font-weight: 600;
  color: var(--text-muted);
  width: 16px;
}

.topic-name {
  flex: 1;
}

.topic-pct {
  color: var(--text-muted);
}

.placeholder {
  flex: 1;
  min-height: 80px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Streamgraph */
#streamgraph-chart {
  flex: 1;
  min-height: 200px;
}

#streamgraph-legend {
  display: flex;
  flex-wrap: nowrap;
  gap: 1rem;
  margin-top: 0.75rem;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

#streamgraph-legend::-webkit-scrollbar {
  display: none;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.65rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.legend-color {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* Tarot */
.card-tarot {
  padding: 0;
  overflow: hidden;
  position: relative;
}


#tarot-container {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  position: relative;
}

#tarot-container .card-label {
  position: absolute;
  top: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  background: rgba(var(--bg-card-rgb, 240, 240, 240), 1);
  color: var(--text);
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 0;
  white-space: nowrap;
}

.tarot-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Section 5: You and ChatGPT
   ═══════════════════════════════════════════════════════════════════════════ */

/* Frustration Chart */
.card-frustration {
  min-height: 450px;
}

#frustration-chart {
  flex: 1;
  min-height: 350px;
}

.frustration-legend {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 0.75rem;
}

.frustration-color {
  background: var(--color-coral);
}

.apology-color {
  background: var(--color-teal);
}

/* Word Cloud Container */
.card-wordcloud {
  display: flex;
  flex-direction: column;
  min-height: 450px;
  position: relative;
  padding: 0;
}

.card-wordcloud .card-label {
  position: absolute;
  top: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  background: rgba(var(--bg-card-rgb, 240, 240, 240), 1);
  color: var(--text);
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 0;
}

/* Frustration word cloud font classes */
.wc-serif { font-family: Georgia, 'Times New Roman', serif !important; }
.wc-sans { font-family: Arial, Helvetica, sans-serif !important; }
.wc-mono { font-family: Menlo, 'Courier New', monospace !important; }
.wc-display { font-family: Impact, 'Arial Black', sans-serif !important; }

#frustration-cloud {
  flex: 1;
  min-height: 380px;
  width: 100%;
  height: 100%;
  filter: saturate(0);
  transition: filter 0.3s ease;
  overflow: hidden;
  border-radius: 64px;
}

.card-wordcloud:hover #frustration-cloud {
  filter: saturate(1);
}

.frust-grid {
  display: flex;
  justify-content: space-around;
  gap: 1rem;
  flex: 1;
  align-items: center;
}

.frust-side {
  text-align: center;
}

.frust-val {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
}

.frust-lbl {
  display: block;
  font-size: 0.65rem;
  color: var(--text-secondary);
}

.frust-rate {
  display: block;
  font-size: 0.6rem;
  color: var(--text-muted);
}

.emoji-total {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.emoji-list {
  font-size: 0.9rem;
  line-height: 1.6;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Section 6: Nutrition Label
   ═══════════════════════════════════════════════════════════════════════════ */

.nutrition-label {
  border: none;
  padding: 0.75rem;
}

.nutrition-title {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  text-align: center;
  letter-spacing: -0.02em;
  border-bottom: 1px solid var(--accent);
  padding-bottom: 0.25rem;
}

.nutrition-serving {
  font-size: 0.7rem;
  text-align: center;
  margin: 0.25rem 0;
}

.nutrition-divider {
  height: 1px;
  background: var(--accent);
  margin: 0.35rem 0;
}

.nutrition-divider.thick {
  height: 6px;
}

.nutrition-dv {
  font-size: 0.6rem;
  text-align: right;
  color: var(--text-muted);
}

.nutrition-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
}

.nutrition-row:last-of-type {
  border-bottom: none;
}

.nutrition-item {
  display: flex;
  flex-direction: column;
}

.nutrition-name {
  font-size: 0.85rem;
}

.nutrition-desc {
  font-size: 0.55rem;
  color: var(--text-muted);
}

.nutrition-val {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
}

.nutrition-row.highlight {
  padding-top: 0.35rem;
}

.nutrition-row.highlight .nutrition-name {
  font-weight: 700;
}

.nutrition-row.highlight .nutrition-val {
  font-size: 1.25rem;
  font-weight: 700;
}

.nutrition-footnote {
  font-size: 0.55rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
  line-height: 1.3;
}

/* ═══════════════════════════════════════════════════════════════════════════
   API Key Card
   ═══════════════════════════════════════════════════════════════════════════ */

.card-apikey {
  grid-column: span 12;
}

.apikey-code {
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
  font-size: 1.5rem;
  background: transparent;
  border: none;
  padding: 0;
  white-space: nowrap;
  overflow-x: auto;
  flex: 1;
  color: var(--text-secondary);
  scrollbar-width: none;
}

.apikey-code::-webkit-scrollbar {
  display: none;
}

/* Footer */
.footer {
  text-align: center;
  padding: 3rem 1rem 2rem;
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.footer a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.footer a:hover {
  color: var(--text);
}

.footer-disclaimer {
  opacity: 0.6;
  font-size: 0.6rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Landscape Blocker (mobile only)
   ═══════════════════════════════════════════════════════════════════════════ */

.landscape-blocker {
  display: none;
}

@media (max-width: 768px) and (orientation: landscape) {
  .landscape-blocker {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-card);
    z-index: 9999;
    align-items: center;
    justify-content: center;
  }

  .landscape-message {
    text-align: center;
    color: var(--text);
  }

  .rotate-icon {
    font-size: 4rem;
    display: block;
    margin-bottom: 1rem;
    animation: rotate-hint 2s ease-in-out infinite;
  }

  @keyframes rotate-hint {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-20deg); }
    75% { transform: rotate(20deg); }
  }

  .landscape-message p {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--text-secondary);
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Mobile — Single Card Horizontal Swipe
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  /* Lock body scroll on mobile */
  html, body {
    overflow: hidden;
    height: 100%;
    height: 100dvh;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    overscroll-behavior: none;
    background: var(--bg-card);
  }

  /* Ensure html background matches for safe areas */
  html {
    background: var(--bg-card);
  }

  /* Hide header on mobile */
  .header {
    display: none;
  }

  /* Show title card on mobile */
  .card-title {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .title-text {
    font-size: 2.5rem;
  }

  /* Intro stack - combined on mobile */
  .intro-stack {
    display: flex;
    flex: 0 0 100vw;
    width: 100vw;
    height: 100%;
    overflow-y: auto;
    scroll-snap-align: center;
    scroll-snap-stop: always;
    flex-direction: column;
    gap: 3rem;
    padding: 1.5rem 1.25rem;
    box-sizing: border-box;
    justify-content: center;
    background: var(--bg-card);
  }

  /* Cards inside intro-stack */
  .intro-stack .card {
    flex: none;
    width: auto;
    height: auto;
    overflow-y: visible;
    scroll-snap-align: unset;
    scroll-snap-stop: unset;
    border: none;
    border-radius: 0;
    padding: 0.5rem 0;
    background: transparent;
  }

  /* Hide section headers completely (remove from flex flow) */
  .section-header {
    display: none !important;
  }

  /* Hide footer on mobile (it's outside the fixed layout) */
  .footer {
    display: none;
  }

  /* Horizontal scroll container */
  .bento {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 40px; /* pagination bar height */
    padding: 0;
    gap: 0;
    display: flex;
    flex-direction: row;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    touch-action: pan-x;
    overscroll-behavior: contain;
  }

  .bento::-webkit-scrollbar {
    display: none;
  }

  /* Cards as full-screen swipeable pages */
  .card {
    flex: 0 0 100vw;
    width: 100vw;
    height: 100%;
    overflow-y: auto;
    scroll-snap-align: center;
    scroll-snap-stop: always;
    border-radius: 0;
    border: none;
    border-right: 1px solid var(--border);
    justify-content: center;
    padding: 1.5rem 1.25rem;
    box-sizing: border-box;
  }

  /* Hide share button on mobile */
  .share-btn {
    display: none;
  }

  /* Stats stack - vertically stacked on one swipeable page */
  .stats-stack {
    display: flex;
    flex: 0 0 100vw;
    width: 100vw;
    height: 100%;
    overflow-y: auto;
    scroll-snap-align: center;
    scroll-snap-stop: always;
    flex-direction: column;
    gap: 2px;
    padding: 0 1.25rem;
    box-sizing: border-box;
    justify-content: center;
    align-items: stretch;
    background: var(--bg-card);
  }

  /* Cards inside stats-stack should not be full-width pages */
  .stats-stack .card {
    flex: none;
    width: auto;
    height: auto;
    overflow-y: visible;
    scroll-snap-align: unset;
    scroll-snap-stop: unset;
    border: none;
    border-radius: 0;
    padding: 1rem 0;
    background: transparent;
  }

  /* Charts stacks - vertically stacked on swipeable pages */
  .charts-stack-1,
  .charts-stack-2 {
    display: flex;
    flex: 0 0 100vw;
    width: 100vw;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-snap-align: center;
    scroll-snap-stop: always;
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem 0;
    box-sizing: border-box;
    justify-content: center;
    background: var(--bg-card);
  }

  /* Cards inside chart stacks should not be full-width pages */
  .charts-stack-1 .card,
  .charts-stack-2 .card {
    flex: 1;
    width: auto;
    height: auto;
    min-height: 0;
    overflow-y: visible;
    overflow-x: hidden;
    scroll-snap-align: unset;
    scroll-snap-stop: unset;
    border: none;
    border-radius: 0;
    padding: 0.75rem 1.25rem;
    background: transparent;
  }

  /* Chart containers edge-to-edge on mobile */
  .charts-stack-1 #hour-chart,
  .charts-stack-1 #day-chart,
  .charts-stack-2 #month-chart,
  .charts-stack-2 #timeline-chart {
    margin-left: -1.25rem;
    margin-right: -1.25rem;
    width: calc(100% + 2.5rem);
  }

  /* Chart labels need padding */
  .charts-stack-1 .chart-labels-h,
  .charts-stack-2 .chart-labels-h {
    padding: 0 1.25rem;
  }

  /* Show mobile day labels */
  .day-labels-mobile {
    display: flex;
  }

  /* Perspective stacks - vertically stacked on swipeable pages */
  .perspective-stack-1,
  .perspective-stack-2 {
    display: flex;
    flex: 0 0 100vw;
    width: 100vw;
    height: 100%;
    overflow-y: auto;
    scroll-snap-align: center;
    scroll-snap-stop: always;
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem 1.25rem;
    box-sizing: border-box;
    justify-content: center;
    background: var(--bg-card);
  }

  /* Tokens, energy, water - tighter vertical spacing */
  .perspective-stack-2 {
    gap: 2px;
  }

  /* Cards inside perspective stacks should not be full-width pages */
  .perspective-stack-1 .card,
  .perspective-stack-2 .card {
    flex: none;
    width: auto;
    height: auto;
    overflow-y: visible;
    scroll-snap-align: unset;
    scroll-snap-stop: unset;
    border: none;
    border-radius: 0;
    padding: 0.75rem 0;
    background: transparent;
  }

  .card-label {
    font-size: 0.65rem;
    margin-bottom: 0.5rem;
  }

  /* ═══════════════════════════════════════════════════════════════════════
     Typography Scaling for Mobile
     ═══════════════════════════════════════════════════════════════════════ */

  .stat-value,
  .big-number {
    font-size: 3rem;
  }

  .big-label {
    font-size: 1.25rem;
  }

  .medium-number {
    font-size: 1.75rem;
  }

  .medium-detail {
    font-size: 0.7rem;
  }

  .card-fun {
    font-size: 0.75rem;
  }

  .card-note {
    font-size: 0.6rem;
  }

  /* ═══════════════════════════════════════════════════════════════════════
     First Conversation Card
     ═══════════════════════════════════════════════════════════════════════ */

  .first-date {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
  }

  .chat {
    gap: 0.4rem;
    margin-bottom: 0.75rem;
  }

  .msg {
    font-size: 0.75rem;
    padding: 0.4rem 0.6rem;
    max-width: 85%;
  }

  .first-duration {
    font-size: 0.75rem;
  }

  /* ═══════════════════════════════════════════════════════════════════════
     Overview Card
     ═══════════════════════════════════════════════════════════════════════ */

  .overview-number {
    font-size: 4rem;
  }

  .overview-label {
    font-size: 0.9rem;
  }

  .overview-breakdown {
    flex-direction: row;
    gap: 0;
  }

  .overview-val {
    font-size: 0.85rem;
  }

  .overview-desc {
    font-size: 0.55rem;
  }

  /* ═══════════════════════════════════════════════════════════════════════
     Chart Cards
     ═══════════════════════════════════════════════════════════════════════ */

  #hour-chart,
  #month-chart {
    height: 100px;
  }

  #day-chart {
    min-height: 100px;
  }

  #timeline-chart {
    min-height: 180px;
  }

  #streamgraph-chart {
    min-height: 160px;
  }

  .chart-labels-h {
    font-size: 0.55rem;
  }

  .chart-peak {
    font-size: 0.65rem;
  }

  /* ═══════════════════════════════════════════════════════════════════════
     Topics Card - combined on mobile
     ═══════════════════════════════════════════════════════════════════════ */

  .topics-stack {
    display: flex;
    flex: 0 0 100vw;
    width: 100vw;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-snap-align: center;
    scroll-snap-stop: always;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.5rem 0;
    box-sizing: border-box;
    justify-content: center;
    background: var(--bg-card);
  }

  /* Cards inside topics-stack */
  .topics-stack .card {
    flex: none;
    width: auto;
    height: auto;
    overflow-y: visible;
    overflow-x: hidden;
    scroll-snap-align: unset;
    scroll-snap-stop: unset;
    border: none;
    border-radius: 0;
    padding: 0.5rem 1.25rem;
    background: transparent;
  }

  /* Streamgraph chart edge-to-edge on mobile */
  .topics-stack #streamgraph-chart {
    margin-left: -1.25rem;
    margin-right: -1.25rem;
    width: calc(100% + 2.5rem);
  }

  .topic {
    font-size: 0.75rem;
    gap: 0.4rem;
  }

  .topic-rank {
    width: 14px;
  }

  /* Streamgraph legend */
  #streamgraph-legend {
    gap: 0.75rem;
    margin-top: 0.5rem;
  }

  .legend-item {
    font-size: 0.6rem;
  }

  .legend-color {
    width: 8px;
    height: 8px;
  }

  /* ═══════════════════════════════════════════════════════════════════════
     Frustration Section
     ═══════════════════════════════════════════════════════════════════════ */

  /* Frustration stack - combined on mobile */
  .frustration-stack {
    display: flex;
    flex: 0 0 100vw;
    width: 100vw;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-snap-align: center;
    scroll-snap-stop: always;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1rem 0;
    box-sizing: border-box;
    justify-content: center;
    background: var(--bg-card);
  }

  /* Cards inside frustration-stack */
  .frustration-stack .card {
    flex: none;
    width: auto;
    height: auto;
    overflow-y: visible;
    overflow-x: hidden;
    scroll-snap-align: unset;
    scroll-snap-stop: unset;
    border: none;
    border-radius: 0;
    padding: 0.5rem 1.25rem;
    background: transparent;
  }

  /* Frustration chart edge-to-edge on mobile */
  .frustration-stack #frustration-chart {
    margin-left: -1.25rem;
    margin-right: -1.25rem;
    width: calc(100% + 2.5rem);
  }

  .card-frustration {
    min-height: auto;
  }

  #frustration-chart {
    min-height: 140px;
  }

  .frustration-legend {
    gap: 1rem;
    margin-top: 0.5rem;
  }

  .card-wordcloud {
    min-height: auto;
    padding: 0.5rem 0;
  }

  .card-wordcloud canvas {
    min-height: 150px;
  }

  /* Frustration word cloud always colorful on mobile */
  #frustration-cloud {
    filter: none !important;
    border-radius: 0;
    margin-left: -1.25rem;
    margin-right: -1.25rem;
    width: calc(100% + 2.5rem);
  }

  /* ═══════════════════════════════════════════════════════════════════════
     Tarot Card
     ═══════════════════════════════════════════════════════════════════════ */

  .card-tarot {
    padding: 0;
  }

  #tarot-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
  }

  .tarot-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    max-height: none;
  }

  /* ═══════════════════════════════════════════════════════════════════════
     Vibes Top Stack - separate pages on mobile
     ═══════════════════════════════════════════════════════════════════════ */

  .vibes-top-stack {
    display: contents;
  }

  .vibes-right-stack {
    display: contents;
  }

  .vibes-right-stack .card,
  .vibes-top-stack > .card-tarot {
    flex: 0 0 100vw;
    width: 100vw;
    height: 100%;
    overflow-y: auto;
    scroll-snap-align: center;
    scroll-snap-stop: always;
    border-radius: 0;
    border: none;
    border-right: 1px solid var(--border);
    justify-content: center;
    padding: 1.5rem 1.25rem;
    box-sizing: border-box;
    background: var(--bg-card);
  }

  /* Emoji card keeps its black/white background on mobile */
  .vibes-right-stack .card-emojis {
    background: #000000;
    padding: 0;
  }

  [data-theme="dark"] .vibes-right-stack .card-emojis {
    background: #ffffff;
  }

  /* Emoji cloud edge-to-edge on mobile */
  .vibes-right-stack .card-emojis .emoji-cloud-wrapper {
    position: absolute;
    top: var(--btn-size);
    left: 0;
    right: 0;
    bottom: var(--btn-size);
  }

  /* ═══════════════════════════════════════════════════════════════════════
     Emoji & Nutrition - separate pages on mobile
     ═══════════════════════════════════════════════════════════════════════ */

  .emoji-nutrition-stack {
    display: contents;
  }

  /* Cards inside emoji-nutrition-stack become full swipeable pages */
  .emoji-nutrition-stack .card {
    flex: 0 0 100vw;
    width: 100vw;
    height: 100%;
    overflow-y: auto;
    scroll-snap-align: center;
    scroll-snap-stop: always;
    border-radius: 0;
    border: none;
    border-right: 1px solid var(--border);
    justify-content: flex-start;
    padding: 1.5rem 1.25rem;
    box-sizing: border-box;
    background: var(--bg-card);
  }

  /* Vertically center nutrition facts card */
  .emoji-nutrition-stack .card-nutrition {
    justify-content: center;
  }

  .emoji-nutrition-stack .card-emojis {
    justify-content: stretch;
  }

  .emoji-nutrition-stack .card-emojis .emoji-cloud-wrapper {
    flex: 1;
    min-height: 50vh;
    height: auto;
  }

  /* ═══════════════════════════════════════════════════════════════════════
     Nutrition Label
     ═══════════════════════════════════════════════════════════════════════ */

  .nutrition-label {
    padding: 0.5rem;
  }

  .nutrition-title {
    font-size: 1.5rem;
  }

  .nutrition-serving {
    font-size: 0.65rem;
  }

  .nutrition-dv {
    font-size: 0.55rem;
  }

  .nutrition-row {
    padding: 0.25rem 0;
  }

  .nutrition-name {
    font-size: 0.75rem;
  }

  .nutrition-desc {
    font-size: 0.5rem;
  }

  .nutrition-val {
    font-size: 0.9rem;
  }

  .nutrition-row.highlight .nutrition-val {
    font-size: 1rem;
  }

  .nutrition-footnote {
    font-size: 0.5rem;
    margin-top: 0.25rem;
  }

  .nutrition-divider.thick {
    height: 4px;
  }

  /* ═══════════════════════════════════════════════════════════════════════
     Footer
     ═══════════════════════════════════════════════════════════════════════ */

  .footer {
    padding: 2rem 1rem 1.5rem;
    font-size: 0.65rem;
  }

  /* ═══════════════════════════════════════════════════════════════════════
     Pagination Dots
     ═══════════════════════════════════════════════════════════════════════ */

  .pagination {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 0.75rem;
    background: var(--bg-card);
    z-index: 100;
  }

  .pagination .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--border);
    border: none;
    cursor: pointer;
    padding: 0;
  }

  .pagination .dot.active {
    background: var(--accent);
  }

  /* ═══════════════════════════════════════════════════════════════════════
     Disable saturation filters on mobile (no hover on touch)
     ═══════════════════════════════════════════════════════════════════════ */

  .card-streamgraph,
  .card-streamgraph:hover,
  #frustration-chart,
  .card-frustration:hover #frustration-chart,
  .frustration-legend,
  .card-frustration:hover .frustration-legend,
  .card-wordcloud canvas,
  .card-wordcloud:hover canvas,
  .emoji-cloud-wrapper canvas,
  .card-emojis:hover .emoji-cloud-wrapper canvas {
    filter: none !important;
  }

  /* ═══════════════════════════════════════════════════════════════════════
     Keep special backgrounds for streak, energy, water on mobile
     Cards extend edge-to-edge horizontally
     ═══════════════════════════════════════════════════════════════════════ */

  .stats-stack .card-streak,
  .perspective-stack-2 .card-energy,
  .perspective-stack-2 .card-water {
    margin-left: -1.25rem;
    margin-right: -1.25rem;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
    border-radius: 0;
  }

  .stats-stack .card-streak {
    background: var(--color-orange);
  }

  .perspective-stack-2 .card-energy {
    background: var(--color-amber);
  }

  .perspective-stack-2 .card-water {
    background: var(--color-sky);
  }

  /* ═══════════════════════════════════════════════════════════════════════
     API Key Card on mobile
     ═══════════════════════════════════════════════════════════════════════ */

  .bento > .card.card-apikey {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    text-align: center;
    height: 100%;
    min-height: 100%;
  }

  .card-apikey .card-label {
    margin-bottom: 1rem;
  }

  .apikey-code {
    font-size: 1.1rem;
    white-space: normal;
    word-break: break-all;
    line-height: 1.4;
    flex: none;
  }

}

/* ═══════════════════════════════════════════════════════════════════════════
   Tablet (769px - 1024px)
   ═══════════════════════════════════════════════════════════════════════════ */

@media (min-width: 769px) and (max-width: 1024px) {
  /* Grid: 6 columns instead of 12 */
  .bento {
    grid-template-columns: repeat(6, 1fr);
  }

  /* Card grid assignments */
  .card-first { grid-column: span 6; }
  .card-overview { grid-column: span 6; }
  .card-longest-convo { grid-column: span 2; }
  .card-longest-msg { grid-column: span 2; }
  .card-streak { grid-column: span 2; }
  .card-hourly { grid-column: span 6; }
  .card-daily { grid-column: span 3; }
  .card-monthly { grid-column: span 3; }
  .card-timeline { grid-column: span 6; }
  .card-words { grid-column: span 3; }
  .card-pages { grid-column: span 3; }
  .card-warpeace { grid-column: span 3; }
  .card-receipt { grid-column: span 3; }
  .card-tokens { grid-column: span 2; }
  .card-energy { grid-column: span 2; }
  .card-water { grid-column: span 2; }
  .card-topics { grid-column: span 3; }
  .card-streamgraph { grid-column: span 6; }
  .card-frustration { grid-column: span 4; }
  .card-wordcloud { grid-column: span 2; }
  /* Vibes section */
  .vibes-top-stack {
    grid-column: span 6;
    display: flex;
    gap: var(--card-gap);
  }

  .vibes-top-stack > .card-tarot {
    flex: 1;
  }

  .vibes-right-stack {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--card-gap);
  }

  .card-tarot { grid-column: span 3; }
  .card-apikey { grid-column: span 6; }

  /* Header */
  .logo {
    font-size: 2.5rem;
  }

  /* Section headers */
  .section-title {
    font-size: 1.25rem;
  }

  /* Overview card */
  .overview-number {
    font-size: 4rem;
  }

  .overview-label {
    font-size: 1rem;
  }

  /* Typography scaling */
  .stat-value,
  .big-number {
    font-size: 2rem;
  }

  .big-label {
    font-size: 1.25rem;
  }

  .medium-number {
    font-size: 1.25rem;
  }

  .first-date {
    font-size: 1.25rem;
  }

  /* Chart heights */
  #hour-chart,
  #month-chart {
    height: 100px;
  }

  #timeline-chart {
    min-height: 200px;
  }

  #streamgraph-chart {
    min-height: 180px;
  }

  /* Frustration section */
  .card-frustration {
    min-height: 350px;
  }

  #frustration-chart {
    min-height: 280px;
  }

  .card-wordcloud {
    min-height: 350px;
  }

  .card-wordcloud canvas {
    min-height: 280px;
  }

  /* Nutrition label */
  .nutrition-title {
    font-size: 1.5rem;
  }

  .nutrition-name {
    font-size: 0.75rem;
  }

  .nutrition-val {
    font-size: 0.95rem;
  }

  .nutrition-row.highlight .nutrition-val {
    font-size: 1.1rem;
  }

  /* Tarot */
  .tarot-image {
    max-height: 80vh;
  }

  /* Emoji card background */
  .vibes-right-stack .card-emojis {
    background: #000000;
  }

  [data-theme="dark"] .vibes-right-stack .card-emojis {
    background: #ffffff;
  }
}

/* Hide pagination on desktop */
.pagination {
  display: none;
}

@media (max-width: 768px) {
  .pagination {
    display: flex;
  }
}
