:root {
  color-scheme: dark;
  --canvas: #000000;
  --surface: #1c1c1e;
  --ink: #f5f5f7;
  --muted: #86868b;
  --line: rgba(255, 255, 255, 0.12);
  --blue: #0a84ff;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.47;
  -webkit-font-smoothing: antialiased;
}

button, input, a { font-family: inherit; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 48px 20px;
}

.gate-card {
  width: min(440px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 48px 40px 36px;
}

.gate-card h1 {
  margin: 0;
  font-size: 40px;
  font-weight: 650;
  letter-spacing: -0.03em;
}

.lede {
  margin: 10px 0 28px;
  color: var(--muted);
  font-size: 17px;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

input[type="password"],
.search input {
  width: 100%;
  margin-top: 8px;
  border: 1px solid var(--line);
  background: #000;
  color: var(--ink);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 17px;
}

input[type="password"]:focus,
.search input:focus {
  border-color: var(--blue);
}

.error {
  margin: 12px 0 0;
  color: #ff453a;
  font-size: 14px;
}

.continue, .download, .launch, .unavailable {
  border: 0;
  border-radius: 980px;
  min-height: 36px;
  padding: 8px 18px;
  font-size: 15px;
  font-weight: 590;
  letter-spacing: -0.01em;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.continue {
  margin-top: 22px;
  width: 100%;
  min-height: 48px;
  background: #fff;
  color: #000;
  cursor: pointer;
}

.continue:hover, .download:hover, .launch:hover { background: #e8e8ed; }

.top {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 14px 32px 16px;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}

.bar {
  display: flex;
  align-items: center;
  gap: 20px;
  min-width: 0;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  min-width: 0;
  max-width: 100%;
}

.chip {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--line);
  background: transparent;
  color: #fff;
  border-radius: 980px;
  margin: 0;
  padding: 6px 14px;
  min-height: 32px;
  font-size: 14px;
  font-weight: 590;
  letter-spacing: -0.01em;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}

.chip:hover { background: rgba(255, 255, 255, 0.08); }

.chip.is-selected {
  background: #fff;
  color: #000;
  border-color: #fff;
}

.chip.is-selected:hover { background: #e8e8ed; }

.wordmark {
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.03em;
  text-decoration: none;
  color: var(--ink);
  white-space: nowrap;
}

.search { flex: 1; max-width: 560px; }

.search input { margin-top: 0; height: 40px; border-radius: 12px; background: #1c1c1e; }

.logout { margin-left: auto; }

.quiet {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  padding: 8px 4px;
}

.quiet:hover { color: var(--ink); }

.page {
  width: min(1120px, calc(100% - 64px));
  margin: 0 auto;
  padding: 56px 0 96px;
}

.intro h1 {
  margin: 0;
  font-size: 56px;
  font-weight: 650;
  letter-spacing: -0.035em;
  line-height: 1.05;
}

.intro p {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 21px;
  letter-spacing: -0.015em;
}

.shelf { margin-top: 56px; }

.shelf h2 {
  margin: 0 0 18px;
  font-size: 28px;
  font-weight: 650;
  letter-spacing: -0.025em;
}

.grid { display: grid; gap: 18px; }

.card[hidden],
.shelf[hidden] { display: none !important; }

.card {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 20px 22px;
}

.mark, .tile {
  width: 68px;
  height: 68px;
  border-radius: 18px;
  display: block;
}

.tile {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.copy h3 {
  margin: 0;
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.summary {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.facts span + span::before {
  content: "";
  display: inline-block;
  width: 3px;
  height: 3px;
  margin-right: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.28);
  transform: translateY(-2px);
}

.note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.action {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.download, .launch {
  background: #fff;
  color: #000;
  cursor: pointer;
}

.unavailable {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}

.empty {
  margin-top: 36px;
  color: var(--muted);
  font-size: 19px;
}

@media (max-width: 720px) {
  .top { padding: 12px 16px; gap: 10px; }
  .bar { gap: 10px; flex-wrap: wrap; }
  .search { order: 3; flex: 1 1 100%; max-width: none; }
  .chip { padding: 6px 12px; }
  .page { width: min(1120px, calc(100% - 32px)); padding: 32px 0 72px; }
  .intro h1 { font-size: 40px; }
  .intro p { font-size: 17px; }
  .shelf { margin-top: 40px; }
  .card {
    grid-template-columns: 64px minmax(0, 1fr);
    align-items: start;
    padding: 16px;
    gap: 14px;
  }
  .mark, .tile { width: 64px; height: 64px; border-radius: 16px; }
  .action { grid-column: 1 / -1; }
  .download, .launch, .unavailable { width: 100%; min-height: 44px; }
  .gate-card { padding: 36px 22px 28px; }
  .gate-card h1 { font-size: 34px; }
}

.tools {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}

.logout { margin-left: 0; }

.gear {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: transparent;
  color: #fff;
  cursor: pointer;
}

.gear svg { display: block; }

.gear:hover, .row-btn:hover, .text-btn:hover { background: rgba(255, 255, 255, 0.08); }

.field,
select.field {
  width: 100%;
  margin-top: 8px;
  border: 1px solid var(--line);
  background: #000;
  color: var(--ink);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 17px;
  font-family: inherit;
}

select.field { appearance: none; }

input[type="color"].field {
  width: 72px;
  height: 44px;
  padding: 6px;
}

.field:focus,
select.field:focus { border-color: var(--blue); }

dialog.sheet {
  margin: auto;
  padding: 0;
  width: min(640px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  overflow: auto;
  overscroll-behavior: contain;
  background: #1c1c1e;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 22px;
}

dialog.sheet::backdrop { background: rgba(0, 0, 0, 0.72); }

.sheet-bar {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 12px;
  background: #1c1c1e;
}

.sheet-bar h2 {
  margin: 0;
  font-size: 28px;
  font-weight: 650;
  letter-spacing: -0.03em;
}

.sheet-body { padding: 0 18px 22px; }

.block {
  margin-top: 14px;
  padding: 16px;
  background: #000;
  border: 1px solid var(--line);
  border-radius: 18px;
}

.block h3 {
  margin: 0 0 12px;
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.hint, .confirm-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.ok {
  margin: 8px 0 0;
  color: #32d74b;
  font-size: 14px;
}

.checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.checks label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 6px 10px;
  color: #fff;
  background: #000;
  border: 1px solid var(--line);
  border-radius: 980px;
  font-size: 13px;
  font-weight: 590;
}

.primary, .row-btn, .text-btn {
  border-radius: 980px;
  font-weight: 590;
  letter-spacing: -0.01em;
  cursor: pointer;
}

.primary {
  margin-top: 14px;
  border: 0;
  min-height: 44px;
  padding: 8px 18px;
  background: #fff;
  color: #000;
  font-size: 15px;
}

.primary:hover { background: #e8e8ed; }

.settings-list {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
}

.settings-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}

.settings-row .name {
  flex: 1 1 140px;
  min-width: 0;
  font-size: 15px;
  font-weight: 650;
}

.settings-row input.field {
  width: auto;
  flex: 1 1 140px;
  margin-top: 0;
  min-height: 36px;
  padding: 8px 10px;
  font-size: 15px;
}

.handle {
  width: 28px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  cursor: grab;
  user-select: none;
}

.row-btn, .text-btn {
  min-height: 36px;
  border: 1px solid var(--line);
  background: transparent;
  color: #fff;
  padding: 6px 10px;
  font-size: 13px;
}

.row-btn:disabled { opacity: 0.35; cursor: default; }

.danger { color: #ff453a; }

.icon-preview {
  width: 40px;
  height: 40px;
  margin-top: 8px;
  border-radius: 10px;
}

.icon-preview img,
.icon-preview .swatch {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: block;
}

.icon-preview .swatch { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14); }

@media (max-width: 720px) {
  .quiet { min-height: 44px; padding: 8px 10px; }
  .gear { width: 44px; height: 44px; }
  .row-btn, .text-btn { min-height: 44px; }
  .primary { width: 100%; }
  dialog.sheet {
    width: calc(100vw - 12px);
    max-height: calc(100vh - 12px);
    border-radius: 18px;
  }
}
