:root {
  color-scheme: dark;
  --bg: #030807;
  --surface: #0a1512;
  --surface-strong: #0f211c;
  --line: rgba(206, 255, 235, 0.14);
  --text: #f2fff9;
  --muted: #93ab9f;
  --accent: #68f0b2;
  --accent-strong: #20d990;
  --focus: #e7fff4;
  --display-size: 600px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background: #000;
}

body {
  display: grid;
  place-items: center;
  color: var(--text);
  overflow: hidden;
}

button,
a {
  font: inherit;
}

.display-shell {
  position: relative;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  width: min(100vw, var(--display-size));
  height: min(100vh, var(--display-size));
  min-height: 390px;
  padding: 26px 28px 20px;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at 82% -8%, rgba(32, 217, 144, 0.22), transparent 38%),
    radial-gradient(circle at -12% 88%, rgba(41, 116, 92, 0.17), transparent 42%),
    linear-gradient(145deg, #040b09 0%, var(--bg) 62%, #06100d 100%);
}

.display-shell::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  content: "";
  pointer-events: none;
  opacity: 0.23;
  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: 42px 42px;
  mask-image: linear-gradient(to bottom, black, transparent 78%);
}

.topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 13px;
  padding-bottom: 17px;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  display: grid;
  grid-template-columns: repeat(2, 8px);
  grid-template-rows: repeat(2, 8px);
  gap: 3px;
  width: 26px;
  height: 26px;
  transform: rotate(45deg);
}

.brand-mark span {
  border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(104, 240, 178, 0.45);
}

.brand-mark span:last-child {
  grid-column: 2;
}

.eyebrow,
.section-kicker,
.brand-copy h1,
.intro p {
  margin: 0;
}

.eyebrow,
.section-kicker {
  color: var(--accent);
  font-size: 10px;
  font-weight: 760;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.brand-copy h1 {
  margin-top: 2px;
  font-size: 25px;
  font-weight: 720;
  letter-spacing: -0.045em;
  line-height: 1;
}

.topbar-meta {
  display: grid;
  justify-items: end;
  gap: 2px;
}

#clock {
  font-variant-numeric: tabular-nums;
  font-size: 17px;
  font-weight: 680;
  letter-spacing: -0.02em;
}

.connection-state {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.connection-state::before {
  width: 5px;
  height: 5px;
  content: "";
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(104, 240, 178, 0.75);
}

.connection-state.offline::before {
  background: #ffca71;
  box-shadow: 0 0 8px rgba(255, 202, 113, 0.6);
}

.intro {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 21px 0 14px;
}

.intro #status-copy {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.3;
}

.app-count {
  flex: 0 0 auto;
  margin-bottom: 1px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: minmax(128px, 1fr);
  align-content: stretch;
  gap: 12px;
  min-height: 0;
  overflow: auto;
  scrollbar-width: none;
}

.app-grid::-webkit-scrollbar {
  display: none;
}

.app-card {
  --card-accent: #68f0b2;
  position: relative;
  display: grid;
  grid-template-columns: 42px 1fr auto;
  grid-template-rows: auto 1fr;
  gap: 12px 10px;
  min-width: 0;
  padding: 17px;
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(17, 39, 32, 0.9), rgba(8, 20, 16, 0.9));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.card-glow {
  position: absolute;
  width: 105px;
  height: 105px;
  top: -58px;
  right: -42px;
  border-radius: 999px;
  opacity: 0.18;
  background: var(--card-accent);
  filter: blur(22px);
  pointer-events: none;
}

.app-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  grid-row: 1 / span 2;
  flex: 0 0 auto;
  border: 1px solid color-mix(in srgb, var(--card-accent) 35%, transparent);
  border-radius: 13px;
  color: var(--card-accent);
  background: color-mix(in srgb, var(--card-accent) 11%, transparent);
}

.app-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.app-copy {
  display: grid;
  align-content: start;
  min-width: 0;
}

.app-title {
  overflow: hidden;
  font-size: 16px;
  font-weight: 690;
  letter-spacing: -0.025em;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-description {
  display: -webkit-box;
  margin-top: 7px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.launch-mark {
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
}

.app-card:hover,
.app-card:focus-visible,
.app-card.is-focused {
  outline: none;
  border-color: color-mix(in srgb, var(--card-accent) 78%, white 12%);
  background: linear-gradient(145deg, rgba(23, 54, 43, 0.98), rgba(9, 25, 19, 0.98));
  box-shadow:
    0 0 0 2px rgba(3, 8, 7, 0.9),
    0 0 0 4px color-mix(in srgb, var(--card-accent) 78%, white 12%),
    0 12px 28px rgba(0, 0, 0, 0.3);
  transform: translateY(-2px);
}

.app-card:focus-visible .launch-mark,
.app-card.is-focused .launch-mark {
  color: var(--card-accent);
}

.loading-card,
.empty-state {
  display: grid;
  grid-column: 1 / -1;
  place-items: center;
  align-content: center;
  gap: 12px;
  min-height: 180px;
  color: var(--muted);
  font-size: 13px;
  border: 1px dashed var(--line);
  border-radius: 18px;
}

.loading-card p,
.empty-state p {
  margin: 0;
}

.loading-pulse {
  width: 24px;
  height: 24px;
  border: 2px solid rgba(104, 240, 178, 0.2);
  border-top-color: var(--accent);
  border-radius: 999px;
  animation: spin 900ms linear infinite;
}

.hintbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-top: 15px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 640;
}

kbd {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  margin-right: 2px;
  padding: 0 5px;
  color: #d9f4e7;
  font-family: inherit;
  font-size: 9px;
  border: 1px solid rgba(206, 255, 235, 0.18);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
}

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

@media (max-width: 470px), (max-height: 470px) {
  .display-shell {
    padding: 18px 18px 15px;
  }

  .topbar {
    padding-bottom: 12px;
  }

  .intro {
    padding: 15px 0 11px;
  }

  .app-grid {
    grid-auto-rows: minmax(112px, 1fr);
    gap: 9px;
  }

  .app-card {
    grid-template-columns: 36px 1fr auto;
    padding: 13px;
    border-radius: 15px;
  }

  .app-icon {
    width: 36px;
    height: 36px;
  }

  .app-title {
    font-size: 14px;
  }

  .app-description {
    margin-top: 4px;
    font-size: 10px;
  }

  .hintbar {
    padding-top: 10px;
  }
}

@media (max-width: 360px) {
  .app-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
