/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --border: #e1e4e8;
  --text: #1a1a2e;
  --text-secondary: #6b7280;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --accent: #f59e0b;
  --success: #10b981;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-lg: 0 4px 6px rgba(0,0,0,.07), 0 10px 15px rgba(0,0,0,.1);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans SC", sans-serif;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
  width: 100%;
}

/* ===== Header ===== */
.header {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  color: #fff;
  padding: 40px 0 32px;
  text-align: center;
}
.header h1 { font-size: 2rem; font-weight: 800; letter-spacing: -0.5px; }
.header .subtitle { margin-top: 8px; font-size: .95rem; opacity: .85; max-width: 600px; margin-left: auto; margin-right: auto; }
.header .meta { margin-top: 6px; font-size: .85rem; opacity: .7; }

/* ===== Controls ===== */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 24px 0 16px;
  align-items: center;
}
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1 1 auto;
}
.filter-btn {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: .85rem;
  font-family: var(--font);
  transition: all .15s ease;
  white-space: nowrap;
}
.filter-btn:hover { border-color: var(--primary); color: var(--primary); }
.filter-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.search-bar {
  flex: 0 1 260px;
  min-width: 180px;
}
.search-bar input {
  width: 100%;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: .85rem;
  font-family: var(--font);
  outline: none;
  transition: border-color .15s;
}
.search-bar input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }

/* ===== Stats Bar ===== */
.stats-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 12px 16px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.stats-bar span { font-size: .88rem; color: var(--text-secondary); flex: 1; }

/* ===== Buttons ===== */
.btn {
  padding: 8px 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: .88rem;
  font-family: var(--font);
  cursor: pointer;
  transition: all .15s ease;
  white-space: nowrap;
  font-weight: 500;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-secondary { background: var(--surface); color: var(--text-secondary); border: 1px solid var(--border); }
.btn-secondary:hover { background: #f9fafb; color: var(--text); }

/* ===== Skills Grid ===== */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.skill-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  transition: all .15s ease;
  box-shadow: var(--shadow);
  position: relative;
}
.skill-card:hover { border-color: var(--primary); box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.skill-card.selected { border-color: var(--primary); background: var(--primary-light); }

.skill-check {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 3px;
  transition: all .15s;
  font-size: 12px;
  color: transparent;
}
.skill-card.selected .skill-check { background: var(--primary); border-color: var(--primary); color: #fff; }

.skill-body { flex: 1; min-width: 0; }
.skill-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
  margin-bottom: 4px;
}
.skill-icon {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: var(--primary-light);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 700;
  flex-shrink: 0;
}
.skill-name { font-size: .95rem; font-weight: 600; }
.skill-stars {
  font-size: .75rem;
  color: var(--accent);
  font-weight: 600;
}
.skill-source {
  font-size: .72rem;
  color: var(--text-secondary);
  background: var(--bg);
  padding: 1px 8px;
  border-radius: 10px;
}
.skill-desc {
  font-size: .83rem;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.skill-repo {
  font-size: .65rem;
  font-family: var(--font);
  color: #fff;
  background: #24292e;
  border-radius: 4px;
  padding: 1px 7px;
  margin-left: auto;
  white-space: nowrap;
  transition: background .15s;
  text-decoration: none;
  font-weight: 500;
  line-height: 1.6;
}
.skill-repo:hover {
  background: #0366d6;
  text-decoration: none;
}

.skill-card.hidden { display: none; }

/* ===== Output Section ===== */
.output-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}
.output-section h2 { font-size: 1.1rem; margin-bottom: 4px; }
.output-hint { font-size: .85rem; color: var(--text-secondary); margin-bottom: 12px; }
.output-section textarea {
  width: 100%;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: "SF Mono", "Fira Code", "Consolas", monospace;
  font-size: .82rem;
  line-height: 1.6;
  resize: vertical;
  color: var(--text);
  background: #fafbfc;
  margin-bottom: 12px;
}
.output-section textarea:focus { outline: none; border-color: var(--primary); }

/* ===== Footer ===== */
.footer {
  margin-top: auto;
  text-align: center;
  padding: 24px 0;
  color: var(--text-secondary);
  font-size: .82rem;
  border-top: 1px solid var(--border);
}
.footer a { color: var(--text-secondary); }

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #1a1a2e;
  color: #fff;
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  font-size: .88rem;
  opacity: 0;
  transition: all .3s ease;
  pointer-events: none;
  z-index: 999;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== Empty State ===== */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state p { font-size: .95rem; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .header { padding: 28px 0 24px; }
  .header h1 { font-size: 1.5rem; }
  .controls { flex-direction: column; align-items: stretch; }
  .search-bar { flex: 1; min-width: 0; }
  .skills-grid { grid-template-columns: 1fr; }
  .stats-bar { flex-direction: column; align-items: stretch; text-align: center; }
  .stats-bar span { flex: none; }
  .output-section { padding: 16px; }
}

@media (max-width: 420px) {
  .filter-btn { font-size: .78rem; padding: 5px 10px; }
  .skill-header { gap: 4px 6px; }
  .skill-name { font-size: .88rem; }
}
