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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  background: #312e2b;
  min-height: 100vh;
  padding: 20px;
  color: #fff;
}

main {
  max-width: 780px;
  margin: 0 auto;
}

.header {
  background: #262522;
  border-radius: 16px;
  padding: 30px;
  margin-bottom: 20px;
  text-align: center;
  position: relative;
  overflow: hidden;
  z-index: 1;
}

.header:before {
  content: '';
  position: absolute;
  top: 0;
  left: -10%;
  width: 120%;
  height: 100px;
  background: #3a3a3a;
  border-bottom-left-radius: 60% 100%;
  border-bottom-right-radius: 60% 100%;
  z-index: -1;
}

.header img {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  margin-bottom: 10px;
}

h1 {
  font-size: 2.5em;
  margin-bottom: 10px;
}

a {
  color: #81b64c;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.profile-link {
  display: inline-block;
  margin-top: 10px;
  text-decoration: none;
  font-weight: 600;
}

.profile-link:hover {
  text-decoration: underline;
}

.card {
  background: #262522;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 20px;
}

.card h2 {
  margin-bottom: 20px;
  font-size: 1.5em;
}

/* Heatmap - FIX SIZE CELLS IN SCROLLABLE CONTAINER */
.heatmap-wrapper {
  width: 100%;
  padding-bottom: 10px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.heatmap-wrapper::-webkit-scrollbar {
  height: 8px;
}

.heatmap-wrapper::-webkit-scrollbar-track {
  background: transparent;
}

.heatmap-wrapper::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 4px;
}

.heatmap-wrapper::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

.heatmap {
  display: grid;
  grid-template-rows: repeat(7, 11px);
  grid-auto-flow: column;
  grid-auto-columns: 11px;
  gap: 3px;
  margin-top: 10px;
  width: max-content;
}

.heatmap-cell {
  width: 11px;
  height: 11px;
  border-radius: 2px;
  background: #ebedf0;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}
.heatmap-cell:before {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  background: #1a1816;
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.75em;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
  border: 1px solid #3a3a3a;
  z-index: 100;
}
.heatmap-cell:hover:before {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.heatmap-cell:hover {
  transform: scale(1.3);
  outline: 2px solid rgba(255, 255, 255, 0.5);
  z-index: 10;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

.heatmap-cell[data-count="1"] {
  background: #9be9a8;
}

.heatmap-cell[data-count="2"] {
  background: #40c463;
}

.heatmap-cell[data-count="3"] {
  background: #30a14e;
}

.heatmap-cell[data-count="4"] {
  background: #216e39;
}

.heatmap-empty {
  visibility: hidden;
  pointer-events: none;
}

.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 15px;
  font-size: 0.85em;
  color: #999;
}

.heatmap-legend-box {
  width: 12px;
  height: 12px;
  border-radius: 2px;
}

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 15px;
}

.stat-box {
  background: #282828;
  color: white;
  padding: 20px;
  border-radius: 12px;
  text-align: center;
}

.stat-number {
  font-size: 28px;
  font-weight: bold;
  margin-bottom: 5px;
}

.stat-label {
  font-size: 0.9em;
  opacity: 0.9;
}

.stat-sublabel {
  font-size: 0.8em;
  opacity: 0.8;
  margin-top: 5px;
}

/* Rating chart */
.chart-container {
  height: 300px;
  position: relative;
  margin-top: 20px;
}

/* Time Period Selector */
.time-period-selector {
  display: flex;
  gap: 8px;
  margin-bottom: 15px;
  flex-wrap: wrap;
}

.time-period-btn {
  padding: 6px 12px;
  border: 2px solid #3a3a3a;
  background: #262522;
  color: #999;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85em;
  transition: all 0.3s;
}

.time-period-btn.active {
  background: #3a3a3a;
  color: #fff;
  border-color: #81b64c;
}

.time-period-btn:hover {
  background: #3a3a3a;
  color: #fff;
}

/* Chart Tabs */
.chart-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
  flex-wrap: wrap;
}

.chart-tab {
  padding: 8px 16px;
  border: 2px solid #3a3a3a;
  background: #282828;
  color: #fff;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s;
}

.chart-tab.active {
  border-color: #81b64c;
  background: #3a3a3a;
}

.chart-tab:hover {
  transform: translateY(-2px);
}

canvas {
  max-width: 100%;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 12px 24px;
  background: #282828;
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  margin: 5px;
  transition: transform 0.2s;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-secondary {
  background: #6c757d;
}

.last-updated {
  color: #666;
  font-size: 0.9em;
  margin-top: 10px;
}

.no-data-warning {
  background: #fff3cd;
  color: #856404;
  padding: 15px;
  border-radius: 8px;
  margin-top: 15px;
  border: 2px solid #ffc107;
}

.success-message {
  background: #d4edda;
  color: #155724;
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 15px;
  border: 2px solid #28a745;
}

/* Mobile responsive */
@media (max-width: 768px) {
  body {
    padding: 10px;
  }

  .header h1 {
    font-size: 1.8em;
  }

  .card {
    padding: 15px;
  }

  .stat-number {
    font-size: 24px;
  }

  .heatmap-wrapper {
    overflow-x: auto;
    overflow-y: hidden;
  }

  /* Bigger cells on tablets */
  .heatmap {
    grid-template-rows: repeat(7, 13px);
    grid-auto-flow: column;
    grid-auto-columns: 13px;
    gap: 3px;
  }
  .heatmap-cell {
    width: 13px;
    height: 13px;
  }

  .chart-container {
    height: 250px;
  }
}

/* Extra small screens */
@media (max-width: 480px) {
  main {
    max-width: 100%;
  }

  .header {
    padding: 20px;
  }

  .header h1 {
    font-size: 1.5em;
  }

  .card {
    padding: 12px;
    border-radius: 12px;
  }

  .card h2 {
    font-size: 1.2em;
    margin-bottom: 15px;
  }

  /* Even bigger cells on mobile for better visibility */
  .heatmap {
    grid-template-rows: repeat(7, 12px);
    grid-auto-flow: column;
    grid-auto-columns: 12px;
    gap: 3px;
  }
  .heatmap-cell {
    width: 12px;
    height: 12px;
  }

  .stat-number {
    font-size: 22px;
  }

  .stat-box {
    padding: 15px;
  }

  .chart-container {
    height: 220px;
  }

  .time-period-btn,
  .chart-tab {
    font-size: 0.8em;
    padding: 6px 10px;
  }
}