:root {
  --green-50:  #f0fdf5;
  --green-100: #dcfce9;
  --green-500: #22c55e;
  --green-600: #16a34a;
  --green-700: #15803d;

  --gray-50:  #f8fafb;
  --gray-100: #f1f4f3;
  --gray-200: #e4e9e7;
  --gray-400: #9ca6a3;
  --gray-600: #5b6864;
  --gray-800: #26302c;
  --gray-900: #14201b;

  --white: #ffffff;
  --danger: #dc2626;
  --danger-bg: #fef2f2;

  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;

  --shadow-card: 0 1px 2px rgba(20, 32, 27, 0.04), 0 8px 24px rgba(20, 32, 27, 0.06);
  --shadow-btn: 0 1px 2px rgba(22, 163, 74, 0.15);

  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100dvh;
  background: linear-gradient(180deg, var(--green-50) 0%, var(--gray-50) 320px);
  color: var(--gray-900);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Topbar */
.topbar {
  padding: 18px 20px;
  padding-top: max(18px, env(safe-area-inset-top));
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 480px;
  margin: 0 auto;
}

.topbar__logo {
  font-size: 22px;
  line-height: 1;
}

.topbar__title {
  font-size: 17px;
  font-weight: 700;
  color: var(--gray-900);
  letter-spacing: -0.01em;
}

/* Content */
.content {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12px 16px 32px;
}

.view {
  width: 100%;
  max-width: 480px;
}

/* Card */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 28px 24px 26px;
}

.card__title {
  margin: 4px 0 8px;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--gray-900);
}

.card__subtitle {
  margin: 0 0 24px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--gray-600);
}

/* Form */
.form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.field-row .field {
  flex: 1;
  min-width: 120px;
}

.field-row .field--series {
  flex: 0 1 100px;
}

.field__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-800);
}

.field__input {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  font-size: 17px;
  font-family: inherit;
  color: var(--gray-900);
  background: var(--gray-50);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.field__input::placeholder {
  color: var(--gray-400);
}

.field__input:focus {
  background: var(--white);
  border-color: var(--green-500);
  box-shadow: 0 0 0 4px var(--green-100);
}

.field__input.is-invalid {
  border-color: var(--danger);
  background: var(--danger-bg);
}

.form-error {
  margin: -4px 0 0;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--danger);
  background: var(--danger-bg);
  border-radius: var(--radius-sm);
}

.form-error-contact {
  margin: -8px 0 0;
  padding: 0 14px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--gray-600);
}

.form-error-contact a {
  color: var(--green-700);
  font-weight: 600;
  text-decoration: none;
}

.form-error-contact a:hover {
  text-decoration: underline;
}

/* Buttons */
.btn {
  position: relative;
  height: 52px;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.1s ease, background-color 0.15s ease, opacity 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.98);
}

.btn--primary {
  background: var(--green-600);
  color: var(--white);
  box-shadow: var(--shadow-btn);
}

.btn--primary:hover {
  background: var(--green-700);
}

.btn--primary:disabled {
  opacity: 0.75;
  cursor: default;
}

.btn--secondary {
  width: 100%;
  margin-top: 24px;
  background: var(--green-50);
  color: var(--green-700);
  border: 1.5px solid var(--green-100);
}

.btn--secondary:hover {
  background: var(--green-100);
}

.btn__spinner {
  display: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.4);
  border-top-color: var(--white);
  animation: spin 0.7s linear infinite;
}

.btn.is-loading .btn__label {
  opacity: 0.85;
}

.btn.is-loading .btn__spinner {
  display: inline-block;
}

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

/* Result view */
.result-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.result-header__badge {
  flex-shrink: 0;
  min-width: 56px;
  height: 56px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--green-600);
  color: var(--white);
  font-size: 20px;
  font-weight: 800;
  border-radius: 16px;
  box-shadow: var(--shadow-btn);
}

.result-header__name {
  margin: 0 0 2px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--gray-900);
  word-break: break-word;
}

.result-header__hint {
  margin: 0;
  font-size: 14px;
  color: var(--gray-600);
}

.info-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.info-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px;
  background: var(--gray-50);
  border: 1px solid var(--gray-100);
  border-radius: var(--radius-md);
}

.info-item__icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  background: var(--white);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(20, 32, 27, 0.06);
}

.info-item__body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.info-item__label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.info-item__value {
  font-size: 15.5px;
  font-weight: 600;
  color: var(--gray-900);
  word-break: break-word;
}

.info-item__note {
  font-size: 14px;
  color: var(--gray-600);
  word-break: break-word;
}

.info-item__link {
  margin-top: 4px;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--green-700);
  text-decoration: none;
  width: fit-content;
}

.info-item__link:hover {
  text-decoration: underline;
}

.info-item__link[hidden] {
  display: none;
}

/* Footer */
.footer {
  padding: 16px 20px max(16px, env(safe-area-inset-bottom));
  text-align: center;
}

.footer p {
  margin: 0;
  font-size: 12.5px;
  color: var(--gray-400);
}

/* Small screens */
@media (max-width: 380px) {
  .card {
    padding: 22px 18px 20px;
    border-radius: 16px;
  }

  .card__title {
    font-size: 21px;
  }
}
