/* ── Reset & Base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%; height: 100%; overflow: hidden;
  background: #050d1a;
  font-family: 'Inter', sans-serif;
  color: #fff;
  -webkit-font-smoothing: antialiased;
}

/* ── Shared Background ─────────────────────────────────────────────────────── */
#particle-canvas {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none; z-index: 1;
}

.bg-grid {
  position: fixed; inset: 0; z-index: 2; pointer-events: none;
  background-image:
    linear-gradient(rgba(249,115,22,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(249,115,22,0.04) 1px, transparent 1px);
  background-size: 50px 50px;
  animation: gridMove 22s linear infinite;
}
@keyframes gridMove {
  from { background-position: 0 0; }
  to   { background-position: 50px 50px; }
}

.bg-glow {
  position: fixed; z-index: 2; pointer-events: none;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: min(900px, 130vw); height: min(900px, 130vw);
  background: radial-gradient(ellipse,
    rgba(249,115,22,0.12) 0%,
    rgba(249,115,22,0.04) 40%,
    transparent 70%);
  animation: glowPulse 5s ease-in-out infinite;
}
@keyframes glowPulse {
  0%, 100% { opacity: 0.6; transform: translate(-50%,-50%) scale(1); }
  50%       { opacity: 1;   transform: translate(-50%,-50%) scale(1.08); }
}

.corner {
  position: fixed; z-index: 3; pointer-events: none;
  width: clamp(28px, 4vw, 44px); height: clamp(28px, 4vw, 44px);
  border-color: rgba(249,115,22,0.28); border-style: solid;
}
.corner-tl { top: 14px; left: 14px;   border-width: 1.5px 0 0 1.5px; }
.corner-tr { top: 14px; right: 14px;  border-width: 1.5px 1.5px 0 0; }
.corner-bl { bottom: 14px; left: 14px;  border-width: 0 0 1.5px 1.5px; }
.corner-br { bottom: 14px; right: 14px; border-width: 0 1.5px 1.5px 0; }

/* ── Screen Wrappers ───────────────────────────────────────────────────────── */
#loading-screen, #login-screen {
  position: fixed; inset: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center;
}

.hidden { display: none !important; }

.screen-exit {
  animation: screenExit 0.48s cubic-bezier(0.4,0,1,1) forwards;
}
@keyframes screenExit {
  to { opacity: 0; transform: translateY(-24px); }
}

.screen-enter {
  animation: screenEnter 0.5s cubic-bezier(0,0,0.2,1) forwards;
}
@keyframes screenEnter {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Success Overlay ───────────────────────────────────────────────────────── */
#success-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(34,197,94,0.06);
  opacity: 0; pointer-events: none;
  transition: opacity 0.35s;
}
#success-overlay.active { opacity: 1; }

/* ════════════════════════════════════════════════════════════════════════════ */
/* LOADING SCREEN                                                              */
/* ════════════════════════════════════════════════════════════════════════════ */

.loading-content {
  position: relative; z-index: 10;
  display: flex; flex-direction: column; align-items: center;
  width: 100%; max-width: 420px; padding: 0 24px;
  animation: loadingContentIn 0.6s cubic-bezier(0.4,0,0.2,1) forwards;
}
@keyframes loadingContentIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Logo */
.logo-container {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 28px;
}
.logo-ring {
  width: 90px; height: 90px;
  border-radius: 24px;
  background: rgba(249,115,22,0.08);
  border: 1.5px solid rgba(249,115,22,0.3);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 40px rgba(249,115,22,0.18), inset 0 1px 0 rgba(255,255,255,0.06);
  animation: logoPulse 3s ease-in-out infinite;
  position: relative; z-index: 2;
  overflow: hidden;
}
@keyframes logoPulse {
  0%, 100% { box-shadow: 0 0 30px rgba(249,115,22,0.15), inset 0 1px 0 rgba(255,255,255,0.06); }
  50%       { box-shadow: 0 0 55px rgba(249,115,22,0.32), inset 0 1px 0 rgba(255,255,255,0.06); }
}
.logo-img { width: 62px; height: 62px; object-fit: contain; }
.logo-pulse {
  position: absolute; inset: -8px;
  border-radius: 30px;
  border: 1.5px solid rgba(249,115,22,0.18);
  animation: ringPulse 3s ease-in-out infinite;
}
.logo-pulse-2 {
  position: absolute; inset: -18px;
  border-radius: 36px;
  border: 1px solid rgba(249,115,22,0.08);
  animation: ringPulse 3s ease-in-out 0.6s infinite;
}
@keyframes ringPulse {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50%       { opacity: 1;   transform: scale(1.04); }
}

/* Title */
.app-title {
  font-family: 'Rajdhani', sans-serif;
  font-size: clamp(28px, 5vw, 38px);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #fff;
  line-height: 1;
  margin-bottom: 8px;
}
.app-title span { color: #f97316; }

.app-subtitle {
  font-size: clamp(11px, 2vw, 13px);
  font-weight: 400;
  color: rgba(255,255,255,0.36);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 32px;
}

/* Data indicators */
.data-pills {
  display: flex; gap: 8px; flex-wrap: wrap; justify-content: center;
  margin-bottom: 36px;
}
.data-pill {
  font-size: 9.5px; font-weight: 600;
  font-family: 'Rajdhani', sans-serif;
  letter-spacing: 0.08em; text-transform: uppercase;
  padding: 4px 12px; border-radius: 99px;
  color: rgba(249,115,22,0.65);
  border: 1px solid rgba(249,115,22,0.18);
  background: rgba(249,115,22,0.06);
}

/* Progress */
.progress-wrapper {
  width: 100%; margin-bottom: 28px;
}
.progress-track {
  width: 100%; height: 5px;
  background: rgba(255,255,255,0.06);
  border-radius: 99px;
  position: relative;
  overflow: visible;
  margin-bottom: 14px;
  box-shadow: inset 0 0 0 1px rgba(249,115,22,0.1);
}
.progress-fill {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, #c2410c, #f97316, #fb923c);
  width: 0%;
  transition: width 0.05s linear;
  position: relative;
}
.progress-fill::after {
  content: '';
  position: absolute; right: 0; top: 50%;
  transform: translate(50%, -50%);
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #fb923c;
  box-shadow: 0 0 10px 3px rgba(249,115,22,0.55);
}
.progress-info {
  display: flex; justify-content: space-between; align-items: center;
}
.progress-pct {
  font-family: 'Rajdhani', sans-serif;
  font-size: 20px; font-weight: 700;
  color: #f97316;
  letter-spacing: 0.04em;
  min-width: 52px;
}
.loading-status {
  font-size: 11.5px; font-weight: 400;
  color: rgba(255,255,255,0.4);
  letter-spacing: 0.06em;
  text-align: right;
  flex: 1; padding-left: 12px;
  transition: opacity 0.25s;
}

/* Loading footer */
.loading-footer {
  display: flex; align-items: center; gap: 8px;
  font-size: 10px; color: rgba(255,255,255,0.18);
  font-family: 'Rajdhani', sans-serif; font-weight: 500;
  letter-spacing: 0.06em; text-transform: uppercase;
}
.loading-footer .sep { opacity: 0.4; }

/* ════════════════════════════════════════════════════════════════════════════ */
/* LOGIN SCREEN                                                                */
/* ════════════════════════════════════════════════════════════════════════════ */

.login-wrap {
  position: relative; z-index: 10;
  display: flex; flex-direction: column; align-items: center;
  width: 100%; max-width: 384px; padding: 0 16px;
}

.login-card {
  width: 100%;
  background: rgba(255,255,255,0.044);
  border: 1px solid rgba(249,115,22,0.22);
  border-radius: 22px;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow:
    0 24px 64px rgba(0,0,0,0.55),
    0 0 70px rgba(249,115,22,0.07),
    inset 0 1px 0 rgba(255,255,255,0.07);
  padding: 30px 26px 26px;
  position: relative; overflow: hidden;
}

.card-shimmer {
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, #f97316 40%, #fb923c 60%, transparent);
}

/* Header */
.card-header {
  display: flex; flex-direction: column; align-items: center;
  margin-bottom: 22px;
  animation: fadeUp 0.45s ease 0.05s both;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.logo-ring-sm {
  width: 58px; height: 58px; border-radius: 15px;
  background: rgba(249,115,22,0.09);
  border: 1px solid rgba(249,115,22,0.3);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
  box-shadow: 0 0 28px rgba(249,115,22,0.15);
  overflow: hidden;
}
.logo-img-sm { width: 36px; height: 36px; object-fit: contain; }

.card-title {
  font-family: 'Rajdhani', sans-serif;
  font-size: 26px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: #fff; line-height: 1;
}
.card-title span { color: #f97316; }

.card-subtitle {
  font-size: 11px; font-weight: 400;
  color: rgba(255,255,255,0.3);
  letter-spacing: 0.09em; text-transform: uppercase;
  margin-top: 5px;
}

.divider {
  width: 100%; height: 1px; margin-bottom: 22px;
  background: linear-gradient(90deg, transparent, rgba(249,115,22,0.3), transparent);
  animation: fadeUp 0.45s ease 0.12s both;
}

/* PIN Dots */
.pin-section {
  margin-bottom: 22px; text-align: center;
  animation: fadeUp 0.45s ease 0.18s both;
}
.pin-label {
  display: block;
  font-size: 10.5px; font-weight: 500;
  color: rgba(255,255,255,0.3);
  letter-spacing: 0.12em; text-transform: uppercase;
  margin-bottom: 14px;
}
.pin-dots { display: flex; gap: 18px; justify-content: center; }
.pin-dot {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid rgba(249,115,22,0.24);
  background: transparent;
  transition: all 220ms cubic-bezier(0.34,1.56,0.64,1);
}
.pin-dot.filled {
  background: linear-gradient(135deg, #f97316, #fb923c);
  border-color: #f97316;
  box-shadow: 0 0 16px rgba(249,115,22,0.7);
  transform: scale(1.18);
}
.pin-dot.error {
  background: rgba(239,68,68,0.85);
  border-color: #ef4444;
  box-shadow: 0 0 16px rgba(239,68,68,0.55);
  transform: scale(1.1);
}
.pin-dot.success {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  border-color: #22c55e;
  box-shadow: 0 0 16px rgba(34,197,94,0.65);
  transform: scale(1.1);
}

/* Numpad */
.numpad-wrap { animation: fadeUp 0.45s ease 0.24s both; }
.numpad {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.num-btn {
  height: 60px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(249,115,22,0.11);
  border-radius: 13px;
  color: #fff;
  font-family: 'Rajdhani', sans-serif;
  font-size: 24px; font-weight: 600;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 120ms, border-color 120ms, transform 90ms, box-shadow 120ms;
  user-select: none; -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  tabindex: -1;
}
.num-btn:hover {
  background: rgba(249,115,22,0.09);
  border-color: rgba(249,115,22,0.28);
}
.num-btn.pressed {
  transform: scale(0.88);
  background: rgba(249,115,22,0.2);
  border-color: rgba(249,115,22,0.55);
  box-shadow: 0 0 20px rgba(249,115,22,0.22);
}

.num-btn-zero { grid-column: 2; }

.num-btn-del { color: rgba(255,255,255,0.42); }
.num-btn-del:hover {
  color: #ef4444;
  background: rgba(239,68,68,0.08);
  border-color: rgba(239,68,68,0.24);
}
.num-btn-del.pressed {
  color: #ef4444;
  background: rgba(239,68,68,0.18);
  transform: scale(0.88);
}

/* Error bar */
.error-bar {
  max-height: 0; overflow: hidden; opacity: 0;
  transition: max-height 260ms ease, opacity 260ms ease;
  margin-top: 12px;
}
.error-bar.visible { max-height: 44px; opacity: 1; }
.error-inner {
  display: flex; align-items: center; gap: 8px;
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.28);
  border-radius: 9px; padding: 9px 13px;
  font-size: 12px; color: #ef4444;
}

/* Shake */
@keyframes shake {
  0%,100% { transform: translateX(0); }
  15%      { transform: translateX(-9px); }
  35%      { transform: translateX(9px); }
  50%      { transform: translateX(-5px); }
  65%      { transform: translateX(5px); }
  80%      { transform: translateX(-2px); }
}
.shake { animation: shake 0.44s ease; }

/* Login footer */
.login-footer {
  margin-top: 16px; text-align: center;
  animation: fadeUp 0.45s ease 0.35s both;
}
.footer-brand {
  font-size: 10.5px; color: rgba(255,255,255,0.16);
  letter-spacing: 0.07em;
  font-family: 'Rajdhani', sans-serif; font-weight: 500;
}
.footer-pills {
  display: flex; gap: 5px; justify-content: center;
  margin-top: 7px; flex-wrap: wrap;
}
.fpill {
  font-size: 9px; font-weight: 600;
  font-family: 'Rajdhani', sans-serif;
  letter-spacing: 0.06em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 99px;
  color: rgba(249,115,22,0.6);
  border: 1px solid rgba(249,115,22,0.16);
  background: rgba(249,115,22,0.05);
}

/* Install App button */
.btn-install-pwa {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  margin: 14px auto 0; padding: 8px 18px;
  background: rgba(249,115,22,0.08);
  border: 1px solid rgba(249,115,22,0.28);
  border-radius: 8px;
  color: #f97316;
  font-family: 'Rajdhani', sans-serif; font-weight: 600; font-size: 12.5px;
  letter-spacing: 0.04em; text-transform: uppercase;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, transform 0.15s;
}
.btn-install-pwa:hover { background: rgba(249,115,22,0.14); border-color: rgba(249,115,22,0.45); transform: translateY(-1px); }
.btn-install-pwa:active { transform: translateY(0); }
.btn-install-pwa:disabled { opacity: 0.5; cursor: default; transform: none; }

/* Footer version line (login page) */
.footer-version {
  margin-top: 10px;
  font-size: 10px; color: rgba(255,255,255,0.18);
  font-family: 'Rajdhani', sans-serif; letter-spacing: 0.06em;
}

/* Version tag (persistent, bottom-right corner) */
.version-tag {
  position: fixed; bottom: 12px; right: 14px;
  font-size: 10px; color: rgba(255,255,255,0.12);
  font-family: 'Rajdhani', sans-serif; z-index: 20;
}

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-height: 680px) {
  .logo-ring     { width: 72px; height: 72px; margin-bottom: 20px; }
  .logo-img      { width: 50px; height: 50px; }
  .app-subtitle  { margin-bottom: 22px; }
  .data-pills    { margin-bottom: 24px; }
  .logo-ring-sm  { width: 48px; height: 48px; margin-bottom: 10px; }
  .card-header   { margin-bottom: 16px; }
  .divider       { margin-bottom: 16px; }
  .pin-section   { margin-bottom: 16px; }
  .num-btn       { height: 52px; font-size: 22px; }
  .numpad        { gap: 8px; }
}

@media (max-width: 380px) {
  .login-card { padding: 24px 18px 22px; }
  .num-btn    { height: 56px; font-size: 22px; }
}

@media (min-width: 1400px) {
  .app-title    { font-size: 44px; }
  .progress-pct { font-size: 24px; }
  .logo-ring    { width: 110px; height: 110px; }
  .logo-img     { width: 76px; height: 76px; }
}
