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

:root {
  --brand: #E8192C;
  --btn-bg: #4A6587;
  --btn-hover: #3d5472;
  --text-primary: #1a1a1a;
  --text-secondary: #555;
  --text-hint: #888;
  --input-bg: #F2F2F7;
  --input-border: #E0E0E5;
  --error: #E8192C;
  --info-bg: #FFF3CD;
  --info-border: #FFC107;
  --info-text: #856404;
  --white: #ffffff;
  --radius-input: 12px;
  --radius-btn: 50px;
  --radius-card: 0px;
}

html, body {
  height: 100%;
  background: var(--white);
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  color: var(--text-primary);
}

body {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: 100vh;
  padding: 0;
}

.screen {
  display: none;
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  padding: 0;
}

.screen.active {
  display: block;
}

.card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 48px 24px 40px;
  gap: 0;
}

/* BRAND */
.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 20px;
}

.logo {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  object-fit: cover;
  margin-bottom: 10px;
}

.brand-name {
  font-size: 26px;
  font-weight: 700;
  color: var(--brand);
  letter-spacing: -0.3px;
}

/* HINTS */
.hint {
  font-size: 15px;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 24px;
}

.info-text {
  font-size: 14px;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 4px;
}

/* INPUT */
.field-wrap {
  width: 100%;
  margin-bottom: 16px;
}

.input {
  width: 100%;
  background: var(--input-bg);
  border: 1.5px solid transparent;
  border-radius: var(--radius-input);
  padding: 15px 16px;
  font-size: 16px;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

.input::placeholder {
  color: var(--text-hint);
}

.input:focus {
  border-color: var(--btn-bg);
  background: var(--white);
}

.input.error {
  border-color: var(--error);
  background: #FFF5F5;
}

/* FIELD ERROR */
.field-error {
  font-size: 13px;
  color: var(--error);
  margin-top: 6px;
  padding-left: 4px;
}

/* INFO / ERROR BLOCKS */
.info-block {
  width: 100%;
  background: var(--info-bg);
  border: 1px solid var(--info-border);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 14px;
  color: var(--info-text);
  text-align: center;
  margin-bottom: 16px;
}

.error-block {
  width: 100%;
  background: #FFF5F5;
  border: 1px solid #FFCDD2;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 14px;
  color: var(--error);
  text-align: center;
  margin-bottom: 16px;
}

/* BUTTONS */
.btn {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: var(--radius-btn);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  -webkit-appearance: none;
  appearance: none;
}

.btn-primary {
  background: var(--btn-bg);
  color: var(--white);
  margin-top: 8px;
}

.btn-primary:hover:not(:disabled) {
  background: var(--btn-hover);
}

.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-link {
  background: none;
  border: none;
  color: var(--btn-bg);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* OTP CELLS */
.otp-fields {
  display: flex;
  gap: 12px;
  margin-bottom: 8px;
}

.otp-cell {
  width: 64px;
  height: 64px;
  text-align: center;
  font-size: 28px;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--input-bg);
  border: 1.5px solid var(--input-border);
  border-radius: 12px;
  outline: none;
  caret-color: transparent;
  transition: border-color 0.2s, background 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

.otp-cell:focus {
  border-color: var(--btn-bg);
  background: var(--white);
}

.otp-cell.error {
  border-color: var(--error);
  background: #FFF5F5;
  color: var(--error);
}

/* RESEND */
.resend-block {
  margin-top: 16px;
  text-align: center;
  min-height: 28px;
}

.resend-timer {
  font-size: 14px;
  color: var(--text-hint);
}

/* SPINNER */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255,255,255,0.4);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* RESULT SCREENS */
.result-icon {
  font-size: 56px;
  margin: 8px 0 12px;
  line-height: 1;
}

.result-icon--success { color: #34C759; }
.result-icon--fail    { color: var(--error); }

.result-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

/* UTILS */
.hidden {
  display: none !important;
}

@media (max-width: 400px) {
  .otp-cell {
    width: 56px;
    height: 56px;
    font-size: 24px;
  }
  .card {
    padding: 36px 16px 32px;
  }
}
