:root {
  --bg: #1d1114;
  --panel: #2a1d21;
  --panel-soft: #3b2b2f;
  --panel-light: #d8d0d2;
  --line: rgba(255, 192, 212, 0.18);
  --text: #f5edf0;
  --muted: #f3dfe7;
  --pink: #f1bfd0;
  --pink-strong: #f4d7df;
  --pink-deep: #b84d6e;
  --shadow: rgba(0, 0, 0, 0.28);
  --success: #dff6ef;
  --success-text: #1e5948;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  background: var(--bg);
}

html, body {
  margin: 0;
  min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: max(18px, env(safe-area-inset-top)) 16px max(18px, env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at top, rgba(184, 77, 110, 0.16) 0%, rgba(29, 17, 20, 0) 38%),
    var(--bg);
}

.app-shell {
  width: min(100%, 430px);
}

.card {
  background: rgba(35, 24, 28, 0.95);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: 0 18px 40px var(--shadow);
  padding: 22px 18px 18px;
  backdrop-filter: blur(14px);
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 8px;
}

.logo {
  width: 68px;
  height: 68px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #f7dfe8 0%, #e8b7c4 100%);
  color: #2c1820;
  font-size: clamp(2rem, 7vw, 2.4rem);
  font-weight: 800;
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.18);
}

.eyebrow {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.2;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

h1 {
  margin: 4px 0 0;
  font-size: clamp(2.2rem, 6vw, 3rem);
  line-height: 0.97;
  font-weight: 800;
  letter-spacing: -0.06em;
  color: var(--text);
}

.subtitle {
  margin: 18px 0 18px;
  font-size: 1.02rem;
  line-height: 1.45;
  color: var(--muted);
}

.device-state {
  display: block;
  border-radius: 18px;
  background: rgba(184, 77, 110, 0.18);
  border: 1px solid rgba(241, 191, 208, 0.22);
  padding: 14px 16px;
  font-size: 0.98rem;
  line-height: 1.45;
  font-weight: 600;
  color: var(--pink-strong);
}

.supabase-state {
  margin-top: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--muted);
  padding: 10px 12px;
  font-size: 0.8rem;
  line-height: 1.4;
}

.auth-panel,
.account-panel {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.auth-form {
  display: grid;
  gap: 10px;
}

.auth-form label {
  margin-top: 4px;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 650;
}

.auth-form input {
  width: 100%;
  min-height: 52px;
  border: 1px solid rgba(255, 192, 212, 0.3);
  border-radius: 12px;
  padding: 0 14px;
  background: #171013;
  color: var(--text);
  font: inherit;
  font-size: 16px;
  -webkit-appearance: none;
  appearance: none;
}

.auth-form input:focus-visible,
.password-toggle:focus-visible,
.primary-button:focus-visible,
.secondary-button:focus-visible {
  outline: 3px solid var(--pink);
  outline-offset: 2px;
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 86px;
}

.password-toggle {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 72px;
  min-height: 44px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--pink);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
}

.primary-button,
.secondary-button {
  width: 100%;
  min-height: 52px;
  border-radius: 12px;
  padding: 0 16px;
  font: inherit;
  font-size: 1rem;
  font-weight: 750;
}

.primary-button {
  margin-top: 4px;
  border: 1px solid var(--pink-strong);
  background: var(--pink-strong);
  color: #2c1820;
}

.secondary-button {
  margin-top: 10px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
}

.primary-button:disabled,
.secondary-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.feedback {
  margin: 2px 0;
  color: #ffd8d8;
  font-size: 0.9rem;
  line-height: 1.45;
}

.account-role {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.steps, .success, .info {
  margin-top: 18px;
  border-radius: 18px;
  padding: 16px 18px;
  border: 1px solid var(--line);
}

.steps {
  background: rgba(255, 255, 255, 0.04);
}

.success {
  background: rgba(223, 246, 239, 0.18);
  border-color: rgba(157, 210, 192, 0.4);
  color: var(--success);
}

.info {
  background: rgba(216, 208, 210, 0.12);
  color: var(--text);
}

h2 {
  margin: 0 0 12px;
  font-size: 1.08rem;
  line-height: 1.3;
  color: var(--text);
}

ol {
  margin: 0;
  padding-left: 1.3rem;
  line-height: 1.72;
  color: var(--text);
}

strong {
  font-weight: 700;
}

.hidden {
  display: none !important;
}

.hint-row {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: linear-gradient(180deg, #eaaec0 0%, #d78ba5 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.25);
  color: #2d1a22;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.badge.soft {
  background: rgba(244, 215, 223, 0.14);
  color: var(--pink);
  border: 1px solid rgba(244, 215, 223, 0.2);
}

@media (max-width: 360px) {
  .card {
    padding-left: 16px;
    padding-right: 16px;
  }

  h1 {
    font-size: 2.3rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto;
  }
}
