:root {
  --orange: #ff7a18;
  --yellow: #ffd44d;
  --charcoal: #0a0a15;
  --graphite: #1c1c26;
  --deep-copper: #d97f3f;
  --panel-light: #151620;
  --panel-cream: #fff7e3;
  --neon-green: #76ff54;
  --cream-text: #fefefe;
  --muted: rgba(255, 255, 255, 0.65);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Nunito Sans", sans-serif;
  color: var(--cream-text);
  background: linear-gradient(135deg, #0b0b11 0%, #06060b 45%, #040407 100%);
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 10% 10%, rgba(255, 122, 24, 0.35), transparent 45%),
    radial-gradient(circle at 90% 0%, rgba(118, 255, 84, 0.3), transparent 55%);
  pointer-events: none;
  z-index: 0;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: linear-gradient(120deg, var(--orange), var(--deep-copper));
  color: var(--cream-text);
  border-bottom: 4px solid #050505;
  gap: 16px;
}

.brand {
  font-family: "Bebas Neue", sans-serif;
  font-size: 30px;
  letter-spacing: 2px;
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  justify-content: center;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.35);
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.topbar-user img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.topbar-progress {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--cream-text);
  background: rgba(0, 0, 0, 0.35);
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.topbar-progress strong {
  color: var(--neon-green);
}

.user-badge {
  background: rgba(0, 0, 0, 0.5);
  padding: 6px 14px;
  border-radius: 999px;
  font-weight: 700;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.65);
  border-bottom: 2px solid rgba(255, 255, 255, 0.2);
  position: sticky;
  top: 72px;
  z-index: 4;
}

.tab {
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  padding: 10px 8px;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab.active {
  border-color: var(--neon-green);
  color: var(--neon-green);
  background: rgba(118, 255, 84, 0.12);
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.3);
}

.views {
  padding: 18px 20px 60px;
}

.view {
  display: none;
  animation: fadeIn 0.4s ease;
}

.view.active {
  display: block;
}

.section {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.04));
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  margin-bottom: 20px;
}

.builder-section {
  border: 3px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.7);
}

#plansSection > h2,
#workoutSection > h2,
#exerciseSection > h2 {
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--yellow);
  border-bottom: 2px dashed rgba(255, 255, 255, 0.3);
  padding-bottom: 6px;
}

.builder-section .subsection {
  border: 2px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.04);
}

.subsection {
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed rgba(255, 255, 255, 0.25);
  border-radius: 16px;
  padding: 16px;
  margin-top: 14px;
}

.section h2 {
  margin: 0 0 12px;
  font-size: 22px;
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 16px;
}

.profile-avatar {
  width: 72px;
  height: 72px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.04);
}

.profile-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 999px;
}

.avatar-placeholder {
  font-size: 24px;
  font-weight: 700;
  color: var(--neon-green);
}

.profile-details {
  flex: 1;
}

.profile-name {
  font-size: 22px;
  font-weight: 700;
}

.profile-handle,
.profile-id {
  color: var(--muted);
}

.profile-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.metric {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 14px;
  padding: 12px;
  text-align: center;
}

.metric strong {
  display: block;
  font-size: 24px;
  color: var(--neon-green);
}

.metric .small {
  color: var(--muted);
}

.analytics-card {
  border-color: rgba(118, 255, 84, 0.35);
}

.analytics-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.analytics-metric {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 16px;
  padding: 14px;
  text-align: center;
}

.analytics-metric strong {
  font-size: 26px;
  color: var(--neon-green);
}

.analytics-metric .small {
  color: var(--muted);
}

.analytics-chart-wrap {
  padding-top: 12px;
}

.chart-grid {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  min-height: 140px;
}

.chart-bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.chart-bar .bar {
  width: 100%;
  height: 80px;
  background: linear-gradient(180deg, rgba(118, 255, 84, 0.6) 0%, rgba(118, 255, 84, 0.2) 100%);
  border-radius: 18px 18px 0 0;
  box-shadow: 0 10px 20px rgba(118, 255, 84, 0.4);
}

.chart-bar span {
  font-size: 11px;
  color: var(--muted);
}

.leaderboard-section {
  border-color: rgba(255, 255, 255, 0.25);
}

.leaderboard-heading h3 {
  font-size: 20px;
  margin: 0;
}

.leaderboard-split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
}

.leaderboard-card {
  background: rgba(255, 255, 255, 0.03);
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 14px;
}

.leaderboard-card-title {
  font-weight: 700;
  color: var(--neon-green);
  margin-bottom: 10px;
}

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 38px 42px 1fr 70px;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.2);
  gap: 6px;
  color: var(--cream-text);
}

.leaderboard-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.leaderboard-row--user {
  background: rgba(118, 255, 84, 0.12);
  border-radius: 10px;
  padding: 8px 6px;
}

.leaderboard-row-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--neon-green);
}

.leaderboard-row-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.leaderboard-row-avatar.placeholder {
  background: rgba(118, 255, 84, 0.2);
}

.leaderboard-name {
  font-weight: 600;
}

.leaderboard-value {
  font-weight: 700;
  text-align: right;
  color: var(--neon-green);
}

.leaderboard-footer {
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
}

.button {
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease;
  background: var(--orange);
  color: var(--cream-text);
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.4);
}

.button.secondary {
  background: var(--yellow);
  color: var(--charcoal);
}

.button.dark {
  background: var(--charcoal);
  color: #fff;
}

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

.form-row {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.plan-settings {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.plan-schedule {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.plan-day-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 6px;
  padding: 8px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.plan-day-row {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
}

.plan-sets-input {
  width: 64px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(0, 0, 0, 0.35);
  color: var(--cream-text);
}

.plan-day-option {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.line-chart {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.line-chart-wrap {
  display: grid;
  grid-template-columns: 56px 1fr;
  align-items: stretch;
  gap: 8px;
}

.line-axis-y {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
}

.line-axis-max,
.line-axis-min {
  line-height: 1;
}

.line-chart svg {
  width: 100%;
  height: 160px;
}

.line-path {
  fill: none;
  stroke: var(--neon-green);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 6px 10px rgba(118, 255, 84, 0.35));
}

.line-point {
  fill: var(--neon-green);
  stroke: rgba(10, 10, 15, 0.9);
  stroke-width: 0.8;
}

.line-path-secondary {
  stroke: var(--yellow);
}

.line-point-secondary {
  fill: var(--yellow);
}

.chart-value {
  fill: rgba(255, 255, 255, 0.65);
  font-size: 5px;
  text-anchor: middle;
  dominant-baseline: middle;
  font-family: "Nunito Sans", sans-serif;
  font-weight: 400;
}

.chart-value-secondary {
  fill: rgba(255, 255, 255, 0.65);
}

.chart-xlabel {
  fill: rgba(255, 255, 255, 0.65);
  font-size: 5px;
  text-anchor: middle;
  dominant-baseline: hanging;
  text-rendering: geometricPrecision;
  font-family: "Nunito Sans", sans-serif;
  font-weight: 400;
}

.dual-charts {
  display: grid;
  gap: 14px;
}

.chart-axis {
  stroke: rgba(255, 255, 255, 0.35);
  stroke-width: 1.2;
  shape-rendering: crispEdges;
}

.chart-gridline {
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 1;
  shape-rendering: crispEdges;
}

.line-legend {
  display: flex;
  gap: 12px;
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--neon-green);
  display: inline-block;
}

.legend-dot-secondary {
  background: var(--yellow);
}

.line-labels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
}

.line-labels--grid {
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.modal-content {
  background: var(--panel-light);
  border-radius: 16px;
  padding: 16px;
  width: min(520px, 92vw);
  border: 2px solid rgba(255, 255, 255, 0.2);
}

details > summary {
  cursor: pointer;
  font-weight: 700;
}

input,
select {
  padding: 10px 12px;
  border-radius: 10px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  background: rgba(0, 0, 0, 0.3);
  color: var(--cream-text);
}

input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.list {
  display: grid;
  gap: 10px;
}

.card {
  padding: 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.1);
}

.small {
  font-size: 12px;
  color: var(--muted);
}

.badge {
  background: var(--neon-green);
  color: #142416;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
}

.plan-card--done {
  border: 2px solid var(--neon-green);
  box-shadow: 0 0 0 2px rgba(118, 255, 84, 0.25);
}

.card-actions,
.entry-actions {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.button.small {
  padding: 6px 10px;
  font-size: 12px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 720px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }
  .tabs {
    top: 120px;
  }
  .topbar-meta {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  .tabs {
    grid-template-columns: repeat(2, 1fr);
  }
  .profile-card {
    flex-direction: column;
    align-items: flex-start;
  }
  .profile-actions {
    flex-direction: row;
    width: 100%;
  }
  .profile-actions .button {
    flex: 1;
  }
  .leaderboard-row {
    grid-template-columns: 32px 32px 1fr 60px;
  }
  .chart-grid {
    flex-wrap: wrap;
  }
}
