:root {
  color-scheme: dark;
  --bg: #090b0f;
  --surface: #181b21;
  --surface-raised: #20242b;
  --line: #3a3d45;
  --line-strong: #5a5e68;
  --ink: #f7f7f8;
  --muted: #a9abb3;
  --accent: #ff7a45;
  --accent-hover: #ff8c5a;
  --danger: #ff7568;
  --success: #72d98b;
  --focus: #ffd6c2;
  --radius: 12px;
  --header-height: 72px;
  --z-fullscreen: 10;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.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;
}

.site-header {
  min-height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 12px clamp(16px, 3vw, 40px);
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 750;
  text-decoration: none;
  letter-spacing: -0.01em;
}

.brand-mark {
  display: block;
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.header-actions,
.demo-controls,
.form-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.account-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  min-width: 0;
  margin-right: 4px;
  font-size: 0.82rem;
  line-height: 1.35;
}

.account-copy strong {
  max-width: min(30vw, 320px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-label {
  color: var(--muted);
}

main {
  width: 100%;
}

.gate {
  width: min(1120px, 100%);
  min-height: calc(100dvh - var(--header-height));
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  align-items: center;
  gap: clamp(40px, 8vw, 112px);
  margin: 0 auto;
  padding: clamp(52px, 8vw, 112px) clamp(20px, 4vw, 48px);
}

.gate-panel {
  max-width: 680px;
}

.product-note,
.demo-kicker {
  margin: 0 0 14px;
  color: var(--accent);
  font-size: 0.84rem;
  font-weight: 750;
  letter-spacing: 0.01em;
}

h1,
h2,
p {
  text-wrap: pretty;
}

h1 {
  max-width: 13ch;
  margin: 0;
  font-size: clamp(2.5rem, 6vw, 5rem);
  line-height: 0.98;
  letter-spacing: -0.04em;
  text-wrap: balance;
}

h2 {
  margin: 0;
  font-size: 1.45rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.gate-summary {
  max-width: 62ch;
  margin: 28px 0 32px;
  color: var(--muted);
  font-size: 1.03rem;
  line-height: 1.7;
}

.gate-status {
  max-width: 560px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 18px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.status-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.status-copy strong {
  font-size: 0.96rem;
}

.status-copy span,
.privacy-note,
.admin-heading p,
.demo-intro p:last-child {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.gate-status[data-tone="error"] strong {
  color: var(--danger);
}

.gate-status[data-tone="success"] strong {
  color: var(--success);
}

.loading-lines {
  display: grid;
  gap: 8px;
}

.loading-lines span {
  width: 88%;
  height: 7px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--surface), var(--line), var(--surface));
  background-size: 220% 100%;
  animation: loading 1.2s linear infinite;
}

.loading-lines span:last-child {
  width: 58%;
}

@keyframes loading {
  to {
    background-position: -220% 0;
  }
}

.button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-weight: 720;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 180ms ease-out, border-color 180ms ease-out, color 180ms ease-out, transform 120ms ease-out;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:active:not(:disabled) {
  transform: translateY(0);
}

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

.button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.button-primary {
  background: var(--accent);
  color: #1a0e07;
}

.button-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.button-quiet {
  border-color: var(--line);
  background: transparent;
  color: var(--ink);
}

.button-quiet:hover:not(:disabled) {
  border-color: var(--line-strong);
  background: var(--surface);
}

.google-mark {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  background: #ffffff;
  color: #1a73e8;
  font-size: 0.78rem;
  font-weight: 850;
}

.privacy-note {
  max-width: 57ch;
  margin: 16px 0 0;
}

.preview-list {
  border-top: 1px solid var(--line);
}

.preview-list > div {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 14px;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}

.preview-dot {
  width: 9px;
  height: 9px;
  margin: 7px 0 0 3px;
  border-radius: 50%;
  background: var(--accent);
}

.preview-list p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.preview-list strong {
  display: block;
  margin-bottom: 3px;
  color: var(--ink);
}

.demo-shell {
  padding: 18px clamp(12px, 2.5vw, 34px) 28px;
}

.demo-toolbar {
  min-height: 76px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 14px;
}

.demo-kicker {
  margin-bottom: 4px;
}

.demo-controls {
  flex-wrap: wrap;
  flex-shrink: 0;
  max-width: 100%;
  justify-content: flex-end;
}

.demo-intro p:last-child {
  margin: 0;
}

.device-switcher,
.stage-switcher {
  display: flex;
  margin: 0;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.device-switcher label,
.stage-switcher label {
  position: relative;
  cursor: pointer;
}

.device-switcher input,
.stage-switcher input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.device-switcher span,
.stage-switcher span {
  min-height: 34px;
  display: grid;
  place-items: center;
  padding: 0 13px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 720;
}

.device-switcher input:checked + span,
.stage-switcher input:checked + span {
  background: var(--accent);
  color: #1a0e07;
}

.device-switcher input:focus-visible + span,
.stage-switcher input:focus-visible + span {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.demo-viewport {
  width: 100%;
  height: max(560px, calc(100dvh - 180px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #111318;
}

.frame-slot,
.frame-slot iframe {
  height: 100%;
}

.frame-slot iframe {
  display: block;
  width: 100%;
  border: 0;
  background: var(--bg);
}

.demo-viewport[data-device="mobile"] {
  max-width: 430px;
  height: auto;
  aspect-ratio: 9 / 20;
  margin-inline: auto;
}

.demo-viewport[data-device="mobile"] .frame-slot {
  width: 100%;
}

.demo-viewport[data-device="desktop"] .frame-slot {
  width: max(100%, 860px);
}

body.demo-fullscreen {
  overflow: hidden;
}

body.demo-fullscreen .site-header,
body.demo-fullscreen .admin-panel,
.demo-shell[data-fullscreen] .demo-toolbar {
  display: none;
}

.demo-shell[data-fullscreen] {
  position: fixed;
  inset: 0;
  z-index: var(--z-fullscreen);
  display: flex;
  flex-direction: column;
  padding: 0;
  background: var(--bg);
}

.fullscreen-bar {
  display: flex;
  flex-shrink: 0;
  justify-content: flex-end;
  padding: 7px max(12px, env(safe-area-inset-right)) 7px 12px;
}

.fullscreen-shortcut {
  color: var(--muted);
  font-size: 0.75rem;
}

.demo-shell[data-fullscreen] .demo-viewport {
  flex: 1;
  aspect-ratio: auto;
  min-height: 0;
  height: auto;
  max-width: none;
  margin: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
}

.demo-shell[data-fullscreen] .demo-viewport .frame-slot {
  width: 100%;
}

.access-navigation {
  width: min(980px, calc(100% - 32px));
  margin: 28px auto 0;
}

.admin-panel {
  width: min(980px, calc(100% - 32px));
  margin: 28px auto 64px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.admin-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 32px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.admin-heading .product-note {
  margin-bottom: 7px;
}

.admin-heading p {
  max-width: 46ch;
  margin: 0;
}

.allowlist-form {
  padding: 24px 0;
}

.allowlist-form label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.86rem;
  font-weight: 720;
}

.allowlist-form input {
  min-width: 0;
  min-height: 44px;
  flex: 1;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg);
  color: var(--ink);
}

.allowlist-form input::placeholder {
  color: #b8bac1;
}

.field-message {
  min-height: 1.35em;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.field-message[data-tone="error"] {
  color: var(--danger);
}

.field-message[data-tone="success"] {
  color: var(--success);
}

.allowlist-table-wrap {
  position: relative;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

th,
td {
  padding: 13px 10px;
  border-top: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 720;
}

td:last-child,
th:last-child {
  text-align: right;
}

.remove-access {
  min-height: 34px;
  padding-inline: 11px;
  color: var(--danger);
  font-size: 0.8rem;
}

.empty-state {
  margin: 0;
  padding: 26px 10px 8px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.88rem;
}

@media (max-width: 760px) {
  :root {
    --header-height: 64px;
  }

  .site-header {
    align-items: flex-start;
    padding: 12px;
  }

  .header-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .account-copy {
    width: 100%;
  }

  .account-copy strong {
    max-width: 58vw;
  }

  .header-actions .button {
    min-height: 36px;
    padding-inline: 10px;
    font-size: 0.8rem;
  }

  .gate {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 44px;
    padding-top: 58px;
    padding-bottom: 58px;
  }

  h1 {
    font-size: clamp(2.4rem, 13vw, 4rem);
  }

  .demo-toolbar,
  .admin-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .demo-controls {
    justify-content: space-between;
  }

  .demo-viewport {
    height: max(600px, calc(100dvh - 230px));
  }

  .access-navigation,
  .admin-panel {
    width: calc(100% - 24px);
  }

  .admin-panel {
    padding: 20px 16px;
  }
}

@media (max-width: 480px) {
  .brand > span:last-child,
  .account-label {
    display: none;
  }

  .header-actions {
    gap: 6px;
  }

  .account-copy strong {
    max-width: 190px;
    font-size: 0.78rem;
  }

  .gate {
    padding-inline: 16px;
  }

  .demo-shell {
    padding-inline: 8px;
  }

  .demo-controls,
  .form-row {
    align-items: stretch;
    flex-direction: column;
  }

  .device-switcher,
  .stage-switcher {
    align-self: stretch;
  }

  .device-switcher label,
  .stage-switcher label {
    flex: 1;
  }

  .allowlist-form .button {
    width: 100%;
  }
}

@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;
  }
}
