:root {
  --ink: #0a0a0c;
  --ink-soft: #141418;
  --mist: rgba(255, 248, 240, 0.72);
  --mist-strong: #fff8f0;
  --amber: #e8a54b;
  --amber-dim: rgba(232, 165, 75, 0.35);
  --error: #e07060;
  --pad: min(88px, 22vw);
  --font-brand: "Syne", system-ui, sans-serif;
  --font-ui: "DM Sans", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  min-height: 100%;
  height: 100%;
}

body {
  font-family: var(--font-ui);
  background: var(--ink);
  color: var(--mist-strong);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 55% at 50% -10%, rgba(232, 165, 75, 0.18), transparent 55%),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(60, 90, 110, 0.22), transparent 50%),
    radial-gradient(ellipse 50% 35% at 10% 85%, rgba(40, 35, 50, 0.4), transparent 45%),
    var(--ink);
  animation: breathe 12s ease-in-out infinite alternate;
}

@keyframes breathe {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0.92; transform: scale(1.03); }
}

.gate,
.home {
  position: relative;
  z-index: 1;
  min-height: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding:
    max(2.5rem, env(safe-area-inset-top))
    1.25rem
    max(1.5rem, env(safe-area-inset-bottom));
}

.gate[hidden],
.home[hidden] {
  display: none;
}

/* —— Brand (hero) —— */
.brand {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  text-align: center;
  padding-bottom: 2.25rem;
  animation: rise 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.brand__mark {
  font-family: var(--font-brand);
  font-weight: 800;
  font-size: clamp(2.4rem, 11vw, 3.4rem);
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--mist-strong);
  text-shadow: 0 0 48px var(--amber-dim);
}

.brand__hint {
  margin-top: 1rem;
  font-size: 0.95rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--mist);
  animation: rise 0.7s 0.12s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* —— PIN dots —— */
.pin {
  display: flex;
  gap: 1.1rem;
  margin-bottom: 0.75rem;
  animation: rise 0.7s 0.2s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.pin__dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 248, 240, 0.35);
  background: transparent;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

.pin__dot.is-filled {
  background: var(--amber);
  border-color: var(--amber);
  box-shadow: 0 0 12px var(--amber-dim);
  transform: scale(1.08);
}

.pin.is-shake {
  animation: shake 0.45s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-10px); }
  40% { transform: translateX(10px); }
  60% { transform: translateX(-7px); }
  80% { transform: translateX(7px); }
}

.gate__error {
  min-height: 1.25rem;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  color: var(--error);
  letter-spacing: 0.02em;
}

.gate__error[hidden] {
  visibility: hidden;
  display: block;
}

/* —— Keypad —— */
.pad {
  display: grid;
  grid-template-columns: repeat(3, var(--pad));
  gap: 0.65rem 1.1rem;
  justify-content: center;
  margin-top: auto;
  padding-top: 1.5rem;
  animation: rise 0.7s 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.pad__key {
  width: var(--pad);
  height: var(--pad);
  border: none;
  border-radius: 50%;
  background: rgba(255, 248, 240, 0.06);
  color: var(--mist-strong);
  font-family: var(--font-ui);
  font-size: 1.65rem;
  font-weight: 500;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition:
    background 0.12s ease,
    transform 0.12s ease,
    box-shadow 0.12s ease;
}

.pad__key:active,
.pad__key.is-press {
  background: rgba(232, 165, 75, 0.22);
  transform: scale(0.94);
  box-shadow: inset 0 0 0 1px var(--amber-dim);
}

.pad__key--action {
  background: transparent;
  color: var(--mist);
}

.pad__key--action:active,
.pad__key--action.is-press {
  background: rgba(255, 248, 240, 0.08);
}

.pad__spacer {
  width: var(--pad);
  height: var(--pad);
}

/* —— Empty home —— */
.home {
  justify-content: stretch;
  padding: 0;
}

.home__blank {
  flex: 1;
  width: 100%;
  min-height: 100dvh;
  background: transparent;
}

@media (prefers-reduced-motion: reduce) {
  .atmosphere,
  .brand,
  .brand__hint,
  .pin,
  .pad {
    animation: none;
  }
}
