:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-subtle: #f8fafc;
  --text: #111827;
  --muted: #64748b;
  --muted-strong: #475569;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --primary: #171923;
  --primary-hover: #272a36;
  --accent: #5b5bd6;
  --accent-soft: #eeeeff;
  --danger: #c2414b;
  --success: #13795b;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --shadow-card: 0 18px 50px rgba(15, 23, 42, 0.08);
  --shadow-qr: 0 22px 65px rgba(15, 23, 42, 0.13);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100svh;
  overflow-x: hidden;
  background:
    linear-gradient(rgba(255, 255, 255, 0.62), rgba(245, 247, 251, 0.92)),
    var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

svg {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.page-glow {
  position: fixed;
  z-index: -1;
  width: 24rem;
  height: 24rem;
  border-radius: 999px;
  filter: blur(90px);
  opacity: 0.2;
  pointer-events: none;
}

.page-glow-one {
  top: -13rem;
  left: -11rem;
  background: #8b8cf8;
}

.page-glow-two {
  right: -12rem;
  bottom: -14rem;
  background: #72d6bf;
}

.app-shell {
  width: min(100%, 34rem);
  margin: 0 auto;
  padding:
    max(1rem, env(safe-area-inset-top))
    1.1rem
    calc(2rem + env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 3rem;
  margin-bottom: 2.25rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  border-radius: 0.8rem;
}

.brand-mark {
  display: grid;
  width: 2.4rem;
  height: 2.4rem;
  place-items: center;
  border-radius: 0.72rem;
  background: var(--primary);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  box-shadow: 0 7px 18px rgba(23, 25, 35, 0.18);
}

.brand > span:last-child {
  display: grid;
  gap: 0.08rem;
}

.brand strong {
  font-size: 0.9rem;
  letter-spacing: -0.01em;
}

.brand small {
  color: var(--muted);
  font-size: 0.72rem;
}

.text-button {
  display: inline-flex;
  min-height: 2.75rem;
  align-items: center;
  gap: 0.45rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 0.85rem;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted-strong);
  font-weight: 650;
  transition:
    transform 140ms var(--ease-out),
    border-color 160ms ease,
    background-color 160ms ease;
}

.text-button svg {
  width: 1rem;
  height: 1rem;
}

.view {
  display: grid;
  gap: 1.5rem;
}

.intro {
  display: grid;
  gap: 0.75rem;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.intro h1 {
  max-width: none;
  margin: 0;
  font-size: clamp(2.25rem, 10vw, 3.6rem);
  font-weight: 760;
  letter-spacing: -0.055em;
  line-height: 0.98;
}

.intro > p:last-child {
  max-width: 35rem;
  margin: 0;
  color: var(--muted-strong);
  font-size: 1.02rem;
  line-height: 1.6;
}

.setup-card {
  display: grid;
  gap: 1rem;
  padding: 1.1rem;
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 1.4rem;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(16px);
}

.field-group {
  display: grid;
  gap: 0.55rem;
}

.field-group label {
  display: flex;
  align-items: center;
  gap: 0.72rem;
}

.field-group label > span:last-child {
  display: grid;
  gap: 0.1rem;
}

.field-group label strong {
  font-size: 0.9rem;
}

.field-group label small {
  color: var(--muted);
  font-size: 0.76rem;
}

.platform-mark {
  display: grid;
  flex: 0 0 auto;
  width: 2.25rem;
  height: 2.25rem;
  place-items: center;
  border-radius: 0.7rem;
  font-size: 0.83rem;
  font-weight: 800;
}

.platform-mark-x {
  background: #111111;
  color: #ffffff;
}

.platform-mark-linkedin {
  background: #0a66c2;
  color: #ffffff;
  font-family: Arial, sans-serif;
}

.platform-mark-web {
  background: #eeeefe;
  color: #4e4eb7;
}

.platform-mark-web svg {
  width: 1.15rem;
  height: 1.15rem;
}

.field-group input {
  width: 100%;
  min-height: 3.45rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  outline: none;
  background: var(--surface-subtle);
  color: var(--text);
  font-size: 1rem;
  transition:
    border-color 160ms ease,
    background-color 160ms ease,
    box-shadow 160ms ease;
}

.field-group input::placeholder {
  color: #94a3b8;
}

.field-group input:focus {
  border-color: var(--accent);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(91, 91, 214, 0.12);
}

.field-group input[aria-invalid="true"] {
  border-color: var(--danger);
  background: #fffafa;
}

.field-error {
  min-height: 1rem;
  margin: -0.15rem 0 0 0.15rem;
  color: var(--danger);
  font-size: 0.78rem;
  line-height: 1.25;
}

.privacy-note {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.8rem;
  border-radius: 0.85rem;
  background: #f4f5ff;
  color: var(--muted-strong);
  font-size: 0.78rem;
  line-height: 1.45;
}

.privacy-note svg {
  flex: 0 0 auto;
  width: 1rem;
  height: 1rem;
  margin-top: 0.08rem;
  color: var(--accent);
}

.danger-button {
  min-height: 2.75rem;
  padding: 0.65rem 0.8rem;
  border: 0;
  border-radius: 0.8rem;
  background: transparent;
  color: var(--danger);
  font-size: 0.8rem;
  font-weight: 700;
  transition:
    transform 140ms var(--ease-out),
    background-color 160ms ease;
}

.danger-button.is-armed {
  background: #fff1f2;
}

.form-actions,
.share-actions {
  display: grid;
  gap: 0.7rem;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  min-height: 3.35rem;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.85rem 1rem;
  border-radius: 0.95rem;
  font-weight: 700;
  transition:
    transform 140ms var(--ease-out),
    background-color 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    box-shadow 160ms ease;
}

.primary-button {
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 10px 24px rgba(23, 25, 35, 0.16);
}

.primary-button svg {
  width: 1.15rem;
  height: 1.15rem;
}

.secondary-button {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.82);
  color: var(--muted-strong);
}

.share-view {
  gap: 1.1rem;
}

.share-intro {
  gap: 0.55rem;
}

.share-intro h1 {
  max-width: 12ch;
  font-size: clamp(2rem, 8vw, 3.1rem);
}

.share-intro > p:last-child {
  font-size: 0.94rem;
  line-height: 1.5;
}

.platform-switcher {
  display: flex;
  gap: 0.55rem;
  overflow-x: auto;
  padding: 0.15rem 0.05rem 0.4rem;
  scrollbar-width: none;
}

.platform-switcher::-webkit-scrollbar {
  display: none;
}

.platform-button {
  display: inline-flex;
  min-height: 2.85rem;
  flex: 1 0 auto;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.7rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted-strong);
  font-weight: 700;
  white-space: nowrap;
  transition:
    transform 140ms var(--ease-out),
    background-color 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    box-shadow 160ms ease;
}

.platform-button .tab-mark {
  display: grid;
  width: 1.35rem;
  height: 1.35rem;
  place-items: center;
  border-radius: 0.4rem;
  background: var(--border);
  color: var(--muted-strong);
  font-size: 0.62rem;
  font-weight: 850;
}

.platform-button[aria-selected="true"] {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 7px 18px rgba(23, 25, 35, 0.16);
}

.platform-button[aria-selected="true"] .tab-mark {
  background: rgba(255, 255, 255, 0.17);
  color: #ffffff;
}

.qr-stage {
  display: grid;
  gap: 0.85rem;
  margin: 0;
  padding: 0.9rem;
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 1.55rem;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow-qr);
  backdrop-filter: blur(16px);
}

.qr-surface {
  display: grid;
  width: 100%;
  aspect-ratio: 1;
  place-items: center;
  overflow: hidden;
  padding: 0;
  border: 0;
  border-radius: 1.1rem;
  background: #ffffff;
  color: inherit;
  cursor: zoom-in;
}

.qr-code {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
}

.qr-code img,
.presentation-qr img {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
}

.qr-error {
  max-width: 16rem;
  margin: auto;
  padding: 1rem;
  color: var(--danger);
  text-align: center;
  line-height: 1.5;
}

.qr-stage figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 2rem;
  padding: 0 0.2rem 0.1rem;
}

.selected-platform {
  font-weight: 750;
}

.selected-value {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.86rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.present-button {
  min-height: 3.65rem;
}

.secondary-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.secondary-actions .secondary-button svg {
  width: 1rem;
  height: 1rem;
}

.local-note {
  margin: 0.1rem auto 0;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.45;
  text-align: center;
}

.presentation-view {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  min-height: 100svh;
  place-items: center;
  overflow: auto;
  padding:
    calc(4.5rem + env(safe-area-inset-top))
    1.2rem
    calc(2rem + env(safe-area-inset-bottom));
  background: #ffffff;
}

.presentation-content {
  display: grid;
  width: min(100%, 38rem);
  gap: clamp(1.5rem, 5vh, 3rem);
  text-align: center;
}

.presentation-qr {
  display: grid;
  width: min(78vw, 31rem);
  aspect-ratio: 1;
  margin: auto;
  place-items: center;
  background: #ffffff;
}

.presentation-kicker {
  margin: 0 0 0.5rem;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.presentation-content h2 {
  margin: 0;
  font-size: clamp(2rem, 8vw, 3.4rem);
  letter-spacing: -0.04em;
}

.presentation-content > div:last-child > p:last-child {
  margin: 0.65rem 0 0;
  color: var(--muted-strong);
}

.close-button {
  position: fixed;
  top: max(1rem, env(safe-area-inset-top));
  right: 1rem;
  display: grid;
  width: 3rem;
  height: 3rem;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #f8fafc;
  color: var(--text);
  transition:
    transform 140ms var(--ease-out),
    background-color 160ms ease;
}

.close-button svg {
  width: 1.2rem;
  height: 1.2rem;
}

.status-message {
  position: fixed;
  z-index: 30;
  right: 1rem;
  bottom: calc(1rem + env(safe-area-inset-bottom));
  left: 1rem;
  width: fit-content;
  max-width: min(30rem, calc(100% - 2rem));
  margin: 0 auto;
  padding: 0.8rem 1rem;
  border: 1px solid #d7dbe5;
  border-radius: 0.85rem;
  background: #171923;
  box-shadow: 0 12px 36px rgba(15, 23, 42, 0.22);
  color: #ffffff;
  font-size: 0.86rem;
  line-height: 1.4;
  text-align: center;
  pointer-events: none;
}

.status-message.is-error {
  background: #8f2430;
}

.status-message.is-success {
  background: #0d684f;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(91, 91, 214, 0.35);
  outline-offset: 3px;
}

.primary-button:active,
.secondary-button:active,
.text-button:active,
.platform-button:active,
.close-button:active,
.danger-button:active {
  transform: scale(0.97);
}

@media (hover: hover) and (pointer: fine) {
  .primary-button:hover {
    background: var(--primary-hover);
  }

  .secondary-button:hover,
  .text-button:hover,
  .platform-button:hover {
    border-color: var(--border-strong);
    background: #ffffff;
  }

  .platform-button[aria-selected="true"]:hover {
    border-color: var(--primary);
    background: var(--primary-hover);
  }

  .close-button:hover {
    background: #eef2f7;
  }

  .danger-button:hover {
    background: #fff1f2;
  }
}

@media (min-width: 40rem) {
  .app-shell {
    padding-right: 1.5rem;
    padding-left: 1.5rem;
  }

  .topbar {
    margin-bottom: 3.5rem;
  }

  .setup-view .intro h1 {
    max-width: 11ch;
  }

  .setup-card,
  .qr-stage {
    padding: 1.25rem;
  }

  .form-actions.has-cancel {
    grid-template-columns: 1.4fr 1fr;
  }
}

@media (max-height: 46rem) {
  .topbar {
    margin-bottom: 1.5rem;
  }

  .share-intro > p:last-child,
  .local-note {
    display: none;
  }

  .share-view {
    gap: 0.8rem;
  }

  .qr-stage {
    width: min(100%, 25rem);
    justify-self: center;
  }
}

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