/* Stella 卡密门禁：状态确认前隐藏所有业务视图。 */
:root.license-checking #view-auth,
:root.license-checking #view-console,
:root.license-checking #boot-skeleton,
:root.license-required #view-auth,
:root.license-required #view-console,
:root.license-required #boot-skeleton {
  display: none !important;
  visibility: hidden !important;
}

:root.license-checking body,
:root.license-required body { overflow: hidden !important; }

#license-gate {
  --lg-ink: #49384f;
  --lg-dim: #806f86;
  --lg-pink: #c75e83;
  --lg-pink-deep: #a9466d;
  --lg-gold: #d9a94d;
  --lg-paper: rgba(255, 251, 253, .88);
  --lg-line: rgba(139, 94, 124, .25);
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: max(20px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  overflow: auto;
  color: var(--lg-ink);
  font-family: "Avenir Next Rounded", "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at 16% 16%, rgba(255,255,255,.72), transparent 30%),
    radial-gradient(circle at 86% 82%, rgba(231,190,221,.45), transparent 35%),
    linear-gradient(rgba(255,244,250,.26), rgba(255,244,250,.26)),
    url("stella/cloud-sky.jpg") center / cover;
}

#license-gate[hidden] { display: none !important; }
#license-gate *, #license-gate *::before, #license-gate *::after { box-sizing: border-box; }

:root[data-theme="stella-demon"] #license-gate {
  --lg-ink: #f5eaf5;
  --lg-dim: #cbb8ce;
  --lg-pink: #e590b3;
  --lg-pink-deep: #f0a4c1;
  --lg-paper: rgba(49, 35, 60, .9);
  --lg-line: rgba(236, 192, 222, .24);
  background:
    radial-gradient(circle at 18% 14%, rgba(169,107,161,.24), transparent 34%),
    linear-gradient(rgba(35,22,49,.78), rgba(54,31,58,.72)),
    url("stella/cloud-sky.jpg") center / cover;
}

.lg-shell {
  position: relative;
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(340px, 1.1fr);
  overflow: hidden;
  border: 1px solid var(--lg-line);
  border-radius: 30px;
  background: var(--lg-paper);
  box-shadow: 0 30px 90px rgba(76, 47, 83, .2), inset 0 1px rgba(255,255,255,.55);
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  animation: lg-arrive .45s cubic-bezier(.2,.8,.2,1) both;
}

.lg-scene {
  position: relative;
  min-height: 480px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 34px 28px;
  overflow: hidden;
  border-right: 1px solid var(--lg-line);
  background: linear-gradient(155deg, rgba(255,255,255,.28), rgba(230,184,215,.14));
}

.lg-brand { position: relative; z-index: 2; }
.lg-kicker { display: block; color: var(--lg-pink); font-size: 10px; font-weight: 800; letter-spacing: .22em; }
.lg-brand h1 { margin: 8px 0 10px; color: var(--lg-pink); font-size: clamp(48px, 7vw, 68px); line-height: 1; letter-spacing: -.05em; }
.lg-brand p { max-width: 270px; margin: 0; color: var(--lg-dim); font-size: 14px; line-height: 1.8; }

.lg-art { position: relative; align-self: center; width: 250px; height: 245px; }
.lg-art::before, .lg-art::after {
  content: "";
  position: absolute;
  inset: 34px -5px 24px;
  border: 1px solid var(--lg-line);
  border-radius: 50%;
  transform: rotate(-18deg);
}
.lg-art::after { inset: 64px -24px 50px; transform: rotate(24deg); }
.lg-mascot { position: absolute; z-index: 2; left: 28px; bottom: 6px; width: 190px; max-width: none; filter: drop-shadow(0 18px 16px rgba(75,45,81,.18)); animation: lg-breathe 4s ease-in-out infinite; }
.lg-wand { position: absolute; z-index: 3; right: 0; top: 8px; width: 64px; max-width: none; animation: lg-float 4.5s ease-in-out infinite alternate; }
.lg-star { position: absolute; color: var(--lg-gold); font-size: 22px; animation: lg-float 3s ease-in-out infinite alternate; }
.lg-star.one { left: 5px; top: 38px; }
.lg-star.two { right: 20px; bottom: 34px; animation-delay: -1.4s; }

.lg-panel { display: flex; flex-direction: column; justify-content: center; padding: 42px 38px; }
.lg-secure { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 22px; color: var(--lg-pink); font-size: 11px; font-weight: 750; letter-spacing: .1em; }
.lg-secure::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--lg-pink); box-shadow: 0 0 0 5px rgba(199,94,131,.1); }
.lg-panel h2 { margin: 0; font-size: 29px; line-height: 1.25; letter-spacing: -.03em; }
.lg-intro { margin: 10px 0 26px; color: var(--lg-dim); font-size: 13px; line-height: 1.75; }
.lg-label { display: grid; gap: 7px; color: var(--lg-dim); font-size: 12px; font-weight: 650; }
.lg-input {
  width: 100%;
  min-height: 54px;
  padding: 12px 15px;
  border: 1px solid var(--lg-line);
  border-radius: 14px;
  outline: 0;
  background: rgba(255,255,255,.56);
  color: var(--lg-ink);
  font: 600 16px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: .035em;
  text-transform: uppercase;
  transition: border-color .18s, box-shadow .18s;
}
:root[data-theme="stella-demon"] .lg-input { background: rgba(20,12,30,.25); }
.lg-input:focus { border-color: var(--lg-pink); box-shadow: 0 0 0 4px rgba(199,94,131,.12); }
.lg-input::placeholder { color: var(--lg-dim); opacity: .65; font-weight: 400; letter-spacing: 0; text-transform: none; }
.lg-submit, .lg-retry {
  min-height: 50px;
  margin-top: 14px;
  padding: 11px 18px;
  border: 0;
  border-radius: 14px;
  background: var(--lg-pink);
  color: #fff;
  font: 750 15px/1.4 inherit;
  cursor: pointer;
  box-shadow: 0 12px 25px rgba(169,70,109,.2);
  transition: transform .16s, background .18s;
}
.lg-submit:hover:not(:disabled), .lg-retry:hover:not(:disabled) { transform: translateY(-2px); background: var(--lg-pink-deep); }
.lg-submit:active:not(:disabled), .lg-retry:active:not(:disabled) { transform: none; }
.lg-submit:disabled { opacity: .58; cursor: wait; }
.lg-retry { background: transparent; color: var(--lg-pink); border: 1px solid var(--lg-line); box-shadow: none; }
.lg-retry[hidden] { display: none; }
.lg-message { min-height: 24px; margin: 12px 0 0; color: #b44364; font-size: 13px; line-height: 1.6; }
.lg-message.ok { color: #38846f; }
.lg-note { margin: 14px 0 0; padding-top: 16px; border-top: 1px solid var(--lg-line); color: var(--lg-dim); font-size: 11px; line-height: 1.7; }
.lg-submit:focus-visible, .lg-retry:focus-visible { outline: 3px solid var(--lg-pink); outline-offset: 3px; }

@keyframes lg-arrive { from { opacity: 0; transform: translateY(12px) scale(.985); } }
@keyframes lg-breathe { 50% { transform: translateY(-5px) rotate(2deg); } }
@keyframes lg-float { to { transform: translateY(-9px) rotate(5deg); } }

@media (max-width: 700px) {
  #license-gate { place-items: start center; }
  .lg-shell { grid-template-columns: 1fr; max-width: 480px; border-radius: 24px; }
  .lg-scene { min-height: 190px; padding: 24px; border-right: 0; border-bottom: 1px solid var(--lg-line); }
  .lg-brand h1 { font-size: 48px; }
  .lg-brand p { max-width: 220px; font-size: 12px; }
  .lg-art { position: absolute; right: 4px; bottom: -12px; width: 180px; height: 185px; transform: scale(.78); transform-origin: right bottom; }
  .lg-panel { padding: 28px 24px 26px; }
  .lg-secure { margin-bottom: 15px; }
  .lg-panel h2 { font-size: 25px; }
  .lg-intro { margin-bottom: 20px; }
}

@media (max-width: 390px) {
  .lg-brand p { max-width: 175px; }
  .lg-art { right: -18px; }
  .lg-panel { padding-inline: 20px; }
  .lg-input { font-size: 14px; }
}

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

/* 触屏与窄屏安全约束。 */
html, body { touch-action: manipulation; }
#license-gate, .lg-shell, .lg-panel, .lg-scene { max-width: 100%; }
@media (max-width: 390px) { .lg-input { font-size: 16px; } }
@media (pointer: coarse) {
  #license-gate input, #license-gate select, #license-gate textarea { font-size: 16px !important; }
}
