/* ================= 系统选择页 + 镜头景深转场 + 侧栏系统标 / 账户区 =================
   独立于 styles.css（Codex 在改那个文件），避免互相覆盖。
   玻璃材质沿用**登录面板的配方**（.login-card，styles.css 第 119 行），深色场景统一加 body.app-mode 前缀。 */

/* ---------- 全屏容器 ---------- */
.module-wrap {
  position: fixed; inset: 0; z-index: 30;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.module-inner {
  position: relative; z-index: 2;
  display: flex; flex-direction: column; align-items: center; gap: 28px;
  width: 100%; max-width: 1400px;
}

.module-greeting { text-align: center; }
.module-greeting .mg-hi { font-size: 22px; font-weight: 700; letter-spacing: .01em; }
.module-greeting .mg-hi b { font-weight: 750; }
.module-greeting .mg-sub { margin-top: 6px; font-size: 13px; }
.module-logout { margin-top: 4px; }

/* 问候语与退出按钮：跟随景深转场一起浮现 */
.module-greeting, .module-logout { opacity: 0; transition: opacity .42s ease; }
.module-inner.shown .module-greeting,
.module-inner.shown .module-logout { opacity: 1; }

/* ---------- 系统卡片：浅弧形空间排列 + visionOS 玻璃 ---------- */
.module-cards {
  display: flex; align-items: center; justify-content: center;
  gap: clamp(28px, 2.8vw, 50px); width: 100%; padding: 30px 18px 50px;
  perspective: 1500px; perspective-origin: 50% 42%;
  isolation: isolate;
}
.module-cards::after {
  content: ''; position: absolute; z-index: -1; left: 14%; right: 14%; bottom: 22px; height: 34px;
  border-radius: 50%; pointer-events: none;
  background: radial-gradient(ellipse, rgba(3,29,40,.28), transparent 70%);
  filter: blur(15px); transform: rotateX(68deg);
}
.module-cards.is-intro { pointer-events: none; }     /* 动效期间不可点击 */

.module-card {
  --tilt-x: 0deg; --tilt-y: 0deg; --parallax-x: 0px; --parallax-y: 0px;
  --arc-y: 0px; --arc-r: 0deg; --arc-z: 0px;
  position: relative; width: clamp(238px, 19vw, 286px); min-height: 198px; padding: 27px 25px 22px;
  display: flex; flex-direction: column; align-items: flex-start; gap: 18px; flex: 0 1 286px;
  text-align: left; cursor: pointer; overflow: hidden;
  border: 1px solid rgba(229,255,255,.26); border-top-color: rgba(255,255,255,.46);
  border-radius: 30px;
  background:
    linear-gradient(145deg, rgba(231,255,255,.24), rgba(164,222,226,.10) 55%, rgba(255,255,255,.12)),
    color-mix(in srgb, var(--mc-accent) 5%, rgba(5,47,57,.32));
  box-shadow:
    0 28px 70px rgba(0,20,31,.28), 0 8px 24px rgba(0,31,42,.16),
    inset 0 1px 0 rgba(255,255,255,.55), inset 1px 0 0 rgba(255,255,255,.12),
    inset 0 -1px 0 color-mix(in srgb, var(--mc-accent) 24%, transparent);
  -webkit-backdrop-filter: blur(22px) saturate(152%) brightness(.94);
  backdrop-filter: blur(22px) saturate(152%) brightness(.94);
  transform: translate3d(0,var(--arc-y),var(--arc-z)) rotateY(calc(var(--arc-r) + var(--tilt-y))) rotateX(var(--tilt-x));
  transform-style: preserve-3d;
  opacity: 0;
  transition: transform .34s cubic-bezier(.2,.72,.2,1), opacity .34s ease, box-shadow .34s ease, border-color .34s ease, filter .34s ease;
}
.module-card:nth-child(1) { --arc-y: 14px; --arc-r: 7deg; --arc-z: -36px; }
.module-card:nth-child(2) { --arc-y: 1px; --arc-r: 2.5deg; --arc-z: 0px; }
.module-card:nth-child(3) { --arc-y: 1px; --arc-r: -2.5deg; --arc-z: 0px; }
.module-card:nth-child(4) { --arc-y: 14px; --arc-r: -7deg; --arc-z: -36px; }
.module-card.shown { opacity: 1; }
.module-card.shown:hover, .module-card.shown:focus-visible {
  z-index: 3;
  transform: translate3d(0,calc(var(--arc-y) - 13px),38px) rotateY(var(--tilt-y)) rotateX(var(--tilt-x)) scale(1.028);
  border-color: rgba(236,255,255,.48);
  box-shadow:
    0 46px 100px rgba(0,19,31,.38), 0 14px 34px color-mix(in srgb, var(--mc-accent) 15%, transparent),
    inset 0 1px 0 rgba(255,255,255,.7), inset 0 -1px 0 color-mix(in srgb, var(--mc-accent) 42%, transparent);
}
.module-card:active { transform: translate3d(0,calc(var(--arc-y) - 6px),20px) rotateY(var(--tilt-y)) rotateX(var(--tilt-x)) scale(.996); }
.module-card:focus-visible { outline: 2px solid color-mix(in srgb, var(--mc-accent) 70%, white); outline-offset: 5px; }

.mc-depth { position: absolute; inset: 0; border-radius: inherit; pointer-events: none; }
.mc-depth-back {
  inset: 14% -8% -22% 24%; opacity: .34; filter: blur(26px);
  background: radial-gradient(circle, color-mix(in srgb, var(--mc-accent) 52%, transparent), transparent 68%);
  transform: translate3d(calc(var(--parallax-x) * -.45),calc(var(--parallax-y) * -.45),-24px);
  transition: opacity .3s ease;
}
.module-card:hover .mc-depth-back { opacity: .62; }

.module-card .mc-icon {
  position: relative; width: 56px; height: 56px; border-radius: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  color: color-mix(in srgb, var(--mc-accent, #54d8cf) 74%, white);
  background: linear-gradient(145deg,rgba(255,255,255,.24),color-mix(in srgb,var(--mc-accent) 18%,rgba(8,54,63,.3)));
  border: 1px solid rgba(255,255,255,.27);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.38), 0 12px 24px rgba(0,27,38,.18);
  transform: translate3d(calc(var(--parallax-x) * .65),calc(var(--parallax-y) * .65),38px);
  transition: transform .24s ease-out;
}
.module-card .mc-icon svg { width: 29px; height: 29px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.mc-copy { position: relative; display: flex; flex-direction: column; transform: translate3d(calc(var(--parallax-x) * .32),calc(var(--parallax-y) * .32),25px); transition: transform .24s ease-out; }
.module-card .mc-name { font-size: 19px; font-weight: 720; letter-spacing: .015em; }
.mc-enter { position: relative; width: 100%; margin-top: auto; padding-top: 15px; display: flex; justify-content: space-between; align-items: center; border-top: 1px solid rgba(255,255,255,.13); font-size: 11px; letter-spacing: .12em; transform: translateZ(16px); }
.mc-enter b { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; font-size: 14px; font-weight: 500; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.14); transition: transform .3s ease, background .3s ease; }
.module-card:hover .mc-enter b { transform: translate(2px,-2px); background: color-mix(in srgb,var(--mc-accent) 20%,rgba(255,255,255,.12)); }
.module-card::before {
  content: ''; position: absolute; left: 22px; top: 0; width: 42%; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.66), transparent); opacity: .58;
}
/* 深色场景：文字、次要文字 */
body.app-mode .module-greeting .mg-hi { color: rgba(238,252,252,.96); }
body.app-mode .module-greeting .mg-sub { color: rgba(211,234,236,.62); }
body.app-mode .module-card { color: rgba(239,253,253,.96); }
body.app-mode .module-card .mc-enter { color: rgba(220,243,245,.62); }
body.app-mode .module-logout { color: rgba(211,234,236,.62); }

/* ---------- 镜头景深：登录面板退入背景 ---------- */
#login-view.is-depth-leaving { pointer-events: none; }
#login-view.is-depth-leaving .login-card {
  animation: login-depth-out .52s cubic-bezier(.4,0,.2,1) forwards;
  transform-origin: center;
}
@keyframes login-depth-out {
  0% { opacity: 1; transform: perspective(1200px) translateZ(0) scale(1); filter: blur(0) brightness(1); }
  100% { opacity: 0; transform: perspective(1200px) translateZ(-260px) scale(.9); filter: blur(13px) brightness(.78); }
}

/* 选择板块后：卡片向镜头铺满，再由主界面接管 */
.module-wrap.is-entering { pointer-events: none; }
.app.app-preparing { visibility: hidden; }
.app.app-arriving { animation: app-through-glass .4s cubic-bezier(.2,.72,.2,1) both; }
@keyframes app-through-glass {
  from { opacity: 0; transform: perspective(1400px) translateZ(-90px) scale(.975); filter: blur(9px) brightness(.88); }
  to { opacity: 1; transform: scale(1); filter: none; }
}

/* ---------- 侧栏：当前系统标 ---------- */
.side-mod {
  margin: 10px 14px 0; padding: 0 0 9px 3px;
  display: flex; align-items: center; gap: 7px;
  border-bottom: 1px solid rgba(255,255,255,.14);
  font-size: 11px; font-weight: 700; letter-spacing: .1em;
}
.side-mod::before {
  content: ''; width: 5px; height: 5px; border-radius: 50%; flex: none;
  background: #54d8cf; box-shadow: 0 0 8px rgba(84,216,207,.9);
}
body.app-mode .side-mod { color: rgba(196,236,238,.66); }

/* ---------- 侧栏底部：账户区 ---------- */
.account-foot {
  padding: 8px 10px 12px;
  border-top: 1px solid rgba(255,255,255,.34);
  display: flex; flex-direction: column; gap: 2px;
}
.af-user {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px 10px; font-size: 13px; font-weight: 650; letter-spacing: .01em;
}
.af-user .ic { width: 17px; height: 17px; flex: none; }
.af-item {
  display: flex; align-items: center; gap: 10px; text-align: left; width: 100%;
  padding: 8px 14px; border: 0; background: transparent; border-radius: 8px;
  font-size: 13px; cursor: pointer;
  transition: background .18s, color .18s, transform .18s;
}
.af-item .ic { width: 16px; height: 16px; flex: none; }
.af-user .ic, .af-item .ic { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.af-item:hover { transform: translateX(2px); }

/* 配色：比导航菜单（.92）暗一档，但比原来的按钮文字更清楚 → 看得清又不抢重心 */
body.app-mode .af-user { color: rgba(231,249,250,.86); }
body.app-mode .af-user .ic { color: rgba(127,230,223,.8); }
body.app-mode .account-foot { border-top-color: rgba(255,255,255,.16); }
body.app-mode .af-item { color: rgba(203,231,235,.74); }
body.app-mode .af-item .ic { color: rgba(176,215,220,.66); }
body.app-mode .af-item:hover { color: rgba(232,250,251,.94); background: rgba(255,255,255,.11); }
body.app-mode .af-item:hover .ic { color: rgba(127,230,223,.92); }
body.app-mode .af-item.af-danger:hover { color: #ffbcbc; background: rgba(255,120,120,.13); }
body.app-mode .af-item.af-danger:hover .ic { color: #ff9f9f; }

/* 菜单过多时允许滚动（正常每个系统最多 11 项，不会触发） */
body.app-mode .nav { overflow-y: auto; scrollbar-width: thin; }
body.app-mode .nav::-webkit-scrollbar { width: 6px; }
body.app-mode .nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.16); border-radius: 3px; }

/* 窄屏：卡片竖排 */
@media (max-width: 760px) {
  .module-card { width: 100%; max-width: 320px; }
  .module-cards { gap: 20px; flex-direction: column; padding-top: 10px; overflow-y: auto; }
  .module-card:nth-child(n) { --arc-y: 0px; --arc-r: 0deg; --arc-z: 0px; min-height: 188px; }
  .module-greeting .mg-hi { font-size: 19px; }
}
@media (min-width: 761px) and (max-width: 1260px) {
  .module-cards { flex-wrap: wrap; max-width: 820px; }
  .module-card:nth-child(n) { --arc-y: 0px; --arc-r: 0deg; --arc-z: 0px; }
}
@media (prefers-reduced-motion: reduce) {
  .module-card, .module-card .mc-icon, .mc-copy, .mc-enter b { transition-duration: .01ms !important; }
}
/* 窄屏（与 styles.css 里侧栏折叠为图标的 860px 断点对齐） */
@media (max-width: 860px) {
  .af-name { display: none; }
  .af-user, .af-item { justify-content: center; padding-left: 0; padding-right: 0; }
  .af-user .ic, .af-item .ic { font-size: 16px; }
  .side-mod { justify-content: center; margin-left: 0; margin-right: 0; }
  .side-mod .side-mod-name { display: none; }
}
