/* Login-only theme. The protected download page keeps its existing styles. */
#accessGate {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  padding: 32px 24px;
  color: #f6f6ff;
  background:
    radial-gradient(ellipse at 27% 23%, rgba(57, 111, 235, .8), transparent 61%),
    radial-gradient(ellipse at 77% 42%, rgba(106, 60, 223, .75), transparent 58%),
    radial-gradient(ellipse at 49% 94%, rgba(66, 34, 109, .6), transparent 65%),
    #151b3a;
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

body.access-checking #accessGate { display: flex; }
body.access-ready #accessGate { display: none; }
/* Keep the existing backdrop, but never paint the login form until the
   server has resolved the session. All visibility follows the body state. */
body.access-checking #accessGate .access-card { display: none; }
body:not(.access-checking) #accessLoading { display: none; }
#accessLoading {
  margin: auto;
  padding: 24px;
  color: #d1d6f4;
  text-align: center;
  font-size: 14px;
  line-height: 1.8;
}

body:has(#tutorialDialog[open]) { overflow: hidden; }
.tutorial-dialog {
  width: min(1040px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100dvh - 32px);
  box-sizing: border-box;
  padding: 0;
  border: 1px solid rgba(186, 197, 255, .3);
  border-radius: 16px;
  color: #eef0ff;
  background: linear-gradient(145deg, #171f42, #211c44);
  box-shadow: 0 24px 90px rgba(0, 0, 0, .45);
}
.tutorial-dialog[open] { display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; }
.tutorial-dialog::backdrop { background: rgba(6, 9, 27, .65); backdrop-filter: blur(6px); }
.tutorial-header, .tutorial-footer { display: flex; align-items: center; gap: 16px; padding: 18px 22px; }
.tutorial-header { justify-content: space-between; border-bottom: 1px solid rgba(186, 197, 255, .15); }
.tutorial-header h2 { margin: 0 0 6px; font-size: 22px; }
.tutorial-header p, .tutorial-content p { margin: 0; color: #c7cbed; font-size: 14px; line-height: 1.7; }
.tutorial-methods { display: flex; flex-wrap: wrap; gap: 10px; padding: 16px 22px 0; }
.tutorial-methods button[aria-pressed="true"] { color: #112f3a; border-color: #86edde; background: #86edde; }
.tutorial-content { min-height: 0; overflow-y: auto; padding: 16px 22px; }
.tutorial-content p { margin-bottom: 12px; }
.tutorial-content img { display: block; width: 100%; height: auto; border-radius: 8px; }
.tutorial-footer { flex-wrap: wrap; border-top: 1px solid rgba(186, 197, 255, .15); }
.tutorial-footer span { flex: 1 1 180px; color: #b8c1e2; font-size: 12px; }
.tutorial-dialog button:focus-visible, .tutorial-dialog a:focus-visible { outline: 2px solid #b7fff1; outline-offset: 3px; }
@media (max-width: 520px) {
  .tutorial-header, .tutorial-footer { padding: 14px; gap: 10px; }
  .tutorial-methods { padding: 12px 14px 0; }
  .tutorial-content { padding: 12px 14px; }
  .tutorial-header h2 { font-size: 20px; }
}

#accessGate .access-card {
  flex: 0 0 auto;
  width: min(500px, 100%);
  margin: auto;
  padding: 36px;
  gap: 0;
  overflow: visible;
  border: 1px solid rgba(220, 222, 255, .18);
  border-radius: 12px;
  background: rgba(155, 156, 238, .13);
  box-shadow: 0 24px 90px rgba(12, 13, 43, .22), inset 0 1px 0 rgba(255, 255, 255, .12);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
}

#accessGate .access-card::before { display: none; }
.access-topline { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.access-eyebrow { display: flex; align-items: center; gap: 8px; color: #78ebdb; font-size: 12px; font-weight: 600; }
#accessGate svg { flex-shrink: 0; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.access-language { display: flex; gap: 2px; padding: 4px; border: 1px solid rgba(184, 191, 237, .17); border-radius: 7px; background: rgba(18, 23, 55, .7); }
.access-language button { min-width: 34px; min-height: 28px; padding: 4px 8px; border: 0; border-radius: 4px; background: transparent; color: #c5c9e4; cursor: pointer; font-size: 11px; font-weight: 600; }
.access-language button[aria-pressed="true"] { background: #69ded1; color: #102d37; box-shadow: 0 1px 5px rgba(0, 0, 0, .16); }
#accessGate .access-copy { gap: 8px; margin-bottom: 28px; }
#accessGate .access-copy h1 { margin: 0; color: #fff; font-size: 28px; font-weight: 700; line-height: 1.3; letter-spacing: -.6px; }
#accessGate .access-copy p { margin: 0; color: #c7cbed; font-size: 13px; font-weight: 400; line-height: 1.6; }
#accessGate .access-field { gap: 9px; margin-bottom: 28px; }
#accessGate .access-field-label { color: #d1d4ee; font-size: 12px; font-weight: 500; }
#accessGate .access-input-wrap { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 0 15px; border: 1px solid rgba(177, 190, 235, .19); border-radius: 6px; background: rgba(19, 24, 55, .72); transition: border-color .15s, box-shadow .15s; }
#accessGate .access-input-wrap:focus-within { border-color: #73e6d7; box-shadow: 0 0 0 3px rgba(105, 222, 209, .12); }
#accessGate .access-input-wrap svg { width: 21px; height: 21px; color: #72dfd4; }
#accessGate .access-field input { flex: 1; min-width: 0; min-height: 54px; padding: 0; border: 0; outline: 0; border-radius: 0; background: transparent; color: #f3f5ff; box-shadow: none; font-size: 13px; font-weight: 400; }
#accessGate .access-field input::placeholder { color: #a2a9cb; }
#accessGate .access-count { flex: 0 0 auto; color: #b2b9d8; font-family: Consolas, monospace; font-size: 10px; font-weight: 400; font-variant-numeric: tabular-nums; }
.access-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
#accessGate .access-submit, #accessGate .access-query { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 12px; border: 1px solid transparent; border-radius: 6px; font: inherit; font-size: 13px; font-weight: 600; line-height: 1.3; text-shadow: none; cursor: pointer; transition: background .15s, box-shadow .15s, border-color .15s; }
#accessGate .access-submit { border-color: rgba(147, 255, 233, .6); background: #68dfd0; color: #112f3a; box-shadow: 0 6px 22px rgba(67, 218, 199, .13), inset 0 1px 0 rgba(255, 255, 255, .18); }
#accessGate .access-submit:hover { transform: none; filter: none; background: #87edde; box-shadow: 0 6px 24px rgba(67, 218, 199, .2); }
#accessGate .access-query { border-color: rgba(207, 210, 255, .23); background: rgba(191, 187, 255, .06); color: #f0f0ff; }
#accessGate .access-query:hover { border-color: rgba(225, 228, 255, .5); background: rgba(204, 202, 255, .14); }
#accessGate .access-actions svg { width: 16px; height: 16px; }
#accessGate button:focus-visible { outline: 2px solid #b7fff1; outline-offset: 3px; }
#accessGate button:disabled { cursor: wait; opacity: .6; transform: none; filter: none; }
#accessGate input:disabled { opacity: .7; }
#accessGate .access-message { min-height: 0; margin: 18px 0 0; padding: 12px 14px; border-radius: 6px; background: rgba(16, 22, 51, .28); color: #d1d6f4; font-size: 12px; font-weight: 400; line-height: 1.8; white-space: pre-line; overflow-wrap: anywhere; }
#accessGate .access-message:empty { display: none; }
#accessGate .access-message.error { color: #ffd1d8; background: rgba(100, 25, 62, .28); }
#accessGate .access-message.ok { color: #a7f9e4; background: rgba(18, 65, 72, .28); }

@media (max-width: 520px) {
  #accessGate { padding: 24px 18px; }
  #accessGate .access-card { padding: 28px 24px; }
  #accessGate .access-copy h1 { font-size: 26px; }
  #accessGate .access-copy p { font-size: 12px; }
}

@media (max-width: 360px) {
  #accessGate .access-card { padding: 24px 18px; }
  .access-actions { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  #accessGate *, #accessGate *::before, #accessGate *::after { transition: none; }
}

/* Protected console glass theme, matching the front login surface. */
body.access-ready {
  color: #eef0ff;
  background:
    radial-gradient(ellipse at 18% 8%, rgba(73, 117, 255, .28), transparent 42%),
    radial-gradient(ellipse at 86% 18%, rgba(151, 78, 255, .24), transparent 44%),
    radial-gradient(ellipse at 52% 100%, rgba(50, 38, 124, .28), transparent 58%),
    linear-gradient(145deg, #0b1027 0%, #111534 48%, #171237 100%);
}

body.access-ready::before {
  background:
    radial-gradient(circle, rgba(137, 158, 255, .26) 0 1px, transparent 2px) 8% 22% / 240px 240px,
    radial-gradient(circle, rgba(224, 177, 255, .2) 0 1px, transparent 2px) 76% 18% / 310px 310px,
    radial-gradient(circle, rgba(111, 226, 255, .18) 0 1px, transparent 2px) 36% 78% / 280px 280px;
  opacity: .42;
}

body.access-ready::after {
  background:
    radial-gradient(ellipse 620px 420px at 50% 12%, rgba(117, 119, 255, .16), transparent 64%),
    radial-gradient(ellipse 420px 320px at 82% 72%, rgba(205, 105, 255, .11), transparent 68%),
    linear-gradient(115deg, transparent 0%, rgba(121, 176, 255, .08) 32%, transparent 58%);
  opacity: .76;
}

body.access-ready .main-panel {
  padding-top: clamp(22px, 4vw, 50px);
  padding-bottom: clamp(28px, 5vw, 70px);
}

body.access-ready .topbar {
  border-bottom-color: rgba(180, 189, 255, .2);
}

body.access-ready .pubg-mark {
  border-bottom-color: #8fa8ff;
  color: #f4f4ff;
}

body.access-ready h1,
body.access-ready h2,
body.access-ready h3,
body.access-ready .section-title h2,
body.access-ready .card-title h3 {
  color: #f1f2ff;
}

body.access-ready .section-title span {
  background: linear-gradient(90deg, #78e8ff, #a88aff);
  box-shadow: 0 0 14px rgba(121, 167, 255, .68);
}

body.access-ready .control-card,
body.access-ready .license-status-item {
  border-color: rgba(181, 188, 255, .2);
  background: linear-gradient(145deg, rgba(104, 103, 190, .18), rgba(22, 25, 65, .48));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 20px 60px rgba(4, 6, 28, .24);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}

body.access-ready .control-card::before {
  background: linear-gradient(180deg, rgba(255, 255, 255, .08), transparent 38%), radial-gradient(ellipse at 50% 0%, rgba(145, 165, 255, .12), transparent 58%);
}

body.access-ready .control-card:hover {
  border-color: rgba(137, 196, 255, .48);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 0 28px rgba(112, 137, 255, .18), 0 22px 64px rgba(4, 6, 28, .3);
}

body.access-ready .announcement-panel {
  border-color: rgba(119, 224, 255, .34);
  box-shadow: inset 0 0 0 1px rgba(119, 224, 255, .12), 0 0 26px rgba(90, 136, 255, .18), 0 20px 54px rgba(4, 6, 28, .24);
}

body.access-ready .title-dot {
  background: #82e8ff;
  box-shadow: 0 0 12px rgba(108, 220, 255, .86);
}

body.access-ready .announcement-list li,
body.access-ready .notice-row {
  border-color: rgba(171, 180, 255, .14);
  background: rgba(22, 27, 70, .42);
}

body.access-ready .license-status-item strong[data-state="unused"] {
  color: #ffcf8e;
}

body.access-ready .deploy-code {
  border-color: rgba(153, 169, 255, .28);
  background: rgba(7, 10, 31, .68);
  color: #dfe4ff;
}

body.access-ready .primary-button {
  border-color: rgba(168, 224, 255, .7);
  background: linear-gradient(135deg, #8fe8ff, #8b91ff 55%, #bc7dff);
  color: #121536;
  box-shadow: 0 8px 24px rgba(111, 130, 255, .22);
}

body.access-ready .secondary-button {
  border-color: rgba(181, 188, 255, .3);
  background: rgba(123, 123, 220, .12);
  color: #e8e9ff;
}

body.access-ready .logout-cta {
  border-color: rgba(255, 177, 205, .34);
  background: rgba(190, 86, 143, .12);
  color: #ffd9e7;
}

body.access-ready .logout-cta:hover {
  border-color: rgba(255, 177, 205, .66);
  background: rgba(210, 93, 151, .24);
  color: #fff0f6;
}
