:root {
  --bg-body: #0a0b0e;
  --bg-surface: rgba(17, 19, 26, 0.88);
  --bg-input: rgba(11, 13, 18, 0.92);
  --border: #252a38;
  --border-bright: #363d52;
  --text-main: #e6e9f0;
  --text-muted: #9aa2b6;
  --text-dim: #646c80;
  --accent: #d8bea2;
  --accent-hover: #c5a98a;
  --error-bg: rgba(220, 68, 82, 0.12);
  --error-border: rgba(220, 68, 82, 0.45);
  --error-text: #f5a3ab;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", "Courier New", monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  background: var(--bg-body);
}

body {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background: var(--bg-body);
  color: var(--text-main);
  font-family: var(--font-sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a,
button {
  cursor: pointer;
}

#ascii-water {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

.scanlines {
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  opacity: 0.44;
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0) 50%,
    rgba(0, 0, 0, 0.19) 50%,
    rgba(0, 0, 0, 0.19) 100%
  );
  background-size: 100% 4px;
}

.scanlines::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(216, 190, 162, 0.03), transparent 18%, transparent 82%, rgba(216, 190, 162, 0.025));
}

.crt-vignette {
  position: fixed;
  inset: 0;
  z-index: 998;
  pointer-events: none;
  background: radial-gradient(circle at center, transparent 58%, rgba(5, 6, 8, 0.52) 100%);
}

.container {
  width: min(100% - 40px, 1120px);
  margin-inline: auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--border);
  background: rgba(14, 16, 22, 0.86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.topbar-inner {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text-main);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 1.12rem;
  font-weight: 800;
  letter-spacing: 0.075em;
  white-space: nowrap;
  transition: color 200ms ease, text-shadow 200ms ease;
}

.brand:hover {
  text-shadow: 0 0 14px rgba(216, 190, 162, 0.35);
}

.brand-ext {
  color: var(--accent);
  transition: letter-spacing 220ms ease;
}

.brand:hover .brand-ext {
  letter-spacing: 0.11em;
}

.rec-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 9px rgba(216, 190, 162, 0.8);
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}

.auth-stage {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 44px 0;
}

.auth-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  padding: 30px 32px;
  border-style: solid;
  border-width: 2px 1px 1px 1px;
  border-color: var(--accent) var(--border) var(--border) var(--border);
  border-radius: 12px;
  background: var(--bg-surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.52);
}

.auth-lock-badge {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  border: 1px solid var(--border-bright);
  border-radius: 10px;
  background: rgba(24, 27, 36, 0.95);
  color: var(--accent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.auth-lock-icon {
  width: 20px;
  height: 20px;
}

.auth-title {
  margin-bottom: 22px;
  color: var(--text-main);
  font-size: 1.5rem;
  font-weight: 740;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.auth-label {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.auth-input {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--border-bright);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.94rem;
  outline: none;
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.auth-input::placeholder {
  color: var(--text-dim);
}

.auth-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(216, 190, 162, 0.14);
}

.auth-password-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-input--password {
  padding-right: 44px;
}

.auth-eye-btn {
  position: absolute;
  right: 8px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  transition: color 180ms ease, background 180ms ease;
}

.auth-eye-btn:hover {
  color: var(--accent);
  background: rgba(216, 190, 162, 0.08);
}

.auth-eye-icon {
  width: 18px;
  height: 18px;
}

.auth-status {
  padding: 10px 12px;
  border: 1px solid var(--error-border);
  border-radius: 8px;
  background: var(--error-bg);
  color: var(--error-text);
  font-size: 0.84rem;
  line-height: 1.5;
}

.auth-status[hidden] {
  display: none;
}

.auth-submit-btn {
  width: 100%;
  min-height: 44px;
  margin-top: 4px;
  padding: 11px 18px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: #161412;
  font-family: var(--font-sans);
  font-size: 0.94rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  transition:
    background 180ms ease,
    border-color 180ms ease,
    transform 180ms ease,
    box-shadow 180ms ease;
}

.auth-submit-btn:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(216, 190, 162, 0.24);
}

.auth-submit-btn:active:not(:disabled) {
  transform: translateY(0);
}

.auth-submit-btn:disabled {
  opacity: 0.65;
  cursor: wait;
}

.hero-stagger {
  opacity: 0;
  transform: translateY(14px);
  animation: heroEnter 640ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: calc(var(--stagger, 0) * 90ms + 60ms);
}

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

.footer {
  position: relative;
  z-index: 2;
  margin-top: auto;
  border-top: 1px solid var(--border);
  background: rgba(14, 16, 22, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.footer-inner {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.045em;
}

.footer-note,
.back-to-top {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.075em;
}

.footer-note {
  color: var(--text-dim);
  font-size: 0.61rem;
}

.back-to-top {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.65rem;
  transition: color 200ms ease, transform 200ms ease;
}

.back-to-top:hover {
  color: var(--accent);
  transform: translateX(2px);
}

::selection {
  color: #171513;
  background: var(--accent);
}

@media (max-width: 560px) {
  .container {
    width: min(100% - 28px, 1120px);
  }

  .auth-card {
    padding: 24px 22px;
  }

  .footer-inner {
    min-height: 76px;
    flex-wrap: wrap;
    padding-top: 15px;
    padding-bottom: 15px;
  }

  .footer-note {
    order: 3;
    width: 100%;
  }
}

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

  .hero-stagger {
    opacity: 1 !important;
    transform: none !important;
  }
}
