html {
  background: #020617;
  color: #e5e7eb;
}

:root {
  --bg: #020617;
  --bg-alt: #020617;
  --card-bg: #020617;
  --accent: #38bdf8;
  --accent-2: #22c55e;
  --accent-soft: rgba(56, 189, 248, 0.12);
  --text: #e5e7eb;
  --muted: #9ca3af;
  --border: rgba(148, 163, 184, 0.35);
  --shadow: 0 24px 70px rgba(15, 23, 42, 0.95);
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #0b1120 0, #020617 45%, #000 100%);
  color: var(--text);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
}

.bg-orbit {
  position: fixed;
  inset: -40%;
  background:
    radial-gradient(circle at 10% 0%, rgba(56, 189, 248, 0.18), transparent 55%),
    radial-gradient(circle at 90% 100%, rgba(34, 197, 94, 0.16), transparent 55%);
  opacity: 0.9;
  filter: blur(2px);
  pointer-events: none;
  z-index: 0;
}

.top-bar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.75rem;
  backdrop-filter: blur(18px);
  background: linear-gradient(to right, rgba(15, 23, 42, 0.9), rgba(15, 23, 42, 0.65));
  border-bottom: 1px solid rgba(148, 163, 184, 0.35);
}

.top-bar h1 {
  margin: 0;
  font-size: 1.2rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #e5e7eb;
}

.badge {
  font-size: 0.75rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  color: var(--muted);
  background: rgba(15, 23, 42, 0.8);
}

.container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.2rem 1rem 1.8rem;
  position: relative;
  z-index: 1;
}

.card {
  width: 100%;
  max-width: 620px;
  background: radial-gradient(circle at top left, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.96));
  border-radius: 1.7rem;
  padding: 1.9rem 1.9rem 1.6rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  animation: cardIn 0.6s ease-out;
}

.card-glow {
  position: absolute;
  inset: -40%;
  background:
    radial-gradient(circle at 0% 0%, rgba(56, 189, 248, 0.16), transparent 55%),
    radial-gradient(circle at 100% 100%, rgba(34, 197, 94, 0.14), transparent 55%);
  opacity: 0.9;
  pointer-events: none;
}

.card > * {
  position: relative;
  z-index: 1;
}

.controls {
  margin-bottom: 1rem;
}

.controls-row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
}

.control-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.control-group label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

#category,
#difficulty {
  padding: 0.6rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.9);
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, transform 0.1s ease;
}

#category:focus,
#difficulty:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-soft);
  transform: translateY(-1px);
}

.idea-box {
  margin-top: 0.9rem;
  padding: 1.35rem 1.2rem;
  border-radius: 1.2rem;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: radial-gradient(circle at top left, var(--accent-soft), rgba(15, 23, 42, 0.9));
  min-height: 96px;
  font-size: 1rem;
  line-height: 1.6;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  color: var(--text);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.2s ease, background 0.2s ease;
  opacity: 0;
  transform: translateY(6px);
  animation: ideaIn 0.45s ease-out forwards;
}

.idea-box.active {
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.8);
  border-color: var(--accent);
}

.idea-placeholder {
  margin: 0;
  color: var(--muted);
}

.category-pill {
  display: inline-block;
  margin-top: 0.55rem;
  font-size: 0.72rem;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  border: 1px solid transparent;
  letter-spacing: 0.1em;
  font-weight: 600;
  min-height: 1.4em;
  transition: opacity 0.2s ease;
}

.pill-python  { background: rgba(59,130,246,0.15); border-color: rgba(59,130,246,0.5); color: #93c5fd; }
.pill-web     { background: rgba(56,189,248,0.15); border-color: rgba(56,189,248,0.5); color: #7dd3fc; }
.pill-games   { background: rgba(168,85,247,0.15); border-color: rgba(168,85,247,0.5); color: #d8b4fe; }
.pill-tools   { background: rgba(251,191,36,0.15); border-color: rgba(251,191,36,0.5); color: #fde68a; }
.pill-ai      { background: rgba(34,197,94,0.15);  border-color: rgba(34,197,94,0.5);  color: #86efac; }
.pill-mobile  { background: rgba(249,115,22,0.15); border-color: rgba(249,115,22,0.5); color: #fdba74; }
.pill-api     { background: rgba(236,72,153,0.15); border-color: rgba(236,72,153,0.5); color: #f9a8d4; }
.pill-cli     { background: rgba(148,163,184,0.15);border-color: rgba(148,163,184,0.5);color: #cbd5e1; }

.buttons {
  display: flex;
  gap: 0.6rem;
  margin-top: 1.1rem;
}

.buttons button {
  border-radius: 999px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.1s ease, box-shadow 0.18s ease, border-color 0.18s ease, color 0.18s ease;
  border: 1px solid transparent;
}

#generate-btn {
  flex: 1.4;
  padding: 0.7rem 1rem;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #020617;
  font-weight: 600;
  box-shadow: 0 14px 40px rgba(34, 197, 94, 0.4);
}

#generate-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 55px rgba(34, 197, 94, 0.55);
}

.ghost-btn {
  flex: 1;
  padding: 0.7rem 0.9rem;
  background: rgba(15, 23, 42, 0.8);
  color: var(--text);
  border-color: var(--border);
}

.ghost-btn:hover {
  border-color: var(--accent);
  background: rgba(15, 23, 42, 0.95);
}

.icon-btn {
  width: 44px;
  padding: 0.7rem 0;
  background: rgba(15, 23, 42, 0.8);
  color: var(--muted);
  border-color: var(--border);
  font-size: 1rem;
}

.icon-btn.active {
  color: #facc15;
  border-color: #facc15;
  background: rgba(24, 24, 15, 0.9);
}

.icon-btn:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
}

.status {
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--muted);
  min-height: 1em;
  transition: color 0.2s ease;
}

.diff-beginner     { color: #86efac; }
.diff-intermediate { color: #fde68a; }
.diff-advanced     { color: #fca5a5; }

.favourites {
  margin-top: 1.3rem;
  padding-top: 1rem;
  border-top: 1px dashed rgba(148, 163, 184, 0.4);
}

.fav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.fav-header h2 {
  margin: 0;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.fav-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.2em;
  padding: 0 0.35em;
  height: 1.2em;
  border-radius: 999px;
  background: var(--accent);
  color: #020617;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
}

.tiny-btn {
  font-size: 0.7rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: rgba(15, 23, 42, 0.8);
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.tiny-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

.fav-search {
  width: 100%;
  margin-bottom: 0.6rem;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.9);
  color: var(--text);
  font-size: 0.82rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.fav-search::placeholder {
  color: var(--muted);
}

.fav-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-soft);
}

.fav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 180px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.7) transparent;
}

.fav-list::-webkit-scrollbar {
  width: 6px;
}

.fav-list::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.7);
  border-radius: 999px;
}

.fav-item {
  font-size: 0.86rem;
  padding: 0.45rem 0.4rem;
  border-radius: 0.6rem;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.9);
  margin-bottom: 0.4rem;
  display: flex;
  gap: 0.4rem;
  align-items: flex-start;
  animation: favIn 0.25s ease-out;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.fav-item:hover {
  border-color: var(--accent);
  background: rgba(15, 23, 42, 0.98);
}

.fav-bullet {
  font-size: 0.7rem;
  color: var(--accent);
  margin-top: 0.1rem;
}

.fav-text {
  flex: 1;
}

.fav-remove {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.7rem;
  padding: 0 0.2rem;
  line-height: 1;
  border-radius: 4px;
  transition: color 0.15s ease;
  flex-shrink: 0;
}

.fav-remove:hover {
  color: #fca5a5;
}

.fav-empty {
  font-size: 0.8rem;
  color: var(--muted);
}

.footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 0.8rem 1rem 1.1rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.footer a {
  color: var(--accent);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

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

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

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

@media (max-width: 640px) {
  .card {
    padding: 1.6rem 1.3rem 1.3rem;
    border-radius: 1.4rem;
  }

  .top-bar {
    padding-inline: 1.1rem;
  }

  .top-bar h1 {
    font-size: 1.05rem;
  }

  .controls-row {
    flex-direction: column;
    align-items: stretch;
  }

  .ghost-btn {
    width: 100%;
  }
}
