.br-auth-root {
  align-items: center;
  justify-content: center;
  padding: 28px 16px;
  overflow-y: auto;
}

.br-auth-shell {
  width: min(440px, 92vw);
  margin: auto;
}

.br-auth-shell.is-entering {
  animation: br-rise .6s cubic-bezier(.2, .8, .3, 1) both;
}

.br-auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  margin-bottom: 20px;
  color: var(--acc-deep);
}

.br-auth-brand svg { animation: br-bob 4.5s ease-in-out infinite; }
.br-auth-brand div { color: var(--tx); font-family: var(--font-heading); font-size: 26px; letter-spacing: .5px; }

.br-auth-card {
  width: 100%;
  display: block;
  align-items: stretch;
  padding: 24px 28px 22px;
  overflow: hidden;
  border: 1.5px solid var(--line);
  border-radius: 26px;
  background: var(--sf);
  box-shadow: var(--shadow-lg);
  animation: none;
}

.br-auth-tabs {
  position: relative;
  display: flex;
  margin-bottom: 20px;
  padding: 4px;
  border-radius: 999px;
  background: var(--sf2);
}

.br-auth-tab-thumb {
  position: absolute;
  inset: 4px auto 4px 4px;
  width: calc(50% - 4px);
  border-radius: 999px;
  background: var(--sf);
  box-shadow: var(--shadow-sm);
  transition: transform .4s cubic-bezier(.3, .9, .3, 1);
}

.br-auth-tabs.is-register .br-auth-tab-thumb { transform: translateX(100%); }

.br-auth-tab {
  position: relative;
  z-index: 1;
  flex: 1;
  padding: 8px 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--tx2);
  font-size: 13.8px;
  font-weight: 600;
  cursor: pointer;
  transition: color .25s;
}

.br-auth-tab[aria-selected="true"] { color: var(--tx); }
.br-auth-tab:disabled { cursor: default; }

.br-auth-stage {
  min-height: 292px;
  display: flex;
  flex-direction: column;
}

.br-auth-mode-stage { height: 350px; min-height: 350px; }
.br-auth-mode-content { min-height: 0; flex: 1; display: flex; flex-direction: column; opacity: 1; transition: opacity 260ms ease-in-out; will-change: opacity; }
.br-auth-mode-content.is-entering,
.br-auth-mode-content.is-leaving { opacity: 0; }

.br-auth-progress { margin: 0 6px 16px; }
.br-auth-progress-track { position: relative; height: 34px; }
.br-auth-progress-track::before { content: ''; position: absolute; right: 0; bottom: 5px; left: 0; height: 3px; border-radius: 99px; background: var(--sf2); }
.br-auth-progress-value { position: absolute; bottom: 5px; left: 0; height: 3px; border-radius: 99px; background: var(--sage); transition: width .55s cubic-bezier(.4, 0, .2, 1); }
.br-auth-progress-snail { position: absolute; bottom: 8px; color: var(--acc-deep); transition: left .55s cubic-bezier(.4, 0, .2, 1); }
.br-auth-progress-snail svg { display: block; transform: scaleX(-1); }
.br-auth-progress-labels { display: flex; justify-content: space-between; margin-top: 6px; color: var(--tx2); font-size: 11.5px; font-weight: 600; }
.br-auth-progress-labels .is-current { color: var(--sage-deep); }

.br-auth-form { min-height: 0; flex: 1; display: flex; flex-direction: column; gap: 12px; }
.br-auth-form.is-login { padding-top: 38px; }
.br-auth-input { width: 100%; padding: 11px 18px; border: 1.5px solid var(--line); border-radius: 999px; outline: none; background: var(--bg); color: var(--tx); font-size: 14.5px; transition: border-color .2s; }
.br-auth-input:focus { border-color: var(--acc); }
.br-auth-input::placeholder { color: var(--tx2); opacity: .75; }
.br-auth-input:disabled { opacity: .62; }
.br-auth-card .br-auth-note { margin: 0; padding: 0 4px; color: var(--tx2); font-size: 12.6px; text-align: left; }
.br-auth-form-spacer { flex: 1; }
.br-auth-message { min-height: 28px; padding: 6px 4px 2px; color: var(--tx2); font-size: 12.6px; }
.br-auth-message.is-error { color: var(--acc-deep); animation: br-auth-shake .4s ease; }

.br-auth-remember { width: fit-content; display: inline-flex; align-items: center; gap: 9px; padding: 2px 4px; color: var(--tx2); font-size: 13.2px; cursor: pointer; }
.br-auth-checkbox { position: absolute; width: 1px; height: 1px; opacity: 0; }
.br-auth-checkmark { width: 19px; height: 19px; display: grid; place-items: center; border: 1.5px solid var(--line); border-radius: 6px; color: var(--on-acc); transition: background .2s, border-color .2s; }
.br-auth-checkmark svg { opacity: 0; transition: opacity .2s; }
.br-auth-checkbox:checked + .br-auth-checkmark { border-color: var(--acc); background: var(--acc); }
.br-auth-checkbox:checked + .br-auth-checkmark svg { opacity: 1; }
.br-auth-checkbox:focus-visible + .br-auth-checkmark { outline: 2px solid var(--acc); outline-offset: 2px; }
.br-auth-legal-consent { width: 100%; display: flex; align-items: flex-start; gap: 9px; padding: 4px; color: var(--tx2); font-size: 12px; line-height: 1.55; }
.br-auth-legal-toggle { flex: 0 0 19px; display: block; cursor: pointer; }
.br-auth-legal-copy { min-width: 0; }
.br-auth-legal-link { display: inline; padding: 0; border: 0; background: transparent; color: var(--acc-deep); font-weight: 600; text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 55%, transparent); text-underline-offset: 2px; cursor: pointer; }
.br-auth-legal-link:hover { color: var(--acc-strong); }

.br-auth-primary, .br-auth-secondary {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 11px 0;
  border: 0;
  border-radius: 999px;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
}

.br-auth-primary {
  background: var(--acc);
  color: var(--on-acc);
  box-shadow: var(--shadow-sm);
  transition: background-color 260ms ease-in-out, color 260ms ease-in-out, box-shadow 260ms ease-in-out;
}
.br-auth-primary:hover:not(:disabled) { background: var(--acc-strong); }
.br-auth-primary:active:not(:disabled) { transform: translateY(1px); }
.br-auth-primary:disabled { background: var(--line); color: var(--tx2); box-shadow: none; cursor: default; }
.br-auth-primary.is-mode-switching { pointer-events: none; transition-duration: 520ms; }
.br-auth-primary.is-next-disabled { background: var(--line); color: var(--tx2); box-shadow: none; }
.br-auth-primary.is-next-enabled { background: var(--acc); color: var(--on-acc); box-shadow: var(--shadow-sm); }
.br-auth-secondary { margin-top: auto; border: 1.5px solid var(--line); background: transparent; color: var(--tx2); }
.br-auth-secondary:hover { background: var(--sf2); color: var(--tx); }

.br-auth-confirm { display: grid; gap: 10px; padding: 8px 4px 4px; }
.br-auth-confirm div { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 12px; align-items: baseline; }
.br-auth-confirm span { color: var(--tx2); font-size: 12.6px; }
.br-auth-confirm strong { min-width: 0; overflow-wrap: anywhere; font-size: 14px; font-weight: 600; }

.br-auth-devices h2 { margin: 4px 0 2px; font-family: var(--font-heading); font-size: 20px; font-weight: 400; }
.br-auth-device-list { display: grid; gap: 8px; margin: 12px 0; }
.br-auth-device { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 14px; background: transparent; text-align: left; cursor: pointer; }
.br-auth-device:hover { background: var(--sf2); }
.br-auth-device:disabled { opacity: .55; cursor: default; }
.br-auth-device-copy { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.br-auth-device-copy strong { overflow: hidden; font-size: 12.8px; text-overflow: ellipsis; white-space: nowrap; }
.br-auth-device-copy small { color: var(--tx2); font-size: 11.5px; }
.br-auth-device-action { flex: 0 0 auto; color: var(--acc-deep); font-size: 11.8px; }

.br-auth-success { align-items: center; justify-content: center; gap: 10px; animation: br-pop .35s cubic-bezier(.2, .8, .3, 1) both; }
.br-auth-success-mark { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 50%; background: var(--sage-soft); color: var(--sage-deep); }
.br-auth-success > strong { font-size: 15px; }
.br-auth-success > span:last-child { color: var(--tx2); font-size: 12.8px; }

.br-legal-overlay { position: fixed; z-index: 120; inset: 0; display: grid; place-items: center; padding: 24px; background: color-mix(in srgb, #17120e 68%, transparent); backdrop-filter: blur(8px); animation: br-legal-fade .18s ease-out both; }
.br-legal-dialog { width: min(760px, 100%); max-height: min(780px, calc(100dvh - 48px)); display: flex; flex-direction: column; overflow: hidden; border: 1px solid color-mix(in srgb, var(--line) 82%, var(--sf)); border-radius: 24px; background: var(--sf); color: var(--tx); box-shadow: 0 28px 80px rgba(18, 13, 9, .34); animation: br-legal-rise .24s cubic-bezier(.2, .8, .3, 1) both; }
.br-legal-head { flex: 0 0 auto; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 25px 30px 20px; border-bottom: 1px solid var(--line); background: linear-gradient(145deg, var(--sf), color-mix(in srgb, var(--acc-soft) 42%, var(--sf))); }
.br-legal-head > div { min-width: 0; }
.br-legal-kicker { display: block; margin-bottom: 5px; color: var(--acc-deep); font-size: 9.5px; font-weight: 700; letter-spacing: .16em; }
.br-legal-head h2 { margin: 0; font-family: var(--font-heading); font-size: clamp(21px, 3vw, 27px); font-weight: 400; line-height: 1.25; }
.br-legal-head p { margin: 6px 0 0; color: var(--tx2); font-size: 11.5px; }
.br-legal-close { flex: 0 0 auto; padding: 7px 13px; border: 1px solid var(--line); border-radius: 999px; background: color-mix(in srgb, var(--sf) 84%, transparent); color: var(--tx2); font-size: 12px; font-weight: 600; cursor: pointer; }
.br-legal-close:hover { border-color: var(--acc); color: var(--tx); }
.br-legal-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 8px 30px 30px; }
.br-legal-section { padding: 18px 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 72%, transparent); }
.br-legal-section:last-child { border-bottom: 0; }
.br-legal-section h3 { margin: 0 0 9px; color: var(--tx); font-size: 14px; font-weight: 700; }
.br-legal-section p, .br-legal-section li { color: var(--tx2); font-size: 13px; line-height: 1.75; }
.br-legal-section p { margin: 0 0 9px; }
.br-legal-section p:last-child { margin-bottom: 0; }
.br-legal-section ul { display: grid; gap: 7px; margin: 0; padding-left: 19px; }

@keyframes br-legal-fade { from { opacity: 0; } }
@keyframes br-legal-rise { from { opacity: 0; transform: translateY(10px) scale(.985); } }

@keyframes br-auth-shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }

@media (max-width: 520px) {
  .br-auth-root { align-items: flex-start; padding: 24px 12px; }
  .br-auth-shell { width: 100%; }
  .br-auth-card { padding: 20px 18px 18px; border-radius: 22px; }
  .br-auth-brand { margin-bottom: 16px; }
  .br-legal-overlay { align-items: end; padding: 12px; }
  .br-legal-dialog { max-height: calc(100dvh - 24px); border-radius: 22px; }
  .br-legal-head { gap: 12px; padding: 21px 20px 17px; }
  .br-legal-head h2 { font-size: 21px; }
  .br-legal-close { padding: 6px 11px; }
  .br-legal-body { padding: 5px 20px 24px; }
  .br-legal-section { padding: 15px 0; }
  .br-legal-section p, .br-legal-section li { font-size: 12.5px; line-height: 1.7; }
}

@media (prefers-reduced-motion: reduce) {
  .br-auth-shell, .br-auth-brand svg, .br-auth-stage, .br-auth-message, .br-legal-overlay, .br-legal-dialog { animation: none; }
}
