:root {
  --bg: rgba(8, 8, 8, 0.95);
  --card-bg: #141414;
  --border: #333;
  --border-focus: #e50914;
  --text: #ffffff;
  --text-dim: #999999;
  --error: #ff6b6b;
  --success: #46d369;
  --accent: #e50914;
  --accent-hover: #f6121d;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: linear-gradient(rgba(8, 8, 8, 0.45), rgba(8, 8, 8, 0.45)), url("images/background.jpg");
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 50px 16px;
}

.site-header {
  width: 100%;
  max-width: 520px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 50px;
}
.site-header .logo {
  height: 80px;
  width: auto;
  display: block;
}

.card {
  width: 100%;
  max-width: 520px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 40px;
}

h1 {
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 6px;
  letter-spacing: 0.01em;
}

.subtitle {
  color: var(--text-dim);
  font-size: 15px;
  margin: 0 0 32px;
}

fieldset {
  border: none;
  padding: 0;
  margin: 0 0 28px;
}

legend {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 14px;
  padding: 0;
}

.row {
  display: flex;
  gap: 14px;
}

.field {
  flex: 1;
  margin-bottom: 18px;
  position: relative;
}

label {
  display: block;
  font-size: 13px;
  margin-bottom: 7px;
  color: var(--text-dim);
}

input,
select {
  width: 100%;
  background-color: #000000;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 18px 14px;
  min-height: 54px;
  font-size: 16px;
  font-family: "Roboto", sans-serif;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, background-color 0.15s;
  font-variant-numeric: tabular-nums;
}
input::placeholder { color: #666666; }
input:focus, select:focus { border-color: var(--border-focus); background-color: #0a0a0a; }
input.invalid, select.invalid { border-color: var(--error); }
input.valid, select.valid { border-color: var(--success); }

/* Native <select> is kept in the DOM for form semantics/value, but its own
   dropdown is invisible cross-browser chrome we can't restyle — CustomSelect
   (script.js) renders the visible trigger + listbox on top of it. */
.custom-select {
  position: relative;
}
.custom-select select.native-select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
}

.select-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background-color: #000000;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 18px 14px;
  min-height: 54px;
  font-size: 16px;
  font-family: "Roboto", sans-serif;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}
.select-trigger:focus,
.select-trigger:focus-visible {
  outline: none;
  border-color: var(--border-focus);
  background-color: #0a0a0a;
}
.select-trigger.invalid { border-color: var(--error); }
.select-trigger.valid { border-color: var(--success); }

.select-trigger-label.is-placeholder { color: #666666; }

.select-caret {
  flex: none;
  width: 12px;
  height: 8px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath fill='%23999' d='M6 8 0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: contain;
  transition: transform 0.15s;
}
.select-trigger[aria-expanded="true"] .select-caret {
  transform: rotate(180deg);
}

.select-options {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 4px;
  max-height: 260px;
  overflow-y: auto;
  list-style: none;
  background-color: #0d0d0d;
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.55);
  display: none;
  scrollbar-width: thin;
  scrollbar-color: #444 transparent;
}
.select-options.open { display: block; }
.select-options::-webkit-scrollbar { width: 8px; }
.select-options::-webkit-scrollbar-track { background: transparent; }
.select-options::-webkit-scrollbar-thumb { background: #444; border-radius: 4px; }

.select-option {
  padding: 10px 12px;
  border-radius: 4px;
  font-size: 15px;
  color: var(--text);
  cursor: pointer;
}
.select-option.is-placeholder { color: #666666; }
.select-option.highlighted { background: rgba(229, 9, 20, 0.18); }
.select-option.selected {
  background: var(--accent);
  color: #ffffff;
}

.card-number-wrap { position: relative; }
.brand-badge {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  height: 24px;
  width: auto;
  border-radius: 3px;
  pointer-events: none;
}

.error-text {
  color: var(--error);
  font-size: 13px;
  margin-top: 6px;
  min-height: 15px;
}

button[type="submit"] {
  width: 100%;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 4px;
  padding: 18px;
  min-height: 60px;
  font-size: 18px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}
button[type="submit"]:hover { background: var(--accent-hover); }
button[type="submit"]:disabled { opacity: 0.5; cursor: not-allowed; }

.status-banner {
  display: none;
  margin-bottom: 22px;
  padding: 14px 16px;
  border-radius: 4px;
  font-size: 14px;
  background: rgba(255, 107, 107, 0.1);
  border: 1px solid rgba(255, 107, 107, 0.35);
  color: var(--error);
}
.status-banner.show { display: block; }
.status-banner.ok,
.status-banner.success {
  background: rgba(70, 211, 105, 0.1);
  border: 1px solid rgba(70, 211, 105, 0.35);
  color: var(--success);
}

.lock-note {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 22px;
  justify-content: center;
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 40px;
  max-width: 400px;
  text-align: center;
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header h2 {
  margin: 0 0 20px 0;
  font-size: 24px;
  color: var(--text);
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.checkmark {
  font-size: 64px;
  color: var(--success);
  font-weight: bold;
}

.modal-body p {
  margin: 0;
  font-size: 16px;
  color: var(--text);
}

.redirect-text {
  font-size: 14px;
  color: var(--text-dim);
}

@media (max-width: 600px) {
  body {
    padding: 16px 0;
  }
  .site-header {
    max-width: 100%;
    margin-bottom: 24px;
    padding: 0 16px;
  }
  .site-header .logo {
    height: 50px;
  }
  .card {
    max-width: 100%;
    width: 100%;
    padding: 20px;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
  }
  h1 {
    font-size: 19px;
    margin: 0 0 6px 0;
    font-weight: 600;
  }
  .subtitle {
    font-size: 13px;
    margin: 0 0 14px 0;
    color: var(--text-dim);
  }
  .status-banner {
    margin-bottom: 14px;
    padding: 11px 12px;
    font-size: 12px;
    border-radius: 3px;
  }
  fieldset {
    margin-bottom: 14px;
    padding: 0;
    border: none;
  }
  fieldset:last-of-type {
    margin-bottom: 0;
  }
  legend {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 10px;
    padding: 0;
    color: var(--text-dim);
    font-weight: 500;
  }
  .field {
    margin-bottom: 10px;
  }
  .field:last-child {
    margin-bottom: 0;
  }
  .field label {
    font-size: 12px;
    margin-bottom: 5px;
    font-weight: 500;
    display: block;
  }
  .error-text {
    font-size: 11px;
    margin-top: 4px;
  }
  .row {
    flex-direction: column;
    gap: 0;
  }
  input,
  .select-trigger {
    min-height: 44px;
    padding: 11px 12px;
    font-size: 16px;
    border-radius: 3px;
  }
  button[type="submit"] {
    min-height: 48px;
    font-size: 14px;
    margin-top: 14px;
    border-radius: 3px;
  }
  .lock-note {
    font-size: 10px;
    margin-top: 12px;
  }
  .card-number-wrap {
    position: relative;
  }
  .brand-badge {
    height: 20px !important;
    width: 32px !important;
  }
  .select-options {
    font-size: 14px;
  }
  .select-option {
    padding: 10px 12px;
  }
}
