:root {
  --bg: #f2f2f7;
  --ink: #1c1c1e;
  --secondary: #636366;
  --separator: rgba(60, 60, 67, 0.18);
  --fill: rgba(120, 120, 128, 0.12);
  --fill-press: rgba(120, 120, 128, 0.22);
  --blue: #007aff;
  --blue-press: #0066d6;
  --ok: #34c759;
  --glass-heavy: rgba(255, 255, 255, 0.92);
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
  --radius-group: 12px;
  --font: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "SF Pro Display", "PingFang SC", "Helvetica Neue", sans-serif;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --spring: 380ms var(--ease-out);
  font: 100% / 1.47 var(--font);
  color: var(--ink);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  background: var(--bg);
}

.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(900px 520px at 18% -10%, rgba(0, 122, 255, 0.16), transparent 58%),
    radial-gradient(640px 380px at 100% 8%, rgba(52, 199, 89, 0.1), transparent 50%),
    var(--bg);
}

.stage {
  width: min(100%, 440px);
  margin: 0 auto;
  padding:
    max(32px, min(10vh, 96px))
    max(16px, env(safe-area-inset-right, 0px))
    calc(48px + env(safe-area-inset-bottom, 0px))
    max(16px, env(safe-area-inset-left, 0px));
}

.hidden {
  display: none !important;
}

.large-title h1 {
  margin: 0;
  font-size: clamp(1.5rem, 5.5vw + 0.4rem, 2.25rem);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}

.subtitle {
  margin: 8px 0 0;
  color: var(--secondary);
  font-size: clamp(0.875rem, 2.8vw + 0.4rem, 0.9375rem);
  line-height: 1.4;
  max-width: 36em;
}

.group-header {
  margin: 22px 4px 8px;
  padding: 0 12px;
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--secondary);
}

.group-footer {
  margin: 8px 4px 0;
  padding: 0 12px;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--secondary);
}

.group-body,
.status-card,
.link-box {
  background: var(--glass-heavy);
  border-radius: var(--radius-group);
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.55);
}

.group-body {
  overflow: hidden;
}

.materialize {
  animation: materialize var(--spring) both;
}

@keyframes materialize {
  from {
    opacity: 0;
    transform: scale(0.98) translateY(6px);
    filter: blur(6px);
  }
  to {
    opacity: 1;
    transform: none;
    filter: none;
  }
}

.cell {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 0 14px;
}

.cell.stack {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  padding: 12px 14px 14px;
}

.cell-label {
  font-size: 0.8125rem;
  color: var(--secondary);
  letter-spacing: 0.01em;
}

.cell-value {
  flex: 1;
  text-align: right;
  font-size: 0.9375rem;
  font-weight: 560;
  letter-spacing: -0.01em;
  word-break: break-all;
}

.cell-input {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.9375rem;
  outline: none;
  width: 100%;
  padding: 4px 0;
}

.cell-input.left {
  text-align: left;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.875rem;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
  padding: 0 4px;
}

.action-row .btn.primary {
  flex: 1 1 100%;
  width: 100%;
}

a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  text-align: center;
  box-sizing: border-box;
}

.email-actions {
  margin-top: 10px;
}

.email-actions .btn,
.email-actions .btn.primary {
  flex: 1 1 calc(50% - 5px);
  width: auto;
}

.btn {
  appearance: none;
  border: 0;
  border-radius: 980px;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  padding: 12px 18px;
  min-height: 44px;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 100ms ease-out, background 120ms ease, opacity 120ms ease;
}

.btn.primary {
  background: var(--blue);
  color: #fff;
}

.btn.primary:active,
.btn.primary.is-pressed {
  background: var(--blue-press);
}

.btn.secondary {
  background: var(--fill);
  color: var(--ink);
}

.btn.secondary:active,
.btn.secondary.is-pressed {
  background: var(--fill-press);
}

.btn.ghost {
  background: transparent;
  color: var(--blue);
  padding: 11px 12px;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pressable.is-pressed {
  transform: scale(0.97);
}

.status-card {
  margin-top: 18px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.status-card strong {
  display: block;
  font-size: 0.9375rem;
  letter-spacing: -0.01em;
}

.status-card p {
  margin: 4px 0 0;
  font-size: 0.8125rem;
  color: var(--secondary);
}

.status-card.is-ok strong {
  color: var(--ok);
}

.pulse {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 0 0 rgba(0, 122, 255, 0.45);
  animation: pulse 1.6s var(--ease-out) infinite;
  flex: 0 0 auto;
}

.status-card.is-ok .pulse {
  background: var(--ok);
  box-shadow: none;
  animation: none;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(0, 122, 255, 0.45);
  }
  70% {
    box-shadow: 0 0 0 12px rgba(0, 122, 255, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(0, 122, 255, 0);
  }
}

.link-box {
  margin-top: 18px;
  padding: 8px 14px 14px;
}

.magic {
  display: block;
  margin: 4px 0 8px;
  color: var(--blue);
  font-size: 0.8125rem;
  line-height: 1.4;
  word-break: break-all;
  text-decoration: none;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  z-index: 30;
  transform: translate3d(-50%, 16px, 0) scale(0.98);
  padding: 10px 16px;
  border-radius: 980px;
  background: rgba(28, 28, 30, 0.92);
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 560;
  opacity: 0;
  pointer-events: none;
  transition: opacity 280ms var(--ease-out), transform 280ms var(--ease-out);
}

.toast.show {
  opacity: 1;
  transform: translate3d(-50%, 0, 0) scale(1);
}

.turnstile-wrap {
  margin: 4px 0 8px;
  padding: 12px 14px;
  background: var(--glass-heavy);
  border-radius: var(--radius-group);
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.55);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.turnstile-wrap .group-footer {
  margin: 10px 0 0;
  padding: 0;
}

#cfTurnstile {
  min-height: 65px;
}

#cfTurnstile iframe {
  max-width: 100%;
}

@media (max-width: 420px) {
  .cell:not(.stack) {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .cell-value {
    text-align: left;
    width: 100%;
  }

  .group-header,
  .group-footer {
    padding-left: 4px;
    padding-right: 4px;
  }
}

@media (min-width: 720px) {
  .stage {
    width: min(100%, 480px);
    padding-top: max(48px, min(12vh, 120px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .materialize {
    animation: none;
  }
  .pulse {
    animation: none;
  }
  .pressable.is-pressed,
  .btn:active {
    transform: none !important;
  }
  .toast,
  .toast.show {
    transform: translate3d(-50%, 0, 0);
  }
}

@media (prefers-reduced-transparency: reduce) {
  .group-body,
  .status-card,
  .link-box {
    background: #fff;
  }
}
