:root {
  --gate-ink: #102a43;
  --gate-muted: #5d6b7c;
  --gate-line: #cbd8e6;
  --gate-blue: #2f6fbb;
  --gate-blue-dark: #123b64;
  --gate-green: #1f7a67;
  color: var(--gate-ink);
  font-family: Inter, "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  font-synthesis: none;
  letter-spacing: 0;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
}

body {
  min-height: 100vh;
  min-height: 100svh;
  background: #eaf1f7 url("assets/original-bg.png") center / cover no-repeat fixed;
  background-blend-mode: soft-light;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  background: rgba(239, 245, 249, 0.86);
}

button, a { font: inherit; letter-spacing: 0; }
button:focus-visible, a:focus-visible {
  outline: 3px solid rgba(47, 111, 187, 0.28);
  outline-offset: 3px;
}

.gate-page {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 100vh;
  min-height: 100svh;
  padding: 24px;
}

.gate-panel {
  width: min(100%, 460px);
  margin: auto;
  padding: 36px;
  border: 1px solid rgba(151, 171, 193, 0.75);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 18px 54px rgba(16, 42, 67, 0.14);
  text-align: center;
}

.gate-panel h1 {
  margin: 0 0 10px;
  font-size: 32px;
  line-height: 1.2;
}

.gate-intro {
  margin: 0;
  color: var(--gate-muted);
  font-size: 15px;
  line-height: 1.7;
}

.gate-verification { margin-top: 30px; text-align: left; }
.gate-heading, .gate-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.gate-heading { margin-bottom: 10px; font-size: 13px; font-weight: 650; }
.gate-percent {
  min-width: 40px;
  color: var(--gate-muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.gate-slider {
  --gate-progress: 0%;
  --gate-thumb-x: 0px;
  position: relative;
  width: 100%;
  height: 62px;
  overflow: hidden;
  border: 1px solid var(--gate-line);
  border-radius: 8px;
  background: #edf3f7;
  touch-action: none;
}

.gate-progress {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--gate-progress);
  background: #dbeaf7;
}

.gate-instruction {
  position: absolute;
  inset: 0 58px;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #69768a;
  font-size: 13px;
  white-space: nowrap;
  pointer-events: none;
}

.gate-thumb {
  position: absolute;
  top: 5px;
  left: 5px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  padding: 0;
  border: 1px solid #b7c9e5;
  border-radius: 7px;
  color: var(--gate-blue);
  background: #fff;
  box-shadow: 0 5px 14px rgba(18, 59, 100, 0.14);
  cursor: grab;
  transform: translateX(var(--gate-thumb-x));
  transition: transform 260ms cubic-bezier(0.22, 1, 0.36, 1), color 180ms ease, background 180ms ease;
}

.gate-thumb span { font-size: 24px; line-height: 1; }
.gate-slider.is-dragging .gate-thumb { cursor: grabbing; transition: color 180ms ease, background 180ms ease; }
.gate-slider[data-state="success"] { border-color: #8bbcac; background: #e4f3ee; }
.gate-slider[data-state="success"] .gate-progress { background: #c9e6dc; }
.gate-slider[data-state="success"] .gate-thumb { border-color: var(--gate-green); color: #fff; background: var(--gate-green); }
.gate-slider[data-state="success"] .gate-instruction { color: #17623f; font-weight: 650; }
.gate-slider[data-state="error"] { border-color: #e4a8ad; background: #fff0f1; animation: gate-shake 240ms ease-in-out; }

.gate-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.gate-help, .gate-close {
  border: 0;
  color: var(--gate-blue-dark);
  background: transparent;
  cursor: pointer;
}
.gate-dialog-button, .gate-success-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 50px;
  border: 1px solid var(--gate-blue-dark);
  border-radius: 7px;
  color: #fff;
  background: var(--gate-blue-dark);
  cursor: pointer;
  font-weight: 650;
}
.gate-dialog-button:hover, .gate-success-link:hover { background: #0c2f52; }
.gate-help { margin-top: 20px; padding: 5px; font-size: 12px; }

.gate-dialog {
  width: min(calc(100% - 32px), 400px);
  padding: 0;
  border: 1px solid #cad3df;
  border-radius: 8px;
  color: var(--gate-ink);
  background: #fff;
  box-shadow: 0 24px 70px rgba(16, 42, 67, 0.24);
}
.gate-dialog::backdrop { background: rgba(23, 32, 51, 0.42); }
.gate-dialog form { padding: 24px; }
.gate-dialog h2 { margin: 0; font-size: 21px; }
.gate-dialog p { margin: 18px 0 0; color: var(--gate-muted); font-size: 14px; line-height: 1.75; }
.gate-close { width: 34px; height: 34px; border-radius: 6px; color: var(--gate-ink); font-size: 24px; }
.gate-close:hover { background: #edf3f7; }
.gate-dialog-button { justify-content: center; margin-top: 22px; padding: 0 18px; }

.gate-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  z-index: 10;
  max-width: calc(100% - 32px);
  padding: 12px 16px;
  border-radius: 7px;
  color: #fff;
  background: #102a43;
  box-shadow: 0 10px 30px rgba(16, 42, 67, 0.24);
  font-size: 13px;
  transform: translateX(-50%);
}

.gate-success-badge {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin: 0 auto 22px;
  border-radius: 50%;
  color: #fff;
  background: var(--gate-green);
  box-shadow: 0 0 0 9px rgba(22, 138, 86, 0.1);
  font-size: 26px;
  font-weight: 700;
}
.gate-success-link { justify-content: center; width: auto; margin-top: 26px; padding: 0 20px; text-decoration: none; }

@keyframes gate-shake {
  0%, 100% { transform: translateX(0); }
  35% { transform: translateX(-5px); }
  70% { transform: translateX(5px); }
}

@media (max-width: 520px) {
  .gate-page { padding: 16px; }
  .gate-panel { padding: 30px 20px; }
  .gate-panel h1 { font-size: 28px; }
  .gate-instruction { inset: 0 52px; font-size: 12px; }
}

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