:root {
  --primary: #ffffff;
  --primary-dark: #e5e5e5;
  --bg-card: #ffffff;
  --text: #1a1a1a;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --gold: #c4b155;
}

* { box-sizing: border-box; }
*::-webkit-scrollbar { display: none; }

html.deneigement-root,
body.deneigement-standalone {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100%;
  min-height: 100dvh;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
  background: transparent;
  overflow: hidden;
}

body.deneigement-standalone {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  touch-action: manipulation;
}

.app-recharge-splash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  pointer-events: none;
}
.app-recharge-splash[hidden],
html.app-boot-done .app-recharge-splash {
  display: none !important;
}
.app-recharge-splash__logo {
  width: min(72vw, 280px);
  height: auto;
  aspect-ratio: 420 / 158;
  object-fit: contain;
}

#simulator-wrapper,
#phone-scale-wrap,
#phone-frame,
#app-container {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 0;
  min-height: 100%;
}

#app-container {
  padding-top: env(safe-area-inset-top, 0px);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.screen:not(.active) {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}
.screen.active {
  display: flex !important;
  visibility: visible !important;
  pointer-events: auto !important;
  flex: 1 1 auto;
  min-height: 0;
}

.form { display: flex; flex-direction: column; gap: 20px; flex: 1; }
.input-group { display: flex; flex-direction: column; gap: 10px; }
.input-group label {
  font-size: 0.875rem;
  color: #fff;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.55);
  font-weight: 600;
}
.input-group input {
  padding: 14px 16px;
  min-height: 48px;
  font-size: 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
}
.input-group input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(196, 177, 85, 0.25);
}

.password-wrap { position: relative; display: flex; align-items: center; }
.password-wrap input { padding-right: 48px; flex: 1; }
.password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  background: none;
  color: #4b5563;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}
.password-wrap.show-password .icon-eye { display: none; }
.password-wrap.show-password .icon-eye-off { display: block !important; }

.error-msg {
  display: none;
  background: rgba(220, 38, 38, 0.15);
  color: #b91c1c;
  padding: 12px 16px;
  border-radius: 12px;
  margin-bottom: 0;
  font-size: 0.9rem;
  border: 1px solid rgba(220, 38, 38, 0.3);
}
.error-msg[data-visible="1"] { display: block; }

.btn-primary, .btn-secondary {
  padding: 16px 24px;
  min-height: 48px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
}
.btn-primary {
  background: #ffffff;
  color: #1a1a1a;
  text-transform: uppercase;
}
.btn-primary:hover { background: #f0f0f0; }
.btn-primary:disabled { opacity: 0.7; cursor: not-allowed; }
.btn-block { width: 100%; text-align: center; }
.btn-secondary {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

@keyframes loginFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes loginLogoIn {
  from { transform: scale(0.96); }
  to { transform: scale(1); }
}

#login-screen.login-screen {
  padding: 0 24px;
  padding-top: max(12px, 16px);
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  row-gap: 20px;
  position: relative;
  overflow-x: hidden;
  overflow-y: auto;
  isolation: isolate;
}
#login-screen.login-screen::before,
#verify-screen.verify-screen::before {
  content: none;
  display: none;
}

.login-header {
  text-align: center;
  padding: 32px 0 clamp(24px, 5vmin, 36px);
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: loginFadeIn 0.5s ease-out forwards;
}
.login-logo-wrap {
  margin-bottom: 22px;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px 20px;
  min-height: 88px;
  width: 100%;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  animation: loginLogoIn 0.6s ease-out 0.1s both;
}
.login-logo {
  width: 100%;
  max-width: min(320px, 85vw);
  height: auto;
  min-height: 64px;
  max-height: 160px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.15));
}
.login-title {
  font-size: clamp(1.85rem, 4.8vmin + 0.75rem, 2.45rem);
  font-weight: 700;
  color: #fff;
  margin: 0 auto;
  text-align: center;
  letter-spacing: 0.02em;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.45), 0 1px 2px rgba(0, 0, 0, 0.6);
}
#login-screen .login-form {
  flex: 1 1 auto;
  gap: 20px;
  width: 100%;
  animation: loginFadeIn 0.45s ease-out 0.15s both;
}
#login-screen #login-btn {
  background: #ffffff;
  color: #1a1a1a;
  text-transform: uppercase;
}
.login-version-row { text-align: center; margin: 0; }
.login-app-version-primary {
  margin: 0;
  font-size: 0.9rem;
  color: #fff;
  font-weight: 600;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
}

#verify-screen.verify-screen {
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 16px 20px;
  overflow-y: auto;
  position: relative;
  isolation: isolate;
}
.verify-top {
  text-align: center;
  max-width: 340px;
  width: 100%;
  margin-bottom: 12px;
}
.verify-title {
  font-size: clamp(1.2rem, 3.8vw, 1.65rem);
  font-weight: 700;
  margin: 0 0 8px;
  color: #fff;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.45), 0 1px 2px rgba(0, 0, 0, 0.6);
}
.verify-subtitle {
  font-size: clamp(0.88rem, 2.4vw, 1.02rem);
  color: #fff;
  margin: 0 0 8px;
  line-height: 1.45;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.55);
}
.verify-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 340px;
}
.verify-center {
  display: flex;
  justify-content: center;
}
.verify-code-input {
  width: 100%;
  max-width: 220px;
  min-height: 64px;
  font-size: clamp(1.75rem, 6vw, 2.5rem);
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.42em;
  padding: 12px 10px;
  border: 2px solid var(--gold);
  border-radius: 16px;
  background: #fff;
}
.verify-code-input:focus {
  outline: none;
  border-color: #a8943d;
  box-shadow: 0 0 0 3px rgba(196, 177, 85, 0.28);
}
.verify-bottom {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.verify-btn { width: 100%; min-height: 52px; border-radius: 14px; }
#btn-resend-code-app {
  width: 100%;
  min-height: 48px;
  border-radius: 12px;
  font-weight: 600;
  background: #0a0a0a;
  color: #fff;
  border: 1px solid #0a0a0a;
}
#cancel-verify {
  width: 100%;
  min-height: 48px;
  border-radius: 12px;
  font-weight: 600;
  background: #6b7280;
  color: #fff;
  border: 1px solid #6b7280;
}
.resend-code-msg {
  min-height: 1.2em;
  font-size: 0.85rem;
  color: #fff;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
}
