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

:root {
  color-scheme: dark;
  
  /* Restored & Enhanced Red/Gold Palette (Đỏ / Vàng) */
  --bg-base: #100a0a;
  --card-bg-start: rgba(28, 18, 20, 0.85);
  --card-bg-end: rgba(16, 10, 11, 0.95);
  
  --emerald-400: #e9b72c; /* Gold */
  --cyan-400: #fadb5f;    /* Bright Gold */
  --sky-400: #9c1f2e;     /* Crimson Red */
  
  --slate-100: #fcf9f2;
  --slate-300: #e3dbcc;
  --slate-400: #cfc4b6;
  --slate-500: #8c7f6b;
  --slate-600: #5c5243;
  --border-light: rgba(233, 183, 44, 0.15);
  
  --warning: #e9b72c;
  --danger: #9c1f2e;
}

body {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  background: var(--bg-base);
  color: var(--slate-100);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.bg-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: radial-gradient(circle at 15% 20%, rgba(156, 31, 46, 0.2) 0%, transparent 45%),
              radial-gradient(circle at 85% 80%, rgba(233, 183, 44, 0.15) 0%, transparent 45%);
}

.noise {
  position: fixed;
  inset: 0;
  z-index: 1;
  opacity: 0.02;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 150px 150px;
  pointer-events: none;
}

.app-wrap {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 520px;
  padding: 16px;
  perspective: 1000px;
}

.card-outer {
  position: relative;
  border-radius: 28px;
  padding: 1px;
  background: conic-gradient(
    from var(--border-angle, 0deg),
    transparent 20%,
    rgba(156, 31, 46, 0.4) 35%,
    rgba(233, 183, 44, 0.5) 50%,
    rgba(255, 255, 255, 0.15) 65%,
    transparent 80%
  );
  animation: rotateBorder 12s linear infinite;
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.6);
  transform-style: preserve-3d;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.card-outer:hover {
  transform: translateY(-2px);
}

@property --border-angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

@keyframes rotateBorder {
  to {
    --border-angle: 360deg;
  }
}

.card-inner {
  background: linear-gradient(
    165deg,
    var(--card-bg-start) 0%,
    var(--card-bg-end) 100%
  );
  backdrop-filter: blur(24px) saturate(1.2);
  border-radius: 27px;
  padding: 32px 28px;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.05);
}

.card-inner::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 10%,
    rgba(233, 183, 44, 0.15) 50%,
    transparent 90%
  );
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  transition: transform 0.5s ease;
}

.card-outer:hover .logo-icon {
  transform: scale(1.05);
}

.logo-icon img {
  width: 145%;
  height: 145%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.app-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #ffffff, var(--slate-300));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.badge-live {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 9999px;
  background: rgba(156, 31, 46, 0.15);
  border: 1px solid rgba(233, 183, 44, 0.25);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--emerald-400);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: all 0.3s ease;
  box-shadow: 0 0 10px rgba(156, 31, 46, 0.15);
}

.badge-live:hover {
  background: rgba(156, 31, 46, 0.25);
  box-shadow: 0 0 15px rgba(233, 183, 44, 0.2);
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--emerald-400);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% {
    opacity: 1;
    box-shadow: 0 0 0 0 rgba(233, 183, 44, 0.4);
  }
  50% {
    opacity: 0.5;
    box-shadow: 0 0 0 4px rgba(233, 183, 44, 0);
  }
}

.input-section {
  margin-bottom: 24px;
}

.input-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.secret-input {
  flex: 1;
  min-width: 0;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(233, 183, 44, 0.15);
  background: rgba(0, 0, 0, 0.25);
  color: var(--slate-100);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.4;
  outline: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.secret-input::placeholder {
  color: var(--slate-500);
}

.secret-input:focus {
  border-color: rgba(233, 183, 44, 0.5);
  background: rgba(0, 0, 0, 0.4);
  box-shadow: 0 0 0 3px rgba(233, 183, 44, 0.1), 
              inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.submit-btn {
  flex-shrink: 0;
  width: 52px;
  border-radius: 14px;
  border: 1px solid rgba(233, 183, 44, 0.25);
  background: linear-gradient(135deg, rgba(156, 31, 46, 0.2), rgba(233, 183, 44, 0.15));
  color: var(--emerald-400);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  position: relative;
}

.submit-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(156, 31, 46, 0.35), rgba(233, 183, 44, 0.25));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.submit-btn svg {
  position: relative;
  z-index: 1;
  transition: transform 0.3s ease;
}

.submit-btn:hover {
  border-color: rgba(233, 183, 44, 0.5);
  box-shadow: 0 0 15px rgba(233, 183, 44, 0.2);
  transform: translateY(-1px);
}

.submit-btn:hover::before {
  opacity: 1;
}

.submit-btn:hover svg {
  transform: translateX(2px);
  color: #fff;
}

.submit-btn:active {
  transform: scale(0.95);
}

/* OTP Region */
.otp-section {
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.otp-container {
  position: relative;
  cursor: pointer;
  user-select: none;
}

.otp-digits {
  display: flex;
  gap: 8px;
  justify-content: center;
  padding: 12px 0;
}

.otp-digit {
  width: 56px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: linear-gradient(165deg, rgba(35, 20, 22, 0.8), rgba(20, 15, 16, 0.9));
  border: 1px solid var(--border-light);
  font-family: "JetBrains Mono", monospace;
  font-size: 2rem;
  font-weight: 800;
  color: var(--slate-100);
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.04),
              0 6px 12px rgba(0, 0, 0, 0.3);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.otp-digit::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent);
  border-radius: 15px 15px 0 0;
}

.otp-digit.pop {
  animation: digitPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes digitPop {
  0% {
    transform: scale(0.65) translateY(10px);
    opacity: 0.5;
    color: var(--emerald-400);
  }
  50% {
    transform: scale(1.05) translateY(-3px);
    color: var(--slate-100);
    text-shadow: 0 0 15px rgba(233, 183, 44, 0.4);
    border-color: rgba(233, 183, 44, 0.4);
  }
  100% {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

.otp-digit-sep {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 12px;
}

.otp-digit-sep::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--slate-500);
  box-shadow: 0 0 4px rgba(255, 255, 255, 0.1);
}

.otp-container:hover .otp-digit {
  border-color: rgba(233, 183, 44, 0.4);
  box-shadow: inset 0 2px 6px rgba(255, 255, 255, 0.05),
              0 8px 16px rgba(156, 31, 46, 0.15);
  transform: translateY(-2px);
}
.otp-container:hover .otp-digit:nth-child(1) { transition-delay: 0.00s; }
.otp-container:hover .otp-digit:nth-child(2) { transition-delay: 0.02s; }
.otp-container:hover .otp-digit:nth-child(3) { transition-delay: 0.04s; }
.otp-container:hover .otp-digit:nth-child(5) { transition-delay: 0.06s; }
.otp-container:hover .otp-digit:nth-child(6) { transition-delay: 0.08s; }
.otp-container:hover .otp-digit:nth-child(7) { transition-delay: 0.10s; }

.copy-toast {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  background: rgba(156, 31, 46, 0.9);
  color: #fff;
  padding: 8px 20px;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 600;
  pointer-events: none;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 10;
  backdrop-filter: blur(8px);
  box-shadow: 0 6px 20px rgba(156, 31, 46, 0.4);
}

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

.copy-hint {
  text-align: center;
  font-size: 0.7rem;
  color: var(--slate-500);
  padding-bottom: 6px;
  letter-spacing: 0.05em;
  opacity: 0;
  transition: opacity 0.3s ease;
  font-weight: 500;
}

.copy-hint.visible {
  opacity: 1;
}

.ring-wrap {
  position: relative;
  width: 46px; /* Restored EXACT original width */
  height: 46px; /* Restored EXACT original height */
  flex-shrink: 0;
}

.ring-svg {
  transform: rotate(-90deg);
  width: 46px;
  height: 46px;
  filter: drop-shadow(0 0 6px rgba(233, 183, 44, 0.2));
}

.ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 3.5;
}

.ring-fg {
  fill: none;
  stroke: url(#ringGrad);
  stroke-width: 3.5;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.1s linear, stroke 0.3s ease;
}

.ring-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--slate-100);
}

.progress-track {
  margin-top: 10px;
  height: 3px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--danger), var(--warning), var(--cyan-400));
  background-size: 200% 100%;
  transition: width 0.1s linear, background 0.3s ease;
  width: 0%;
}

/* Warning State */
.state-warning .otp-digit {
  border-color: rgba(233, 183, 44, 0.6);
  color: var(--warning);
  text-shadow: 0 0 12px rgba(233, 183, 44, 0.3);
}

.state-warning .ring-fg {
  stroke: var(--warning);
  filter: drop-shadow(0 0 8px rgba(233, 183, 44, 0.4));
}

.state-warning .progress-fill {
  background: linear-gradient(90deg, var(--danger), var(--warning));
}

/* Danger State */
.state-danger .otp-digit {
  border-color: rgba(156, 31, 46, 0.6);
  color: var(--danger);
  text-shadow: 0 0 12px rgba(156, 31, 46, 0.4);
  animation: shakeDanger 0.6s ease-in-out infinite alternate;
}

@keyframes shakeDanger {
  0% { transform: translateX(0); box-shadow: 0 0 0 rgba(156, 31, 46, 0.2); }
  50% { transform: translateX(-1px); }
  100% { transform: translateX(1px); box-shadow: 0 0 10px rgba(156, 31, 46, 0.3); }
}

.state-danger .ring-fg {
  stroke: var(--danger);
  filter: drop-shadow(0 0 8px rgba(156, 31, 46, 0.5));
}

.state-danger .progress-fill {
  background: var(--danger);
}

/* Site Header */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 50;
  background: rgba(16, 10, 11, 0.45);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(233, 183, 44, 0.15);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

.site-header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: 0.05em;
  color: var(--slate-100);
}

.site-logo span {
  background: linear-gradient(135deg, #ffffff, var(--slate-300));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.site-logo img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(233, 183, 44, 0.3));
}

.site-nav {
  display: flex;
  gap: 8px;
}

.nav-link {
  color: var(--slate-300);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 10px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  letter-spacing: 0.02em;
}

.nav-link:hover, .nav-link.active {
  color: var(--emerald-400);
  background: rgba(233, 183, 44, 0.1);
  box-shadow: inset 0 0 0 1px rgba(233, 183, 44, 0.2);
}

/* Modal / Popup */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal-content {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: linear-gradient(165deg, var(--card-bg-start), var(--card-bg-end));
  border: 1px solid rgba(233, 183, 44, 0.2);
  border-radius: 24px;
  padding: 32px;
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.modal-overlay.active .modal-content {
  transform: translateY(0) scale(1);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: none;
  color: var(--slate-400);
  font-size: 1.5rem;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 50%;
  transition: all 0.2s;
}

.modal-close:hover {
  color: var(--emerald-400);
  background: rgba(233, 183, 44, 0.1);
}

.modal-footer {
  display: flex;
  justify-content: center;
}

.btn-close-modal {
  width: 100%;
  padding: 14px 24px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(233, 183, 44, 0.2);
  border-radius: 12px;
  color: var(--slate-100);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
}

.btn-close-modal:hover {
  background: rgba(233, 183, 44, 0.1);
  border-color: rgba(233, 183, 44, 0.4);
  color: var(--emerald-400);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(233, 183, 44, 0.1);
}

.btn-close-modal:active {
  transform: translateY(0);
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--slate-100);
}

.modal-body p {
  color: var(--slate-300);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 8px;
}
.modal-body p:last-child {
  margin-bottom: 0;
}

.contact-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(233, 183, 44, 0.1);
  border-radius: 12px;
  text-decoration: none;
  color: var(--slate-100);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.contact-item:hover {
  background: rgba(233, 183, 44, 0.1);
  border-color: rgba(233, 183, 44, 0.3);
  transform: translateX(4px);
}

.contact-item svg {
  color: var(--emerald-400);
  background: rgba(233, 183, 44, 0.1);
  padding: 8px;
  border-radius: 10px;
  box-sizing: content-box;
  flex-shrink: 0;
  transition: transform 0.3s ease;
}

.contact-item:hover svg {
  transform: scale(1.1);
}

.contact-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.contact-name {
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.contact-detail {
  font-size: 0.8rem;
  color: var(--slate-400);
}

@media (max-width: 480px) {
  .site-header-container {
    padding: 12px 16px;
  }
  .site-logo span {
    font-size: 1rem;
  }
  .site-logo img {
    width: 28px;
    height: 28px;
  }
  .site-nav {
    display: flex;
  }

  .app-wrap {
    padding: 10px; /* Restored original mobile padding */
  }

  .card-inner {
    padding: 24px 18px;
  }

  .otp-digit {
    width: 44px; /* Restored original mobile digit */
    height: 58px;
    font-size: 1.5rem;
    border-radius: 12px;
  }

  .otp-digits {
    gap: 5px;
  }

  .otp-digit-sep {
    width: 6px;
  }

  .logo-icon {
    width: 36px;
    height: 36px;
  }

  .app-title {
    font-size: 1.1rem;
  }
}

@media (max-width: 360px) {
  .otp-digit {
    width: 38px;
    height: 50px;
    font-size: 1.3rem;
  }
}
