:root {
  --bg-image: url('../../img/background.png');
  --ui-bg: rgba(0, 0, 0, 0.55);
  --overlay-bg: rgba(0, 0, 0, 0.07);
  --ui-border-color: #00c3ff;
  --ui-title-color: #00c3ff;
  --ui-text-color: #ddeaf7;
  --radius: 12px;
  --gap: 12px;
  --card-max-width: 450px;
  --accent: #00c3ff;
  --muted: #b0c4ff;
  --danger: #ff6a6a;
}

/* Base */
body,
body.startpage {
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: var(--ui-text-color);
  min-height: 100vh;
  background: var(--bg-image) no-repeat center center fixed;
  background-size: cover;
  overflow-x: hidden;
}

.background {
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  z-index: 0;
}

/* Language switch */
.lang-switch {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100vw - 24px);
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 12px;
  padding: 6px 12px;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
}

/* Flag-only language buttons */
.lang-btn {
  min-width: 38px;
  width: 38px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 8px;
  font-size: 20px;
  line-height: 1;
  font-family: 'Segoe UI Emoji', 'Noto Color Emoji', 'Apple Color Emoji', sans-serif;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lang-btn.active,
.lang-btn:hover {
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.8);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

.lang-flag {
  width: 22px;
  height: 16px;
  object-fit: cover;
  border-radius: 2px;
  box-shadow: none;
  display: block;
}

/* Card containers */
.login-container,
.reg-container,
.forgot-container,
.verify-container {
  position: relative;
  z-index: 1;
  max-width: var(--card-max-width);
  margin: 80px auto;
  background: var(--ui-bg);
  border-radius: 20px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
  padding: 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.reg-container {
  max-width: 520px;
}

h1 {
  text-align: center;
  margin-bottom: 20px;
  font-size: 2rem;
  color: var(--ui-title-color);
  text-shadow: 0 0 12px var(--accent);
}

label {
  margin-top: 12px;
  margin-bottom: 6px;
  font-size: 1.05rem;
  color: #e0e0e0;
  font-weight: 500;
}

.required {
  color: var(--danger);
  font-weight: 700;
}

/* Inputs */
input[type='text'],
input[type='email'],
input[type='password'] {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 2px solid rgba(255, 255, 255, 0.12);
  background: rgba(20, 20, 30, 0.85);
  color: #fff;
  font-size: 1rem;
  margin-bottom: 8px;
  box-sizing: border-box;
  transition: all 0.18s ease;
}

input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(0, 195, 255, 0.18);
  background: rgba(20, 20, 30, 0.95);
}

.password-wrapper {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
}

.toggle-password {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  color: #aaa;
  user-select: none;
}

.toggle-password:hover {
  color: var(--accent);
}

/* Buttons */
.btn {
  border-radius: 10px;
  padding: 10px 18px;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.6);
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font-weight: 700;
}

.btn-blue {
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.15);
}

.btn-green {
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.15);
}

.btn:hover {
  transform: translateY(-1px);
  background: rgba(0, 0, 0, 0.55);
  border-color: rgba(255, 255, 255, 0.9);
}

/* Messages */
#login-message,
#reg-message,
#forgot-message,
#verify-message,
.reg-message,
.verify-message,
.forgot-message {
  margin-top: 12px;
  min-height: 26px;
  text-align: center;
  font-weight: 600;
  border-radius: 8px;
  padding: 8px;
}

.reg-message.success,
.verify-message.success,
.forgot-message.success {
  color: #0f8;
  background: rgba(0, 255, 136, 0.06);
}

.reg-message.error,
.verify-message.error,
.forgot-message.error {
  color: #ff6a6a;
  background: rgba(255, 106, 106, 0.06);
}

/* Field hints */
.field-hint {
  display: block;
  margin-top: 6px;
  margin-bottom: 12px;
  font-size: 0.88rem;
  color: #9aa;
  font-style: italic;
}

.field-hint::before {
  content: 'ℹ ';
  margin-right: 6px;
}

/* Special: resend button */
#btn-resend {
  margin-top: 12px;
  padding: 10px 0;
  width: 100%;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.6);
  font-weight: 700;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.15);
  cursor: pointer;
}

#btn-resend:hover {
  transform: translateY(-1px);
  background: rgba(0, 0, 0, 0.55);
  border-color: rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.2);
}

/* Links */
.link-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
  width: 100%;
  align-items: center;
}

.link-container a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.link-container a:hover {
  color: #00ff88;
}

.info {
  margin-top: 16px;
  font-size: 0.98rem;
  color: var(--muted);
  text-align: center;
}

/* Index page */
.logo {
  display: block;
  margin: 48px auto 18px;
  width: 260px;
  filter: drop-shadow(0 0 24px #4a90e2);
  position: relative;
  z-index: 1;
}

.main-panel {
  max-width: 480px;
  margin: 32px auto 0;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 22px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  padding: 38px 36px 32px;
  text-align: center;
  position: relative;
  z-index: 1;
}

.story {
  font-size: 1.15rem;
  margin-bottom: 28px;
  color: #e0e6f0;
  text-shadow: 0 0 8px #1a2233;
}

.countdown {
  font-size: 1.3rem;
  margin: 18px 0;
  color: #ffd700;
  font-weight: 700;
  letter-spacing: 1px;
  text-shadow: 0 0 8px #4a90e2;
}

.pre-reg {
  display: flex;
  gap: 16px;
  justify-content: center;
  align-items: center;
  margin-top: 24px;
}

/* Responsive */
@media (max-width: 768px) {
  .login-container,
  .reg-container,
  .forgot-container,
  .verify-container {
    margin: 96px 20px 24px;
    padding: 28px;
  }

  h1 {
    font-size: 1.8rem;
  }

  .lang-switch {
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 8px;
    gap: 6px;
    border-radius: 10px;
  }

  .lang-btn {
    min-width: 34px;
    width: 34px;
    height: 30px;
    font-size: 18px;
  }

  .lang-flag {
    width: 20px;
    height: 14px;
  }

  .main-panel {
    margin: 20px;
    padding: 30px 20px;
  }

  .logo {
    width: 200px;
  }
}

@media (max-width: 600px) {
  .main-panel {
    max-width: 98vw;
    padding: 18px 6vw;
  }

  .logo {
    width: 160px;
  }

  .pre-reg {
    flex-direction: column;
    gap: 12px;
  }
}

@media (max-width: 480px) {
  .login-container,
  .reg-container,
  .forgot-container,
  .verify-container {
    margin: 40px 15px;
    padding: 22px;
  }

  h1 {
    font-size: 1.6rem;
  }

  input {
    padding: 10px 12px;
    font-size: 0.95rem;
  }
}
