:root {
  --bg1: #a8edea;
  --bg2: #fed6e3;
  --card: #ffffff;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --success: #10b981;
  --error: #f43f5e;
  --text: #1e293b;
  --muted: #64748b;
}
* { box-sizing: border-box; }
body {
  font-family: 'Nunito', system-ui, sans-serif;
  background: linear-gradient(135deg, var(--bg1), var(--bg2));
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.container {
  background: var(--card);
  padding: 2.5rem 2rem 2rem;
  border-radius: 28px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.12), 0 0 0 1px rgba(255,255,255,0.6);
  width: 100%;
  max-width: 440px;
  position: relative;
}
h1 {
  margin: 0 0 0.5rem;
  text-align: center;
  color: var(--text);
  font-weight: 800;
  font-size: 2.1rem;
  letter-spacing: -0.5px;
}
.header-image {
  text-align: center;
}
.subtitle {
  text-align: center;
  color: var(--muted);
  margin-bottom: 1.8rem;
  font-size: 1.05rem;
  font-weight: 600;
}
label {
  display: block;
  margin: 1.2rem 0 0.5rem;
  font-weight: 700;
  color: #334155;
  font-size: 0.95rem;
}
input[type="text"], input[type="password"] {
  width: 100%;
  padding: 0.95rem 1.1rem;
  font-size: 1.15rem;
  font-family: inherit;
  border: 3px solid #e2e8f0;
  border-radius: 16px;
  background: #f8fafc;
  transition: all 0.2s ease;
}
input:focus {
  outline: none;
  border-color: var(--accent);
  background: white;
  box-shadow: 0 0 0 4px rgba(99,102,241,0.15);
}
.password-wrapper {
  position: relative;
}
#togglePassword {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  transition: background 0.2s;
}
#togglePassword:hover { background: #f1f5f9; }
button[type="submit"], .btn {
  width: 100%;
  margin-top: 1.6rem;
  padding: 1rem;
  font-size: 1.15rem;
  font-weight: 700;
  font-family: inherit;
  background: linear-gradient(135deg, var(--accent), #818cf8);
  color: white;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(99,102,241,0.3);
  transition: all 0.2s ease;
}
button[type="submit"]:hover, .btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(99,102,241,0.4);
}
button[type="submit"]:active, .btn:active {
  transform: translateY(1px);
}
.settings-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  background: #f1f5f9;
  border: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 1.25rem;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  transition: all 0.2s;
}
.settings-btn:hover {
  background: #e2e8f0;
  transform: scale(1.05);
}
.about-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: white;
  border: none;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  font-size: 1.6rem;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0,0,0,0.15);
  z-index: 40;
  transition: all 0.2s;
}
.about-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 10px 24px rgba(0,0,0,0.2);
}
.error {
  border-color: var(--error) !important;
  background: #fff1f2 !important;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-7px); }
  40%, 80% { transform: translateX(7px); }
}
.shake { animation: shake 0.45s ease-in-out; }

/* Modal */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.55);
  backdrop-filter: blur(4px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal.active { display: flex; }
.modal-content {
  background: white;
  padding: 1.75rem;
  border-radius: 24px;
  width: 100%;
  max-width: 420px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px rgba(0,0,0,0.18);
}
.about-modal .modal-content {
  max-width: 62vw;
}
@media (max-width: 480px) {
  .about-modal .modal-content {
    max-width: 100%;
    width: 100%;
    border-radius: 20px 20px 0 0;
    max-height: 90vh;
  }
}
.modal-content h2 {
  margin-top: 0;
  font-weight: 800;
  color: var(--text);
}
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 1.15rem 0;
  gap: 1rem;
}
.toggle-row label {
  margin: 0;
  font-weight: 600;
  font-size: 1rem;
  color: #334155;
}
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
  flex-shrink: 0;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #cbd5e1;
  transition: .3s;
  border-radius: 28px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
input:checked + .slider {
  background-color: var(--accent);
}
input:checked + .slider:before {
  transform: translateX(22px);
}
.about-text {
  line-height: 1.55;
  color: #334155;
}
.about-text p { margin: 0.85rem 0; }
.about-text ul { padding-left: 1.3rem; margin: 0.5rem 0; }
.modal-buttons {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.2rem;
}
.modal-buttons .btn {
  margin-top: 0;
  flex: 1;
}
.success-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(16,185,129,0.12);
  z-index: 50;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}
.success-overlay.active { display: flex; }
.success-message {
  background: white;
  padding: 2.2rem 3.2rem;
  border-radius: 24px;
  text-align: center;
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--success);
  box-shadow: 0 15px 40px rgba(0,0,0,0.18);
}
#confettiCanvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 60;
}
.hidden { display: none; }