/* Clickable "views" stat under each post */
.x-post-stats .x-stat-btn.x-stat-readonly[data-yal-views-clickable="1"] {
  cursor: pointer;
}
.x-post-stats .x-stat-btn.x-stat-readonly[data-yal-views-clickable="1"]:hover {
  color: #1d9bf0;
}
.x-post-stats .x-stat-btn.x-stat-readonly[data-yal-views-clickable="1"]:hover svg {
  fill: #1d9bf0;
  color: #1d9bf0;
}
.x-post-stats .x-stat-btn.x-stat-readonly[data-yal-views-clickable="1"]:focus-visible {
  outline: 2px solid #1d9bf0;
  outline-offset: 2px;
  border-radius: 4px;
}

/* Analytics overlay */
.yal-pa-overlay[hidden] {
  display: none;
}
.yal-pa-overlay {
  position: fixed;
  inset: 0;
  z-index: 100060;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow-y: auto;
  backdrop-filter: blur(2px);
}
.yal-pa-panel {
  width: min(640px, 100%);
  min-height: 100%;
  background: #000;
  border-left: 1px solid #2f3336;
  border-right: 1px solid #2f3336;
  display: flex;
  flex-direction: column;
  color: #e7e9ea;
  font: 15px/1.4 Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
}
.yal-pa-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid #2f3336;
}
.yal-pa-back {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #e7e9ea;
  cursor: pointer;
  display: grid;
  place-items: center;
  transform: rotate(-90deg);
}
.yal-pa-back:hover {
  background: rgba(231, 233, 234, 0.1);
}
.yal-pa-back svg {
  width: 22px;
  height: 22px;
}
.yal-pa-titles {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
}
.yal-pa-title {
  font-size: 18px;
  font-weight: 800;
}
.yal-pa-sub {
  font-size: 13px;
  color: #71767b;
}
.yal-pa-body {
  flex: 1 1 auto;
  padding: 16px;
}
.yal-pa-loading,
.yal-pa-empty {
  padding: 36px 24px;
  text-align: center;
  color: #71767b;
}

/* Summary tiles */
.yal-pa-tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}
.yal-pa-tile {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 16px;
  border: 1px solid #2f3336;
  border-radius: 14px;
  background: rgba(231, 233, 234, 0.02);
}
.yal-pa-tile-num {
  font-size: 22px;
  font-weight: 800;
  color: #e7e9ea;
}
.yal-pa-tile-label {
  font-size: 13px;
  color: #71767b;
}
.yal-pa-tiles-secondary .yal-pa-tile-num {
  font-size: 18px;
}

/* Chart */
.yal-pa-section {
  border: 1px solid #2f3336;
  border-radius: 14px;
  padding: 14px 14px 6px;
  margin-bottom: 18px;
}
.yal-pa-legend {
  display: flex;
  gap: 18px;
  margin-bottom: 8px;
  font-size: 13px;
  color: #71767b;
}
.yal-pa-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.yal-pa-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
}
.yal-pa-swatch-views {
  background: #1d9bf0;
}
.yal-pa-swatch-expands {
  background: #00ba7c;
}
.yal-pa-chart-wrap {
  width: 100%;
}
.yal-pa-chart {
  width: 100%;
  height: auto;
  display: block;
}
.yal-pa-bar {
  fill: #1d9bf0;
}
.yal-pa-bar:hover {
  fill: #4cb5f5;
}
.yal-pa-line {
  stroke: #00ba7c;
  stroke-width: 2;
}
.yal-pa-dot {
  fill: #00ba7c;
}
.yal-pa-grid {
  stroke: #2f3336;
  stroke-width: 1;
}
.yal-pa-axis {
  fill: #71767b;
  font-size: 11px;
}
.yal-pa-note {
  margin: 8px 2px 4px;
  font-size: 12px;
  color: #71767b;
}

html.yal-pa-open,
body:has(.yal-pa-overlay:not([hidden])) {
  overflow: hidden;
}

@media (max-width: 640px) {
  .yal-pa-panel {
    border-left: 0;
    border-right: 0;
  }
}
