:root { color-scheme: dark; }
* { box-sizing: border-box; }
body { min-width: 320px; margin: 0; background: var(--bg); color: var(--text); font-family: var(--font-ui); font-size: 16px; line-height: 1.5; }
.portal-header { min-height: 64px; display: flex; align-items: center; justify-content: space-between; padding: 0 32px; border-bottom: 1px solid var(--line); background: #0c0f10; }
.portal-header a { min-height: 40px; display: flex; align-items: center; gap: 9px; color: var(--text-secondary); text-decoration: none; font-size: 14px; font-weight: 700; }
.portal-header a:hover { color: var(--text); }
.portal-brand span { color: var(--red); font-family: var(--font-data); font-size: 22px; }
.portal-back svg { width: 17px; height: 17px; }

.access-layout { min-height: calc(100svh - 64px); display: grid; place-items: center; padding: 48px 24px; background: linear-gradient(rgba(11,11,13,.74), rgba(11,11,13,.93)), url('/assets/basewf-operations-v2.jpg') center / cover no-repeat; }
.login-panel { position: relative; width: min(560px, 100%); padding: 36px; border: 1px solid var(--line); border-top: 3px solid var(--red); border-radius: 0; background: #121214; box-shadow: 0 24px 80px #0008; }
.login-panel::after { content: ""; position: absolute; top: -3px; right: -1px; width: 28px; height: 28px; background: var(--bg); clip-path: polygon(100% 0, 100% 100%, 0 0); border-top: 3px solid var(--red); }
.login-panel__head { display: flex; align-items: center; justify-content: space-between; color: var(--red); font-size: 12px; font-weight: 700; }
.login-panel__head svg { width: 20px; height: 20px; }
.login-panel h1 { margin: 20px 0 12px; font-size: 32px; line-height: 1.15; }
.login-panel > p { max-width: 540px; margin: 0 0 24px; color: var(--text-secondary); font-size: 16px; line-height: 1.5; }
.vk-login { min-height: 48px; }
.login-emblem { width: 72px; height: 78px; display: grid; justify-items: center; align-content: center; gap: 5px; margin-top: 28px; color: var(--red); border: 1px solid #5a2a26; background: #241615; clip-path: polygon(0 0, 100% 0, 100% 75%, 50% 100%, 0 75%); }
.login-emblem svg { width: 28px; height: 28px; }
.login-emblem span { font-family: var(--font-data); font-size: 12px; font-weight: 700; }
.login-start, .bot-challenge > .ui-button { width: 100%; min-height: 48px; }
.bot-challenge { padding-top: 4px; }
.challenge-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--text-secondary); font-size: 12px; }
.challenge-heading time { color: var(--amber); }
.challenge-code { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px; margin-top: 10px; border: 1px solid #654038; background: #1d1415; }
.challenge-code code { font-family: var(--font-data); color: white; font-size: 18px; font-weight: 700; white-space: nowrap; }
.challenge-code .ui-icon-button { flex: 0 0 40px; width: 40px; height: 40px; background: #271b1c; }
.bot-challenge p { margin: 14px 0 20px; color: var(--text-secondary); font-size: 14px; line-height: 1.6; }
.challenge-wait { display: flex; align-items: center; justify-content: center; gap: 9px; margin-top: 18px; font-size: 13px; color: var(--text-secondary); }
.status-pulse { flex: 0 0 7px; width: 7px; height: 7px; background: var(--green); animation: login-pulse 1.8s ease-in-out infinite; }
.login-retry { display: block; min-height: 44px; margin: 8px auto 0; padding: 8px 12px; border: 0; background: transparent; color: var(--text-muted); font-size: 13px; text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }
.login-retry:hover { color: var(--text); }
.login-state.is-warning { border-left-color: var(--amber); background: #221d14; }
.login-state { position: relative; min-height: 48px; display: flex; align-items: center; margin-top: 14px; padding: 11px 13px; border-left: 3px solid var(--blue); background: #121a1f; color: var(--text-secondary); font-size: 14px; }
.login-state.is-ok { padding-left: 48px; border-left-color: var(--green); background: #101b16; color: #d8f7e6; animation: access-confirm 220ms ease-out; }
.login-state.is-ok::before { content: "✓"; position: absolute; left: 14px; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: var(--green); color: #08110c; font-family: var(--font-data); font-weight: 700; }
.join-panel { display: grid; grid-template-columns: 34px 1fr; gap: 12px; margin-top: 16px; padding: 16px; border-left: 3px solid var(--amber); background: #1a160e; }
.join-panel > svg { width: 25px; height: 25px; color: var(--amber); }
.join-panel strong { font-size: 16px; }
.join-panel p { margin: 4px 0 0; color: var(--text-secondary); font-size: 14px; }
.join-panel .ui-button, .join-panel small { grid-column: 2; }
.join-panel .ui-button { justify-self: start; margin-top: 6px; }
.join-panel small { color: var(--text-muted); font-size: 12px; }
.access-note { display: flex; align-items: flex-start; gap: 9px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line-soft); color: var(--text-muted); font-size: 12px; line-height: 1.6; }
.access-note svg { width: 16px; height: 16px; flex: 0 0 auto; }
.privacy-link { display: inline-block; margin-top: 14px; color: var(--text-muted); font-size: 12px; }
.privacy-link:hover { color: var(--text-secondary); }

.legal-page { width: min(820px, calc(100% - 32px)); margin: 0 auto; padding: 56px 0 80px; }
.legal-kicker { color: var(--red); font-family: var(--font-data); font-size: 12px; font-weight: 700; }
.legal-page h1 { margin: 10px 0 16px; font-size: 44px; line-height: 1.1; }
.legal-lead { color: var(--text-secondary); font-size: 16px; }
.legal-page section { padding: 24px 0; border-top: 1px solid var(--line); }
.legal-page h2 { margin: 0 0 8px; font-size: 20px; }
.legal-page section p { margin: 0; color: var(--text-secondary); font-size: 16px; line-height: 1.5; }
.legal-page section a { color: var(--text); }

@keyframes access-confirm { from { opacity: 0; transform: translateY(6px); } }
@keyframes login-pulse { 50% { opacity: .35; } }

@media (max-width: 720px) {
  .portal-header { min-height: 56px; padding: 0 16px; }
  .portal-brand { max-width: 210px; }
  .access-layout { min-height: calc(100svh - 56px); padding: 24px 14px; }
  .login-panel { padding: 24px 20px; }
  .login-panel h1 { font-size: 28px; }
  .legal-page { padding-top: 38px; }
  .legal-page h1 { font-size: 32px; }
}

@media (max-width: 440px) {
  .portal-back span { display: none; }
  .login-panel { padding: 22px 16px; }
  .join-panel { grid-template-columns: 28px 1fr; }
  .join-panel .ui-button { width: 100%; }
  .challenge-code { padding: 10px 8px; }
  .challenge-code code { font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
