:root {
  --bg0: #0e1116;
  --bg1: #161b22;
  --ink: #e8edf5;
  --muted: #8b97a8;
  --line: rgba(255, 255, 255, 0.08);
  --accent: #6ea8ff;
  --accent-ink: #061018;
  --tile: rgba(255, 255, 255, 0.04);
  --radius: 22px;
  --font: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(110, 168, 255, 0.16), transparent 55%),
    radial-gradient(900px 500px at 90% 0%, rgba(90, 210, 180, 0.08), transparent 50%),
    linear-gradient(180deg, #12161d 0%, var(--bg0) 40%, #0b0d11 100%);
  background-attachment: fixed;
}

a { color: inherit; text-decoration: none; }
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 28px 24px 8px;
  max-width: 960px;
  margin: 0 auto;
}
.top h1 { margin: 0; font-size: 1.6rem; letter-spacing: -0.02em; font-weight: 650; }
.sub, .meta, .hint, .lede, .eyebrow, .notes, .empty {
  color: var(--muted);
}
.sub { margin: 4px 0 0; font-size: 0.95rem; }

.grid {
  max-width: 960px;
  margin: 0 auto;
  padding: 20px 24px 48px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 22px 18px;
}

.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 14px 10px 16px;
  border-radius: 18px;
  background: transparent;
  transition: transform 180ms ease, background 180ms ease;
  position: relative;
}
.tile:hover, .tile:focus-within {
  background: var(--tile);
  transform: translateY(-2px);
}
.icon-wrap {
  position: relative;
  width: 84px;
  height: 84px;
  flex: none;
}
.icon-hit { display: block; width: 84px; height: 84px; }
.tile img {
  width: 84px;
  height: 84px;
  border-radius: var(--radius);
  object-fit: cover;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  background: var(--bg1);
}
.remove {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  z-index: 2;
  display: grid;
  place-items: center;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  touch-action: manipulation;
}
.remove-mark {
  display: block;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #3d434c;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
  position: relative;
}
.remove-mark::before,
.remove-mark::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 2px;
  background: #e8edf5;
  border-radius: 1px;
}
.remove-mark::before { transform: translate(-50%, -50%) rotate(45deg); }
.remove-mark::after { transform: translate(-50%, -50%) rotate(-45deg); }
.remove:hover .remove-mark,
.remove:focus-visible .remove-mark { background: #5a616c; }

.caption {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 100%;
  min-width: 0;
}
.tile .name {
  font-size: 0.92rem;
  text-align: center;
  line-height: 1.25;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tile .meta,
.tile time {
  font-size: 0.78rem;
  text-align: center;
  color: var(--muted);
  line-height: 1.2;
}
.tile time {
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 8px 10px 16px;
  border-radius: 14px;
  background: #1c222b;
  color: var(--ink);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  max-width: calc(100% - 32px);
}
.toast[hidden] { display: none; }
.toast .undo {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 650;
  min-height: 36px;
  padding: 0 12px;
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}
.toast .undo:hover,
.toast .undo:focus-visible { filter: brightness(1.15); }

.detail {
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 24px 64px;
  text-align: center;
}
.detail .hero {
  width: 120px;
  height: 120px;
  border-radius: 28px;
  object-fit: cover;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
  background: var(--bg1);
}
.detail h1 { margin: 18px 0 8px; font-size: 1.75rem; letter-spacing: -0.03em; }
.actions { margin: 28px 0 12px; }
.notes { white-space: pre-wrap; line-height: 1.45; }
.hint { font-size: 0.9rem; line-height: 1.45; margin-top: 18px; }

.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 22px;
  border-radius: 999px;
  background: linear-gradient(180deg, #8bbcff, var(--accent));
  color: var(--accent-ink);
  font-weight: 650;
  letter-spacing: 0.01em;
  box-shadow: 0 8px 24px rgba(110, 168, 255, 0.28);
}
.primary:hover { filter: brightness(1.05); }

.ghost {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 12px;
  color: var(--muted);
  border-radius: 10px;
}
.ghost:hover { color: var(--ink); background: var(--tile); }

.landing {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 32px;
}
.landing main { max-width: 420px; text-align: left; }
.landing .eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  margin: 0 0 12px;
}
.landing h1 {
  margin: 0;
  font-size: clamp(2.4rem, 8vw, 3.4rem);
  letter-spacing: -0.04em;
  font-weight: 700;
}
.landing .lede {
  margin: 16px 0 28px;
  font-size: 1.1rem;
  line-height: 1.5;
}

.empty { grid-column: 1 / -1; padding: 40px 8px; text-align: center; }

@media (prefers-reduced-motion: reduce) {
  .tile { transition: none; }
}

.automatic { max-width: 720px; margin: 0 auto; padding: 24px 24px 64px; line-height: 1.6; }
.automatic section { margin-bottom: 48px; }
.automatic h2 { font-size: 1.25rem; margin: 0 0 16px; }
.automatic p { margin: 16px 0; }
.automatic button { font: inherit; border: 0; cursor: pointer; }
.automatic label, .automatic input { display: block; margin-bottom: 16px; max-width: 100%; }
.automatic input { font: inherit; }
.setup-steps { padding-left: 24px; }
.setup-steps li { padding-left: 8px; margin: 24px 0 32px; }
.device-list, .delivery-list { list-style: none; padding: 0; }
.device-list li, .delivery-list li { padding: 16px 0; border-bottom: 1px solid var(--line); }
.device-list span, .delivery-list span { display: block; }
.delivery-list p { color: var(--muted); margin: 4px 0 0; }
.top nav { display: flex; flex-wrap: wrap; justify-content: flex-end; }
