/* ============================================================
   Design System — dark / premium
   ============================================================ */
:root {
  color-scheme: dark;

  --bg: #0a0b10;
  --bg-soft: #0e1017;
  --surface: #12141d;
  --surface-2: #171a25;
  --line: rgba(255, 255, 255, .07);
  --line-strong: rgba(255, 255, 255, .14);

  --ink: #eef0f6;
  --ink-2: #9aa0b4;
  --ink-3: #5f6579;

  --accent: #3b82f6;
  --accent-strong: #38bdf8;
  --accent-grad: linear-gradient(135deg, #3b82f6 0%, #0ea5e9 100%);
  --accent-ring: rgba(59, 130, 246, .32);

  --ok: #3fcf8e;
  --ok-bg: rgba(63, 207, 142, .1);
  --ok-line: rgba(63, 207, 142, .28);
  --err: #ff7a70;
  --err-bg: rgba(255, 106, 97, .09);
  --err-line: rgba(255, 106, 97, .28);
  --warn: #f5b85f;
  --warn-bg: rgba(245, 184, 95, .1);
  --info: #6aa9ff;
  --info-bg: rgba(106, 169, 255, .1);

  --radius-lg: 20px;
  --radius: 12px;
  --radius-sm: 9px;

  --shadow-card: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 20px 50px rgba(0, 0, 0, .45);
  --shadow-pop: 0 12px 32px rgba(0, 0, 0, .5);

  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
          "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Consolas, "JetBrains Mono", monospace;

  --ease: cubic-bezier(.2, .7, .3, 1);
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: rgba(59, 130, 246, .35); color: #fff; }
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -.01em; }

/* subtle ambient backdrop */
.bg-decor {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(52rem 32rem at 18% -12%, rgba(59, 130, 246, .15), transparent 62%),
    radial-gradient(44rem 30rem at 92% 4%, rgba(14, 165, 233, .1), transparent 60%),
    radial-gradient(60rem 44rem at 50% 118%, rgba(59, 130, 246, .07), transparent 66%);
}
.bg-decor::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: radial-gradient(42rem 30rem at 50% 0%, rgba(0, 0, 0, .5), transparent 75%);
  -webkit-mask-image: radial-gradient(42rem 30rem at 50% 0%, rgba(0, 0, 0, .5), transparent 75%);
}

/* ---------- layout ---------- */
.page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 40px 20px;
}
.shell {
  width: min(560px, 100%);
  display: grid;
  gap: 22px;
}

/* brand row above the card */
.page-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .02em;
}
.brand-badge {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--accent-grad);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  box-shadow: 0 6px 18px rgba(59, 130, 246, .35);
}

/* ---------- card ---------- */
.card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, .022), rgba(255, 255, 255, 0) 42%), var(--surface);
  box-shadow: var(--shadow-card);
}
.card-pad { padding: 34px; }
.card-head { margin-bottom: 24px; }
.card-head h1 {
  font-size: 24px;
  line-height: 1.25;
}
.card-head .sub {
  margin: 8px 0 0;
  color: var(--ink-2);
  font-size: 14px;
}

/* ---------- form ---------- */
.form { display: grid; gap: 18px; }
.field { display: grid; gap: 8px; }
.field > label {
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: .01em;
}
input[type="text"],
input[type="password"],
input[type="number"],
input:not([type]),
textarea,
select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 12px 14px;
  color: var(--ink);
  background: var(--bg-soft);
  outline: none;
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease), background .16s var(--ease);
  -webkit-appearance: none;
  appearance: none;
}
input::placeholder, textarea::placeholder { color: var(--ink-3); }
input:hover, textarea:hover, select:hover { border-color: rgba(255, 255, 255, .22); }
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  background: #0c0e15;
  box-shadow: 0 0 0 3px var(--accent-ring);
}
textarea {
  min-height: 200px;
  resize: vertical;
  line-height: 1.7;
}
.field-hint {
  margin: 0;
  color: var(--ink-3);
  font-size: 12.5px;
}

/* card-code style input */
.code-input {
  font-family: var(--mono);
  font-size: 15px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 650;
  letter-spacing: .01em;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background .16s var(--ease), border-color .16s var(--ease),
              box-shadow .16s var(--ease), transform .16s var(--ease), opacity .16s var(--ease);
  user-select: none;
}
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-ring); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; transform: none; }

.btn-primary {
  background: var(--accent-grad);
  color: #fff;
  box-shadow: 0 8px 22px rgba(59, 130, 246, .32), 0 1px 0 rgba(255, 255, 255, .18) inset;
}
.btn-primary:hover:not(:disabled) {
  filter: brightness(1.08);
  box-shadow: 0 10px 28px rgba(59, 130, 246, .42), 0 1px 0 rgba(255, 255, 255, .18) inset;
}
.btn-ghost {
  background: rgba(255, 255, 255, .04);
  border-color: var(--line-strong);
  color: var(--ink);
}
.btn-ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, .08);
  border-color: rgba(255, 255, 255, .22);
}
.btn-lg { height: 48px; font-size: 15px; border-radius: 13px; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: var(--radius-sm); }
.btn-block { width: 100%; }

/* loading spinner inside a button */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- notice ---------- */
.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 18px;
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 13.5px;
  line-height: 1.55;
}
.notice svg { flex: 0 0 16px; width: 16px; height: 16px; margin-top: 2px; }
.notice.ok { color: var(--ok); background: var(--ok-bg); border: 1px solid var(--ok-line); }
.notice.err {
  color: var(--err);
  background: var(--err-bg);
  border: 1px solid var(--err-line);
  animation: notice-in .28s var(--ease);
}
@keyframes notice-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}

/* ---------- footer ---------- */
.page-foot {
  text-align: center;
  color: var(--ink-3);
  font-size: 12.5px;
}

/* ---------- success page ---------- */
.success-card {
  text-align: center;
  padding: 46px 34px 38px;
}
.check-wrap {
  width: 76px;
  height: 76px;
  margin: 0 auto 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ok-bg);
  border: 1px solid var(--ok-line);
  box-shadow: 0 0 0 10px rgba(63, 207, 142, .05);
}
.check {
  width: 40px;
  height: 40px;
  stroke: var(--ok);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}
.check path {
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  animation: check-draw .5s .18s var(--ease) forwards;
}
@keyframes check-draw { to { stroke-dashoffset: 0; } }
.success-card h1 { font-size: 24px; }
.success-card .sub { margin: 10px 0 0; color: var(--ink-2); font-size: 14px; }
.success-meta {
  display: grid;
  gap: 0;
  margin: 26px auto;
  max-width: 380px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-soft);
  overflow: hidden;
  text-align: left;
}
.success-meta > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 16px;
  font-size: 13.5px;
  color: var(--ink-2);
}
.success-meta > div + div { border-top: 1px solid var(--line); }
.success-meta strong { color: var(--ink); font-weight: 650; }

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ---------- mobile ---------- */
@media (max-width: 640px) {
  .page { padding: 24px 14px; }
  .card-pad { padding: 24px 20px; }
  .card { border-radius: 18px; }
  .card-head h1 { font-size: 21px; }
  input[type="text"],
  input[type="password"],
  input[type="number"],
  input:not([type]),
  textarea,
  select { font-size: 16px; } /* prevent iOS zoom */
  textarea { min-height: 170px; }
  .btn-lg { height: 50px; }
  .success-card { padding: 36px 22px 30px; }
}
