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

:root {
  --bg: #0f1419;
  --surface: #1a222d;
  --surface-hover: #243040;
  --border: #2d3a4d;
  --text: #e8edf4;
  --muted: #8b9bb0;
  --accent: #3d8bfd;
  --accent-glow: rgba(61, 139, 253, 0.35);
  --error: #ff6b6b;
  --aoe2: #c9a227;
  --bday: #e879a8;
  --games: #5eead4;
  --radius: 16px;
  --key-size: min(72px, 22vw);
}

html,
body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

body {
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(61, 139, 253, 0.12), transparent),
    var(--bg);
}

.app {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.screen {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.75rem;
  animation: fade-in 0.35s ease;
}

.screen--hidden {
  display: none;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.brand {
  text-align: center;
}

.brand h1 {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.brand--compact h1 {
  font-size: 1.5rem;
}

.subtitle {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.pin-display {
  min-height: 3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.pin-dots {
  display: flex;
  gap: 1rem;
}

.pin-dots::before,
.pin-dots::after {
  content: none;
}

.pin-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--border);
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}

.pin-dot--filled {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

.pin-dot--shake {
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-6px);
  }
  75% {
    transform: translateX(6px);
  }
}

.pin-error {
  margin: 0;
  font-size: 0.875rem;
  color: var(--error);
}

.numpad {
  display: grid;
  grid-template-columns: repeat(3, var(--key-size));
  gap: 0.65rem;
  justify-content: center;
}

.numpad-key {
  width: var(--key-size);
  height: var(--key-size);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 1.5rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, border-color 0.15s;
  user-select: none;
  touch-action: manipulation;
}

.numpad-key:hover {
  background: var(--surface-hover);
  border-color: #3d4f66;
}

.numpad-key:active {
  transform: scale(0.96);
}

.numpad-key--muted {
  font-size: 1.25rem;
  color: var(--muted);
}

.numpad-key--accent {
  font-size: 1rem;
  font-weight: 600;
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.numpad-key--accent:hover {
  background: #5a9dff;
  border-color: #5a9dff;
}

.tiles {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
  width: 100%;
}

.tile {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  gap: 0.15rem 1rem;
  padding: 1.1rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  text-decoration: none;
  color: inherit;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.tile:hover {
  transform: translateY(-2px);
  border-color: #3d4f66;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.tile:active {
  transform: translateY(0);
}

.tile-icon {
  grid-row: 1 / 3;
  font-size: 2rem;
  align-self: center;
}

.tile-label {
  font-size: 1.1rem;
  font-weight: 600;
}

.tile-desc {
  font-size: 0.8rem;
  color: var(--muted);
}

.tile--aoe2:hover {
  border-color: var(--aoe2);
  box-shadow: 0 8px 24px rgba(201, 162, 39, 0.15);
}

.tile--bday:hover {
  border-color: var(--bday);
  box-shadow: 0 8px 24px rgba(232, 121, 168, 0.15);
}

.tile--games:hover {
  border-color: var(--games);
  box-shadow: 0 8px 24px rgba(94, 234, 212, 0.15);
}

.lock-btn {
  margin-top: 0.5rem;
  padding: 0.55rem 1.25rem;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.875rem;
  cursor: pointer;
  transition: color 0.15s;
}

.lock-btn:hover {
  color: var(--text);
}

@media (min-width: 420px) {
  .tiles {
    grid-template-columns: 1fr;
  }
}
