/* ─── Design Tokens ──────────────────────────────────────────────── */
:root {
  --bg:           #0a0a0a;
  /* --surface-1-flat: #181818; */ /* backup — swap back in here to revert gradient */
  --surface-1:    linear-gradient(145deg, #212126 0%, #171719 100%);
  /* --surface-list: linear-gradient(145deg, #1b2421 0%, #171917 100%); */ /* mint experiment — reverted */
  --surface-2:    #232323;
  --surface-3:    #333333;
  --border:       transparent;
  --border-subtle:transparent;
  --text-primary: #f0f2ff;
  --text-secondary:#c8cfe0;
  --text-muted:   #6b7280;
  --accent:         #e6e6e6;
  --accent-hover:   #d1d1d1;
  --accent-views:   #3b82f6;
  --accent-views-hover: #2563eb;
  --color-wishlists: #f59e0b;
  --success:      #22c55e;
  --warning:      #f59e0b;
  --error:        #ef4444;
  --radius-sm:    8px;
  --radius-md:    12px;
  --radius-lg:    16px;
  --z-nav:        10;
  --z-bottom-nav: 50;
  --z-modal:      100;
  --z-toast:      200;
}

/* ─── Desktop: flat surfaces (gradient looks off on large screens) ── */
@media (min-width: 769px) {
  :root {
    --surface-1: #181818;
  }
}

/* ─── Reset ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

/* Kill native tap flash globally on touch devices */
* { -webkit-tap-highlight-color: transparent; }

/* Flat dark base — covers overscroll/elastic bounce areas too */
html {
  background: #0a0a0a;
}

@keyframes ptr-spin {
  to { transform: rotate(360deg); }
}

/* ─── Base ───────────────────────────────────────────────────────── */
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  background: transparent;
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  font-size: 16px;
  line-height: 1.5;
  overscroll-behavior: contain;
}

/* ─── Focus rings (keyboard nav) ────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ─── Layout ─────────────────────────────────────────────────────── */
.app-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Full-width top bar — shown above the sidebar+main row */
.app-topbar {
  height: 52px;
  background: var(--surface-1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding: 0 16px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 40;
}

/* Inner flex-row that holds the sidebar and main content */
.app-body {
  display: flex;
  flex: 1;
  min-height: 0;
}

.app-sidebar {
  width: 220px;
  background: var(--surface-1);
  border-right: none;
  color: var(--text-primary);
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 52px;
  height: calc(100vh - 52px);
  overflow-y: auto;
}

.app-main {
  flex: 1;
  padding: 24px 32px;
  min-width: 0;
}

/* ─── Bottom nav — hidden on desktop ─────────────────────────────── */
.bottom-nav {
  display: none;
}

/* ─── Stat cards ─────────────────────────────────────────────────── */
.stat-cards {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.stat-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  flex: 1 1 140px;
  min-width: 120px;
}

.stat-card-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--accent-views);
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.stat-card-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

/* ─── iOS-style page nav bar ─────────────────────────────────────── */
.ios-nav {
  position: sticky;
  top: 0;
  z-index: var(--z-nav);
  background: rgba(15, 15, 15, 0.88);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  backdrop-filter: blur(16px) saturate(180%);
  border-bottom: none;
  display: flex;
  align-items: center;
  height: 48px;
  margin: -24px -32px 24px;
  padding: 0 8px 0 4px;
}

.ios-nav-back {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--accent);
  background: none;
  border: none;
  padding: 0 12px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 400;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
  min-height: 44px;
  min-width: 44px;
  transition: opacity 0.15s;
}

.ios-nav-back:active {
  opacity: 0.5;
}

.ios-nav-back svg {
  flex-shrink: 0;
}

.ios-nav-title {
  flex: 1;
  text-align: center;
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 8px;
  margin-right: 44px;
}

/* ─── Detail cards ───────────────────────────────────────────────── */
.detail-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 20px;
}

/* ─── Platform chips ─────────────────────────────────────────────── */
.platform-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--surface-2);
  border: none;
  border-radius: 20px;
  padding: 6px 14px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  min-height: 34px;
}

.platform-chip:hover,
.platform-chip:active {
  background: var(--surface-3);
  color: var(--text-primary);
}

/* Platform-specific chip tints */
.platform-chip--youtube   { background: rgba(252,165,165,0.12); color: #fca5a5; }
.platform-chip--tiktok    { background: rgba(94,234,212,0.12);  color: #5eead4; }
.platform-chip--instagram { background: rgba(216,180,254,0.12); color: #d8b4fe; }
.platform-chip--x         { background: rgba(148,163,184,0.12); color: #94a3b8; }

/* ─── Creator stats grid ─────────────────────────────────────────── */
.creator-stats-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.creator-stats-grid .stat-cell {
  flex: 1;
  min-width: 100px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  text-align: center;
}

.creator-stats-grid .stat-cell-val {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.creator-stats-grid .stat-cell-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

/* ─── Section titles ─────────────────────────────────────────────── */
.section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin: 0 0 12px;
}

/* ─── Tables ─────────────────────────────────────────────────────── */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-md);
  width: 100%;
}

.ios-table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.ios-table th {
  padding: 8px 10px;
  text-align: left;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.ios-table th:last-child,
.ios-table td:last-child {
  padding-right: 10px;
}

.ios-table th:first-child,
.ios-table td:first-child {
  padding-left: 10px;
}

.ios-table td {
  padding: 8px 10px;
  vertical-align: middle;
  color: var(--text-secondary);
}

.ios-table tbody tr {
  cursor: pointer;
  transition: background 0.12s;
  position: relative;
}

/* Faded separator: visible in the center, fades to transparent at the edges */
.ios-table tbody tr:not(:last-child)::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.14) 15%,
    rgba(255, 255, 255, 0.14) 85%,
    transparent 100%
  );
  pointer-events: none;
}

/* Mobile card list separator — attach to each card item except the last */
.list-card-sep {
  position: relative;
}
.list-card-sep:not(:last-child)::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.14) 10%,
    rgba(255, 255, 255, 0.14) 90%,
    transparent 100%
  );
  pointer-events: none;
}

.ios-table tbody tr:hover,
.ios-table tbody tr:active {
  background: var(--surface-2);
}

/* Section label / capture rows inside the unified beats table — no hover highlight */
.ios-table .no-hover-row {
  cursor: default;
}
.ios-table .no-hover-row:hover,
.ios-table .no-hover-row:active {
  background: transparent;
}

/* ─── Scrollable table wrapper on mobile ────────────────────────── */

/* ─── Game switcher in sidebar ──────────────────────────────────── */
.game-select-wrapper {
  position: relative;
  flex: 1;
  min-width: 0;
}

.game-select-wrapper select {
  width: 100%;
  padding: 6px 28px 6px 10px;
  background: var(--surface-2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  outline: none;
  transition: background 0.15s, border-color 0.15s;
  min-width: 0;
  max-width: 100%;
}

.game-select-wrapper select:hover {
  background: var(--surface-3);
  border-color: rgba(255, 255, 255, 0.15);
}

.game-select-wrapper select:focus-visible {
  border-color: rgba(255, 255, 255, 0.25);
}

.game-select-chevron {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--text-muted);
  display: flex;
  align-items: center;
}

.game-single-selector {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 8px 6px 10px;
  background: var(--surface-2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 13px;
  transition: background 0.15s, border-color 0.15s;
  min-width: 0;
  overflow: hidden;
  cursor: default;
}

.game-single-selector .game-single-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.game-single-selector .game-single-chevron {
  color: var(--text-muted);
  flex-shrink: 0;
  opacity: 0.6;
}

/* ─── Shared button styles ───────────────────────────────────────── */
.btn-primary {
  background: var(--accent);
  color: #111;
  border: none;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.15s;
  min-height: 38px;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-ghost {
  background: var(--surface-2);
  color: var(--text-muted);
  border: none;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  transition: background 0.15s, color 0.15s;
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-ghost:hover {
  background: var(--surface-3);
  color: var(--text-secondary);
}

/* ─── Loading text ───────────────────────────────────────────────── */
.loading-text {
  padding: 40px 24px;
  color: var(--text-muted);
  text-align: center;
  font-size: 15px;
}

/* ─── Page header ────────────────────────────────────────────────── */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}

.page-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

/* ─── Overview stat header ───────────────────────────────────── */
.overview-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 12px;
}

.overview-stat-column {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
}

.overview-stat-col-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}

.overview-stat-total {
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 4px;
}

.overview-stat-total-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.overview-stat-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.overview-stat-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.overview-stat-row-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  min-width: 26px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.overview-stat-row-value {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.pct-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
}

.pct-badge--pos {
  color: var(--success);
  background: rgba(34, 197, 94, 0.1);
}

.pct-badge--neg {
  color: var(--error);
  background: rgba(239, 68, 68, 0.1);
}

.overview-tracked-line {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 0 8px;
}

/* ─── Trending Videos ────────────────────────────────────────── */
.trending-section {
  margin-top: 28px;
}

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

.trending-toggle-btn {
  background: var(--surface-2);
  border: none;
  color: var(--text-muted);
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  min-height: 28px;
}

.trending-toggle-btn.active {
  background: var(--surface-3);
  color: var(--text-primary);
}

.trending-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.trending-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  cursor: pointer;
  transition: background 0.12s;
  -webkit-tap-highlight-color: transparent;
}
/* Add pressable to trending cards on touch */
@media (hover: none) {
  .trending-card:active {
    transform: scale(0.97);
    transition: transform 0.1s ease;
  }
}

.trending-card:hover {
  background: var(--surface-2);
}

.trending-rank {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 22px;
  text-align: right;
  flex-shrink: 0;
}

.trending-thumb {
  width: 72px;
  height: 41px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--surface-3);
  flex-shrink: 0;
}

.trending-info {
  flex: 1;
  min-width: 0;
}

.trending-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
  line-height: 1.3;
}

.trending-meta {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.trending-gain {
  text-align: right;
  flex-shrink: 0;
}

.trending-gain-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--success);
  white-space: nowrap;
}

.trending-gain-label {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
  text-align: right;
}

/* ─── Responsive visibility helpers ─────────────────────────────── */
.desktop-only { display: block; }
.mobile-only  { display: none !important; }

@media (max-width: 768px) {
  .desktop-only { display: none !important; }
  /* Use revert so elements with inline display:flex keep their flex layout */
  .mobile-only  { display: revert !important; }
}

/* ─── Beats ──────────────────────────────────────────────────────── */
.beats-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

@media (max-width: 768px) {
  .beats-meta-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
}

/* ─── Tiptap Editor ──────────────────────────────────────────────── */
.tiptap {
  outline: none;
  min-height: 200px;
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.65;
}

.tiptap p { margin: 0 0 0.5em; }
.tiptap h1, .tiptap h2, .tiptap h3 {
  color: var(--text-primary);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 1em 0 0.4em;
  line-height: 1.25;
}
.tiptap h1 { font-size: 22px; }
.tiptap h2 { font-size: 18px; }
.tiptap h3 { font-size: 16px; }

.tiptap ul, .tiptap ol {
  padding-left: 1.4em;
  margin: 0.4em 0;
}
.tiptap li + li { margin-top: 0.2em; }

.tiptap blockquote {
  border-left: 3px solid var(--surface-3);
  padding-left: 12px;
  margin: 0.6em 0;
  color: var(--text-muted);
  font-style: italic;
}

.tiptap code {
  background: var(--surface-3);
  border-radius: 4px;
  padding: 2px 5px;
  font-size: 0.875em;
  color: #e2e8f0;
  font-family: "SF Mono", ui-monospace, monospace;
}

.tiptap pre {
  background: var(--surface-3);
  border-radius: 8px;
  padding: 12px 16px;
  overflow-x: auto;
  margin: 0.6em 0;
}
.tiptap pre code { background: none; padding: 0; font-size: 13px; }

.tiptap hr {
  border: none;
  border-top: 1px solid var(--surface-3);
  margin: 1.2em 0;
}

.tiptap a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }

/* Task list */
.tiptap ul[data-type="taskList"] {
  list-style: none;
  padding-left: 0;
}
.tiptap ul[data-type="taskList"] li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.tiptap ul[data-type="taskList"] li > label {
  flex-shrink: 0;
  margin-top: 3px;
  cursor: pointer;
}
.tiptap ul[data-type="taskList"] li > div { flex: 1; }

/* Placeholder */
.tiptap p.is-editor-empty:first-child::before {
  content: attr(data-placeholder);
  float: left;
  color: var(--text-muted);
  pointer-events: none;
  height: 0;
}

/* ─── Reduced motion ─────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ─── Mobile ≤ 768px ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .app-sidebar { display: none; }
  .app-topbar  { display: none; }

  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: calc(16px + env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 56px);
    max-width: 420px;
    background: rgba(60, 60, 65, 0.92);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    backdrop-filter: blur(24px) saturate(180%);
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 4px 12px rgba(0, 0, 0, 0.3);
    padding: 5px 6px;
    z-index: var(--z-bottom-nav);
  }

  .bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 4px 7px;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-size: 10px;
    font-weight: 500;
    gap: 3px;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.2s, background 0.2s;
    border-radius: 24px;
    min-height: 50px;
  }

  .bottom-nav a.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
  }

  .bottom-nav a:active {
    transform: scale(0.9);
    transition: transform 0.1s ease;
  }

  .ios-table tbody tr:active {
    background: var(--surface-2);
    transform: scale(0.99);
    transition: transform 0.1s ease;
  }

  .bottom-nav a svg {
    width: 21px;
    height: 21px;
    flex-shrink: 0;
  }

  .app-main {
    padding: 0 16px;
    padding-bottom: calc(86px + env(safe-area-inset-bottom));
    overscroll-behavior: contain;
  }

  .ios-nav {
    margin: 0 -16px 20px;
  }

  .stat-card {
    flex: 1 1 calc(50% - 8px);
    padding: 14px 16px;
  }

  .stat-card-value {
    font-size: 22px;
  }

  /* Video detail: stack thumbnail above text on mobile */
  .video-detail-meta {
    flex-direction: column;
  }
  .video-detail-thumb {
    width: 100% !important;
    max-width: 100% !important;
  }
  .video-detail-thumb img {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 16/9;
    object-fit: cover;
  }

  /* Video detail stat boxes: wrap on narrow screens */
  .video-detail-stats {
    flex-wrap: wrap;
    gap: 10px;
  }
  .video-detail-stats > div {
    flex: 1 1 90px;
  }

  /* Chart header: allow title + range buttons to wrap */
  .chart-header {
    flex-wrap: wrap;
    gap: 8px;
  }

  .overview-stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .overview-stat-column {
    padding: 14px 16px;
  }

  .overview-stat-total {
    font-size: 28px;
  }

  .overview-stat-row-value {
    font-size: 15px;
  }

  .trending-card {
    padding: 10px 12px;
    gap: 10px;
  }

  .trending-thumb {
    width: 56px;
    height: 32px;
  }
}


/* ─── react-day-picker dark theme overrides ──────────────────────────────── */
/* NOTE: react-day-picker/style.css is imported BEFORE global.css in main.tsx
   so these rules always win the cascade at equal specificity. */
.rdp-root {
  /* Size */
  --rdp-day-width:               40px;
  --rdp-day-height:              40px;
  --rdp-day_button-width:        36px;
  --rdp-day_button-height:       36px;
  --rdp-day_button-border-radius: 50%;
  --rdp-day_button-border:       2px solid transparent;
  --rdp-nav-height:              2.5rem;
  --rdp-nav_button-height:       2rem;
  --rdp-nav_button-width:        2rem;

  /* Colors */
  --rdp-accent-color:                      var(--accent);
  /* accent-background-color drives the range_start/end gradient shoulders */
  --rdp-accent-background-color:           rgba(230, 230, 230, 0.1);
  --rdp-range_middle-background-color:     rgba(230, 230, 230, 0.1);
  --rdp-range_middle-color:                var(--text-primary);
  --rdp-range_start-color:                 #111;
  --rdp-range_end-color:                   #111;
  --rdp-range_start-date-background-color: var(--accent);
  --rdp-range_end-date-background-color:   var(--accent);
  --rdp-selected-border:                   2px solid transparent;
  --rdp-today-color:                       var(--accent);
  --rdp-outside-opacity:                   0.35;

  /* Typography */
  font-size:   14px;
  font-family: inherit;
  color:       var(--text-primary);
}

/* Month heading */
.rdp-month_caption {
  font-size:   14px;
  font-weight: 600;
  color:       var(--text-primary);
}

/* Weekday labels — Su Mo Tu … */
.rdp-weekday {
  font-size:      11px;
  font-weight:    600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color:          var(--text-muted);
  opacity:        1; /* override library's 0.75 */
}

/* Every day button */
.rdp-day_button {
  color:         var(--text-secondary);
  font-size:     14px;
  font-family:   inherit;
  border-radius: 50%;
  transition:    background 0.1s, color 0.1s;
}

/* Hover on non-selected, non-disabled days */
.rdp-day_button:hover:not([disabled]) {
  background: var(--surface-3);
  color:      var(--text-primary);
}

/* Today's date — accent-coloured text, keep circular shape */
.rdp-today:not(.rdp-outside) .rdp-day_button {
  color:       var(--accent);
  font-weight: 600;
}

/* Selected single day or range start/end button — filled circle */
.rdp-range_start .rdp-day_button,
.rdp-range_end   .rdp-day_button {
  background:    var(--accent);
  color:         #111;
  border-radius: 50%;
  font-weight:   600;
}

/* Range middle — subtle tint strip, no border-radius interruption */
.rdp-range_middle {
  background-color: rgba(230, 230, 230, 0.1);
}
.rdp-range_middle .rdp-day_button {
  border-radius: 0;
  color:         var(--text-primary);
  background:    transparent;
  border:        none;
}

/* Outside month days */
.rdp-outside .rdp-day_button {
  color: var(--text-muted);
}

/* Nav buttons (‹ ›) */
.rdp-button_previous,
.rdp-button_next {
  border-radius: 8px;
  transition:    background 0.12s;
}
.rdp-button_previous:hover,
.rdp-button_next:hover {
  background: var(--surface-3);
}
.rdp-chevron {
  fill: var(--text-muted);
}

/* ─── Tiptap / ProseMirror prose styles ─────────────────────────────────── */
.ProseMirror {
  outline: none;
  min-height: 160px;
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.65;
}

.ProseMirror > * + * { margin-top: 0.6em; }

.ProseMirror h1 { font-size: 1.5em; font-weight: 700; color: var(--text-primary); margin: 1em 0 0.35em; line-height: 1.25; }
.ProseMirror h2 { font-size: 1.25em; font-weight: 700; color: var(--text-primary); margin: 1em 0 0.35em; line-height: 1.3; }
.ProseMirror h3 { font-size: 1.1em; font-weight: 600; color: var(--text-primary); margin: 0.9em 0 0.3em; line-height: 1.35; }

.ProseMirror p { margin: 0; }

.ProseMirror ul,
.ProseMirror ol {
  padding-left: 1.4em;
  margin: 0.4em 0;
}
.ProseMirror li { margin: 0.15em 0; }
.ProseMirror li p { margin: 0; }

.ProseMirror blockquote {
  border-left: 3px solid var(--surface-3);
  padding-left: 1em;
  color: var(--text-muted);
  margin: 0.6em 0;
  font-style: italic;
}

.ProseMirror code {
  background: var(--surface-3);
  border-radius: 4px;
  padding: 2px 5px;
  font-size: 0.875em;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  color: var(--text-secondary);
}

.ProseMirror pre {
  background: var(--surface-3);
  border-radius: 8px;
  padding: 12px 16px;
  overflow-x: auto;
  margin: 0.6em 0;
}
.ProseMirror pre code {
  background: none;
  padding: 0;
  font-size: 13px;
}

.ProseMirror a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ProseMirror img {
  max-width: 100%;
  border-radius: 8px;
  display: block;
  margin: 0.6em 0;
}

.ProseMirror hr {
  border: none;
  border-top: 1px solid var(--surface-3);
  margin: 1.2em 0;
}

.ProseMirror .is-editor-empty:first-child::before {
  content: attr(data-placeholder);
  float: left;
  color: var(--text-muted);
  pointer-events: none;
  height: 0;
}

/* ─── Spinner keyframes ──────────────────────────────────────────────────── */
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ─── Notion-style property pill buttons ─────────────────────────────────── */
.prop-pill-btn {
  display: inline-flex;
  align-items: center;
  background: none;
  border: none;
  padding: 3px 4px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s;
  -webkit-tap-highlight-color: transparent;
}
.prop-pill-btn:hover {
  background: var(--surface-3);
}

.prop-option-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 10px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 7px;
  text-align: left;
  font-family: inherit;
  font-size: 12px;
  color: var(--text-secondary);
  transition: background 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.prop-option-btn:hover {
  background: var(--surface-3);
}

/* ─── Date picker popover ────────────────────────────────────────────────── */
.date-picker-popover {
  /* Equal padding on all sides so the calendar sits centred in the box */
  padding: 16px;
}

@media (max-width: 600px) {
  .date-picker-popover {
    position: fixed !important;
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%) !important;
  }
}


/* ─── Comment textarea ───────────────────────────────────────────────────── */
.comment-textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--surface-2);
  color: var(--text-secondary);
  font-size: 15px;
  font-family: inherit;
  line-height: 1.6;
  resize: none;
  outline: none;
  transition: border-color 0.15s;
  min-height: 76px;
  max-height: 240px;
  box-sizing: border-box;
  display: block;
}
.comment-textarea:focus {
  border-color: var(--accent);
}
.comment-textarea::placeholder {
  color: var(--text-muted);
}

/* ─── Hide scrollbars on touch devices (keeps desktop scrollbars intact) ── */
@media (hover: none) and (pointer: coarse) {
  ::-webkit-scrollbar { display: none; }
  * { scrollbar-width: none; -ms-overflow-style: none; }
}

/* ─── Touch press feedback (.pressable) ─────────────────────────────────── */
/* Only activates on real touch devices (no hover capability) */
@media (hover: none) {
  .pressable:active {
    transform: scale(0.97);
    transition: transform 0.1s ease;
  }
  /* Slightly stronger scale for primary buttons */
  .pressable-btn:active {
    transform: scale(0.95);
    transition: transform 0.1s ease;
  }
}

/* ─── Page slide transitions (mobile touch devices only) ────────────────── */
/* Single keyframe animation: fires immediately on class apply, no two-step  */
/* state trick needed, no blank frames.                                       */
@media (hover: none) and (pointer: coarse) {
  @keyframes page-slide-in {
    from {
      opacity: 0;
      transform: translateX(20px);
    }
    to {
      opacity: 1;
      transform: translateX(0);
    }
  }

  .page-animating {
    animation: page-slide-in 180ms ease-out both;
    will-change: transform, opacity;
  }
}

/* ─── Safe area: top nav padding when in standalone PWA mode ────────────── */
@media (max-width: 768px) {
  /* iOS standalone: status bar sits above the app chrome */
  @supports (padding-top: env(safe-area-inset-top)) {
    .ios-nav {
      padding-top: env(safe-area-inset-top);
      height: calc(48px + env(safe-area-inset-top));
    }
    /* app-main top padding needs to account for the taller nav */
    .app-main {
      padding-top: 0;
    }
  }
}

/* ─── Ignored list row separators ───────────────────────────────────────── */
.ignored-row-sep {
  position: relative;
}
.ignored-row-sep:not(:last-child)::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.14) 15%,
    rgba(255, 255, 255, 0.14) 85%,
    transparent 100%
  );
  pointer-events: none;
}

/* ─── Swipe-back page wrapper ────────────────────────────────────────────── */
.swipe-back-page {
  will-change: transform;
  transform-origin: center center;
  backface-visibility: hidden;
}

/* ─── overscroll containment for scrollable sub-areas ───────────────────── */
@media (max-width: 768px) {
  .app-main {
    overscroll-behavior: contain;
  }
}

/* ─── Mobile layout utilities ────────────────────────────────────────────── */
/* Show as flex only on mobile; hidden on desktop */
.mobile-only-flex { display: none; }
@media (max-width: 768px) {
  .mobile-only-flex { display: flex; align-items: center; gap: 6px; }
}

/* ─── Mobile sticky page header ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .page-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(10, 10, 10, 0.92);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    margin: 0 -16px 16px;
    padding: 10px 16px;
  }
}

/* ─── Mobile game switcher circle ────────────────────────────────────────── */
.mobile-game-circle {
  display: none; /* hidden on desktop */
}

@media (max-width: 768px) {
  .mobile-game-circle {
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.18);
    border: 1.5px solid rgba(59, 130, 246, 0.35);
    color: #93c5fd;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    flex-shrink: 0;
    cursor: pointer;
    transition: background 0.15s;
    line-height: 1;
    vertical-align: middle;
  }
  .mobile-game-circle:active {
    background: rgba(59, 130, 246, 0.3);
  }
}

/* ─── Mobile game switcher bottom sheet ──────────────────────────────────── */
.mobile-game-sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: flex-end;
}

.mobile-game-sheet {
  width: 100%;
  background: var(--surface-1);
  border-radius: 20px 20px 0 0;
  padding: 12px 0 calc(24px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}

.mobile-game-sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  margin: 0 auto 16px;
}

.mobile-game-sheet-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0 20px 10px;
}

/* Mobile game items — rendered as horizontal chips inside the WorkspaceNav sheet */
.mobile-only .mobile-game-sheet-items-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 7px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 0;
}

.mobile-game-sheet-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px 6px 7px;
  background: rgba(255, 255, 255, 0.05);
  border: none;
  border-radius: 20px;
  color: rgba(255, 255, 255, 0.55);
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  font-family: inherit;
  transition: background 0.1s;
}
.mobile-game-sheet-item.active {
  background: rgba(0, 209, 178, 0.1);
  color: #00d1b2;
  font-weight: 600;
}

.mobile-game-sheet-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.4);
  font-size: 9px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.mobile-game-sheet-item.active .mobile-game-sheet-dot {
  background: rgba(0, 209, 178, 0.18);
  color: #00d1b2;
}

.mobile-game-sheet-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-game-sheet-add {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 13px 6px 10px;
  background: transparent;
  border: none;
  border-radius: 20px;
  color: rgba(255, 255, 255, 0.22);
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  font-family: inherit;
}

.mobile-game-sheet-create {
  display: flex;
  gap: 8px;
  padding: 6px 0 0;
  align-items: center;
}

.mobile-game-sheet-input {
  flex: 1;
  padding: 7px 11px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  color: rgba(255, 255, 255, 0.85);
  font-size: 13px;
  outline: none;
  min-width: 0;
  font-family: inherit;
}

.mobile-game-sheet-confirm {
  background: rgba(255, 255, 255, 0.06);
  border: none;
  color: rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  padding: 7px 11px;
  font-size: 13px;
  cursor: pointer;
  flex-shrink: 0;
  font-family: inherit;
}

/* ── Timeline custom scrollbar ─────────────────────────────────────────────── */
.timeline-scroll {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.13) transparent;
}
.timeline-scroll::-webkit-scrollbar {
  height: 4px;
}
.timeline-scroll::-webkit-scrollbar-track {
  background: transparent;
}
.timeline-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.13);
  border-radius: 4px;
}
.timeline-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}
