:root {
  --bg: #070709;
  --surface: #0f0f13;
  --surface-hover: #16161b;
  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.16);
  --border-focus: #f59e0b;
  --text: #f4f4f5;
  --text-muted: #8e8e93;
  --success: #f59e0b;
  --success-hover: #fbbf24;
  --error: #ef4444;
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.03);
  --warning-border: rgba(245, 158, 11, 0.15);
  --radius: 6px;
  --radius-lg: 8px;
  --font: "JetBrains Mono", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, monospace;
}

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

body {
  font-family: var(--font);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  letter-spacing: -0.01em;
}

/* Fading Vercel-style developer grid background */
.glow-bg {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: -1;
  pointer-events: none;
  background-color: var(--bg);
}

/* Fading Vercel-style developer grid lines overlay */
.glow-bg::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 85% 60% at 50% 0%, black 30%, rgba(0, 0, 0, 0.5) 75%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 85% 60% at 50% 0%, black 30%, rgba(0, 0, 0, 0.5) 75%, transparent 100%);
}

.glow-circle {
  display: none;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 4.5rem 1.5rem;
}

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

header h1 {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  background: linear-gradient(135deg, #ffffff 40%, #f59e0b 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.75rem;
}

header p {
  color: var(--text-muted);
  font-size: 1.05rem;
  font-weight: 400;
  max-width: 550px;
  margin: 0 auto;
}

/* Search Bar */
.search-bar {
  margin-bottom: 2.5rem;
}

#search-input {
  width: 100%;
  padding: 0.85rem 1.25rem;
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  letter-spacing: -0.01em;
}

#search-input::placeholder {
  color: var(--text-muted);
  opacity: 0.6;
}

#search-input:focus {
  border-color: rgba(245, 158, 11, 0.4);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.06);
}

/* Category Sections */
.category {
  margin-bottom: 3rem;
}

.category h3 {
  margin-bottom: 1.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cat-icon {
  font-size: 0.85rem;
  line-height: 1;
}

.cat-count {
  margin-left: auto;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  letter-spacing: 0;
  text-transform: none;
}

/* No Results */
.no-results {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Apps Grid */
.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.75rem;
}

/* App Cards */
.app-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.app-card:hover {
  border-color: var(--border-hover);
  background-color: var(--surface-hover);
  transform: translateY(-1px);
}

.app-card.selected {
  border-color: var(--border-focus);
  background-color: rgba(245, 158, 11, 0.03);
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.08);
}

/* Custom Checkbox integration */
.app-card input[type="checkbox"] {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  accent-color: var(--success);
  border: 1px solid var(--border);
  cursor: pointer;
  flex-shrink: 0;
}

/* High-contrast off-white icon background (so Vaultwarden and dark logos pop!) */
.app-card img {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  object-fit: contain;
  background: #ffffff; /* Contrast background so dark icons stand out */
  padding: 4px;
  border: 1px solid rgba(0, 0, 0, 0.05);
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

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

.app-info strong {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-info small {
  display: block;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Actions Panel */
.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  margin-top: 4rem;
  padding: 1.25rem 1.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

button {
  padding: 0.65rem 1.4rem;
  font-size: 0.85rem;
  font-weight: 700;
  border: 1px solid var(--success);
  border-radius: var(--radius);
  cursor: pointer;
  background: var(--success);
  color: #000000;
  transition: all 0.2s ease;
}

button:hover:not(:disabled) {
  background: var(--success-hover);
  border-color: var(--success-hover);
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.3);
}

button:active:not(:disabled) {
  opacity: 0.85;
}

button:disabled {
  opacity: 0.25;
  cursor: not-allowed;
  border-color: var(--border);
  background: transparent;
  color: var(--text-muted);
}

#selected-count {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
}

/* Results Window */
#result {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.25);
}

#result h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 1.5rem;
  color: #ffffff;
}

#result p {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

/* Warnings Box */
#warnings {
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}

#warnings::before {
  content: "warnings";
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--warning);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.5rem;
}

#warnings ul {
  list-style-type: none;
}

#warnings li {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.8rem;
  position: relative;
  padding-left: 1rem;
  margin-bottom: 0.25rem;
  line-height: 1.5;
}

#warnings li::before {
  content: "-";
  position: absolute;
  left: 0.1rem;
  color: var(--warning);
}

#warnings li:last-child {
  margin-bottom: 0;
}

/* IDE / Terminal Code Block */
.code-block {
  position: relative;
  background: #020202;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  padding-top: 2.25rem;
  margin: 1rem 0 1.5rem;
}

/* simulated titlebar dots */
.code-block::before {
  content: "";
  position: absolute;
  top: 0.85rem;
  left: 1rem;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 14px 0 0 rgba(255, 255, 255, 0.15), 28px 0 0 rgba(255, 255, 255, 0.15);
}

.code-block code {
  display: block;
  font-family: var(--font);
  font-size: 0.85rem;
  line-height: 1.6;
  color: #e4e4e7;
  word-break: break-all;
  white-space: pre-wrap;
}

#copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.3rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text);
}

#copy-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-hover);
}

.hint {
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-bottom: 1.5rem !important;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  line-height: 1.5;
}

.hint::before {
  content: "!";
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  border: 1px solid var(--border);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

#back-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

#back-btn:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--border-hover);
}

/* Loading & Error States */
#loading {
  text-align: center;
  padding: 4rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.error-text {
  color: var(--error);
  text-align: center;
  padding: 1.5rem;
  background: rgba(239, 68, 68, 0.02);
  border: 1px solid rgba(239, 68, 68, 0.1);
  border-radius: var(--radius);
  font-size: 0.85rem;
}

.hidden {
  display: none !important;
}

/* Footer */
footer {
  text-align: center;
  margin-top: 5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.75rem;
}

@media (max-width: 640px) {
  header h1 {
    font-size: 1.75rem;
  }
  .container {
    padding: 2.5rem 1rem;
  }
  .apps-grid {
    grid-template-columns: 1fr;
  }
  .actions {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    padding: 1.25rem;
    gap: 1rem;
  }
  #result {
    padding: 1.5rem;
  }
}
