:root {
  --base: #F5EFE0;
  --card: rgba(255, 255, 255, 0.62);
  --card-solid: #FFFDF6;
  --text: #1E2B24;
  --muted: #6E7A72;
  --forest: #2F6B4F;
  --forest-dark: #204B38;
  --gold: #B88A2A;
  --border: rgba(47, 107, 79, 0.16);
  --shadow: 0 24px 70px rgba(30, 43, 36, 0.14);
  --error: #C95F5F;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(184, 138, 42, 0.18), transparent 32%),
    radial-gradient(circle at bottom right, rgba(47, 107, 79, 0.18), transparent 30%),
    var(--base);
  color: var(--text);
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 460px;
  padding: 38px;
  border-radius: 30px;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.42), transparent 45%),
    radial-gradient(circle at top right, rgba(122, 199, 160, 0.18), transparent 35%);
  pointer-events: none;
}

.login-content {
  position: relative;
  z-index: 1;
}

.brand-pill {
  display: inline-flex;
  align-items: center;
  padding: 7px 13px;
  border-radius: 999px;
  background: rgba(184, 138, 42, 0.14);
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 20px;
}

h1 {
  margin: 0;
  font-size: 46px;
  line-height: 1.02;
  letter-spacing: -0.055em;
  color: var(--text);
  font-weight: 900;
}

h1 em { font-style: italic; }

.subtitle {
  margin: 14px 0 30px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.5;
  font-weight: 500;
}

.login-form {
  display: grid;
  gap: 14px;
}

/* Password field with inline show/hide toggle */
.password-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.password-wrap input {
  padding-right: 64px; /* make room for the toggle */
}

.toggle-password {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  /* reset button styles */
  border: none;
  background: none;
  box-shadow: none;
  padding: 6px;
  margin: 0;
  color: var(--muted);
  cursor: pointer;
  border-radius: 8px;
  line-height: 0; /* prevent extra height from inline */
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease, background 0.15s ease;
  z-index: 1;
}

.toggle-password:hover {
  background: rgba(47, 107, 79, 0.08);
  color: var(--forest);
  transform: translateY(-50%);
  box-shadow: none;
}

.toggle-password:active {
  transform: translateY(-50%);
  opacity: 0.7;
}

/* Icon visibility: show eye by default, eye-off when .is-visible */
.toggle-password .icon-eye     { display: block; }
.toggle-password .icon-eye-off { display: none;  }

.toggle-password.is-visible .icon-eye     { display: none;  }
.toggle-password.is-visible .icon-eye-off { display: block; }

input {
  width: 100%;
  border: 1px solid var(--border);
  background: rgba(255, 253, 246, 0.88);
  color: var(--text);
  border-radius: 16px;
  padding: 15px 16px;
  font-size: 16px;
  outline: none;
  transition: border 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

input::placeholder { color: rgba(110, 122, 114, 0.75); }

input:focus {
  border-color: rgba(47, 107, 79, 0.48);
  box-shadow: 0 0 0 4px rgba(47, 107, 79, 0.10);
  background: var(--card-solid);
}

button {
  margin-top: 2px;
  border: none;
  border-radius: 16px;
  padding: 15px 18px;
  background: linear-gradient(135deg, var(--forest), var(--forest-dark));
  color: #FFFDF6;
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 14px 30px rgba(47, 107, 79, 0.24);
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 36px rgba(47, 107, 79, 0.28);
}

button:active {
  transform: translateY(0);
  opacity: 0.92;
}

.footer-note {
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.error-message {
  display: none;
  padding: 11px 13px;
  border-radius: 14px;
  background: rgba(201, 95, 95, 0.10);
  border: 1px solid rgba(201, 95, 95, 0.22);
  color: #9F3F3F;
  font-size: 13px;
  margin: 0 0 14px;
}

body.login-error-invalid      .error-invalid      { display: block; }
body.login-error-rate-limited .error-rate-limited { display: block; }
body.login-error-server       .error-server        { display: block; }

/* Legacy: keep show-error working for any old bookmarked URLs */
body.show-error .error-invalid { display: block; }

@media (max-width: 480px) {
  .login-card { padding: 30px 22px; border-radius: 24px; }
  h1 { font-size: 38px; }
  .subtitle { font-size: 16px; }
}
