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

:root {
  --bg:          #0d1117;
  --surface:     #161b22;
  --surface2:    #21262d;
  --border:      #30363d;
  --text:        #e6edf3;
  --text-muted:  #8b949e;
  --accent:      #58a6ff;
  --accent2:     #3fb950;
  --danger:      #f85149;
  --warning:     #d29922;
  --radius:      10px;
  --font-mono:   'JetBrains Mono', monospace;
  --font-sans:   'Inter', system-ui, sans-serif;
  --anim-fast:   0.18s;
  --anim-med:    0.4s;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

.page {
  max-width: 860px;
  margin: 0 auto;
  padding: 3rem 1.25rem 6rem;
}

/* ── Hero ─────────────────────────────────────────── */

.hero {
  text-align: center;
  margin-bottom: 2.5rem;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero .subtitle {
  color: var(--text-muted);
  margin-top: 0.5rem;
  font-size: 1rem;
}

/* ── Form ─────────────────────────────────────────── */

.form-section {
  margin-bottom: 2.5rem;
}

.input-group {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 0 0 14px;
  gap: 8px;
  transition: border-color var(--anim-fast);
}

.input-group:focus-within {
  border-color: var(--accent);
}

.input-icon {
  color: var(--text-muted);
  flex-shrink: 0;
}

.input-group input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 14px;
  padding: 14px 0;
}

.input-group input::placeholder { color: var(--text-muted); }

#submit-btn {
  background: var(--accent);
  color: #0d1117;
  border: none;
  border-radius: 0 calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0;
  padding: 0 22px;
  height: 50px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--anim-fast), transform var(--anim-fast);
  white-space: nowrap;
}

#submit-btn:hover  { opacity: 0.85; }
#submit-btn:active { transform: scale(0.97); }
#submit-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Options panel ────────────────────────────────── */

.options-panel {
  margin-top: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.options-panel summary {
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  list-style: none;
}

.options-panel summary::-webkit-details-marker { display: none; }
.options-panel summary::before {
  content: '▶ ';
  font-size: 10px;
  display: inline-block;
  transition: transform var(--anim-fast);
}
.options-panel[open] summary::before { transform: rotate(90deg); }

.options-body {
  padding: 4px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
}

.checkboxes label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
}
.checkboxes label:hover { color: var(--text); }
.checkboxes input[type="checkbox"] { accent-color: var(--accent); }

.token-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.token-row label {
  font-size: 12px;
  color: var(--text-muted);
}

.token-row .hint { opacity: 0.6; }

.token-row input {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 8px 10px;
  outline: none;
  max-width: 380px;
  transition: border-color var(--anim-fast);
}
.token-row input:focus { border-color: var(--accent); }

/* ── Loader ───────────────────────────────────────── */

.loader {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 3rem 0;
}

.loader span {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: pulse 1.1s infinite ease-in-out;
}
.loader span:nth-child(2) { animation-delay: 0.18s; }
.loader span:nth-child(3) { animation-delay: 0.36s; }

@keyframes pulse {
  0%,80%,100% { transform: scale(0.6); opacity: 0.3; }
  40%          { transform: scale(1);   opacity: 1;   }
}

/* ── Error ────────────────────────────────────────── */

.error-banner {
  background: rgba(248, 81, 73, 0.1);
  border: 1px solid rgba(248, 81, 73, 0.3);
  border-radius: var(--radius);
  color: var(--danger);
  padding: 14px 18px;
  font-size: 14px;
}

/* ── Profile header ───────────────────────────────── */

.profile-header {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 1.25rem;
  animation: fadeUp var(--anim-med) ease both;
}

.avatar {
  width: 60px; height: 60px;
  border-radius: 50%;
  border: 2px solid var(--border);
  object-fit: cover;
  flex-shrink: 0;
}

.profile-meta .name {
  font-size: 18px;
  font-weight: 600;
}

.profile-meta .handle {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
}

.profile-meta .bio {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── Cards grid ───────────────────────────────────── */

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin-bottom: 1.25rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  animation: fadeUp var(--anim-med) ease both;
}

.card-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.card-value {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 600;
  line-height: 1;
  color: var(--text);
}

.card-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.card-bar {
  margin-top: 12px;
  height: 3px;
  background: var(--surface2);
  border-radius: 2px;
  overflow: hidden;
}

.card-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  width: 0;
  transition: width 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── Streak card ──────────────────────────────────── */

.streak-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 1.25rem;
  animation: fadeUp var(--anim-med) ease 0.1s both;
}

.streak-inner {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 10px;
  text-align: center;
}

.streak-num {
  font-family: var(--font-mono);
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--accent2);
}

.streak-lbl {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── Language + Radar two-col ─────────────────────── */

.lang-radar-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 1.25rem;
}

@media (max-width: 600px) {
  .lang-radar-row { grid-template-columns: 1fr; }
}

/* ── Language bars ────────────────────────────────── */

.lang-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  animation: fadeUp var(--anim-med) ease 0.15s both;
}

.lang-list { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }

.lang-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.lang-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.lang-name {
  width: 100px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lang-track {
  flex: 1;
  height: 6px;
  background: var(--surface2);
  border-radius: 3px;
  overflow: hidden;
}

.lang-fill {
  height: 100%;
  border-radius: 3px;
  width: 0;
  transition: width 1.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.lang-pct {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  width: 42px;
  text-align: right;
}

/* ── Radar card ───────────────────────────────────── */

.radar-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  animation: fadeUp var(--anim-med) ease 0.15s both;
  display: flex;
  flex-direction: column;
}

.radar-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 8px;
}

/* ── Heatmap ──────────────────────────────────────── */

.heatmap-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 1.25rem;
  animation: fadeUp var(--anim-med) ease 0.2s both;
  overflow-x: auto;
}

.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(53, 1fr);
  grid-auto-rows: 1fr;
  gap: 3px;
  margin-top: 12px;
  min-width: 600px;
}

.heatmap-cell {
  aspect-ratio: 1;
  border-radius: 2px;
  background: var(--surface2);
  transition: opacity 0.3s;
  cursor: default;
}

.heatmap-cell[data-level="1"] { background: #0e4429; }
.heatmap-cell[data-level="2"] { background: #006d32; }
.heatmap-cell[data-level="3"] { background: #26a641; }
.heatmap-cell[data-level="4"] { background: #39d353; }

.heatmap-cell:hover { opacity: 0.7; }

.heatmap-legend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-muted);
}

.heatmap-legend .heatmap-cell {
  width: 12px; height: 12px;
  cursor: default;
}

/* ── Top repos ────────────────────────────────────── */

.repos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 12px;
  margin-bottom: 1.25rem;
}

.repo-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  animation: fadeUp var(--anim-med) ease both;
  text-decoration: none;
  color: inherit;
  transition: border-color var(--anim-fast);
}

.repo-card:hover { border-color: var(--accent); }

.repo-name {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}

.repo-desc {
  font-size: 12px;
  color: var(--text-muted);
  flex: 1;
  line-height: 1.5;
}

.repo-meta {
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-top: 4px;
}

/* ── Section heading ──────────────────────────────── */

.section-title {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
  margin-top: 0.5rem;
}

/* ── Animations ───────────────────────────────────── */

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

/* ── Responsive ───────────────────────────────────── */

@media (max-width: 500px) {
  .streak-inner { grid-template-columns: 1fr 1fr; }
  .cards-grid   { grid-template-columns: 1fr 1fr; }
}

/* ── Streak header ────────────────────────────────── */

.streak-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 2px;
}

.streak-approx {
  font-size: 11px;
  color: var(--warning);
  opacity: 0.8;
}

.streak-exact {
  font-size: 11px;
  color: var(--accent2);
  opacity: 0.8;
}

/* ── Lang name — allow wrapping on long names ─────── */

.lang-name {
  width: auto !important;
  min-width: 70px;
  max-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Range toggle ─────────────────────────────────── */

.range-toggle {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.range-btn {
  padding: 6px 14px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.range-btn:hover {
  border-color: var(--border2, #3d444d);
  color: var(--text);
}

.range-btn.active {
  background: var(--accent);
  color: #0d1117;
  border-color: var(--accent);
  font-weight: 600;
}

/* ── Range header badge ───────────────────────────── */

.range-header {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  display: inline-block;
}

.range-header strong {
  color: var(--accent);
}

/* ── Range pill inside card label ─────────────────── */

.range-pill {
  display: inline-block;
  font-size: 10px;
  font-weight: 500;
  padding: 1px 7px;
  border-radius: 100px;
  background: rgba(88,166,255,0.12);
  color: var(--accent);
  margin-left: 6px;
  letter-spacing: 0.03em;
  text-transform: none;
  vertical-align: middle;
}

/* ── Card menu (⋯ embed button) ──────────────────── */

.card-menu-wrap {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 10;
}

.card-menu-btn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s, border-color 0.15s;
  line-height: 1;
  padding: 0;
}

.card:hover .card-menu-btn,
.streak-card:hover .card-menu-btn,
.lang-card:hover .card-menu-btn,
.repos-grid:hover .card-menu-btn {
  opacity: 1;
}

.card-menu-btn:hover {
  background: var(--surface2);
  border-color: var(--border);
  color: var(--text);
}

.card-menu-dropdown {
  display: none;
  position: absolute;
  top: 32px;
  right: 0;
  width: 300px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 100;
}

.card-menu-dropdown.open {
  display: block;
  animation: fadeUp 0.15s ease both;
}

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

.menu-section-label {
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 4px;
  letter-spacing: 0.05em;
}

.menu-snippet-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.menu-snippet {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 5px 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.menu-copy {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 11px;
  padding: 5px 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  flex-shrink: 0;
}

.menu-copy:hover {
  border-color: var(--accent2);
  color: var(--accent2);
}

.menu-preview-link {
  display: block;
  margin-top: 10px;
  font-size: 11px;
  color: var(--accent);
  text-decoration: none;
  text-align: right;
}

.menu-preview-link:hover { text-decoration: underline; }

/* ── Theme picker ─────────────────────────────────── */

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.theme-label {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.theme-swatches {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.theme-btn {
  display: flex;
  gap: 3px;
  align-items: center;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  transition: all 0.15s;
}

.theme-btn:hover {
  border-color: var(--border2, #3d444d);
}

.theme-btn.active {
  border-color: var(--text-muted);
  background: var(--surface2);
}

.swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}