:root {
  --bg: #0f1115;
  --bg-gradient: radial-gradient(circle at 20% -10%, #1a2030 0%, #0f1115 45%);
  --surface: #161922;
  --surface-hover: #1c2029;
  --border: #262b38;
  --border-hover: #3a4256;
  --text: #e7e9ee;
  --text-dim: #8b93a7;

  /* single accent used for the grid glow, highlights, and all hover/link states */
  --accent: #6ea8fe;
  --accent-glow: rgba(110, 168, 254, 0.25);
  --grid-glow: rgba(110, 168, 254, 0.16);

  /* frosted-glass card (pointer: fine only, see below) — a vivid per-card
     accent glow sits under a pale, hazy "condensation" veil (lightened,
     desaturated, blurred). Wiping the veil away reveals the glow beneath
     at full saturation and sharpness, a real, visible contrast rather than
     a subtle filter delta on similarly-dark colors */
  --card-glow-bg: radial-gradient(circle at 30% 25%, rgba(110, 168, 254, 0.5), transparent 62%), var(--surface);
  --card-fog: rgba(225, 232, 245, 0.1);
  --card-fog-hover: rgba(225, 232, 245, 0.14);

  --radius: 14px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
}

/* registered (a) so the fog-wipe radius/position can transition smoothly, and
   (b) with inherits:true so values set via JS on .card actually reach the
   .card::before pseudo-element that reads them — pseudo-elements only see
   inherited custom properties, not ones merely set as inline styles nearby */
@property --clear-r {
  syntax: "<length>";
  inherits: true;
  initial-value: 0px;
}

@property --mx {
  syntax: "<length>";
  inherits: true;
  initial-value: 0px;
}

@property --my {
  syntax: "<length>";
  inherits: true;
  initial-value: 0px;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg-gradient), var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 56px 32px 40px;
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.page-header {
  margin-bottom: 40px;
}

.page-header h1 {
  margin: 0;
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.page-header .dot {
  color: var(--accent);
}

.subtitle {
  margin: 6px 0 0;
  color: var(--text-dim);
  font-size: 0.95rem;
}

main {
  flex: 1;
  position: relative;
}

/* soft accent-colored glow radiating from roughly where the grid sits */
main::before {
  content: "";
  position: absolute;
  top: -40px;
  left: 50%;
  translate: -50% 0;
  width: min(820px, 140%);
  aspect-ratio: 1;
  background: radial-gradient(circle, var(--grid-glow) 0%, transparent 70%);
  z-index: -1;
  pointer-events: none;
}

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

.card {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 28px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--text);
  text-align: center;
  transition: transform 0.15s ease, background-color 0.15s ease,
    border-color 0.15s ease, box-shadow 0.15s ease;
}

.card:hover,
.card:focus-visible {
  background: var(--surface-hover);
  border-color: var(--border-hover);
  transform: translateY(-3px);
  box-shadow: var(--shadow), 0 0 0 1px var(--accent-glow);
}

.card:active {
  transform: translateY(-1px);
}

.card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.card-icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  object-fit: contain;
  background: #0000;
}

.card-name {
  font-size: 0.95rem;
  font-weight: 500;
  word-break: break-word;
}

/* Frosted glass + fog-wipe hover: mouse/trackpad only. Touch devices keep the
   plain solid card above — no half-working hover state to fight with. */
@media (pointer: fine) {
  .card {
    background: var(--card-glow-bg);
  }

  .card::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    border-radius: inherit;
    pointer-events: none;
    background: var(--card-fog);
    backdrop-filter: blur(18px) saturate(55%) brightness(1.25);
    -webkit-backdrop-filter: blur(18px) saturate(55%) brightness(1.25);
    /* radius stays proportional to --clear-r so the mask is perfectly flat
       (fully frosted) at rest, with no artifact at the default 0,0 position */
    -webkit-mask-image: radial-gradient(
      circle at var(--mx) var(--my),
      transparent 0,
      transparent var(--clear-r),
      black calc(var(--clear-r) * 1.4)
    );
    mask-image: radial-gradient(
      circle at var(--mx) var(--my),
      transparent 0,
      transparent var(--clear-r),
      black calc(var(--clear-r) * 1.4)
    );
    transition: --clear-r 0.35s ease, background-color 0.15s ease;
  }

  .card:hover::before,
  .card:focus-visible::before {
    background: var(--card-fog-hover);
  }

  .card-icon,
  .card-name {
    position: relative;
    z-index: 1;
  }
}

.empty-state {
  color: var(--text-dim);
  text-align: center;
  margin-top: 60px;
  font-size: 0.95rem;
}

.empty-state code {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 0.85em;
}

.page-footer {
  margin-top: 48px;
  color: var(--text-dim);
  font-size: 0.8rem;
  text-align: center;
}

@media (max-width: 480px) {
  .page {
    padding: 40px 20px 32px;
  }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 14px;
  }

  .card {
    padding: 22px 12px;
  }
}
