  /* Two-column split for the project page: left = .project-page (live frame +
     chart + actions), right = .stat-side panel hosting the legacy 6-tile mini
     summary ABOVE the inline Phase F analytics dashboard (#proj-analytics).
     Right column widened from the old 280px to 400px so the multi-section
     dashboard breathes. Not sticky — the dashboard is taller than the viewport
     and would scroll out of useful range. Collapses to single column <900px. */
  .stat-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 400px);
    gap: 18px;
    align-items: start;
  }
  .stat-side {
    display: flex; flex-direction: column;
    gap: 12px;
  }
  .stat-side .stat-tiles {
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    margin-bottom: 0;
  }
  .stat-side .stat-tile { aspect-ratio: 1 / 1; padding: 10px 6px; }
  .stat-side .stat-tile .ic svg { width: 32px; height: 32px; }
  .stat-side .stat-tile .num { font-size: 20px; margin-top: 4px; }
  /* Gold-amber accent for the "earnings" tile — matches sell-btn / inventory
     pill gold tone. Project page side-tile + stats screen plusik tile. */
  .stat-tile.earnings {
    border-color: rgba(220,180,80,0.45);
    background:
      linear-gradient(180deg, rgba(220,180,80,0.08), transparent 55%),
      var(--surface);
  }
  .stat-tile.earnings .ic { color: var(--warn); }
  @media (max-width: 900px) {
    .stat-split { grid-template-columns: minmax(0, 1fr); }
  }

  /* Stats tiles */
  .stat-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
  }
  /* Wrapper that mirrors .stat-tiles grid so the activity chart can span
     exactly N tile-columns via inline `grid-column: 1 / N+1`. This keeps the
     chart visually aligned with the tile-row's filled extent on wide
     viewports (where auto-fill leaves trailing empty tracks). */
  .stat-chart-wrap {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
  }
  /* Overview chart block: title + range toggle, bars, x-axis labels. Spans the
     same column range as the chart-tall did (set inline via grid-column). */
  .stat-chart-block { min-width: 0; }
  .stat-chart-head {
    display: flex; align-items: center; gap: 10px;
    margin: 0 0 8px;
    flex-wrap: wrap;
  }
  .stat-chart-title {
    font-size: 13px; font-weight: 600;
    color: var(--text);
  }
  /* Range toggle — mirrors .ga-range visual pattern from game-analytics.css. */
  .stat-range-row {
    margin-left: auto;
    display: flex;
    gap: 2px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 2px;
  }
  .stat-range {
    border: 0;
    background: transparent;
    color: var(--muted);
    padding: 4px 9px;
    border-radius: calc(var(--r-md) - 4px);
    cursor: pointer;
    font: inherit;
    font-size: 12px;
  }
  @media (hover: hover) {
    .stat-range:hover { color: var(--text); }
  }
  .stat-range.active {
    background: var(--surface-2);
    color: var(--text);
    box-shadow: 0 1px 0 rgba(0,0,0,0.2);
  }
  /* X-axis date labels under the overview chart. One cell per bar (flex:1) so
     labels align with the evenly-distributed bars. Most cells are empty —
     only first/last/markers carry text (see renderOverviewChart). */
  .stat-chart-axis {
    display: flex;
    gap: 5px;
    margin-top: 5px;
    padding: 0 12px;
  }
  .stat-axis-cell {
    flex: 1;
    min-width: 0;
    text-align: center;
    font-size: 10px;
    line-height: 1.2;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
  }

  /* Loading skeleton — subtle opacity pulse, dark-theme tokens. Used for the
     buildsTotal tile number and the overview chart bars until data resolves. */
  @keyframes stat-skel-pulse {
    0%, 100% { opacity: 0.35; }
    50%      { opacity: 0.7; }
  }
  .stat-skeleton {
    display: inline-block;
    background: var(--surface-2);
    border-radius: var(--r-sm, 6px);
    animation: stat-skel-pulse 1.2s ease-in-out infinite;
  }
  .stat-skeleton-num {
    width: 38px; height: 22px;
    vertical-align: middle;
  }
  /* Skeleton bars: faint pulsing columns inside the chart while loading. */
  .chart-tall.is-loading .stat-skeleton-bar {
    flex: 1;
    height: 38%;
    background: var(--surface-2);
    border-radius: 3px 3px 0 0;
    animation: stat-skel-pulse 1.2s ease-in-out infinite;
  }
  .chart-tall.is-loading .stat-skeleton-bar:nth-child(3n)   { height: 64%; }
  .chart-tall.is-loading .stat-skeleton-bar:nth-child(3n+1) { height: 26%; }
  .chart-tall.is-loading .stat-skeleton-bar { cursor: default; }
  .stat-tile {
    aspect-ratio: 1 / 1;
    border-radius: var(--r-md);
    border: 1px solid var(--border-2);
    background:
      linear-gradient(180deg, rgba(255,220,180,0.025), transparent 40%),
      var(--surface);
    box-shadow: var(--shadow-card);
    display: grid; place-items: center;
    grid-template-rows: 1fr auto auto;
    padding: 14px 10px;
    color: var(--text);
  }
  .stat-tile .ic {
    color: #9ec2b3;
    display: grid; place-items: center;
    align-self: end;
  }
  .stat-tile .ic svg { width: 38px; height: 38px; }
  .stat-tile .num {
    align-self: start;
    margin-top: 6px;
    font-size: 28px; font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text);
  }
  .stat-tile .lbl {
    align-self: start;
    margin-top: 2px;
    font-size: 11.5px;
    line-height: 1.1;
    text-align: center;
    color: var(--muted);
  }
  /* Empty-label tiles (e.g. hidden catalog tile) collapse the label row. */
  .stat-tile .lbl:empty { display: none; }
  /* Hidden stat tile — keeps source code in place so it can be re-enabled
     by removing the class. Used for games-published catalog total which now
     lives in the sidebar next to the catalog icon. */
  .stat-tile.hidden-tile { display: none; }

  /* Stats grid game cards */
  .stat-card {
    position: relative;
    background:
      linear-gradient(180deg, rgba(255,220,180,0.04), transparent 50%),
      var(--surface);
    border: 1px solid var(--border-2);
    border-radius: var(--r-md);
    overflow: hidden;
    cursor: pointer;
    box-shadow: var(--shadow-card);
    transition: transform 0.12s ease, border-color 0.12s ease;
  }
  .stat-card:hover {
    transform: translateY(-2px);
    border-color: rgba(110,150,135,0.35);
  }
  .stat-card .poster {
    aspect-ratio: 16/9;
    background:
      radial-gradient(140% 140% at 0% 0%, rgba(255,180,120,0.12), transparent 55%),
      linear-gradient(135deg, #245c49 0%, #143a2c 60%, #1a1714 100%);
    position: relative;
  }
  .stat-card .poster .ph {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    color: rgba(255,255,255,0.55); font-weight: 700; letter-spacing: 1px;
    font-size: 18px;
  }
  .stat-card .badge {
    position: absolute;
    top: 10px; right: 10px;
    padding: 4px 10px;
    background: rgba(20,30,26,0.72);
    border: 1px solid rgba(110,150,135,0.4);
    border-radius: 999px;
    font-size: 13px; font-weight: 700;
    color: #d6e8df;
    backdrop-filter: blur(4px);
  }

  /* Bar chart for per-game stats */
  .barchart {
    display: flex; align-items: flex-end; gap: 8px;
    height: 120px;
    padding: 12px 4px;
  }
  .barchart .bar {
    flex: 1;
    background: linear-gradient(180deg, #2f7058 0%, #143b2c 100%);
    border: 1px solid rgba(70,110,95,0.45);
    border-radius: 6px 6px 2px 2px;
    box-shadow: 0 1px 0 rgba(255,255,255,0.06) inset;
  }

  /* =========================================================================
     CREATOR PORTFOLIO — aggregate audience + dev stats across ALL games.
     One cohesive card above the existing tile row. Dark-theme tokens, reuses
     .stat-skeleton for loading shimmer. Sections: KPI row, top list, week
     deltas, creator funnel. All bounded — no per-frame work.
     ========================================================================= */
  .stat-portfolio {
    border: 1px solid var(--border-2);
    border-radius: var(--r-md);
    background:
      linear-gradient(180deg, rgba(255,220,180,0.03), transparent 45%),
      var(--surface);
    box-shadow: var(--shadow-card);
    padding: 16px 16px 18px;
    margin-bottom: 22px;
  }
  .pf-head { margin-bottom: 12px; }
  .pf-title { font-size: 15px; font-weight: 700; color: var(--text); }
  .pf-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
  .pf-note {
    font-size: 12px; color: var(--muted);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-sm, 6px);
    padding: 6px 10px; margin-bottom: 12px;
  }
  .pf-note-hidden { display: none; }
  .pf-muted { color: var(--muted); font-size: 12.5px; padding: 6px 2px; }

  /* KPI row — compact horizontal cards (icon + num + label). */
  .pf-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
  }
  .pf-kpi {
    display: flex; align-items: center; gap: 10px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 10px 12px;
    min-width: 0;
  }
  .pf-kpi-ic {
    flex: 0 0 auto;
    color: #9ec2b3;
    display: grid; place-items: center;
  }
  .pf-kpi-ic svg { width: 22px; height: 22px; }
  .pf-kpi-body { min-width: 0; }
  .pf-kpi-num {
    font-size: 19px; font-weight: 700; color: var(--text);
    letter-spacing: 0.3px; line-height: 1.1;
    font-variant-numeric: tabular-nums;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .pf-kpi-lbl { font-size: 11px; color: var(--muted); margin-top: 1px; line-height: 1.15; }

  /* Three-column lower grid: top games | deltas | funnel. Collapses on narrow. */
  .pf-cols {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1.2fr);
    gap: 14px;
  }
  @media (max-width: 820px) {
    .pf-cols { grid-template-columns: minmax(0, 1fr); }
  }
  .pf-col { min-width: 0; }
  .pf-col-title {
    font-size: 12px; font-weight: 600; color: var(--text);
    margin-bottom: 8px;
  }

  /* Top-games list — clickable rows opening the analytics modal. */
  .pf-top-list { display: flex; flex-direction: column; gap: 6px; }
  .pf-row {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    width: 100%;
    text-align: left;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-sm, 6px);
    padding: 8px 10px;
    color: var(--text);
    cursor: pointer;
    font: inherit;
    transition: border-color 0.12s ease, transform 0.12s ease;
  }
  .pf-row:hover { border-color: rgba(110,150,135,0.45); transform: translateY(-1px); }
  .pf-row-skel { cursor: default; }
  .pf-row-title {
    font-size: 12.5px; min-width: 0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .pf-row-meta {
    flex: 0 0 auto; display: flex; gap: 10px; align-items: baseline;
    font-variant-numeric: tabular-nums;
  }
  .pf-row-plays { font-size: 12px; font-weight: 700; color: var(--text); }
  .pf-row-earn { font-size: 11.5px; color: var(--warn, #d9b85a); }
  .pf-skel-line { width: 100%; height: 16px; }

  /* Week deltas — two stacked cards with arrow + colour. */
  .pf-delta-cards { display: flex; flex-direction: column; gap: 8px; }
  .pf-delta {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-sm, 6px);
    padding: 8px 10px;
  }
  .pf-delta-lbl { font-size: 11px; color: var(--muted); }
  .pf-delta-val {
    font-size: 17px; font-weight: 700; margin-top: 2px;
    color: var(--text);
    font-variant-numeric: tabular-nums;
  }
  .pf-delta-up   .pf-delta-val { color: #6fce8f; }
  .pf-delta-down .pf-delta-val { color: #e07a7a; }
  .pf-delta-flat .pf-delta-val { color: var(--muted); }

  /* Creator funnel — labelled horizontal bars. */
  .pf-funnel { display: flex; flex-direction: column; gap: 10px; }
  .pf-fn-stage { min-width: 0; }
  .pf-fn-top {
    display: flex; justify-content: space-between; align-items: baseline;
    margin-bottom: 4px;
  }
  .pf-fn-lbl { font-size: 11.5px; color: var(--muted); }
  .pf-fn-num {
    font-size: 12.5px; font-weight: 700; color: var(--text);
    font-variant-numeric: tabular-nums;
  }
  .pf-fn-bar {
    height: 8px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    overflow: hidden;
  }
  .pf-fn-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #2f7058, #4a9a78);
    transition: width 0.3s ease;
    min-width: 2px;
  }
  .pf-fn-pub    { background: linear-gradient(90deg, #2f7058, #58b58c); }
  .pf-fn-played { background: linear-gradient(90deg, #b8902f, #d9b85a); }
  .pf-fn-sub { font-size: 10.5px; color: var(--muted); margin-top: 3px; }

  /* Audience-chart empty/unavailable placeholder (inside .chart-tall). */
  .pf-chart-empty {
    display: flex; align-items: center; justify-content: center;
    height: 100%; width: 100%;
    color: var(--muted); font-size: 12.5px;
  }

  /* Mode toggle (Разработка ↔ Аудитория) sits left of the range picker; reuses
     .stat-range button styling via the .stat-mode-row wrapper. */
  .stat-mode-row {
    display: flex; gap: 2px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 2px;
  }

  /* Empty-state heading above the create-game CTA (stats screen). */
  .empty .stats-empty-msg {
    font-size: 16px; font-weight: 700;
    color: var(--text, #e6f0ea);
    margin-bottom: 4px;
  }
  .empty .cta-create { margin-top: 14px; }

  /* ======================================================================
     МОБИЛЬНАЯ АДАПТИВНОСТЬ
     ====================================================================== */

  /* Планшет: правая колонна stat-split без overflow */
  @media (max-width: 768px) {
    .stat-split {
      grid-template-columns: minmax(0, 1fr);
    }
    /* pf-cols 2-колоночный на планшете */
    .pf-cols {
      grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }
    /* barchart: разрешить pan-y скролл */
    .barchart {
      touch-action: pan-y;
    }
  }

  /* Мобильный */
  @media (max-width: 640px) {
    /* stat-range — тап-таргет 44px */
    .stat-range {
      min-height: 44px;
      min-width: 44px;
      padding: 10px 9px;
    }
    /* pf-row — тап-таргет 44px */
    .pf-row {
      min-height: 44px;
    }
    /* stat-tile: убрать фиксированный aspect-ratio на мобильном */
    .stat-tile {
      aspect-ratio: auto;
      min-height: 80px;
    }
    /* stat-split → одноколоночный */
    .stat-split {
      grid-template-columns: minmax(0, 1fr);
    }
    /* pf-cols → одноколоночный */
    .pf-cols {
      grid-template-columns: minmax(0, 1fr);
    }
    /* chart-tall: touch-action */
    .chart-tall {
      touch-action: none;
    }
  }

  /* Узкий (≤380px) */
  @media (max-width: 380px) {
    .stat-tile {
      aspect-ratio: auto;
      min-height: 72px;
      padding: 10px 6px;
    }
    .stat-range {
      padding: 10px 6px;
    }
  }

  /* На touch: убираем hover-смещение stat-card / pf-row */
  @media (hover: none) {
    .stat-card {
      transform: none !important;
    }
    .pf-row {
      transform: none !important;
    }
  }
