:root {
  --bg-color: #070709;
  --text-primary: #f0f0f5;
  --text-secondary: #c5c5d0;
  --text-muted: #9e9ea9;
  --accent-glow: linear-gradient(135deg, #ff007a, #7928ca, #4200ff);
  --card-bg: rgba(255, 255, 255, 0.035);
  --card-border: rgba(255, 255, 255, 0.09);
  --code-bg: rgba(255, 0, 122, 0.08);
  --code-border: rgba(255, 0, 122, 0.25);
  --pink-accent: #ff007a;
  --pink-light: #ff3399;
  --danger-accent: #ff3366;
  --success-color: #00e676;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: '-apple-system', BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  overflow-x: hidden;
  padding: 2.5rem 1rem;
}

/* Ambient Background Orbs */
.glow-orb {
  position: fixed;
  width: 800px;
  height: 800px;
  background: radial-gradient(circle, rgba(121, 40, 202, 0.18) 0%, rgba(0,0,0,0) 70%);
  top: -300px;
  left: -250px;
  z-index: 0;
  animation: float 12s ease-in-out infinite alternate;
  pointer-events: none;
}

.glow-orb-2 {
  position: fixed;
  width: 800px;
  height: 800px;
  background: radial-gradient(circle, rgba(255, 0, 122, 0.15) 0%, rgba(0,0,0,0) 70%);
  bottom: -300px;
  right: -250px;
  z-index: 0;
  animation: float 16s ease-in-out infinite alternate-reverse;
  pointer-events: none;
}

#particleCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

/* Navigation Bar */
nav {
  position: relative;
  z-index: 2;
  width: 95%;
  max-width: 620px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0 2rem 0;
}

.nav-logo {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #fff;
  text-decoration: none;
}

.nav-logo span {
  background: var(--accent-glow);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Main Glass Container */
.container {
  position: relative;
  z-index: 2;
  width: 95%;
  max-width: 620px;
  background: var(--card-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  padding: 3.5rem 2.5rem;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.6), 
              inset 0 1px 0 rgba(255, 255, 255, 0.12);
  opacity: 0;
  transform: translateY(30px);
  animation: fadeInUp 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  margin-bottom: 2rem;
  text-align: center;
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 2rem;
}

.app-name {
  font-size: 3.2rem;
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 0.75rem;
  background: linear-gradient(135deg, #ffffff 30%, #a5a5a5 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.app-name .accent {
  background: var(--accent-glow);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.tagline {
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.6;
  font-weight: 300;
}

/* Form Group Controls */
.input-group {
  margin-bottom: 1.5rem;
  text-align: left;
}

label {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
  display: block;
}

input[type="text"],
select {
  width: 100%;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: rgba(0, 0, 0, 0.4);
  color: var(--text-primary);
  font-size: 1rem;
  transition: all 0.3s;
}

input[type="text"]:focus,
select:focus {
  outline: none;
  border-color: var(--pink-accent);
  background: rgba(0, 0, 0, 0.6);
  box-shadow: 0 0 12px rgba(255, 0, 122, 0.25);
}

select option {
  background-color: #070709;
  color: var(--text-primary);
}

input:disabled, select:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  background: rgba(0, 0, 0, 0.2);
}

/* Custom Checkbox Label */
.custom-checkbox-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--pink-light);
  font-weight: 500;
  margin-bottom: 1.25rem;
  font-size: 0.95rem;
  transition: color 0.3s ease;
}

.custom-checkbox-label:hover {
  color: #ffffff;
}

.custom-checkbox {
  margin-right: 10px;
  accent-color: var(--pink-accent);
  width: 18px;
  height: 18px;
  cursor: pointer;
}

/* Glass Fieldset */
.glass-fieldset {
  display: none;
  margin: 1.25rem 0 1.75rem;
  padding: 1.75rem 1.5rem 1.5rem;
  border: 1px solid var(--card-border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.02);
  text-align: left;
}

.glass-fieldset.show {
  display: block;
  animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.glass-fieldset legend {
  padding: 0 12px;
  font-size: 0.95rem;
  color: var(--pink-light);
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

/* 2x2 Grid Layout */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

.form-grid .input-group {
  margin-bottom: 0;
}

/* Action Buttons */
.action-buttons {
  display: flex;
  gap: 14px;
  margin-top: 1rem;
}

.btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 24px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  border: none;
}

.glow-btn {
  background: linear-gradient(135deg, #ff007a, #7928ca);
  color: #ffffff;
  box-shadow: 0 8px 25px rgba(255, 0, 122, 0.35);
}

.glow-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 12px 35px rgba(255, 0, 122, 0.55);
  background: linear-gradient(135deg, #ff1a8c, #8a3bd8);
}

.ghost-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--card-border);
  color: #ffffff;
}

.ghost-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.25);
}

.btn-reset {
  background: rgba(255, 51, 102, 0.1);
  border: 1px solid rgba(255, 51, 102, 0.3);
  color: var(--danger-accent);
  width: auto;
  margin-top: 15px;
}

.btn-reset:hover {
  background: rgba(255, 51, 102, 0.2);
  border-color: rgba(255, 51, 102, 0.5);
}

.btn:disabled {
  opacity: 0.4 !important;
  cursor: not-allowed !important;
  transform: none !important;
  box-shadow: none !important;
}

/* Output Display Card */
.output {
  display: none;
  opacity: 0;
  transition: opacity 0.5s ease;
  margin-top: 2rem;
  position: relative;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 18px;
  padding: 2rem 1.5rem;
  border: 1px solid var(--card-border);
}

.output.show {
  display: block;
  opacity: 1;
  animation: fadeInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

h2#totpLabel {
  font-size: 1rem;
  color: var(--text-muted);
  margin: 0 0 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
}

#totp, #countdown, #totpLabel {
  opacity: 0;
  transition: opacity 0.3s ease;
}

#totp.visible, #countdown.visible, #totpLabel.visible {
  opacity: 1;
}

#totp {
  font-size: 3.5rem;
  font-weight: 800;
  color: var(--pink-light);
  margin-bottom: 12px;
  cursor: pointer;
  letter-spacing: 0.12em;
  font-family: 'SFMono-Regular', Consolas, monospace;
  text-shadow: 0 0 25px rgba(255, 0, 122, 0.45);
  transition: color 0.2s ease;
}

#totp:hover {
  color: #ffffff;
}

#countdown {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin: 0;
}

#copyBalloon {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  background: var(--pink-accent);
  color: white;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  white-space: nowrap;
  z-index: 10;
  box-shadow: 0 4px 15px rgba(255, 0, 122, 0.5);
}

.error-msg {
  color: var(--danger-accent);
  font-size: 0.9rem;
  font-weight: 500;
  margin-top: 8px;
  height: 0;
  opacity: 0;
  transition: all 0.3s ease;
}

.error-msg.success {
  color: var(--success-color);
}

.error-msg.show {
  height: auto;
  opacity: 1;
  margin-top: 10px;
}

/* QR Scanner Modal */
.qr-modal {
  display: none;
  position: fixed;
  z-index: 100;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(7, 7, 9, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  align-items: center;
  justify-content: center;
}

.qr-modal.show {
  display: flex;
}

.qr-modal-content {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(24px);
  padding: 2rem;
  border-radius: 24px;
  width: 90%;
  max-width: 440px;
  text-align: center;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.7);
}

.qr-modal-content p {
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 1rem;
  font-size: 1.1rem;
}

#qrVideo {
  width: 100%;
  height: auto;
  border-radius: 14px;
  margin-bottom: 1rem;
  border: 1px solid var(--card-border);
  background: #000000;
}

/* Global Animations & Utilities */
.hidden {
  display: none !important;
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes float {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(50px, 40px) scale(1.1); }
}

@media (max-width: 480px) {
  body { padding: 20px 10px; }
  .container { padding: 2.5rem 1.5rem; }
  .form-grid { grid-template-columns: 1fr; }
  .action-buttons { flex-direction: column; }
  #totp { font-size: 2.75rem; }
}