:root {
  --bg-ink: #02140f;
  --bg-panel: rgba(5, 24, 18, 0.78);
  --bg-panel-strong: rgba(4, 20, 15, 0.92);
  --bg-card: rgba(10, 30, 23, 0.72);
  --line-soft: rgba(213, 255, 236, 0.18);
  --line-bright: rgba(213, 255, 236, 0.36);
  --text-main: #f4fff9;
  --text-soft: rgba(244, 255, 249, 0.74);
  --text-mute: rgba(232, 247, 240, 0.56);
  --accent-green: #22c06c;
  --accent-green-strong: #0f8b49;
  --accent-gold: #ffcb59;
  --accent-gold-strong: #d79a12;
  --danger: #ff6b6b;
  --shadow-panel: 0 24px 80px rgba(0, 0, 0, 0.42);
  --shadow-button: 0 16px 40px rgba(18, 116, 63, 0.32);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Microsoft YaHei UI", "PingFang SC", "Noto Sans SC", sans-serif;
  background: var(--bg-ink);
  color: var(--text-main);
}

body.modal-open {
  overflow: hidden;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.page-shell {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
}

.video-layer {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

.hero-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  filter: saturate(1.06) contrast(1.02);
}

.video-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(2, 10, 8, 0.88) 0%, rgba(2, 10, 8, 0.66) 28%, rgba(2, 10, 8, 0.34) 53%, rgba(2, 10, 8, 0.18) 100%),
    radial-gradient(circle at 70% 28%, rgba(62, 207, 116, 0.22), transparent 28%),
    radial-gradient(circle at 78% 70%, rgba(255, 191, 48, 0.18), transparent 20%);
}

.video-grain {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(90deg, #000 0%, rgba(0, 0, 0, 0.24) 54%, transparent 100%);
  opacity: 0.35;
}

.stage {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 32px;
  padding: 40px 5vw;
}

.login-panel {
  width: min(440px, 100%);
  padding: 32px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(180deg, rgba(15, 52, 38, 0.46), rgba(6, 21, 16, 0.94)),
    rgba(4, 20, 15, 0.9);
  backdrop-filter: blur(22px);
  box-shadow: var(--shadow-panel);
  animation: float-in 720ms ease-out;
}

.panel-head {
  margin-bottom: 20px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  font-size: 12px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--accent-gold);
}

.eyebrow::before {
  content: "";
  width: 18px;
  height: 1px;
  background: currentColor;
}

.panel-head h1,
.modal-head h2 {
  margin: 0 0 10px;
  line-height: 1.18;
  font-weight: 700;
}

.panel-head h1 {
  font-size: clamp(30px, 3vw, 42px);
  color: #f8fff9;
  text-shadow: 0 10px 28px rgba(0, 0, 0, 0.26);
}

.panel-head p,
.modal-head p,
.feature-card span,
.notice-strip,
.form-status {
  color: var(--text-soft);
}

.panel-head p {
  color: rgba(244, 255, 249, 0.82);
}

.auth-form,
.modal-form {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 10px;
}

.field span,
.rules-card h3 {
  font-size: 14px;
  font-weight: 600;
  color: rgba(248, 255, 249, 0.92);
}

.field input {
  width: 100%;
  border: 1px solid rgba(234, 247, 239, 0.14);
  border-radius: var(--radius-md);
  padding: 15px 16px;
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.07);
  outline: none;
  transition: border-color 180ms ease, transform 180ms ease, background-color 180ms ease;
}

.field input::placeholder {
  color: rgba(234, 247, 239, 0.4);
}

.field input:focus {
  border-color: rgba(34, 192, 108, 0.72);
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-1px);
}

.field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 144px;
  gap: 14px;
  align-items: end;
}

.field-inline {
  margin: 0;
}

.captcha-row,
.code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
}

.captcha-box {
  display: grid;
  place-items: center;
  gap: 3px;
  min-height: 54px;
  padding: 5px;
  border: 1px solid rgba(255, 203, 89, 0.2);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(255, 203, 89, 0.14), rgba(255, 203, 89, 0.04));
  color: var(--text-soft);
}

.captcha-box.compact {
  min-height: 48px;
}

.captcha-box canvas {
  width: 100%;
  max-width: 144px;
  height: auto;
  border-radius: 10px;
}

.captcha-box small {
  font-size: 11px;
}

.button-row,
.modal-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.inline-btn,
.text-link,
.icon-btn {
  border: none;
  border-radius: var(--radius-md);
  transition: transform 180ms ease, filter 180ms ease, background-color 180ms ease, border-color 180ms ease;
}

.primary-btn,
.secondary-btn,
.ghost-btn {
  min-height: 52px;
  padding: 0 20px;
}

.primary-btn {
  color: #112014;
  background: linear-gradient(135deg, var(--accent-gold) 0%, #ffe28d 100%);
  box-shadow: 0 14px 36px rgba(255, 203, 89, 0.28);
  font-weight: 700;
}

.primary-btn:hover,
.secondary-btn:hover,
.ghost-btn:hover,
.inline-btn:hover,
.text-link:hover,
.icon-btn:hover,
.captcha-box:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

.secondary-btn {
  color: var(--text-main);
  background: linear-gradient(135deg, rgba(34, 192, 108, 0.22), rgba(34, 192, 108, 0.1));
  border: 1px solid rgba(34, 192, 108, 0.3);
}

.ghost-btn {
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.inline-btn {
  min-width: 128px;
  padding: 0 16px;
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.inline-btn[disabled] {
  cursor: not-allowed;
  opacity: 0.6;
}

.link-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-mute);
}

.text-link {
  padding: 0;
  background: transparent;
  color: var(--accent-gold);
}

.form-status {
  margin: 0;
  min-height: 22px;
  font-size: 13px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(1, 10, 7, 0.74);
  backdrop-filter: blur(16px);
}

.modal-card {
  width: min(760px, 100%);
  max-height: min(92vh, 980px);
  overflow: auto;
  padding: 28px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--line-soft);
  background:
    linear-gradient(180deg, rgba(16, 53, 39, 0.48), rgba(5, 19, 14, 0.94)),
    var(--bg-panel-strong);
  box-shadow: var(--shadow-panel);
}

.small-card {
  width: min(520px, 100%);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.modal-head h2 {
  font-size: clamp(28px, 2.4vw, 34px);
}

.icon-btn {
  width: 42px;
  height: 42px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  font-size: 24px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.register-bottom {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.95fr);
  gap: 16px;
}

.rules-card {
  padding: 18px 18px 18px 20px;
  border-radius: var(--radius-lg);
  background: rgba(255, 203, 89, 0.08);
  border: 1px solid rgba(255, 203, 89, 0.16);
}

.rules-card h3 {
  margin: 0 0 10px;
  color: var(--accent-gold);
}

.rules-card ul {
  margin: 0;
  padding-left: 18px;
  color: var(--text-soft);
  display: grid;
  gap: 8px;
  font-size: 13px;
}

.toast-stack {
  position: fixed;
  z-index: 30;
  top: 20px;
  right: 20px;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 32px));
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(7, 26, 19, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.28);
  animation: toast-in 220ms ease-out;
}

.toast::before {
  content: "";
  width: 10px;
  height: 10px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--accent-green);
  flex: 0 0 auto;
}

.toast.warning::before {
  background: var(--accent-gold);
}

.toast.error::before {
  background: var(--danger);
}

.toast p {
  margin: 0;
  line-height: 1.55;
  color: var(--text-soft);
}

.hidden {
  display: none !important;
}

@keyframes float-in {
  from {
    opacity: 0;
    transform: translateX(-26px) translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateX(0) translateY(0);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(18px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1100px) {
  .stage {
    align-items: stretch;
    flex-direction: column;
    justify-content: center;
  }

  .login-panel {
    width: 100%;
  }
}

@media (max-width: 860px) {
  .stage {
    padding: 24px 16px;
  }

  .login-panel,
  .modal-card {
    padding: 22px;
  }

  .form-grid,
  .register-bottom {
    grid-template-columns: 1fr;
  }

  .field-row,
  .captcha-row,
  .code-row,
  .button-row,
  .modal-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .panel-head h1 {
    font-size: 28px;
  }

  .modal-backdrop {
    padding: 12px;
  }

  .modal-card {
    max-height: 95vh;
    border-radius: 22px;
  }

  .modal-head {
    margin-bottom: 18px;
  }
}
