:root {
  color-scheme: dark;
  --bg: #0b0d12;
  --bg-2: #0f1218;
  --card: #14181f;
  --card-2: #171c24;
  --border: #232a35;
  --border-strong: #303948;
  --text: #eef1f5;
  --muted: #98a1b0;
  --faint: #6b7482;
  --accent: #5b9bff;
  --accent-2: #7c5bff;
  --ok: #34d399;
  --bad: #f65a6c;
  --warn: #f2c34e;
  --radius: 14px;
  --shadow: 0 12px 40px -12px rgba(0, 0, 0, 0.6);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1100px 600px at 50% -10%, rgba(91, 155, 255, 0.10), transparent 60%),
    linear-gradient(180deg, var(--bg-2), var(--bg));
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.bg-glow {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(600px 300px at 15% 20%, rgba(124, 91, 255, 0.08), transparent 70%),
    radial-gradient(500px 300px at 90% 30%, rgba(52, 211, 153, 0.06), transparent 70%);
  pointer-events: none;
}

.wrap {
  max-width: 620px;
  margin: 0 auto;
  padding: 48px 20px 72px;
}

/* ---------- header ---------- */
.header {
  text-align: center;
  margin-bottom: 30px;
}

.logo {
  width: 54px;
  height: 54px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  color: var(--accent);
  background: linear-gradient(145deg, rgba(91, 155, 255, 0.18), rgba(124, 91, 255, 0.12));
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
}

.logo svg {
  width: 28px;
  height: 28px;
}

.header h1 {
  margin: 0 0 8px;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  background: linear-gradient(90deg, #fff, #b9c6e6);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  color: var(--muted);
  margin: 0 auto;
  max-width: 44ch;
  font-size: 0.96rem;
}

.trust-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
}

.chip-mini {
  font-size: 0.72rem;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 999px;
}

/* ---------- card ---------- */
.card {
  background: linear-gradient(180deg, var(--card-2), var(--card));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}

.field + .field {
  margin-top: 18px;
}

label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 8px;
  letter-spacing: 0.01em;
}

/* ---------- inputs ---------- */
.select-wrap {
  position: relative;
}

select,
input[type="password"],
input[type="text"] {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: #0c0f14;
  color: var(--text);
  font-size: 0.95rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 40px;
  cursor: pointer;
}

.select-caret {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--faint);
  pointer-events: none;
}

select:focus,
input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(91, 155, 255, 0.18);
}

input::placeholder {
  color: var(--faint);
}

.key-row {
  display: flex;
  gap: 8px;
}

.key-row input {
  flex: 1;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.02em;
}

/* ---------- inline privacy line ---------- */
.inline-privacy {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 10px;
  padding: 8px 12px;
  background: rgba(52, 211, 153, 0.05);
  border: 1px solid rgba(52, 211, 153, 0.15);
  border-radius: 8px;
}

.inline-privacy svg {
  width: 15px;
  height: 15px;
  color: var(--ok);
  flex: none;
}

.inline-privacy span {
  font-size: 0.76rem;
  color: #8ec9b0;
  line-height: 1.4;
}

.hint {
  color: var(--faint);
  font-size: 0.78rem;
  margin: 8px 0 0;
  min-height: 1em;
}

.detected {
  color: var(--accent);
  font-weight: 500;
}

.hint-amber {
  color: var(--warn);
  font-weight: 500;
}

/* ---------- quick-select chips ---------- */
.quick-select {
  margin-top: 10px;
  padding: 12px 14px;
  background: rgba(242, 195, 78, 0.05);
  border: 1px solid rgba(242, 195, 78, 0.15);
  border-radius: 10px;
  animation: rise 0.2s ease;
}

.quick-select.hidden {
  display: none;
}

.quick-select-label {
  display: block;
  font-size: 0.76rem;
  color: #c9aa5e;
  margin-bottom: 10px;
}

.quick-select-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.quick-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border-strong);
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.quick-chip:hover {
  border-color: var(--warn);
  background: rgba(242, 195, 78, 0.08);
}

.quick-chip-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
}

/* ---------- dropdown pulse animation ---------- */
.select-wrap.pulse select {
  animation: pulse-border 1.5s ease;
}

@keyframes pulse-border {
  0%, 100% {
    border-color: var(--border-strong);
    box-shadow: none;
  }
  20%, 60% {
    border-color: var(--warn);
    box-shadow: 0 0 0 3px rgba(242, 195, 78, 0.2);
  }
}

/* ---------- buttons ---------- */
.actions {
  display: flex;
  gap: 10px;
  margin-top: 22px;
}

button {
  cursor: pointer;
  font-size: 0.92rem;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  font-family: inherit;
  transition: transform 0.08s ease, background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

button:active {
  transform: translateY(1px);
}

.btn-primary {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #06101f;
  border: none;
  font-weight: 650;
  padding: 12px 20px;
  flex: 1;
  box-shadow: 0 8px 22px -10px rgba(91, 155, 255, 0.7);
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(1.06);
}

.btn-primary:disabled {
  opacity: 0.7;
  cursor: progress;
}

.btn-secondary {
  background: transparent;
  color: var(--muted);
  padding: 12px 18px;
}

.btn-secondary:hover {
  color: var(--text);
  border-color: var(--faint);
}

.btn-icon {
  display: inline-grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
  border: 1px solid var(--border-strong);
  padding: 0 12px;
  border-radius: 10px;
  min-width: 46px;
}

.btn-icon:hover {
  color: var(--text);
  border-color: var(--faint);
}

.btn-icon .icon {
  width: 19px;
  height: 19px;
}

/* icon toggling via classes (no emoji, no inline styles) */
.icon-eye-off,
.icon-check {
  display: none;
}

#toggle-visibility.revealed .icon-eye {
  display: none;
}

#toggle-visibility.revealed .icon-eye-off {
  display: inline;
}

#copy-btn.copied .icon-copy {
  display: none;
}

#copy-btn.copied .icon-check {
  display: inline;
  color: var(--ok);
}

/* ---------- spinner ---------- */
.spinner {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(6, 16, 31, 0.35);
  border-top-color: #06101f;
  border-radius: 50%;
  display: none;
  animation: spin 0.6s linear infinite;
}

.btn-primary.loading .spinner {
  display: inline-block;
}

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

/* ---------- security card ---------- */
.security-card {
  border-left: 3px solid var(--ok);
}

.section-title {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0 0 16px;
  color: var(--text);
}

.section-title svg {
  width: 18px;
  height: 18px;
  color: var(--ok);
}

.security-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.security-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.security-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  flex: none;
}

.security-icon svg {
  width: 18px;
  height: 18px;
}

.icon-green {
  background: rgba(52, 211, 153, 0.12);
  color: var(--ok);
  border: 1px solid rgba(52, 211, 153, 0.2);
}

.icon-amber {
  background: rgba(242, 195, 78, 0.12);
  color: var(--warn);
  border: 1px solid rgba(242, 195, 78, 0.2);
}

.security-text {
  flex: 1;
  min-width: 0;
}

.security-headline {
  margin: 0 0 2px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text);
}

.security-sub {
  margin: 0;
  font-size: 0.77rem;
  color: var(--muted);
  line-height: 1.45;
}

.security-sub code {
  background: #0c0f14;
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.9em;
}

/* ---------- providers strip ---------- */
.providers-section {
  margin-bottom: 18px;
}

.providers-label {
  font-size: 0.75rem;
  color: var(--faint);
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.providers-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.provider-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  color: var(--muted);
  background: var(--card);
  border: 1px solid var(--border);
  padding: 5px 11px;
  border-radius: 999px;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.provider-pill:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.provider-pill-manual {
  border-style: dashed;
  border-color: rgba(242, 195, 78, 0.25);
}

.provider-pill-manual:hover {
  border-color: rgba(242, 195, 78, 0.5);
}

.provider-pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
}

/* ---------- result ---------- */
.result {
  animation: rise 0.28s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.result.hidden {
  display: none;
}

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

.result-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.provider-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--faint);
  flex: none;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.04);
}

.result-header h2 {
  font-size: 1.08rem;
  margin: 0;
  flex: 1;
  font-weight: 600;
}

.badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 5px 11px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid transparent;
}

.badge.valid {
  background: rgba(52, 211, 153, 0.14);
  color: var(--ok);
  border-color: rgba(52, 211, 153, 0.3);
}

.badge.invalid {
  background: rgba(246, 90, 108, 0.14);
  color: var(--bad);
  border-color: rgba(246, 90, 108, 0.3);
}

.badge.unknown {
  background: rgba(242, 195, 78, 0.14);
  color: var(--warn);
  border-color: rgba(242, 195, 78, 0.3);
}

.summary {
  margin: 0;
  font-size: 0.92rem;
  color: var(--text);
}

/* result state accent bar */
.result.state-valid {
  border-left: 3px solid var(--ok);
}
.result.state-invalid {
  border-left: 3px solid var(--bad);
}
.result.state-unknown {
  border-left: 3px solid var(--warn);
}

.fields {
  margin: 16px 0 0;
  display: grid;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.fields:empty {
  display: none;
}

.fields .row {
  display: grid;
  grid-template-columns: 40% 1fr;
  gap: 12px;
  background: var(--card);
  padding: 10px 14px;
}

.fields dt {
  color: var(--muted);
  font-size: 0.82rem;
  margin: 0;
}

.fields dd {
  margin: 0;
  font-size: 0.86rem;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.note {
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.78rem;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.note:empty {
  display: none;
}

.keyhint {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ---------- footer ---------- */
.footer {
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 8px;
}

.footer summary {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  list-style: none;
  color: var(--muted);
  font-weight: 500;
}

.footer summary::-webkit-details-marker {
  display: none;
}

.footer summary svg {
  width: 15px;
  height: 15px;
  color: var(--faint);
}

.footer summary:hover {
  color: var(--text);
}

.footer ul {
  padding-left: 18px;
  line-height: 1.6;
  margin: 6px 0 0;
}

.footer li {
  margin-bottom: 6px;
}

.footer code {
  background: #0c0f14;
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 0.9em;
}

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 20px);
  background: var(--card-2);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 0.85rem;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- responsive ---------- */
@media (max-width: 480px) {
  .wrap {
    padding: 32px 16px 56px;
  }
  .header h1 {
    font-size: 1.7rem;
  }
  .actions {
    flex-direction: column;
  }
  .fields .row {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
