:root {
  color-scheme: light;
  --ink: #1a140c;
  --muted: #6b5a48;
  --paper: #ffffff;
  --lime: #edf8a5;
  --lime-strong: #d3e36f;
  --pink: #f8dce8;
  --error: #b4234d;
  --error-soft: #ffe8ef;
  --success: #1e6b3a;
  --success-soft: #e3f8eb;
  --border: rgba(26, 20, 12, 0.14);
  --shadow: 0 24px 70px rgba(33, 14, 7, 0.13);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 14% 12%, rgba(248, 220, 232, 0.9), transparent 30rem),
    radial-gradient(circle at 85% 82%, rgba(237, 248, 165, 0.85), transparent 28rem),
    #f9f7f2;
}

button, input { font: inherit; }

.shell {
  width: min(100% - 32px, 560px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 44px 0 28px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 22px;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand img {
  width: 118px;
  height: 118px;
  display: block;
  object-fit: contain;
}

.card {
  min-height: 360px;
  padding: clamp(28px, 7vw, 46px);
  border: 1px solid var(--border);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.state { text-align: center; }
.state[hidden], form[hidden], .actions[hidden] { display: none; }

.spinner {
  width: 44px;
  height: 44px;
  margin: 38px auto 24px;
  border: 4px solid var(--pink);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.status-icon {
  width: 58px;
  height: 58px;
  margin: 0 auto 20px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  font-size: 27px;
  font-weight: 800;
}

.status-icon.success { color: var(--success); background: var(--success-soft); }
.status-icon.error { color: var(--error); background: var(--error-soft); }
.status-icon.form { color: var(--ink); background: var(--lime); }

.eyebrow {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 7vw, 38px);
  line-height: 1.08;
  letter-spacing: -0.045em;
}

.message {
  max-width: 410px;
  margin: 16px auto 0;
  color: var(--muted);
  line-height: 1.6;
}

form {
  margin-top: 28px;
  text-align: left;
}

.account {
  margin: 0 0 22px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #f6f2ec;
  color: var(--muted);
  text-align: center;
  overflow-wrap: anywhere;
}

label {
  display: block;
  margin: 16px 0 8px;
  font-size: 14px;
  font-weight: 750;
}

.password-field { position: relative; }

input {
  width: 100%;
  min-height: 52px;
  padding: 0 76px 0 14px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 12px;
  outline: none;
}

input:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(237, 248, 165, 0.8);
}

.reveal {
  position: absolute;
  right: 7px;
  top: 7px;
  min-width: 58px;
  height: 38px;
  color: var(--muted);
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
}

.reveal:hover { background: #f6f2ec; }

.hint {
  margin: 7px 2px 0;
  color: var(--muted);
  font-size: 12px;
}

.form-error {
  min-height: 20px;
  margin: 14px 2px 0;
  color: var(--error);
  font-size: 13px;
}

.primary {
  width: 100%;
  min-height: 52px;
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  background: var(--lime);
  border: 1px solid rgba(26, 20, 12, 0.12);
  border-radius: 13px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease;
}

.primary:hover { background: var(--lime-strong); transform: translateY(-1px); }
.primary:disabled { cursor: wait; opacity: 0.65; transform: none; }
.actions { margin-top: 28px; }

footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.language {
  padding: 0;
  color: var(--ink);
  border: 0;
  background: none;
  font-weight: 750;
  text-decoration: underline;
  cursor: pointer;
}

@media (max-width: 520px) {
  .shell { width: min(100% - 20px, 560px); padding: 20px 0; }
  .card { min-height: 330px; border-radius: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
  .spinner { animation-duration: 1.6s; }
}
