*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: #ececec;
  color: #1a1a1a;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

.header {
  padding: 24px 40px;
  padding-top: max(24px, env(safe-area-inset-top));
  padding-left: max(40px, env(safe-area-inset-left));
  padding-right: max(40px, env(safe-area-inset-right));
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.logo img {
  height: 46px;
  width: auto;
  max-width: 100%;
  display: block;
}

.help-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 22px;
  background: #fff;
  border: 1px solid #d5d5d5;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 500;
  color: #333;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.help-btn:hover {
  border-color: #bbb;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.help-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #2e9e4f;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
}

.main {
  display: flex;
  justify-content: center;
  padding: 20px 24px 60px;
  padding-bottom: max(60px, env(safe-area-inset-bottom));
  padding-left: max(24px, env(safe-area-inset-left));
  padding-right: max(24px, env(safe-area-inset-right));
}

.login-card {
  width: 100%;
  max-width: 680px;
  background: #fff;
  border-radius: 28px;
  padding: 48px 56px 44px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

.login-title {
  text-align: center;
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 36px;
  letter-spacing: -0.02em;
}

.username-input {
  width: 100%;
  padding: 18px 24px;
  border: 1px solid #d8d8d8;
  border-radius: 999px;
  font-size: 16px;
  color: #1a1a1a;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

.username-input::placeholder {
  color: #aaa;
}

.username-input:focus {
  border-color: #2e9e4f;
  box-shadow: 0 0 0 3px rgba(46, 158, 79, 0.12);
}

.submit-btn {
  display: block;
  width: 100%;
  margin-top: 36px;
  padding: 18px 24px;
  min-height: 52px;
  border: none;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
  background: #d4d4d4;
  color: #888;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.submit-btn:not(:disabled) {
  background: #2e9e4f;
  color: #fff;
}

.submit-btn:not(:disabled):hover {
  background: #268a44;
}

.submit-btn:disabled {
  cursor: not-allowed;
}

.sms-info {
  text-align: center;
  font-size: 15px;
  color: #555;
  line-height: 1.55;
  margin-bottom: 28px;
}

.sms-info strong {
  color: #1a1a1a;
  font-weight: 700;
}

.sms-input {
  text-align: center;
  font-size: 18px;
  font-weight: 600;
}

.sms-resend {
  margin-top: 24px;
  text-align: center;
  font-size: 14px;
  color: #666;
}

.error-banner {
  background: #fdeaea;
  border: 1px solid #f3b4b4;
  color: #b42318;
  padding: 14px 18px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 24px;
  text-align: center;
}

.link-btn {
  background: none;
  border: none;
  padding: 0;
  color: #2e9e4f;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  -webkit-tap-highlight-color: transparent;
}

.link-btn:hover {
  color: #268a44;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-stack .submit-btn {
  margin-top: 20px;
}

.input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.loading-card {
  text-align: center;
}

.loading-title {
  margin-bottom: 16px;
}

.spinner {
  width: 48px;
  height: 48px;
  margin: 0 auto 28px;
  border: 4px solid #e5e5e5;
  border-top-color: #2e9e4f;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.success-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  margin-top: 8px;
  background: #2e9e4f;
  color: #fff;
}

@media (max-width: 768px) {
  .header {
    padding: 16px 20px;
    padding-top: max(16px, env(safe-area-inset-top));
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
  }

  .header-inner {
    gap: 12px;
  }

  .logo img {
    height: 40px;
  }

  .help-btn {
    padding: 8px 16px;
    font-size: 14px;
    gap: 8px;
    flex-shrink: 0;
  }

  .help-icon {
    width: 22px;
    height: 22px;
    font-size: 13px;
  }

  .main {
    padding: 12px 16px 40px;
    padding-bottom: max(40px, env(safe-area-inset-bottom));
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
    align-items: flex-start;
  }

  .login-card {
    padding: 32px 24px 28px;
    border-radius: 24px;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.05);
  }

  .login-title {
    font-size: 24px;
    margin-bottom: 28px;
  }

  .sms-info {
    font-size: 14px;
    margin-bottom: 24px;
  }

  .sms-input {
    font-size: 18px;
  }

  .submit-btn {
    margin-top: 28px;
    min-height: 48px;
  }
}

@media (max-width: 380px) {
  .header-inner {
    align-items: center;
  }

  .logo img {
    height: 36px;
  }

  .help-btn {
    padding: 8px 12px;
    font-size: 13px;
  }

  .help-btn .help-label {
    display: none;
  }

  .login-card {
    padding: 24px 16px 22px;
    border-radius: 20px;
  }

  .login-title {
    font-size: 22px;
    margin-bottom: 24px;
  }

  .username-input {
    padding: 16px 20px;
  }

  .input-row {
    grid-template-columns: 1fr;
  }
}
