#auth {
  width: min(740px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 1px solid #644058;
  border-radius: 22px;
  background: #1c1521;
  box-shadow: 0 35px 110px #08060bc4;
}
#auth::backdrop { background: #0b0812c4; backdrop-filter: blur(7px); }
.auth-layout { position: relative; display: grid; grid-template-columns: 36% minmax(0, 1fr); }
.auth-art {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: end;
  min-height: 340px;
  padding: 25px;
  isolation: isolate;
  background: #392239 url("/vice-sunset.webp") 64% center / auto 105% no-repeat;
}
.auth-art::before {
  content: "";
  position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(0deg, #180f24 0, #21152a90 22%, transparent 62%);
}
.auth-wordmark { color: #fff; font-style: italic; font-weight: 850; font-size: 1.24rem; letter-spacing: -.055em; }
.auth-wordmark span { color: #ff8bc7; }
.auth-body { align-self: center; padding: 45px 34px 32px; min-width: 0; }
#auth-title { font-size: clamp(1.6rem, 2.4vw, 2rem); line-height: 1.08; margin: 6px 16px 13px 0; }
.auth-description { color: #d1c4d3; line-height: 1.5; margin-bottom: 23px; font-size: .98rem; }
.auth-close { position: absolute; right: 10px; top: 8px; display: grid; place-items: center; width: 42px; height: 42px; border: none; background: none; color: #ccbaca; border-radius: 50%; }
.auth-close:hover { color: white; background: #ffffff0e; }
.auth-close .icon, #telegram-code .icon { width: 17px; height: 17px; }
.telegram-button, #auth .sun-button { display: flex; align-items: center; justify-content: center; width: 100%; gap: 10px; min-height: 48px; border: 0; border-radius: 11px; padding: 10px 12px; font-size: .96rem; font-weight: 650; }
.telegram-button { background: #1675a7; color: white; }
.telegram-button { overflow-wrap: anywhere; }
.telegram-button:hover { background: #1a82b8; color: white; }
.telegram-button:disabled { opacity: .8; }
.telegram-button[aria-disabled="true"] { background: #38434e; color: #d7dde1; pointer-events: none; }
.auth-alternate, .auth-text-button { color: #dccfdd; background: none; border: none; font-size: .89rem; font-weight: 500; }
.auth-alternate { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid #473442; width: 100%; min-height: 45px; text-align: left; margin-top: 22px; padding: 15px 0 0; }
.auth-alternate span { color: #f591c3; font-size: 1.1rem; }
#telegram-back { justify-content: start; gap: 9px; }
.auth-text-button { min-height: 42px; padding: 6px; }
.auth-alternate:hover, .auth-text-button:hover { color: #ffa8d5; }
.auth-feedback, #auth-status { color: #ddc2d3; font-size: .86rem; line-height: 1.42; }
.auth-feedback { margin-top: 13px; }
.auth-feedback[data-tone="error"] { color: #ffbdac; }
#auth-email form { gap: 12px; padding-top: 5px; }
#auth-email label { font-size: .86rem; }
#auth-email input { background: #131019; border-color: #543c51; }
#auth-email .sun-button { margin-top: 3px; }
#auth-email #auth-switch { padding: 2px; min-height: 34px; }
#auth[data-pane="pending"] .auth-art::before { background: linear-gradient(0deg, #170d20e8, #23132bc9); }
.auth-scan { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding-bottom: 18px; }
.auth-scan img { display: block; background: white; border-radius: 9px; width: min(176px, 80%); height: auto; aspect-ratio: 1; }
.auth-scan p { font-size: .78rem; font-weight: 500; margin: 10px 0 0; color: white; }
#telegram-pending .auth-description { margin-bottom: 12px; }
#telegram-code { width: 100%; display: flex; justify-content: space-between; align-items: center; padding: 12px 15px; margin-bottom: 13px; color: #fff; border: 1px solid #61445f; background: #2b1f30; border-radius: 11px; }
#telegram-code-value { font-weight: 650; font-size: 1.6rem; letter-spacing: .13em; font-variant-numeric: tabular-nums; }
#telegram-code .icon { color: #d3b8cf; }
#telegram-new { display: block; margin: 2px auto; }
.telegram-help summary { color: #cfbfce; font-size: .83rem; cursor: pointer; padding-block: 5px; }
.telegram-help p { color: #d5c3d3; font-size: .85rem; padding-top: 5px; overflow-wrap: anywhere; }
#telegram-native { display: none; }
@media (pointer: coarse) {
  body:not(.desktop) #telegram-native[href] { display: inline-flex; align-items: center; min-height: 44px; font-size: .86rem; color: #f5a6d2; }
}

#network { padding-top: clamp(22px, 4vw, 48px); }
.network-heading { margin-bottom: clamp(18px, 2.5vw, 30px); }
.network-heading h1 { font-size: clamp(1.95rem, 4vw, 3.25rem); line-height: 1.04; margin: 0 0 9px; }
.network-heading p { color: #cec1d0; font-size: clamp(.94rem, 1.2vw, 1.05rem); }
.network-layout { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(305px, 1fr); gap: clamp(16px, 2.3vw, 32px); align-items: start; }
.drive-preview { margin: 0; min-width: 0; }
.drive-preview video { display: block; width: 100%; height: auto; aspect-ratio: 16/9; object-fit: contain; background: #1f1923; border-radius: 16px; box-shadow: 0 0 0 1px #493447; }
.drive-preview figcaption { display: flex; gap: 8px 16px; flex-wrap: wrap; align-items: baseline; margin: 13px 1px 0; color: #b7a9bb; font-size: .85rem; }
.drive-preview figcaption strong { color: #f8eef7; font-weight: 650; font-size: 1rem; }
.network-report { min-width: 0; padding: clamp(18px, 2.1vw, 28px); border-radius: 16px; border: 1px solid #493747; background: linear-gradient(145deg, #2a1b2b, #1b1621 46%); }
.network-report h2 { font-size: clamp(1.3rem, 2vw, 1.65rem); }
#check-steps { margin: 14px 0 0; list-style: none; padding: 0; }
#check-steps li { position: relative; padding: 10px 0 10px 30px; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 1px 8px; border-top: 1px solid #ffffff12; }
#check-steps li::before, .check-step-spinner { position: absolute; top: 15px; left: 2px; width: 14px; height: 14px; border-radius: 50%; }
#check-steps li::before { content: ""; border: 1.5px solid #807586; }
#check-steps li[data-state=running]::before { display: none; }
.check-step-spinner { border: 2px solid #67445e; border-top-color: #ff9fce; animation: measure-spin .75s linear infinite; }
@keyframes measure-spin { to { transform: rotate(1turn); } }
.check-step-title { grid-column: 1; color: #faf3fa; font-size: .95rem; font-weight: 550; line-height: 1.35; }
.check-step-value { grid-column: 1/-1; grid-row: 2; color: #c0b2c3; font-size: .8rem; line-height: 1.45; font-variant-numeric: tabular-nums; }
.check-step-grade { grid-column: 2; grid-row: 1; align-self: center; font-size: .77rem; font-weight: 500; color: #8be4b9; }
[data-state=fair] .check-step-grade { color: #f2cb7d; }
[data-state=poor] .check-step-grade { color: #ff9d97; }
#check-steps :is([data-state=excellent],[data-state=good])::before { background: #77dfac; border-color: #77dfac; }
#check-steps :is([data-state=excellent],[data-state=good])::after { content: ""; position: absolute; width: 6px; height: 4px; border-left: 1.6px solid #163a2b; border-bottom: 1.6px solid #163a2b; transform: rotate(-45deg); left: 6px; top: 19px; }
#check-steps [data-state=fair]::before { background: #edc56a; border-color: #edc56a; }
#check-steps [data-state=poor]::before { background: #ff8a88; border-color: #ff8a88; }
#check-steps [data-state=unknown]::before { background: #8c8094; border-color: #8c8094; }
.check-outcome { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding-top: 16px; border-top: 1px solid #594051; }
.result-label { font-size: .82rem; color: #d3c5d3; }
#check-verdict { font-size: clamp(1.35rem, 2.15vw, 1.8rem); line-height: 1.12; letter-spacing: -.04em; }
#check-verdict:is([data-grade=excellent],[data-grade=good]) { color: #82e2b4; }
#check-verdict[data-grade=fair] { color: #f2cb7d; }
#check-verdict[data-grade=poor] { color: #ff9d97; }
#check-status { margin: 10px 0 15px; color: #cbc0ce; font-size: .86rem; line-height: 1.4; }
.network-report :is(#check-start,#check-stop) { width: 100%; min-height: 46px; justify-content: center; }
#network:not([data-phase=running]) #check-stop, #network[data-phase=running] #check-start,
#network:not([data-phase=done]) .check-outcome, #network[data-phase=idle] .network-details { display: none; }
.network-details { margin-top: 26px; padding: 14px 1px; border-block: 1px solid #3b2b3b; }
.network-details summary { cursor: pointer; font-weight: 550; }
.network-details[open] summary { margin-bottom: 14px; }
.network-details .metrics { max-width: 650px; }
.network-details p { font-size: .89rem; }
@media (max-width: 730px) {
  .network-layout { grid-template-columns: 1fr; }
  .drive-preview figcaption { margin-top: 8px; }
  .network-report { display: flex; flex-direction: column; padding: 17px 18px; }
  .network-report h2 { order: 0; }
  .network-report :is(#check-start,#check-stop) { order: 2; }
  #check-status { order: 1; }
  #check-steps { order: 3; }
  .check-outcome { order: 1; padding-top: 13px; margin-top: 12px; }
  #network[data-phase=done] :is(#check-start,#check-stop) { order: 4; margin-top: 12px; }
  #network[data-phase=done] #check-status { order: 2; margin-bottom: 0; }
  #check-steps { margin-top: 10px; }
  #check-steps li { padding-block: 8px; }
  #check-steps li::before, .check-step-spinner { top: 13px; }
  #check-steps :is([data-state=excellent],[data-state=good])::after { top: 17px; }
}
@media (max-width: 580px) {
  #auth { width: min(420px, calc(100% - 24px)); max-height: calc(100dvh - 20px); border-radius: 17px; }
  .auth-layout { grid-template-columns: 1fr; }
  .auth-art { min-height: 85px; padding: 13px 22px; background-size: 190% auto; background-position: 57% 28%; }
  .auth-art::before, #auth[data-pane="pending"] .auth-art::before {
    background: linear-gradient(270deg, #29172f 0 9%, transparent 23%), linear-gradient(90deg, #1b1028d9, #24162a52 48%, transparent);
  }
  .auth-wordmark { font-size: 1.1rem; }
  .auth-body { position: static; padding: 21px 22px; }
  #auth-title { margin-top: 0; }
  .auth-close { top: 8px; right: 8px; color: white; background: #19121edc; }
  .auth-close:hover { background: #231628; }
  #telegram-qr-wrap { display: none; }
  .auth-alternate { margin-top: 15px; }
  .auth-description { margin-bottom: 18px; }
}
@media (prefers-reduced-motion: reduce) { .check-step-spinner { animation: none; border-color: #dd9ac7; border-right-color: transparent; } }
