:root {
  --indigo: #1b2fa8;
  --indigo-bright: #5b74ff;
  --bg: #eef1fb;
  --ink: #12162a;
  --steel: #8992a6;
  --wood: #b9762f;
  --card: #ffffff;
  --line: color-mix(in srgb, var(--steel) 42%, white);
  --shadow: 0 14px 32px rgba(18, 22, 42, 0.08);
  --safe: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0e16;
    --ink: #eef1fb;
    --indigo: #5b74ff;
    --card: #151826;
    --line: #2a3148;
    --shadow: 0 14px 32px rgba(0, 0, 0, 0.35);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: Manrope, sans-serif;
  background:
    radial-gradient(900px 420px at 8% -8%, color-mix(in srgb, var(--indigo) 16%, transparent), transparent 60%),
    radial-gradient(700px 360px at 110% 0%, color-mix(in srgb, var(--wood) 14%, transparent), transparent 55%),
    var(--bg);
  color: var(--ink);
}
a { color: var(--indigo); }
.page {
  width: min(1180px, calc(100% - 24px));
  margin: 0 auto;
  padding: 20px 0 calc(56px + var(--safe));
}

.hero { display: flex; flex-direction: column; gap: 12px; margin-bottom: 22px; }
.hero-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.badge {
  margin: 0;
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--steel);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.whale { width: 40px; height: 26px; color: var(--indigo); flex: 0 0 auto; }
.whale img { width: 100%; height: 100%; display: block; }
h1 {
  font-family: Unbounded, sans-serif;
  font-weight: 800;
  font-size: clamp(1.85rem, 7vw, 3.3rem);
  line-height: 1.05;
  margin: 0;
  max-width: 14ch;
}
.route {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  margin: 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  color: var(--steel);
}
.route .dot { opacity: 0.5; }
.pitch { margin: 0; max-width: 62ch; font-size: 16px; line-height: 1.45; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
}
.toggle {
  display: inline-flex;
  padding: 4px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--card) 80%, var(--line));
  border: 1px solid var(--line);
}
.toggle button {
  border: 0;
  background: transparent;
  color: var(--steel);
  font: inherit;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
}
.toggle button.on { background: var(--indigo); color: #fff; }
.count { margin: 0; color: var(--steel); font-family: "IBM Plex Mono", monospace; font-size: 12px; }

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

.card, .add-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 16px 12px 14px;
  min-height: 248px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 7px;
  color: inherit;
}
.card { cursor: pointer; }
.card:hover, .add-card:hover { border-color: var(--indigo); }

.photo {
  width: 104px;
  height: 104px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid color-mix(in srgb, var(--wood) 55%, var(--line));
  background: #d9deef;
}
.photo.bike { border-radius: 22px; }
.initials {
  width: 104px;
  height: 104px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: Unbounded, sans-serif;
  font-size: 30px;
  color: white;
  border: 3px solid color-mix(in srgb, var(--wood) 55%, var(--line));
}
.initials.bike { border-radius: 22px; font-size: 22px; }
.name { font-weight: 700; font-size: 15px; line-height: 1.25; }
.handle {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  color: var(--steel);
  word-break: break-all;
}
.bio {
  font-size: 13px;
  line-height: 1.35;
  color: color-mix(in srgb, var(--ink) 78%, var(--steel));
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.invite { color: var(--indigo); font-size: 13px; font-weight: 600; }
.stickers {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  min-height: 28px;
}
.stickers span, .sticker-add {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 70%, var(--line));
  font-size: 15px;
}
.sticker-add {
  border: 1px dashed var(--steel);
  background: transparent;
  cursor: pointer;
  color: var(--steel);
}

.add-card {
  border-style: dashed;
  background: transparent;
  justify-content: center;
  color: var(--indigo);
  font-family: Unbounded, sans-serif;
  font-size: 15px;
  cursor: pointer;
}
.add-plus { font-size: 34px; line-height: 1; }

.modal, .sheet {
  border: none;
  border-radius: 24px;
  width: min(520px, calc(100% - 20px));
  padding: 0;
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow);
}
.modal::backdrop, .sheet::backdrop { background: rgba(12, 14, 22, 0.55); }
.modal form, .sheet { display: flex; flex-direction: column; gap: 12px; padding: 20px; }
.modal h2, .sheet-title { font-family: Unbounded, sans-serif; margin: 0; font-size: 22px; }
.modal-hint { margin: 0; color: var(--steel); font-size: 14px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }
input, textarea {
  font: inherit;
  font-weight: 400;
  font-size: 16px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
}
.hp { position: absolute; left: -9999px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn {
  border: 0;
  border-radius: 999px;
  padding: 11px 16px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.btn.primary { background: var(--indigo); color: white; }
.btn.ghost { background: transparent; color: var(--steel); }
.form-error { color: #b42318; margin: 0; font-size: 13px; }
.sticker-pack { display: flex; flex-wrap: wrap; gap: 8px; }
.sticker-pack button {
  width: 48px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--bg);
  font-size: 24px;
  cursor: pointer;
}

@media (max-width: 640px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .page { width: min(1180px, calc(100% - 16px)); padding-top: 14px; }
  .photo, .initials { width: 84px; height: 84px; }
  .card, .add-card { min-height: 228px; padding: 12px 10px; border-radius: 18px; }
  .pitch { font-size: 15px; }
}
