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

:root {
  --bg: #080e1a;
  --surface: #0d1526;
  --surface-2: #111d33;
  --border: #1a2d4a;
  --accent: #1d6ff2;
  --accent-hover: #1558cc;
  --accent-dim: #1d6ff215;
  --text: #dce8f5;
  --text-muted: #5e7a99;
  --green: #22c55e;
  --cyan: #22d3ee;
  --radius: 6px;
  --transition: 0.16s ease;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  line-height: 1.6;
}

/* ── Header ── */
header {
  border-bottom: 1px solid var(--border);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}

.logo {
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0.01em;
  color: var(--text);
  text-decoration: none;
}

.logo span {
  color: var(--accent);
}

nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color var(--transition);
}

nav a:hover {
  color: var(--text);
}

/* ── Hero ── */
.hero {
  max-width: 820px;
  margin: 0 auto;
  padding: 5rem 2rem 3rem;
  text-align: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 4px;
  padding: 0.25rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 500;
  margin-bottom: 1.5rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 1rem;
}

.hero h1 .accent {
  color: var(--accent);
}

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

/* ── Pinned section ── */
.pinned-section {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 2rem 2rem;
}

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

/* ── Search bar ── */
.search-bar {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 2rem 0.75rem;
}

.search-bar input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
  padding: 0.5rem 0.9rem;
  outline: none;
  transition: border-color var(--transition);
  box-sizing: border-box;
}

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

.search-bar input:focus {
  border-color: var(--accent);
}

/* ── Filter bar ── */
.filter-bar {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 2rem 2rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.filter-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 4px;
  padding: 0.35rem 0.9rem;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  font-weight: 500;
}

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

.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ── App grid ── */
.grid-section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 2rem 6rem;
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

/* ── App card ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
  animation: fadeUp 0.25s ease both;
}

.card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 6px 24px #1d6ff212;
}

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

.card-header {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.card-icon {
  font-size: 1.6rem;
  line-height: 1;
  flex-shrink: 0;
}

.card-title-group {
  flex: 1;
  min-width: 0;
}

.card-title {
  font-size: 0.975rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.type-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.12rem 0.45rem;
  border-radius: 3px;
  margin-top: 0.3rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.type-badge.web {
  background: #1d6ff218;
  color: var(--accent);
  border: 1px solid #1d6ff230;
}

.type-badge.desktop {
  background: #22d3ee18;
  color: var(--cyan);
  border: 1px solid #22d3ee30;
}

.type-badge.flutter {
  background: #54c5f818;
  color: #54c5f8;
  border: 1px solid #54c5f830;
}

.type-badge.package {
  background: #f9731618;
  color: #f97316;
  border: 1px solid #f9731630;
}

.card-desc {
  color: var(--text-muted);
  font-size: 0.855rem;
  flex: 1;
  line-height: 1.55;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.tag {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.7rem;
  padding: 0.1rem 0.45rem;
  border-radius: 3px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.card-date {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
  opacity: 0.7;
}

.date-source-only {
  font-style: italic;
  opacity: 0.5;
}

.card-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.85rem;
  border-radius: 5px;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  transition: all var(--transition);
  cursor: pointer;
  border: none;
  font-family: inherit;
  letter-spacing: 0.01em;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-ghost {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

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

/* ── Info button & install panel ── */
.info-btn {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: none;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-style: italic;
  font-weight: 700;
  font-family: serif;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  padding: 0;
}

.info-btn:hover,
.info-btn.active {
  border-color: var(--accent);
  color: var(--accent);
}

.card-install {
  display: none;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.45rem 0.6rem;
  margin-bottom: 0.4rem;
  flex-direction: column;
  gap: 0.3rem;
}

.card-install.open {
  display: flex;
}

.install-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.install-line code {
  font-family: 'Courier New', monospace;
  font-size: 0.75rem;
  color: var(--accent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-family: inherit;
  padding: 0.1rem 0.4rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--transition);
}

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

/* ── Loading ring ── */
.loading-ring {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Flutter modal ── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.modal[hidden] {
  display: none;
}

.modal-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.modal-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
}

.modal-close {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 4px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  font-family: inherit;
}

.modal-close:hover {
  border-color: var(--accent);
  color: var(--text);
}

.modal-frame {
  flex: 1;
  border: none;
  width: 100%;
}

/* ── Empty state ── */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}

.empty-state span {
  display: block;
  font-size: 2rem;
  margin-bottom: 0.75rem;
}

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

footer a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition);
}

footer a:hover {
  color: var(--text);
}

/* ── Responsive ── */
@media (max-width: 600px) {
  header {
    padding: 1rem;
  }
  .hero {
    padding: 3rem 1rem 2rem;
  }
  .filter-bar, .grid-section {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}
