.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.appearance-controls, .workspace-toolbar { display: flex; align-items: center; justify-content: flex-end; gap: .5rem; }
.workspace-toolbar { margin-bottom: 1.2rem; }
.appearance-control {
  position: relative;
  display: grid;
  align-items: center;
  color: var(--muted);
  min-width: 0;
}
.appearance-control select {
  appearance: none;
  padding: .45rem 1.3rem .45rem 1.8rem;
  min-height: 36px;
  border-color: var(--line);
  background: var(--subtle);
  font-size: .82rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
}
.appearance-controls svg, .auth-form svg, .auth-text-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.55;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.appearance-control > svg { position: absolute; left: .45rem; pointer-events: none; }
.appearance-control > .control-chevron { width: 13px; height: 13px; right: .3rem; left: auto; }
.appearance-help {
  min-height: 36px;
  width: 36px;
  padding: 0;
  border-radius: 8px;
  background: var(--subtle);
  color: var(--muted);
}
.appearance-help:hover, .appearance-control select:hover { color: var(--ink); border-color: var(--input-line); }

.auth-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100svh;
  padding: max(1.25rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right))
    max(1.25rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 11% 6%, #282044 0, transparent 55%),
    radial-gradient(ellipse at 85% 100%, #251941 0, transparent 48%),
    var(--page);
}
.auth-page::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -65% -31% -85% 18%;
  background: url("/brand/fluid.jpg") center / contain no-repeat;
  opacity: .18;
  filter: blur(19px);
  mix-blend-mode: screen;
  transform: rotate(-20deg);
  pointer-events: none;
}
:root[data-theme="light"] .auth-page {
  background: radial-gradient(ellipse at 15% 0, #e5defb 0%, transparent 60%),
    radial-gradient(ellipse at 95% 100%, #dad0fb 0%, transparent 53%), var(--page);
}
:root[data-theme="light"] .auth-page::before { opacity: .055; mix-blend-mode: multiply; }

.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 52fr) minmax(0, 48fr);
  width: min(100%, 1032px);
  min-height: 620px;
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: 0 34px 100px #07041270, 0 1px 1px #a58aff14;
}
.auth-first { animation: brand-enter .35s ease-out both; }
:root[data-theme="light"] .auth-shell { box-shadow: 0 28px 78px #32236e38; }
.auth-art {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2.2rem;
  min-width: 0;
  padding: 2.05rem 2.45rem 2rem;
  color: #f5f2ff;
  background: radial-gradient(ellipse at 57% 41%, #2d1b54, #130f23 64%, #0d0a17);
}
.auth-artwork {
  position: absolute;
  z-index: -2;
  inset: 6% -12% 4% -6%;
  background: url("/brand/fluid.jpg") center 44% / min(97%, 570px) auto no-repeat;
  mix-blend-mode: screen;
  transform: rotate(-10deg);
  opacity: .96;
}
.auth-art::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background: linear-gradient(180deg, #100b20a0, transparent 23%, transparent 43%, #100b20a0 67%, #100b20f7 91%);
  pointer-events: none;
}
.auth-brand { display: flex; align-items: center; gap: .75rem; font-size: 1.03rem; font-weight: 780; letter-spacing: .14em; }
.auth-brand .brand-icon { width: 42px; height: 42px; flex-basis: 42px; }
.auth-story h2 { margin: 0; font-size: clamp(2.2rem, 4.7vw, 3.4rem); font-weight: 750; line-height: 1.04; letter-spacing: -.055em; }
.auth-story h2 span { color: #c1b5ff; }
.auth-story p { margin-top: .95rem; max-width: 33ch; color: #d5cce8; font-size: .92rem; line-height: 1.55; }
.auth-art-footer {
  display: flex;
  align-items: center;
  gap: .65rem;
  margin-top: 1.45rem;
  color: #b0a2cb;
  font: 550 .72rem/1.3 Inter, "Segoe UI", sans-serif;
  letter-spacing: .16em;
}
.auth-footer-line { display: inline-block; flex: 0 0 16px; height: 1px; background: #a193d3; }

.auth-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 1.45rem clamp(1.65rem, 4vw, 3.2rem) 2rem;
  background: var(--surface);
}
.auth-toolbar { margin-bottom: 1.55rem; }
.auth-content {
  width: min(100%, 358px);
  margin: auto;
  animation: brand-enter .22s ease-out both;
}
.auth-heading { margin-bottom: 1.3rem; }
.auth-heading h1 { font-size: clamp(1.72rem, 3vw, 2.35rem); letter-spacing: -.043em; }
.auth-heading p { margin-top: .35rem; color: var(--muted); font-size: .96rem; }
.auth-form { display: grid; gap: .9rem; }
.auth-roles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  position: relative;
  min-width: 0;
  margin: 0;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--subtle);
  isolation: isolate;
}
.auth-roles::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 4px auto 4px 4px;
  width: calc(50% - 4px);
  border: 1px solid var(--input-line);
  border-radius: 8px;
  background: var(--accent-soft);
  transition: transform .2s ease;
}
.auth-roles:has(input[value="student"]:checked)::before { transform: translateX(100%); }
.auth-roles label {
  position: relative;
  min-width: 0;
  min-height: 39px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  padding: .3rem .55rem;
  color: var(--muted);
  text-align: center;
  cursor: pointer;
  font-size: .89rem;
  font-weight: 650;
}
.auth-roles label:has(input:checked) { color: var(--accent); }
.auth-roles label:has(input:focus-visible) { border-radius: 8px; outline: 2px solid var(--focus); outline-offset: -1px; }
.auth-roles input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; }
.auth-form .field, .auth-password { font-size: .9rem; font-weight: 650; }
.auth-password { display: grid; gap: .4rem; }
.auth-form input:not([type="radio"], [type="checkbox"]) { min-height: 46px; padding: .65rem .82rem; background: var(--subtle); }
.auth-form input::placeholder { color: var(--muted); opacity: 1; }
.auth-password-control { position: relative; }
.auth-form .auth-password-control input { padding-right: 3.15rem; }
.auth-eye {
  position: absolute;
  inset: 4px 4px 4px auto;
  min-height: 0;
  width: 39px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border-color: transparent;
  border-radius: 7px;
}
.auth-eye .eye-slash { display: none; }
.auth-eye[aria-pressed="true"] .eye-slash { display: block; }
.auth-option { display: flex; align-items: center; gap: .55rem; color: var(--muted); cursor: pointer; font-size: .86rem; }
.auth-option input { width: 16px; height: 16px; margin: 0; accent-color: var(--brand-primary); }
.auth-submit { min-height: 47px; gap: .65rem; }
.auth-text-button {
  min-height: 32px;
  padding: .1rem .3rem;
  border-color: transparent;
  background: transparent;
  color: var(--accent);
  font-size: inherit;
  font-weight: 720;
}
.auth-text-button svg { width: 13px; height: 13px; }
.auth-switch {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: .25rem;
  border-top: 1px solid var(--line);
  margin-top: 1.25rem;
  padding-top: .85rem;
  color: var(--muted);
  font-size: .86rem;
}
.auth-error { padding: .45rem .6rem; border-radius: 8px; background: var(--danger-soft); color: var(--danger); font-size: .85rem; }
.brand-loading { display: grid; min-height: 100svh; place-content: center; }
.account-reset-panel { width: min(100%, 460px); }
.brand-loading > img { border-radius: 12px; }
.brand-loading .brand-icon { animation: brand-enter .18s ease-out both; }
@keyframes brand-enter {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 740px) {
  .auth-shell { width: min(100%, 465px); min-height: 0; grid-template-columns: minmax(0, 1fr); }
  .auth-art { min-height: 230px; padding: 1.15rem 1.25rem; gap: 1rem; }
  .auth-artwork { inset: -12% -15% -25% 24%; background-size: min(100%, 340px) auto; }
  .auth-art::after { background: linear-gradient(90deg, #100b20db, transparent 80%), linear-gradient(0deg, #100b20e0, transparent 70%); }
  .auth-story h2 { font-size: clamp(1.75rem, 7vw, 2.65rem); }
  .auth-story p { margin-top: .48rem; font-size: .82rem; }
  .auth-art-footer { margin-top: .75rem; font-size: .62rem; }
  .auth-panel { padding: .9rem 1.25rem 1.3rem; }
  .auth-toolbar { margin-bottom: .8rem; }
}
@media (max-width: 370px) {
  .auth-page { padding-inline: .65rem; }
  .auth-panel { padding-inline: .9rem; }
  .appearance-controls { gap: .35rem; }
  .appearance-control select { font-size: .76rem; }
}
@media (prefers-reduced-motion: reduce) {
  .auth-first, .auth-content, .brand-loading .brand-icon { animation: none; }
  .auth-roles::before { transition: none; }
}
