:root {
  color-scheme: dark;
  --bg: #070f2d;
  --surface: rgba(8, 20, 47, 0.94);
  --surface-strong: #0a2447;
  --line: rgba(109, 211, 255, 0.22);
  --primary: #00edff;
  --primary-strong: #00a9cc;
  --text: #f4fbff;
  --muted: #a8bfd2;
  --danger: #ff9292;
  --focus: #8be9ff;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  min-width: 0;
  color: var(--text);
  background:
    linear-gradient(100deg, rgba(7, 15, 45, 0.96), rgba(7, 15, 45, 0.60)),
    url('/area/desktop/img/bg.jpg') center / cover no-repeat fixed,
    var(--bg);
}

body::before {
  position: fixed;
  inset: 0;
  pointer-events: none;
  content: "";
  opacity: 0.12;
  background-image:
    linear-gradient(rgba(88, 185, 230, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(88, 185, 230, 0.1) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, black, transparent 90%);
}

button, input { font: inherit; }

button { touch-action: manipulation; }

.page-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(420px, 0.9fr);
  min-height: 100dvh;
}

.page-shell::before {
  position: absolute;
  z-index: 0;
  inset: 0;
  content: "";
  pointer-events: none;
  background: url('/assets/erqi-memorial-tower.jpg') calc(50% - 22vw) center / cover no-repeat;
  filter: brightness(0.35);
  opacity: 0.12;
  -webkit-mask-image: linear-gradient(to right, #000 0%, #000 16%, rgba(0, 0, 0, 0.65) 38%, transparent 72%);
  mask-image: linear-gradient(to right, #000 0%, #000 16%, rgba(0, 0, 0, 0.65) 38%, transparent 72%);
}

.brand-panel,
.login-panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(36px, 6vw, 96px);
}

.brand-panel {
  max-width: 880px;
}

.card-kicker {
  margin: 0 0 14px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.2em;
}

h1 {
  margin: 0;
  font-size: clamp(32px, 3.4vw, 64px);
  line-height: 1.4;
  letter-spacing: 0.025em;
}
h1 span { display: block; color: var(--primary); letter-spacing: 0.12em; }

.photo-credit {
  position: absolute;
  bottom: 24px;
  left: clamp(36px, 6vw, 96px);
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: #b8cadb;
  font-size: 12px;
}
.photo-credit a, .credit-trigger { display: inline-flex; align-items: center; min-height: 44px; color: inherit; }
.photo-credit a { text-underline-offset: 2px; }
.credit-trigger { padding: 0; border: 0; background: transparent; text-decoration: underline; text-underline-offset: 2px; }
.photo-credit a:focus-visible, .credit-trigger:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }

.credit-dialog {
  width: min(560px, calc(100vw - 32px));
  max-height: min(80dvh, 680px);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: #0b1a38;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.48);
}
.credit-dialog::backdrop { background: rgba(1, 8, 25, 0.78); }
.credit-dialog h2 { margin: 0 0 18px; font-size: 24px; }
.credit-dialog h2:focus { outline: none; }
.credit-dialog p { margin: 0 0 14px; color: #d8e8f3; font-size: 14px; line-height: 1.7; }
.credit-dialog .credit-uri { overflow-wrap: anywhere; }
.credit-dialog .credit-note { color: var(--muted); font-size: 12px; }
.credit-close { min-height: 44px; padding: 0 24px; border: 1px solid var(--line); color: var(--text); background: var(--surface-strong); }

.login-panel { align-items: center; }

.login-card {
  position: relative;
  width: min(100%, 480px);
  padding: clamp(28px, 4vw, 48px);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(18px);
}
.login-card::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 32px;
  width: 64px;
  height: 2px;
  background: var(--primary);
  box-shadow: 0 0 12px rgba(0, 237, 255, 0.4);
}

h2 { margin: 0; font-size: 30px; }
.card-help { margin: 12px 0 30px; color: var(--muted); line-height: 1.6; }
.field { margin-bottom: 22px; }
.field label { display: block; margin-bottom: 9px; color: #d8edf6; font-size: 14px; font-weight: 600; }

input {
  width: 100%;
  min-height: 50px;
  padding: 0 15px;
  border: 1px solid rgba(135, 198, 224, 0.28);
  border-radius: 4px;
  outline: none;
  color: var(--text);
  background: rgba(2, 16, 34, 0.7);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

input::placeholder { color: #a8bfd2; }
input:focus { border-color: var(--focus); box-shadow: 0 0 0 3px rgba(87, 220, 255, 0.14); }
.code-row { display: grid; grid-template-columns: minmax(0, 1fr) 126px; gap: 10px; }

button {
  min-height: 48px;
  border-radius: 4px;
  cursor: pointer;
  transition: transform 140ms ease, opacity 140ms ease, background 140ms ease;
}

button:active { transform: scale(0.985); }
button:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
button:disabled { cursor: wait; opacity: 0.58; }

.primary-button {
  width: 100%;
  border: 0;
  color: #001a23;
  background: linear-gradient(135deg, #6bf3f5, var(--primary));
  font-weight: 750;
}

.primary-button:hover { background: linear-gradient(135deg, #91fbfc, #35dfed); }
.secondary-button { border: 1px solid rgba(25, 211, 230, 0.48); color: #8cf6ff; background: rgba(8, 73, 93, 0.52); font-size: 14px; }
.field-error { min-height: 18px; margin: 6px 0 0; color: var(--danger); font-size: 13px; }
.form-status { min-height: 22px; margin: -2px 0 12px; color: #b9e8f2; font-size: 14px; }

.resume-box {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  text-align: center;
}
.resume-box p { margin: 0 0 12px; color: var(--muted); }
.resume-box button:not(.text-button) { padding: 0 18px; border: 1px solid var(--line); color: var(--text); background: var(--surface-strong); }
.text-button { margin-left: 10px; border: 0; color: var(--primary); background: transparent; }

@media (max-width: 860px) {
  .page-shell {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
    overflow-x: hidden;
  }
  .page-shell::before {
    background-position: center center;
    background-size: cover;
    opacity: 0.12;
    -webkit-mask-image: none;
    mask-image: none;
  }
  .brand-panel {
    flex: 0 0 auto;
    min-height: 0;
    padding: clamp(28px, 7vh, 52px) 20px 16px;
    text-align: center;
    align-items: center;
  }
  h1 {
    max-width: 520px;
    font-size: clamp(22px, 6vw, 30px);
    line-height: 1.32;
  }
  h1 span { margin-top: 4px; }
  .login-panel {
    flex: 0 0 auto;
    padding: 10px 20px 16px;
  }
  .login-card {
    width: min(100%, 360px);
    padding: 24px;
  }
  .card-kicker { margin-bottom: 8px; }
  h2 { font-size: 26px; }
  .card-help { margin: 8px 0 20px; }
  .field { margin-bottom: 16px; }
  .field label { margin-bottom: 7px; }
  input { min-height: 46px; font-size: 16px; }
  button { min-height: 44px; }
  .photo-credit {
    position: relative;
    bottom: auto;
    left: auto;
    z-index: 1;
    flex: 0 0 auto;
    width: 100%;
    justify-content: center;
    margin-top: auto;
    padding: 8px 16px max(12px, env(safe-area-inset-bottom));
    font-size: 12px;
  }
  body { background-attachment: scroll; }
}

@media (max-width: 420px) {
  .code-row { grid-template-columns: minmax(0, 1fr) 112px; }
  .brand-panel { padding-top: clamp(24px, 6vh, 42px); }
  .login-panel { padding-inline: 16px; }
  .login-card { padding: 22px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
