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

:root {
  --bg: #0d1117;
  --surface: #161b22;
  --border: #30363d;
  --text: #e6edf3;
  --muted: #8b949e;
  --green: #00ff88;
  --green-dim: #00cc6a;
}

body.light {
  --bg: #f6f8fa;
  --surface: #ffffff;
  --border: #d0d7de;
  --text: #24292f;
  --muted: #57606a;
}

.hidden { display: none !important; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Courier New', Courier, monospace;
  min-height: 100vh;
  padding: 2rem 1rem;
  transition: background 0.2s, color 0.2s;
}

/* header */
header { text-align: center; margin-bottom: 2rem; }

.header-top {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin-bottom: 0.4rem;
}

header h1 { font-size: 1.8rem; color: var(--green); letter-spacing: 0.05em; }
header p  { color: var(--muted); font-size: 0.85rem; }

.theme-toggle {
  position: absolute;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.2s;
}
.theme-toggle:hover { border-color: var(--green); }

/* search area */
.search-area { max-width: 500px; margin: 0 auto 1rem; }

.search-box {
  display: flex;
  gap: 0.5rem;
}

.search-box input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.65rem 1rem;
  border-radius: 6px;
  outline: none;
  transition: border-color 0.2s;
}
.search-box input:focus  { border-color: var(--green); }
.search-box input::placeholder { color: var(--muted); }

.search-box button {
  background: var(--green);
  color: #000;
  border: none;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: bold;
  padding: 0.65rem 1.2rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}
.search-box button:hover    { background: var(--green-dim); }
.search-box button:disabled { opacity: 0.5; cursor: not-allowed; }

.search-sub {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.5rem;
  gap: 0.5rem;
  min-height: 1.6rem;
}

.compare-toggle-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: inherit;
  font-size: 0.78rem;
  padding: 0.25rem 0.65rem;
  border-radius: 4px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}
.compare-toggle-btn:hover  { border-color: var(--green); color: var(--green); }
.compare-toggle-btn.active { border-color: var(--green); color: var(--green); }

.compare-box {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.5rem;
}

.vs-badge {
  color: var(--muted);
  font-size: 0.85rem;
  flex-shrink: 0;
}

.compare-input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--green);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.65rem 1rem;
  border-radius: 6px;
  outline: none;
}

/* history chips */
.chips-row {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
  flex: 1;
  min-width: 0;
}

.chips-label {
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
}

.chip {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: inherit;
  font-size: 0.72rem;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
  white-space: nowrap;
}
.chip:hover { border-color: var(--green); color: var(--green); }

/* favorites */
.favorites-panel {
  max-width: 860px;
  margin: 0 auto 1rem;
}

.favorites-label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
}

.favorites-grid {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.fav-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.35rem 0.6rem;
  cursor: pointer;
  transition: border-color 0.2s;
  font-size: 0.8rem;
  color: var(--text);
}
.fav-item:hover { border-color: var(--green); }
.fav-item img   { width: 22px; height: 22px; border-radius: 50%; }

.fav-remove {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0 0 0 0.2rem;
  line-height: 1;
}
.fav-remove:hover { color: #ff6b6b; }

/* error */
#error {
  text-align: center;
  color: #ff6b6b;
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
  display: none;
}

/* skeleton */
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}

.skeleton-block {
  background: linear-gradient(90deg, #21262d 25%, #2d333b 50%, #21262d 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: 4px;
}

.skeleton-avatar { width: 90px; height: 90px; border-radius: 50%; flex-shrink: 0; }
.skeleton-line   { height: 13px; margin-bottom: 10px; }
.skeleton-line.w30  { width: 30%; }
.skeleton-line.w50  { width: 50%; }
.skeleton-line.w70  { width: 70%; }
.skeleton-line.w100 { width: 100%; }

#skeleton { display: none; max-width: 860px; margin: 0 auto; }

/* results wrapper */
#results { display: none; max-width: 860px; margin: 0 auto; }

/* profile card */
.profile-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  margin-bottom: 1.5rem;
}

.profile-card img {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: 2px solid var(--green);
  flex-shrink: 0;
}

.profile-info { flex: 1; min-width: 0; }

.profile-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.2rem;
}

.profile-info h2 { font-size: 1.3rem; color: var(--green); }

.card-actions { display: flex; gap: 0.35rem; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }

.action-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: inherit;
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
  white-space: nowrap;
}
.action-btn:hover  { border-color: var(--green); color: var(--green); }
.action-btn.active { border-color: var(--green); color: var(--green); }

.profile-info .login {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

.profile-info .bio {
  font-size: 0.9rem;
  color: var(--text);
  margin-bottom: 0.9rem;
  line-height: 1.5;
}

/* stats */
.stats { display: flex; gap: 1.2rem; flex-wrap: wrap; }

.stat { display: flex; flex-direction: column; gap: 0.1rem; }

.stat .value {
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--green);
}

.stat .label {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* sections */
.section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.section h3 {
  font-size: 0.85rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 1.2rem;
}

/* charts */
.chart-wrapper { position: relative; height: 260px; }

.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.charts-grid .section { margin-bottom: 0; }
.pie-wrapper { height: 240px; }

/* heatmap */
.heatmap {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 0.5rem;
}

.heatmap-cell {
  aspect-ratio: 1;
  border-radius: 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  border: 1px solid var(--border);
  transition: transform 0.15s;
  cursor: default;
}
.heatmap-cell:hover { transform: scale(1.08); }

.heatmap-month { font-size: 0.58rem; color: inherit; }
.heatmap-count { font-size: 0.72rem; font-weight: bold; color: inherit; }

/* repo list */
.repo-list { display: flex; flex-direction: column; gap: 0.6rem; }

.repo-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0.8rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  gap: 1rem;
}

.repo-item-left { min-width: 0; }

.repo-name {
  font-size: 0.9rem;
  color: var(--green);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.repo-lang {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.repo-pushed { font-size: 0.75rem; color: var(--muted); white-space: nowrap; flex-shrink: 0; }

/* topics */
.topics-list { display: flex; flex-wrap: wrap; gap: 0.45rem; }

.topic-chip {
  background: rgba(0, 255, 136, 0.08);
  border: 1px solid rgba(0, 255, 136, 0.25);
  color: var(--green);
  font-size: 0.78rem;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
}

.topic-count { color: var(--muted); font-size: 0.68rem; margin-left: 0.25rem; }

/* personality */
.personality-card { display: flex; align-items: center; gap: 1.2rem; }

.personality-emoji { font-size: 2.6rem; line-height: 1; flex-shrink: 0; }

.personality-label {
  font-size: 1.15rem;
  color: var(--green);
  font-weight: bold;
  margin-bottom: 0.3rem;
}

.personality-desc { font-size: 0.85rem; color: var(--muted); line-height: 1.5; }

/* compare */
#compareResults { max-width: 860px; margin: 0 auto; }

.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.compare-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.3rem;
}

.compare-card img {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid var(--green);
  display: block;
  margin-bottom: 0.7rem;
}

.compare-card h3 { font-size: 1.05rem; color: var(--green); margin-bottom: 0.15rem; }

.compare-login { font-size: 0.8rem; color: var(--muted); margin-bottom: 0.5rem; }

.compare-bio {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
  margin-bottom: 0.9rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.compare-stats-list { margin-bottom: 0.9rem; }

.compare-stat-row {
  display: flex;
  justify-content: space-between;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
}

.compare-stat-row .stat-label { color: var(--muted); }
.compare-stat-row .stat-val   { color: var(--text); font-weight: bold; }
.compare-stat-row .stat-val.winner { color: var(--green); }

.compare-personality {
  font-size: 0.82rem;
  color: var(--muted);
  padding: 0.5rem 0.7rem;
  background: var(--bg);
  border-radius: 6px;
}

/* toast */
.toast {
  position: fixed;
  bottom: 3rem;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: var(--green);
  color: #000;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: bold;
  padding: 0.5rem 1.2rem;
  border-radius: 6px;
  transition: transform 0.25s ease;
  z-index: 100;
  pointer-events: none;
}

.toast.show { transform: translateX(-50%) translateY(0); }

/* responsive */
@media (max-width: 700px) {
  .charts-grid  { grid-template-columns: 1fr; }
  .compare-grid { grid-template-columns: 1fr; }
  .heatmap      { grid-template-columns: repeat(6, 1fr); }
}

@media (max-width: 540px) {
  .profile-card { flex-direction: column; align-items: center; text-align: center; }
  .profile-header-row { flex-direction: column; align-items: center; }
  .card-actions { justify-content: center; }
  .stats  { justify-content: center; }
  .chart-wrapper { height: 220px; }
  header h1 { font-size: 1.4rem; }
}
