:root {
  --ink: #1b1116;
  --ink-soft: #5a4a52;
  --card: #ffffff;
  --line: #d6cdd1;
  --garnet: #6d1430;
  --garnet-dark: #52102a;
  --gold: #d8b45a;
  --danger: #a4161a;
  --danger-bg: #fbe9e9;
  --serif: "Playfair Display", Georgia, "Times New Roman", serif;
  --sans: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --wine-1: #6d1430;
  --wine-2: #6d1430;
  --wine-3: #6d1430;
  --wine-4: #6d1430;
  --wine-5: #6d1430;
  --wine-6: #6d1430;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  font-family: var(--sans);
  color: var(--ink);
  line-height: 1.5;
  background: var(--wine-6);
}

/* Fundo: escala de cores do vinho, do branco ao tinto */
.stripes { position: fixed; inset: 0; display: flex; z-index: 0; }
.stripes i { flex: 1; }
.stripes i:nth-child(1), .bar i:nth-child(1) { background: var(--wine-1); }
.stripes i:nth-child(2), .bar i:nth-child(2) { background: var(--wine-2); }
.stripes i:nth-child(3), .bar i:nth-child(3) { background: var(--wine-3); }
.stripes i:nth-child(4), .bar i:nth-child(4) { background: var(--wine-4); }
.stripes i:nth-child(5), .bar i:nth-child(5) { background: var(--wine-5); }
.stripes i:nth-child(6), .bar i:nth-child(6) { background: var(--wine-6); }

/* "Ecrã" de app, centrado */
.screen {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 24rem;
  background: var(--card);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(27, 17, 22, 0.35);
}

.bar { display: flex; height: 8px; }
.bar i { flex: 1; }

.brand { text-align: center; padding: 2.5rem 2rem 0; }
.name {
  margin: 0;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 2.2rem;
  line-height: 1.15;
  letter-spacing: 0.01em;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
.brand .bar { margin: -2.5rem -2rem 2rem; }
.sub { margin: 0.4rem 0 0; color: var(--ink-soft); font-size: 0.95rem; }

.form { padding: 2rem 2rem 2.25rem; }

h1 { margin: 0 0 0.5rem; font-size: 1.15rem; font-weight: 600; text-align: center; }

label { display: block; font-weight: 500; font-size: 0.95rem; margin: 1.1rem 0 0.4rem; }

input {
  width: 100%;
  min-height: 3rem;
  font: inherit;
  font-size: 1rem; /* evita zoom automático no iOS */
  color: var(--ink);
  background: #faf8f9;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem 0.95rem;
}

input:focus-visible, button:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}
input:focus-visible { border-color: var(--garnet); background: #fff; }

.password { position: relative; }
.password input { padding-right: 5.5rem; }
.password button {
  position: absolute;
  right: 0.4rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: 0;
  color: var(--garnet);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
}

.submit {
  width: 100%;
  min-height: 3.1rem;
  margin-top: 1.75rem;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--garnet);
  border: 0;
  border-radius: 14px;
  cursor: pointer;
}
.submit:hover { background: var(--garnet-dark); }
.submit:active { transform: scale(0.98); }

.error {
  background: var(--danger-bg);
  color: var(--danger);
  border-left: 4px solid var(--danger);
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  margin: 0.75rem 0 0;
  font-size: 0.95rem;
}

.hint { margin: 1.25rem 0 0; font-size: 0.85rem; color: var(--ink-soft); text-align: center; }

/* Em telemóvel ocupa o ecrã todo, como uma app */
@media (max-width: 480px) {
  body { padding: 0; background: var(--card); }
  .stripes { display: none; }
  .screen {
    max-width: none;
    min-height: 100vh;
    min-height: 100dvh;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .brand { padding-top: 0; }
  .brand .bar { position: absolute; top: 0; left: 0; right: 0; margin: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .submit:active { transform: none; }
}