@media (width > 820px) {
  :root {
    color-scheme: dark;
    font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
    --photo-surface: #142938;
    --surface: #12212d;
    --field: #182a38;
    --text: #f0f5fb;
    --muted: #b8cad9;
    --border: #718899;
    --action: #a0c8ff;
    --action-hover: #b7d5ff;
    --on-action: #102744;
    --error: #ffadb4;
  }

  * { box-sizing: border-box; }
  [hidden] { display: none !important; }

  body {
    margin: 0;
    background: var(--surface);
    color: var(--text);
    line-height: 1.5;
  }

  .login {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(390px, 2fr);
    min-height: 100vh;
    min-height: 100svh;
  }

  .login-photo {
    position: relative;
    background: var(--photo-surface);
  }

  .login-photo img {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 55% center;
    filter: brightness(.82);
  }

  .login-panel {
    display: grid;
    place-items: center;
    padding: 48px clamp(34px, 5vw, 80px);
  }

  .login-content { width: min(100%, 368px); }

  .brand-logo {
    display: block;
    width: 168px;
    height: auto;
    padding: 6px 8px;
    border-radius: 4px;
    background: #fff;
  }

  .brand-platform {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
  }

  h1 {
    margin: 17px 0 32px;
    font-size: clamp(29px, 2.55vw, 40px);
    font-weight: 650;
    line-height: 1.2;
    letter-spacing: -.035em;
  }

  .login-field + .login-field { margin-top: 20px; }

  label {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
  }

  input, button { font: inherit; }

  input {
    display: block;
    width: 100%;
    min-height: 54px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--field);
    color: var(--text);
  }

  input[aria-invalid="true"] { border-color: var(--error); }
  .password-field { position: relative; }
  .password-field input { padding-inline-end: 72px; }

  button { cursor: pointer; }
  button:disabled { opacity: .7; cursor: wait; }

  #show-password {
    position: absolute;
    inset-block-start: 5px;
    inset-inline-end: 5px;
    min-width: 54px;
    min-height: 44px;
    padding: 0 8px;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: var(--action);
    font-size: 14px;
    font-weight: 550;
  }

  #show-password:hover { background: var(--surface); }

  #sign-in {
    width: 100%;
    min-height: 52px;
    margin-top: 24px;
    border: 0;
    border-radius: 8px;
    background: var(--action);
    color: var(--on-action);
    font-weight: 650;
  }

  #sign-in:hover:not(:disabled) { background: var(--action-hover); }
  #login-status { margin: 0; color: var(--error); font-size: 14px; }
  #login-status:not(:empty) { margin-top: 10px; }
  #https-only { margin: 0; color: var(--muted); }
  #https-link { color: var(--action); white-space: nowrap; }

  :focus-visible { outline: 2px solid var(--action); outline-offset: 3px; }
  #show-password:focus-visible { outline-offset: -2px; }

  .mobile-only { display: none; }
}

@media (max-width: 820px) {
  :root {
    color-scheme: light dark;
    --surface: light-dark(#fff, #182738);
    --canvas: light-dark(#f1f5fa, #0f1926);
    --text: light-dark(#16263c, #eff5ff);
    --muted: light-dark(#4c5e74, #b5c5da);
    --border: light-dark(#8b9db1, #667d95);
    --blue: light-dark(#1957a3, #8cbdff);
    --button-text: light-dark(#fff, #101e33);
    --error: light-dark(#a32331, #ffadb4);
    font-family: system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
  }

  * { box-sizing: border-box; }
  [hidden] { display: none !important; }

  body {
    min-height: 100vh;
    margin: 0;
    display: grid;
    place-items: center;
    padding: 24px 16px;
    background: var(--canvas);
    color: var(--text);
    line-height: 1.55;
  }

  .login {
    width: min(100%, 436px);
    border: 1px solid light-dark(#cbd7e5, #33475e);
    border-radius: 12px;
    overflow: hidden;
    background: var(--surface);
  }

  .brand {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 20px clamp(20px, 6vw, 32px);
    background: #122c50;
    color: #fff;
  }

  .brand strong { display: block; font-size: 16px; font-weight: 650; }
  .brand div span { display: block; color: #c3d5eb; font-size: 13px; }

  .brand-logo {
    display: block;
    width: clamp(104px, 30vw, 132px);
    height: auto;
    padding: 7px 9px;
    border-radius: 5px;
    background: #fff;
    flex: none;
  }

  .login-panel { padding: 29px clamp(20px, 6vw, 32px) 32px; }
  h1 { margin: 0 0 22px; font-size: clamp(22px, 6vw, 26px); }
  label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 600; }
  .login-field + .login-field label { margin-top: 16px; }

  input, button {
    min-height: 44px;
    font: inherit;
    border-radius: 6px;
  }

  input {
    width: 100%;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    padding: 8px 11px;
  }

  input[aria-invalid="true"] { border-color: var(--error); }
  .password-field { display: flex; gap: 8px; }
  .password-field input { min-width: 0; }

  button { cursor: pointer; }
  button:disabled { opacity: 0.7; cursor: wait; }

  #show-password {
    flex: none;
    padding: 0 12px;
    color: var(--blue);
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: 14px;
  }

  #sign-in {
    width: 100%;
    border: 0;
    background: var(--blue);
    color: var(--button-text);
    font-weight: 650;
  }

  #login-status { min-height: 22px; margin: 9px 0; color: var(--error); font-size: 14px; }
  #https-only { margin: 0; color: var(--muted); }
  #https-link { color: var(--blue); white-space: nowrap; }

  :focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }

  .desktop-only { display: none; }
  .login-content, .login-field { display: contents; }
}
