/* Game1 Operations — 圓圓劍仙「天機閣」營運中樞。
   沿用頁面語意 class；色彩、字體、動態全在這裡統一管理。
   視覺取材：遊戲 KeyArt 的月夜山門（深青墨夜＋翡翠霧＋月金），題字體 wt064（fonts/brush.woff2，只收標題用到的字）。
   素材：img/（login-hero／banner／sidebar-mist 取自同一張登入主視覺；mascot-* 是 App 圖示角色；formation.svg 陣法環）。
   素材與字型怎麼重產：Tools/Art/Admin/20261022/README.md。
   動態：一律可被 prefers-reduced-motion 關掉（檔尾）。 */

@font-face {
  font-family: "G1 Brush";
  src: url("fonts/brush.woff2") format("woff2");
  font-display: swap;
  /* 只接 CJK：拉丁字母與數字落回內文字體，題字體的英數不好看 */
  unicode-range: U+3000-303F, U+3400-9FFF, U+F900-FAFF, U+FF00-FFEF;
}

:root {
  color-scheme: dark;
  --page: #061013;
  --surface: #0c1b1f;
  --surface-2: #07141a;
  --surface-raised: #11272c;
  --surface-hover: #15323a;
  --glass: linear-gradient(180deg, rgba(17, 38, 43, .86), rgba(9, 22, 26, .9));
  --ink: #e7f1ed;
  --ink-soft: #c3d5d0;
  --muted: #8da8a3;
  --faint: #67827e;
  --line: #1c3539;
  --line-soft: rgba(126, 214, 196, .11);
  --line-strong: #2a4e52;
  --brand: #5fe0c4;
  --brand-strong: #3cc8aa;
  --brand-ink: #03221c;
  --brand-glow: rgba(95, 224, 196, .35);
  --brand-2: #f0cf87;
  --gold: #e9c47c;
  --gold-line: rgba(240, 207, 135, .5);
  --gold-soft: rgba(240, 207, 135, .14);
  --cinnabar: #e8604c;
  --sky: #86cff2;
  --warning: #f4c978;
  --warning-bg: #2a2010;
  --warning-line: #5f4b23;
  --danger: #ff9e90;
  --danger-bg: #2d1513;
  --danger-line: #6d3129;
  --ok: #6fe4ba;
  --ok-bg: #0e2a23;
  --ok-line: #24594a;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 18px 46px rgba(0, 0, 0, .32);
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --font-sans: "Segoe UI", "Noto Sans TC", "Microsoft JhengHei UI", system-ui, sans-serif;
  --font-num: "Bahnschrift", "DIN Alternate", "Segoe UI", sans-serif;
  --font-brush: "G1 Brush", "Segoe UI", "Noto Sans TC", serif;
  --font-mono: "Cascadia Code", Consolas, monospace;
  /* 圖表 token（Services/SvgChart.cs 共用；換主題時改這裡，圖跟著走） */
  --chart-1: #5fe0c4;
  --chart-2: #f0cf87;
  --chart-3: #74b9ff;
  --chart-4: #ff8f7a;
  --chart-5: #b9a4ff;
  --chart-6: #7fd8e6;
  --chart-7: #b9e37a;
  --chart-8: #f2a6dc;
  --chart-other: #5d7976;
  --chart-grid: rgba(141, 168, 163, .13);
  --chart-axis: #86a19c;
  --chart-track: rgba(141, 168, 163, .10);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  font-synthesis: none;
  accent-color: var(--brand);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(1100px 560px at 88% -8%, rgba(240, 207, 135, .075), transparent 62%),
    radial-gradient(900px 700px at -8% 6%, rgba(95, 224, 196, .075), transparent 60%),
    radial-gradient(1200px 500px at 50% 110%, rgba(95, 224, 196, .05), transparent 70%),
    linear-gradient(180deg, #071518 0%, #061013 45%, #050d10 100%);
  background-color: var(--page);
  background-attachment: fixed;
}

/* 星點：兩層錯位的細點，慢慢閃 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(1px 1px at 20px 30px, rgba(255, 255, 255, .5), transparent 60%),
    radial-gradient(1px 1px at 140px 90px, rgba(240, 207, 135, .55), transparent 60%),
    radial-gradient(1.2px 1.2px at 230px 170px, rgba(159, 245, 224, .5), transparent 60%),
    radial-gradient(1px 1px at 80px 210px, rgba(255, 255, 255, .35), transparent 60%),
    radial-gradient(1px 1px at 300px 40px, rgba(255, 255, 255, .3), transparent 60%);
  background-size: 340px 260px;
  opacity: .35;
  animation: g1-twinkle 7s ease-in-out infinite alternate;
}

button, input, select, textarea { font: inherit; }
a { color: inherit; }
::selection { background: rgba(95, 224, 196, .32); color: #f4fffc; }
* { scrollbar-color: #2b5052 transparent; scrollbar-width: thin; }

/* ============ 外框 ============ */

.app {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  min-height: 100vh;
}

/* 背景陣法環：右上角慢慢轉，左下再一個反轉的小環 */
.app-backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  overflow: hidden;
}
.app-backdrop::before,
.app-backdrop::after {
  content: "";
  position: absolute;
  background: url("img/formation.svg") center / contain no-repeat;
}
.app-backdrop::before {
  width: 980px;
  height: 980px;
  top: -360px;
  right: -300px;
  opacity: .085;
  animation: g1-spin 240s linear infinite;
}
.app-backdrop::after {
  width: 520px;
  height: 520px;
  bottom: -260px;
  left: 120px;
  opacity: .05;
  animation: g1-spin 180s linear infinite reverse;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px 14px 16px;
  color: var(--ink);
  border-right: 1px solid var(--line-soft);
  background:
    url("img/sidebar-mist.webp") center bottom / 100% auto no-repeat,
    linear-gradient(180deg, rgba(9, 24, 28, .94), rgba(5, 15, 18, .97));
  box-shadow: inset -1px 0 0 rgba(240, 207, 135, .04), 12px 0 40px rgba(0, 0, 0, .25);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 8px 16px;
  border-bottom: 1px solid var(--line-soft);
  position: relative;
}
.brand::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 40%;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, var(--gold-line), transparent);
}

.brand-mark {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 14px;
  object-fit: cover;
  background: radial-gradient(circle at 50% 35%, #1e4a4b, #0b2125);
  color: var(--brand-ink);
  font-weight: 750;
  box-shadow: 0 0 0 1px rgba(240, 207, 135, .5), 0 8px 20px rgba(0, 0, 0, .45), 0 0 26px rgba(95, 224, 196, .18);
  animation: g1-breathe 5s ease-in-out infinite;
}

.brand-title {
  font-family: var(--font-brush);
  font-size: 23px;
  line-height: 1.1;
  letter-spacing: .1em;
  background: linear-gradient(180deg, #fff7e2 10%, #f0cf87 60%, #c99a4a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 8px rgba(240, 207, 135, .2));
}

.brand-subtitle {
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .22em;
}

.nav { display: grid; gap: 10px; }
.nav-group { display: grid; gap: 2px; }
.nav-group + .nav-group { margin-top: 0; }
.nav-caption,
.nav-label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px 2px;
  font-size: 10.5px;
  color: var(--faint);
  letter-spacing: .28em;
  font-weight: 650;
}
.nav-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--line-strong), transparent);
}

.nav-button {
  position: relative;
  width: 100%;
  min-height: 34px;
  padding: 0 12px;
  display: grid;
  grid-template-columns: 20px 1fr auto;
  gap: 11px;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: #a2b9b4;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  isolation: isolate;
  transition: color .2s ease, background-color .2s ease, border-color .2s ease, transform .2s var(--ease-out);
}
.nav a.nav-button { text-decoration: none; }
.nav-button .icon { opacity: .8; transition: transform .3s var(--ease-out), opacity .2s ease, color .2s ease; }
.nav-button:hover {
  color: var(--ink);
  background: rgba(95, 224, 196, .055);
  transform: translateX(2px);
}
.nav-button:hover .icon { opacity: 1; transform: scale(1.12) rotate(-6deg); }
.nav-button.active {
  color: #a8f7e3;
  border-color: rgba(95, 224, 196, .2);
  background: linear-gradient(90deg, rgba(95, 224, 196, .19), rgba(95, 224, 196, .05) 65%, rgba(95, 224, 196, 0));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
}
/* 劍光指示條 */
.nav-button.active::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 3px;
  background: linear-gradient(180deg, #d6fff5, var(--brand));
  box-shadow: 0 0 12px var(--brand), 0 0 3px #fff;
  animation: g1-blade-in .45s var(--ease-out) both;
}
/* 選中項掃過一道光 */
.nav-button.active::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: linear-gradient(100deg, transparent 30%, rgba(159, 245, 224, .18) 50%, transparent 70%);
  background-size: 250% 100%;
  animation: g1-sweep 1.1s var(--ease-out) both;
}
.nav-button.active .icon { opacity: 1; color: var(--brand); filter: drop-shadow(0 0 6px rgba(95, 224, 196, .7)); }
.nav-button.active > span:last-child {
  width: 6px;
  height: 6px;
  transform: rotate(45deg);
  background: var(--gold);
  box-shadow: 0 0 10px var(--gold);
  animation: g1-pop .5s .15s var(--ease-out) both;
}
/* 側欄項目逐一浮現（載入時一次） */
.sidebar .nav-group { animation: g1-rise .55s var(--ease-out) backwards; }
.sidebar .nav-group:nth-child(2) { animation-delay: .06s; }
.sidebar .nav-group:nth-child(3) { animation-delay: .12s; }
.sidebar .nav-group:nth-child(4) { animation-delay: .18s; }
.sidebar .nav-group:nth-child(5) { animation-delay: .24s; }

.nav-badge {
  min-width: 26px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  background: rgba(240, 207, 135, .14);
  color: var(--gold);
  font-size: 12px;
  font-weight: 750;
}

/* 側欄底的劍仙：坐在帳號列右邊的雲上打盹，點她會轉一圈噴星星（fx.js） */
.sidebar-mascot {
  position: absolute;
  right: 0;
  top: -44px;
  width: 84px;
  height: 84px;
  padding: 0;
  border: 0;
  background: url("img/mascot-empty.webp") center / contain no-repeat;
  cursor: pointer;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .5)) drop-shadow(0 0 18px rgba(127, 240, 214, .15));
  animation: g1-float 5s ease-in-out infinite;
  transition: filter .3s ease;
}
.sidebar-mascot:hover { filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .5)) drop-shadow(0 0 26px rgba(127, 240, 214, .45)); }
.sidebar-mascot.is-hop { animation: g1-hop .9s cubic-bezier(.3, 1.4, .5, 1); }
.sidebar-foot {
  position: relative;
  margin-top: auto;
  display: grid;
  gap: 10px;
  padding: 14px 8px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  border-top: 1px solid var(--line-soft);
  overflow-wrap: anywhere;
}
.sidebar-foot .panel-actions { gap: 6px; }
.sidebar-foot .operator { padding-right: 70px; }
.sidebar-foot .button { justify-content: flex-start; }
.operator { display: flex; align-items: center; gap: 10px; min-width: 0; }
.operator-avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
  color: var(--brand-ink);
  background: linear-gradient(140deg, #9ff5e0, #3cc8aa 55%, #e9c47c);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .15) inset, 0 4px 14px rgba(60, 200, 170, .25);
}
.operator-info { display: grid; gap: 1px; min-width: 0; }
.operator-name { color: var(--ink); font-weight: 600; font-size: 12.5px; overflow-wrap: anywhere; }
.operator-role { color: var(--muted); font-size: 11px; }

.content {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar,
.shell-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 68px;
  padding: 12px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  background: rgba(5, 14, 17, .7);
  -webkit-backdrop-filter: blur(16px) saturate(1.25);
  backdrop-filter: blur(16px) saturate(1.25);
  border-bottom: 1px solid var(--line-soft);
}
/* 底緣一條金青流光 */
.topbar::after,
.shell-topbar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(240, 207, 135, .55), rgba(95, 224, 196, .7), rgba(240, 207, 135, .55), transparent);
  background-size: 200% 100%;
  animation: g1-flow 9s linear infinite;
  opacity: .7;
}
/* 換頁時沿著頂列底緣劈過一道劍光（MainLayout 以目前路徑當 @key 重建這個元素） */
.shell-slash {
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 45%;
  height: 2px;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(159, 245, 224, .95) 70%, #fff 96%, transparent);
  box-shadow: 0 0 14px rgba(95, 224, 196, .9);
  opacity: 0;
  /* backwards：結束後回到原位（停在 translateX(130%) 會把頁面撐出水平捲軸） */
  animation: g1-nav-slash .9s var(--ease-out) backwards;
}
.topbar h1 { margin: 0; font-size: 22px; line-height: 1.25; }
.topbar-meta { color: var(--muted); font-size: 13px; margin-top: 4px; display: flex; gap: 10px; flex-wrap: wrap; }
.topbar-actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; flex-wrap: wrap; }

.eyebrow {
  display: block;
  color: var(--faint);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: .22em;
  line-height: 1.4;
}
.shell-title {
  margin: 2px 0 0;
  font-family: var(--font-brush);
  font-size: 21px;
  line-height: 1.25;
  letter-spacing: .08em;
  color: #f6ecd3;
  animation: g1-ink-in .6s var(--ease-out) backwards;
}
.shell-meta {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
}
.shell-clock {
  font-family: var(--font-num);
  font-size: 13px;
  letter-spacing: .06em;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid var(--line-soft);
  background: rgba(4, 14, 17, .5);
}
.shell-clock:empty { display: none; }
.shell-online { display: inline-flex; align-items: center; gap: 8px; }

.status-dot {
  position: relative;
  display: inline-block;
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 8px var(--brand);
  animation: g1-pulse 2.2s ease-out infinite;
}
.status-dot.warning { background: var(--warning); box-shadow: 0 0 8px var(--warning); animation-name: g1-pulse-warn; }

.main {
  width: 100%;
  max-width: 1920px;
  margin-inline: auto;
  padding: 28px 32px 56px;
  display: grid;
  gap: 22px;
  align-content: start;
}

/* ============ 頁首橫幅 ============ */

.section { display: none; gap: 22px; }
.section.active { display: grid; }

/* 換頁「劍氣開路」：每頁的 section 是新 DOM，一進來就從一道斜劍痕往兩側裂開；
   ::after 是那道劍痕的光（img/slash.svg，線從 (0,60) 到 (100%,260)，跟 clip 的斜線同一條） */
.section.active {
  position: relative;
  animation: g1-cleave .75s cubic-bezier(.35, .55, .15, 1) backwards;
}
.section.active::after {
  content: "";
  position: absolute;
  left: -5%;
  top: 0;
  width: 110%;
  height: 320px;
  z-index: 30;
  pointer-events: none;
  background: url("img/slash.svg") 0 0 / 100% 100% no-repeat;
  opacity: 0;
  mask-image: linear-gradient(90deg, #000 45%, transparent 55%);
  -webkit-mask-image: linear-gradient(90deg, #000 45%, transparent 55%);
  mask-size: 240% 100%;
  -webkit-mask-size: 240% 100%;
  animation: g1-slash-draw .8s cubic-bezier(.3, .6, .2, 1) backwards;
}

/* 頁面進場：每塊依序浮上來 */
.section > *,
.main > .panel { animation: g1-rise .6s var(--ease-out) backwards; }
.section > :nth-child(2) { animation-delay: .05s; }
.section > :nth-child(3) { animation-delay: .1s; }
.section > :nth-child(4) { animation-delay: .15s; }
.section > :nth-child(5) { animation-delay: .2s; }
.section > :nth-child(6) { animation-delay: .25s; }
.section > :nth-child(n+7) { animation-delay: .3s; }

.section-head {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  min-height: 132px;
  padding: 26px 30px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  border-radius: 20px;
  border: 1px solid rgba(240, 207, 135, .16);
  background: var(--surface);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), var(--shadow);
}
/* 月夜山門：慢慢推近（Ken Burns），進場時從右側滑入 */
.section-head::before {
  content: "";
  position: absolute;
  inset: 0 0 0 34%;
  z-index: -2;
  background:
    linear-gradient(0deg, rgba(5, 15, 18, .55), transparent 55%),
    url("img/banner.webp") right 40% / cover no-repeat;
  mask-image: linear-gradient(90deg, transparent 0%, rgba(0, 0, 0, .3) 28%, #000 68%);
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, rgba(0, 0, 0, .3) 28%, #000 68%);
  transform-origin: 80% 40%;
  /* 視差：fx.js 依滑鼠在橫幅上的位置寫 --bx／--by（-1～1）；translate 跟 Ken Burns 的 transform 會疊加 */
  translate: calc(var(--bx, 0) * -16px) calc(var(--by, 0) * -8px);
  transition: translate .7s var(--ease-out);
  animation: g1-banner-in 1.1s var(--ease-out) backwards, g1-kenburns 26s ease-in-out 1.1s infinite alternate;
}
/* 雲從橫幅底部飄過（cloud-front 2400×783，高 96px 時一格寬 294.25px） */
.section-head::after {
  content: "";
  position: absolute;
  left: 30%;
  right: 0;
  bottom: -30px;
  height: 96px;
  z-index: -1;
  pointer-events: none;
  --tile: 294.25px;
  background: url("img/cloud-front.webp") 0 100% / auto 100% repeat-x;
  opacity: .5;
  mask-image: linear-gradient(90deg, transparent, #000 40%);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 40%);
  translate: calc(var(--bx, 0) * -30px) 0;
  transition: translate .7s var(--ease-out);
  /* 這條有左側淡出遮罩，要遮罩不動、雲在裡面跑，所以這裡動 background-position（只有 96px 高，重畫成本小） */
  animation: g1-cloud-bg 38s linear infinite;
}
.section-head > * { position: relative; z-index: 1; min-width: 0; }
.section-head > div:first-child::before {
  /* 金角框 */
  content: "";
  position: absolute;
  left: -16px;
  top: -12px;
  width: 18px;
  height: 18px;
  border-left: 1px solid var(--gold-line);
  border-top: 1px solid var(--gold-line);
}

.section-title {
  margin: 0;
  font-family: var(--font-brush);
  font-size: 38px;
  line-height: 1.2;
  font-weight: 400;
  letter-spacing: .08em;
  color: #fbf1d8;
  text-shadow: 0 2px 22px rgba(240, 207, 135, .28), 0 1px 0 rgba(0, 0, 0, .5);
  animation: g1-ink-in .9s .1s var(--ease-out) backwards;
}
.section-meta {
  margin-top: 10px;
  color: #a9c0bb;
  font-size: 13px;
  line-height: 1.6;
  max-width: 760px;
}
/* 說明文字收在左半邊，別壓到月亮 */
.section-head .section-meta { max-width: min(640px, calc((100vw - 320px) * .46)); text-shadow: 0 1px 8px rgba(0, 0, 0, .9); }
.section-meta .code, .field-hint .code { font-size: 1em; }
.section-head .eyebrow,
.section-head .analytics-eyebrow { color: var(--gold); letter-spacing: .26em; margin-bottom: 8px; }
.section-head .chip { backdrop-filter: blur(6px); }

.page-header h1 { margin: 0; font-family: var(--font-brush); font-size: 34px; line-height: 1.25; letter-spacing: .06em; font-weight: 400; }
.page-header p { margin: 9px 0 0; color: var(--muted); font-size: 13px; line-height: 1.7; }

/* ============ 按鈕 ============ */

.button {
  position: relative;
  overflow: hidden;
  min-height: 38px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: linear-gradient(180deg, #15302f, #0e2326);
  color: var(--ink);
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05);
  transition: border-color .2s ease, box-shadow .25s ease, transform .15s ease, filter .2s ease, background .2s ease;
}
/* 掃光：滑過按鈕時一道光帶 */
.button::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(110deg, transparent 35%, rgba(255, 255, 255, .16) 50%, transparent 65%);
  transform: translateX(-120%);
  transition: transform .6s var(--ease-out);
}
.button:hover::after { transform: translateX(120%); }
.button:hover {
  border-color: rgba(95, 224, 196, .5);
  background: linear-gradient(180deg, #1a3a3a, #11302f);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 0 0 3px rgba(95, 224, 196, .07), 0 6px 18px rgba(0, 0, 0, .25);
}
.button:active { transform: translateY(1px) scale(.985); }

.button.primary {
  border-color: #8ff3dc;
  background: linear-gradient(180deg, #86f2d9, #3ec9aa);
  color: var(--brand-ink);
  text-shadow: 0 1px 0 rgba(255, 255, 255, .3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), 0 6px 20px rgba(62, 201, 170, .25);
}
.button.primary:hover {
  border-color: #b4fbe9;
  background: linear-gradient(180deg, #9af7e1, #47d4b4);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55), 0 0 0 4px rgba(95, 224, 196, .14), 0 10px 30px rgba(62, 201, 170, .38);
}
.button.primary::after { background: linear-gradient(110deg, transparent 35%, rgba(255, 255, 255, .55) 50%, transparent 65%); }

.button.danger {
  border-color: var(--danger-line);
  background: linear-gradient(180deg, #3a1916, #2a1210);
  color: #ffb3a7;
}
.button.danger:hover {
  border-color: #b44c3d;
  background: linear-gradient(180deg, #47201b, #331613);
  box-shadow: 0 0 0 3px rgba(232, 96, 76, .13), 0 6px 18px rgba(0, 0, 0, .25);
}
.button.ghost { background: transparent; border-color: transparent; color: var(--muted); box-shadow: none; }
.button.ghost:hover { background: rgba(95, 224, 196, .07); border-color: var(--line-soft); color: var(--ink); box-shadow: none; }
.button.icon-only { width: 38px; padding: 0; }
.button.small { min-height: 28px; padding: 0 9px; font-size: 12px; border-radius: 8px; }
.button:disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }
.button .icon { width: 15px; height: 15px; }

.icon {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  display: inline-block;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ============ 卡片／面板 ============ */

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 16px; }
.module-grid { display: grid; grid-template-columns: repeat(3, minmax(190px, 1fr)); gap: 12px; }

.metric-card,
.module-card,
.panel,
.link-card {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .035), var(--shadow);
  /* 最上層是滑鼠光暈（admin.js 設 --mx／--my），其次四個內縮金角，最下是面板底色 */
  background:
    radial-gradient(520px circle at var(--mx, -1000px) var(--my, -1000px), rgba(95, 224, 196, .075), transparent 42%),
    linear-gradient(var(--gold-line), var(--gold-line)) left 8px top 8px / 12px 1px no-repeat,
    linear-gradient(var(--gold-line), var(--gold-line)) left 8px top 8px / 1px 12px no-repeat,
    linear-gradient(var(--gold-line), var(--gold-line)) right 8px bottom 8px / 12px 1px no-repeat,
    linear-gradient(var(--gold-line), var(--gold-line)) right 8px bottom 8px / 1px 12px no-repeat,
    var(--glass);
  transition: border-color .3s ease, box-shadow .3s ease;
}
.panel:hover,
.metric-card:hover,
.module-card:hover,
.link-card:hover { border-color: rgba(95, 224, 196, .2); }

.metric-card {
  position: relative;
  overflow: hidden;
  min-height: 136px;
  padding: 20px;
  display: grid;
  align-content: space-between;
  gap: 12px;
}
.metric-card::before { content: ""; position: absolute; left: 20px; top: 0; width: 40px; height: 2px; background: var(--brand); box-shadow: 0 0 10px var(--brand); }
.metric-card:nth-child(2)::before { background: var(--gold); box-shadow: 0 0 10px var(--gold); }
.metric-card:nth-child(3)::before { background: var(--sky); box-shadow: 0 0 10px var(--sky); }
.metric-card:nth-child(4)::before { background: var(--cinnabar); box-shadow: 0 0 10px var(--cinnabar); }
.metric-label { color: var(--muted); font-size: 13px; line-height: 1.35; }
.metric-value { font-family: var(--font-num); font-size: 36px; line-height: 1; font-weight: 600; color: #f4fbf8; font-variant-numeric: tabular-nums; }
.metric-foot { color: var(--muted); font-size: 12px; line-height: 1.35; overflow-wrap: anywhere; }

.module-card { min-height: 124px; padding: 16px; display: grid; grid-template-rows: auto 1fr auto; gap: 12px; text-decoration: none; color: inherit; }
button.module-card { width: 100%; text-align: left; cursor: pointer; }
.module-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.module-title { font-weight: 650; line-height: 1.3; }
.module-path { color: var(--muted); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }

.panel { overflow: hidden; min-width: 0; }

.panel-head {
  min-height: 58px;
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(90deg, rgba(95, 224, 196, .065), rgba(95, 224, 196, 0) 55%);
}
.panel-title {
  margin: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-size: 15.5px;
  line-height: 1.35;
  font-weight: 650;
  letter-spacing: .02em;
}
.panel-title::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  transform: rotate(45deg);
  background: var(--gold);
  box-shadow: 0 0 10px rgba(240, 207, 135, .7);
}
.panel-title .code { font-weight: 500; font-size: .8em; }
.panel-title + .chip { font-weight: 500; }
.panel-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.panel-body { padding: 20px; min-width: 0; }
.panel-body > .form-grid + .panel-actions { margin-top: 16px; }
.panel-body > .panel-actions + .table-wrap { margin-top: 18px; }

/* ============ 標籤 ============ */

.chip {
  min-height: 24px;
  padding: 3px 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  border: 1px solid rgba(240, 207, 135, .22);
  background: rgba(240, 207, 135, .09);
  color: #f2d79c;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.chip.ok { background: rgba(95, 224, 196, .1); border-color: rgba(95, 224, 196, .26); color: var(--ok); }
.chip.warn,
.chip.hold { background: rgba(244, 201, 120, .1); border-color: rgba(244, 201, 120, .3); color: var(--warning); }
.chip.danger,
.chip.err { background: rgba(232, 96, 76, .13); border-color: rgba(232, 96, 76, .35); color: var(--danger); }
.chip.muted { background: rgba(141, 168, 163, .08); border-color: rgba(141, 168, 163, .16); color: var(--muted); }
.chip.mod { background: rgba(134, 207, 242, .1); border-color: rgba(134, 207, 242, .26); color: var(--sky); }
.chip.danger::before,
.chip.ok::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 6px currentColor;
}

/* ============ 狀態／回饋 ============ */

.status-line {
  min-height: 40px;
  padding: 9px 14px 9px 16px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  position: relative;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: rgba(4, 14, 17, .6);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}
.status-line::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 3px;
  background: var(--brand);
  box-shadow: 0 0 10px var(--brand);
}
.status-line strong { color: var(--ink); }
.status-line.error { color: var(--danger); background: var(--danger-bg); border-color: var(--danger-line); }
.status-line.error::before { background: var(--cinnabar); box-shadow: 0 0 10px var(--cinnabar); }

.result-box {
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(4, 14, 17, .6);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.result-box:not(:empty) { animation: g1-fade .35s ease backwards; }
.result-box.ok { color: var(--ok); background: var(--ok-bg); border-color: var(--ok-line); }
.result-box.error,
.result-box.err { color: var(--danger); background: var(--danger-bg); border-color: var(--danger-line); }
.result-box.err { animation: g1-shake .4s ease both; }
.result-box.warn { color: var(--warning); background: var(--warning-bg); border-color: var(--warning-line); }

.warn-box,
.ban-box {
  position: relative;
  padding: 10px 14px 10px 16px;
  border-radius: 11px;
  font-size: 13px;
  line-height: 1.6;
}
.warn-box { border: 1px solid var(--warning-line); background: var(--warning-bg); color: var(--warning); }
.ban-box { border: 1px solid var(--danger-line); background: linear-gradient(90deg, rgba(232, 96, 76, .16), var(--danger-bg) 60%); color: var(--danger); font-weight: 700; }
.warn-box::before,
.ban-box::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 3px;
  background: currentColor;
  box-shadow: 0 0 10px currentColor;
}
.ban-box[hidden] { display: none; }

.permission-note {
  padding: 12px 16px;
  border: 1px solid rgba(134, 207, 242, .25);
  background: linear-gradient(90deg, rgba(134, 207, 242, .1), rgba(134, 207, 242, .03));
  color: #bfe3f5;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.7;
}
.permission-note .icon { color: var(--sky); }

/* ============ 表單 ============ */

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}
.search-box { position: relative; }
.search-box svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
  transition: color .2s ease;
}
.search-box:focus-within svg { color: var(--brand); }
.search-box input { width: 100%; min-height: 38px; padding: 0 12px 0 38px; }

button, input, select, textarea { min-width: 0; }
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="range"]):not([type="color"]),
textarea,
select {
  color: var(--ink);
  background-color: rgba(3, 12, 15, .7);
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: border-color .2s ease, box-shadow .25s ease, background-color .2s ease;
}
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):hover,
textarea:hover,
select:hover { border-color: var(--line-strong); }

select {
  min-height: 38px;
  padding: 0 34px 0 11px;
}
select:not([multiple]) {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235fe0c4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 15px;
}
select option { background: #0b1b1f; color: var(--ink); }

textarea {
  width: 100%;
  min-height: 110px;
  resize: vertical;
  padding: 10px 12px;
  line-height: 1.5;
}
textarea.json { font-family: var(--font-mono); font-size: 13px; min-height: 120px; }

input::placeholder, textarea::placeholder { color: #5f7c78; opacity: 1; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--brand); }
input:disabled, textarea:disabled, select:disabled { opacity: .55; cursor: not-allowed; }
input:read-only, textarea:read-only { color: #b5cac5; }
input::-webkit-calendar-picker-indicator { opacity: .6; cursor: pointer; transition: opacity .2s; }
input::-webkit-calendar-picker-indicator:hover { opacity: 1; }

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
}
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none;
  border-color: var(--brand);
  background-color: rgba(5, 20, 23, .85);
  box-shadow: 0 0 0 3px rgba(95, 224, 196, .14), 0 0 22px rgba(95, 224, 196, .12);
}
:where(button, input, select, textarea):disabled:hover { border-color: var(--line); }

.form-grid { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field input { width: 100%; min-height: 38px; padding: 0 11px; }
.field-label {
  margin-bottom: 2px;
  font-size: 12px;
  font-weight: 600;
  color: #b3c8c3;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.field-value { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }
.field-hint { color: var(--muted); font-size: 12px; line-height: 1.65; }
.field-hint b { font-weight: 600; color: #cfe0db; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field-row-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }

.switch-row { display: flex; align-items: center; gap: 10px; }
.switch-row input { width: 18px; height: 18px; min-height: 0; accent-color: var(--brand); }

.segmented {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(3, 12, 15, .7);
}
.segmented button {
  min-height: 34px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 650;
  transition: color .2s ease, background .25s ease, box-shadow .25s ease;
}
.segmented button:hover:not(.active):not(:disabled) { color: var(--ink); background: rgba(95, 224, 196, .06); }
.segmented button:disabled { opacity: .4; cursor: not-allowed; }
.segmented button.active {
  background: linear-gradient(180deg, rgba(95, 224, 196, .26), rgba(95, 224, 196, .1));
  color: #c2fdee;
  box-shadow: inset 0 0 0 1px rgba(95, 224, 196, .38), 0 0 18px rgba(95, 224, 196, .14);
  animation: g1-press .35s var(--ease-out);
}
/* 玩家詳情頁籤（Players.razor）：沿用 segmented 外觀，欄數放寬 */
.segmented.tabs { grid-template-columns: repeat(6, minmax(96px, 1fr)); }

.reward-list { display: grid; gap: 8px; }
.reward-row { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(100px, 140px) 38px; gap: 8px; align-items: center; }
.reward-row input { min-height: 38px; padding: 0 10px; }

.section-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px dashed rgba(240, 207, 135, .22);
  color: var(--gold);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .04em;
}
.section-label::before { content: ""; width: 5px; height: 5px; transform: rotate(45deg); background: currentColor; flex: none; }

/* ============ 表格 ============ */

.table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line-soft);
  border-radius: 13px;
  background: rgba(3, 12, 15, .5);
}
table { width: 100%; border-collapse: collapse; table-layout: fixed; }
th, td {
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
  font-size: 14px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  border-bottom: 1px solid rgba(126, 214, 196, .07);
}
th {
  color: #d4c296;
  background: linear-gradient(180deg, rgba(240, 207, 135, .07), rgba(240, 207, 135, .025));
  border-bottom: 1px solid rgba(240, 207, 135, .16);
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: .07em;
  text-transform: uppercase;
}
tr:last-child td { border-bottom: 0; }
/* 查詢結果一列一列瀑布式滑進來（前 24 列錯開，之後一起） */
tbody tr { animation: g1-row-in .5s var(--ease-out) backwards; animation-delay: calc(min(sibling-index(), 24) * 28ms); }
tbody tr td { transition: background-color .15s ease, box-shadow .15s ease; }
tbody tr:hover:not(.iap-refunded) td { background-color: rgba(95, 224, 196, .045); }
tbody tr:hover:not(.iap-refunded) td:first-child { box-shadow: inset 2px 0 0 var(--brand); }
tbody tr[style*="cursor: pointer"]:hover td { background-color: rgba(95, 224, 196, .08); }
td .button { font-size: 12px; }
td .code { user-select: all; }
td a:not(.button) { color: #8fe9d6; text-underline-offset: 3px; }
table td pre { max-width: 100%; overflow-x: auto; }

.row-click { cursor: pointer; }
.row-click:hover td { background: rgba(95, 224, 196, .07); }
.row-click.selected td { background: rgba(95, 224, 196, .12); }
.row-click.selected td:first-child { box-shadow: inset 3px 0 0 var(--brand); }
tr.iap-refunded td { background: var(--danger-bg); }

/* table-layout: fixed 下固定欄寬總和若超過表寬，最後一欄會被擠成 0——min-width 必須大於各表固定欄總和 */
table.iap-wide { min-width: 1660px; }
table.iap-mid { min-width: 1240px; }

.col-time { width: 176px; }
.col-email { width: 230px; }
.col-playfab { width: 190px; }
.col-action { width: 170px; }
.col-name { width: 150px; }
.col-del { width: 90px; }
.col-sort { width: 64px; }
.col-state { width: 96px; }
.col-window { width: 240px; }
.col-mods { width: 190px; }
.col-player { width: 190px; }
.col-key { width: 150px; }
.col-num { width: 110px; }
.col-sku { width: 190px; }
.col-chip { width: 130px; }

/* ============ 內容元件 ============ */

.notice-title { font-weight: 700; overflow-wrap: anywhere; }
.notice-body {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.window-time { font-size: 13px; color: var(--muted); }

.preview-card { padding: 14px; border: 1px solid var(--line-soft); border-radius: 12px; background: rgba(3, 12, 15, .55); }
.preview-card + .preview-card { margin-top: 10px; }
.preview-title { font-weight: 700; margin-bottom: 6px; }
.preview-body { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; font-size: 14px; }

.email,
.playfab,
.code {
  overflow-wrap: anywhere;
  color: #8fdcf0;
  font-family: var(--font-mono);
  font-size: .93em;
  font-weight: 500;
}

.problem {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* 空狀態：打盹的劍仙 */
.empty {
  min-height: 190px;
  padding: 24px 28px 28px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
  line-height: 1.75;
  background: radial-gradient(ellipse 60% 70% at 50% 35%, rgba(95, 224, 196, .07), transparent 70%);
}
.empty::before {
  content: "";
  width: 104px;
  height: 104px;
  background: url("img/mascot-empty.webp") center / contain no-repeat;
  filter: drop-shadow(0 10px 16px rgba(0, 0, 0, .45));
  animation: g1-float 5.5s ease-in-out infinite;
}
.empty:only-child { border-radius: 12px; }
.empty[hidden] { display: none; }

/* 未授權／找不到頁 */
.state-card {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 28px 36px;
  min-height: 260px;
}
.state-art {
  width: 180px;
  height: 180px;
  flex: 0 0 auto;
  object-fit: contain;
  filter: drop-shadow(0 14px 24px rgba(0, 0, 0, .5));
  animation: g1-float 5s ease-in-out infinite;
}
.state-title {
  margin: 0 0 8px;
  font-family: var(--font-brush);
  font-weight: 400;
  font-size: 32px;
  letter-spacing: .08em;
  color: #fbf1d8;
}
.state-card p { margin: 0; line-height: 1.8; }
.state-card .panel-actions { margin-top: 16px; }

.list { display: grid; gap: 10px; }
.link-card { padding: 14px; display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; text-decoration: none; }
.link-title { font-weight: 650; line-height: 1.3; }
.link-url { margin-top: 4px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }

.kv-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.kv {
  min-width: 0;
  min-height: 74px;
  padding: 14px 16px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: rgba(3, 12, 15, .5);
  transition: border-color .2s ease, background-color .2s ease;
}
.kv:hover { border-color: rgba(95, 224, 196, .22); background: rgba(6, 20, 23, .7); }
.kv-label { margin-bottom: 6px; color: var(--faint); font-size: 11.5px; font-weight: 600; letter-spacing: .04em; }
.kv-value { overflow-wrap: anywhere; font-weight: 600; line-height: 1.45; }
.kv.identity-card { border-color: rgba(95, 224, 196, .3); background: linear-gradient(135deg, rgba(95, 224, 196, .12), rgba(3, 12, 15, .5) 70%); }
.identity-card .field-hint { margin-top: 7px; font-size: 11px; color: #a3c9bf; }

.copyable-value { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; }
.copyable-text { overflow-wrap: anywhere; min-width: 0; user-select: all; padding-top: 3px; }
.copyable-value .button { flex: 0 0 auto; }
.copy-feedback { display: block; color: var(--brand); font-size: 11px; margin-top: 4px; animation: g1-fade .3s ease backwards; }
.copy-feedback:empty { display: none; }

details summary { cursor: pointer; color: #bcd2cd; transition: color .2s ease; }
details summary:hover { color: var(--ink); }
details[open] > summary { margin-bottom: 10px; color: var(--brand); }

/* 活動配置（event） */
.evt-title { font-weight: 700; overflow-wrap: anywhere; }
.evt-id { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; font-family: var(--font-mono); }

/* 玩家（客服工具） */
.detail-stack { display: grid; gap: 22px; }
.detail-stack[hidden] { display: none; }
.detail-stack > * { animation: g1-rise .5s var(--ease-out) backwards; }

/* IAP 驗證 */
.iap-platform-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.iap-card {
  padding: 16px;
  display: grid;
  gap: 12px;
  align-content: start;
  border: 1px solid var(--line-soft);
  border-radius: 13px;
  background: rgba(3, 12, 15, .55);
}
.iap-card-head { display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap; }
.iap-card-title { margin: 0; font-size: 15px; line-height: 1.35; font-weight: 700; }
.iap-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.iap-card .warn-box { white-space: pre-wrap; overflow-wrap: anywhere; }
.iap-help { padding: 8px 12px; border: 1px solid var(--line-soft); border-radius: 10px; background: rgba(3, 12, 15, .5); font-size: 13px; line-height: 1.6; }
.iap-help summary { cursor: pointer; font-weight: 700; color: var(--brand); }
.iap-help ol { margin: 8px 0 0; padding-left: 20px; }
.iap-help pre { margin: 8px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--font-mono); font-size: 12px; }
.iap-toolbar { grid-template-columns: minmax(220px, 1fr) auto auto auto auto; }
.iap-summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* ============ 各頁 KPI 卡（樣式本體在各頁 .razor.css，這裡只補共同的質感與動態） ============ */

.analytics-kpi,
.ads-kpis article,
.usage-kpis article,
.group-facts article,
.analytics-money-grid > div,
.analytics-retention-cards > div {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  /* 3D 傾斜：fx.js 依滑鼠在卡上的位置寫 --rx／--ry（角度）與 --gx／--gy（反光圓心） */
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(var(--lift, 0px));
  transition: transform .35s var(--ease-out), border-color .3s ease, box-shadow .3s ease;
}
:is(.analytics-kpi, .ads-kpis article, .usage-kpis article, .group-facts article)::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  border-radius: inherit;
  background: radial-gradient(260px circle at var(--gx, 50%) var(--gy, 0%), rgba(255, 255, 255, .13), transparent 55%);
  opacity: 0;
  transition: opacity .3s ease;
}
:is(.analytics-kpi, .ads-kpis article, .usage-kpis article, .group-facts article):hover::before { opacity: 1; }
.analytics-kpi::after,
.ads-kpis article::after,
.usage-kpis article::after,
.group-facts article::after {
  /* 角落淡淡的陣法浮水印，滑過時轉一點 */
  content: "";
  position: absolute;
  right: -34px;
  bottom: -34px;
  width: 128px;
  height: 128px;
  z-index: -1;
  background: url("img/formation.svg") center / contain no-repeat;
  opacity: .1;
  transition: transform 1.2s var(--ease-out), opacity .4s ease;
}
.analytics-kpi:hover,
.ads-kpis article:hover,
.usage-kpis article:hover,
.group-facts article:hover {
  --lift: -4px;
  border-color: rgba(95, 224, 196, .35);
  box-shadow: 0 14px 34px rgba(0, 0, 0, .35), 0 0 0 1px rgba(95, 224, 196, .08), 0 0 30px rgba(95, 224, 196, .08);
}
.analytics-kpi:hover::after,
.ads-kpis article:hover::after,
.usage-kpis article:hover::after,
.group-facts article:hover::after { transform: rotate(60deg) scale(1.08); opacity: .18; }
.analytics-kpi strong,
.ads-kpis strong,
.usage-kpis strong,
.group-facts strong,
.analytics-money-grid strong,
.analytics-retention-cards strong,
.usage-card-nums b,
.player-ads-summary strong {
  font-family: var(--font-num);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.analytics-kpis > :nth-child(1),
.ads-kpis > :nth-child(1),
.usage-kpis > :nth-child(1) { animation: g1-rise .6s .05s var(--ease-out) backwards; }
.analytics-kpis > :nth-child(2),
.ads-kpis > :nth-child(2),
.usage-kpis > :nth-child(2) { animation: g1-rise .6s .1s var(--ease-out) backwards; }
.analytics-kpis > :nth-child(3),
.ads-kpis > :nth-child(3),
.usage-kpis > :nth-child(3) { animation: g1-rise .6s .15s var(--ease-out) backwards; }
.analytics-kpis > :nth-child(4),
.ads-kpis > :nth-child(4),
.usage-kpis > :nth-child(4) { animation: g1-rise .6s .2s var(--ease-out) backwards; }
.analytics-kpis > :nth-child(5),
.ads-kpis > :nth-child(5),
.usage-kpis > :nth-child(5) { animation: g1-rise .6s .25s var(--ease-out) backwards; }
.analytics-kpis > :nth-child(n+6),
.ads-kpis > :nth-child(n+6),
.usage-kpis > :nth-child(n+6) { animation: g1-rise .6s .3s var(--ease-out) backwards; }

.analytics-empty::before,
.ads-empty::before {
  content: "";
  width: 120px;
  height: 120px;
  margin: 0 auto 4px;
  display: block;
  background: url("img/mascot-empty.webp") center / contain no-repeat;
  filter: drop-shadow(0 10px 16px rgba(0, 0, 0, .45));
  animation: g1-float 5.5s ease-in-out infinite;
}
.analytics-empty.empty::before { width: 104px; height: 104px; margin: 0; }

/* SVG 圖表（Services/SvgChart.cs 產生）：整張由左往右掃出來；直條從底長高、橫條從左長出（依序） */
.analytics-chart svg,
.usage-chart svg,
.ads-chart svg,
.timeline-chart svg { animation: g1-reveal 1.5s .1s var(--ease-out) backwards; }
:is(.analytics-chart, .usage-chart, .ads-chart, .timeline-chart) svg :is(rect[rx="1"], rect[rx="2"]) {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: g1-grow .7s var(--ease-out) both;
  animation-delay: calc(min(sibling-index(), 80) * 8ms);
}
:is(.analytics-chart, .usage-chart, .ads-chart, .timeline-chart) svg rect[rx="5"]:not([style*="chart-track"]) {
  transform-box: fill-box;
  transform-origin: 0 50%;
  animation: g1-grow-x .9s var(--ease-out) both;
  animation-delay: calc(min(sibling-index(), 60) * 12ms);
}

/* ============ 對話框 ============ */

dialog {
  width: min(760px, calc(100vw - 28px));
  padding: 0;
  color: var(--ink);
  border: 1px solid rgba(240, 207, 135, .22);
  border-radius: 18px;
  background:
    linear-gradient(var(--gold-line), var(--gold-line)) left 9px top 9px / 14px 1px no-repeat,
    linear-gradient(var(--gold-line), var(--gold-line)) left 9px top 9px / 1px 14px no-repeat,
    linear-gradient(var(--gold-line), var(--gold-line)) right 9px bottom 9px / 14px 1px no-repeat,
    linear-gradient(var(--gold-line), var(--gold-line)) right 9px bottom 9px / 1px 14px no-repeat,
    linear-gradient(180deg, #11272c, #0a181c);
  box-shadow: 0 30px 90px rgba(0, 0, 0, .6), 0 0 0 1px rgba(95, 224, 196, .06), 0 0 60px rgba(95, 224, 196, .06);
}
dialog[open] { animation: g1-dialog-in .38s var(--ease-out) both; }
dialog::backdrop {
  background: radial-gradient(ellipse at 50% 40%, rgba(6, 22, 26, .6), rgba(2, 6, 8, .86));
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
#eventDialog { width: min(860px, calc(100vw - 28px)); }
#eventDialog .dialog-body { max-height: 70vh; overflow-y: auto; }
.dialog-head {
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(90deg, rgba(95, 224, 196, .08), transparent 60%);
}
.dialog-title { margin: 0; font-size: 18px; line-height: 1.25; font-weight: 700; letter-spacing: .03em; }
.dialog-body { padding: 18px 20px; display: grid; gap: 14px; }
.dialog-body pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.dialog-foot {
  padding: 14px 20px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line-soft);
}

/* ============ 登入：活的山門 ============
   分層（MainLayout .login-scene）：主視覺 → 後雲 → 陣法 → 粒子畫布（fx.js：靈光＋飛劍）→ 前雲 → 壓暗 → 閃光。
   --px／--py：fx.js 依滑鼠位置寫入（-1～1），各層位移量不同做出視差。
   .is-entering：登入成功「破陣入門」；.is-denied：登入失敗陣法轉紅。 */

.login-screen {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 48px clamp(24px, 8vw, 150px);
  background: #061013;
  perspective: 1200px;
}
.login-scene { position: absolute; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.login-scene > * { position: absolute; }

.login-hero {
  inset: -5%;
  background: url("img/login-hero.webp") 68% center / cover no-repeat;
  translate: calc(var(--px, 0) * -16px) calc(var(--py, 0) * -10px);
  transition: translate .8s var(--ease-out);
  transform-origin: 74% 36%;
  animation: g1-hero-in 2.4s var(--ease-out) backwards, g1-kenburns 40s ease-in-out 2.4s infinite alternate;
}

/* 雲帶比畫面寬一格，用 transform 往左推一格再接回原點（合成層，不重畫）；translate 屬性另外疊滑鼠視差 */
.login-cloud {
  left: -5%;
  width: calc(110% + var(--tile));
  background-repeat: repeat-x;
  background-size: auto 100%;
  will-change: transform;
  transition: translate .8s var(--ease-out);
  animation: g1-cloud-x linear infinite;
}
/* --tile＝圖寬依高度等比縮放後的寬（cloud-back 2400×732、cloud-front 2400×783） */
.login-cloud.back {
  bottom: 1vh;
  height: 40vh;
  --tile: 131.15vh;
  background-image: url("img/cloud-back.webp");
  opacity: .7;
  translate: calc(var(--px, 0) * -34px) calc(var(--py, 0) * -10px);
  animation-duration: 150s;
}
.login-cloud.front {
  bottom: -9vh;
  height: 34vh;
  --tile: 104.21vh;
  background-image: url("img/cloud-front.webp");
  opacity: .92;
  translate: calc(var(--px, 0) * -70px) calc(var(--py, 0) * -16px);
  animation-duration: 80s;
  animation-direction: reverse;
  filter: drop-shadow(0 -12px 30px rgba(127, 240, 214, .08));
}

.login-shade {
  inset: 0;
  background:
    linear-gradient(90deg, rgba(3, 10, 12, .86) 0%, rgba(3, 10, 12, .62) 30%, rgba(3, 10, 12, .08) 60%, rgba(3, 10, 12, 0) 80%),
    radial-gradient(ellipse 80% 60% at 74% 30%, rgba(240, 207, 135, .08), transparent 60%);
}

/* 大陣法：三層反向旋轉＋向外擴散的波紋，坐在登入卡正後方 */
.login-array {
  width: min(900px, 108vh);
  aspect-ratio: 1;
  left: calc(clamp(24px, 8vw, 150px) + 215px);
  top: 50%;
  translate: calc(-50% + var(--px, 0) * 18px) calc(-50% + var(--py, 0) * 12px);
  opacity: .46;
  transition: opacity .6s ease, filter .6s ease, translate .8s var(--ease-out);
  animation: g1-array-in 2s .3s var(--ease-out) backwards;
}
.login-array i {
  position: absolute;
  inset: 0;
  background: center / contain no-repeat;
  will-change: transform;
  filter: drop-shadow(0 0 5px rgba(127, 240, 214, .55));
}
.login-array .outer { background-image: url("img/array-outer.svg"); animation: g1-spin 140s linear infinite; }
.login-array .mid { background-image: url("img/array-mid.svg"); animation: g1-spin 70s linear infinite reverse; }
.login-array .inner { background-image: url("img/array-inner.svg"); animation: g1-spin 36s linear infinite; }
.login-array .wave {
  inset: 28%;
  border-radius: 50%;
  border: 1px solid rgba(127, 240, 214, .7);
  box-shadow: 0 0 22px rgba(127, 240, 214, .35), inset 0 0 22px rgba(127, 240, 214, .2);
  filter: none;
  animation: g1-wave 4.5s ease-out infinite;
}
.login-array .wave + .wave { animation-delay: -2.25s; }
/* 打字時陣法亮起、轉快一點的錯覺（亮度＋光暈） */
.login-screen:has(input:focus) .login-array { opacity: .82; filter: brightness(1.25) saturate(1.2); }
.login-screen:has(input:focus) .login-array .wave { animation-duration: 2.6s; }

.login-fx { inset: 0; width: 100%; height: 100%; }
.login-flash {
  inset: 0;
  opacity: 0;
  background: radial-gradient(circle at calc(clamp(24px, 8vw, 150px) + 215px) 50%, #f4fffb 0, rgba(159, 245, 224, .9) 18%, rgba(6, 16, 19, .96) 55%, #061013 80%);
}

.login-card {
  position: relative;
  width: min(430px, 100%);
  border-radius: 22px;
  border: 1px solid rgba(240, 207, 135, .26);
  background:
    linear-gradient(var(--gold-line), var(--gold-line)) left 10px top 10px / 16px 1px no-repeat,
    linear-gradient(var(--gold-line), var(--gold-line)) left 10px top 10px / 1px 16px no-repeat,
    linear-gradient(var(--gold-line), var(--gold-line)) right 10px bottom 10px / 16px 1px no-repeat,
    linear-gradient(var(--gold-line), var(--gold-line)) right 10px bottom 10px / 1px 16px no-repeat,
    radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%), rgba(127, 240, 214, .1), transparent 50%),
    linear-gradient(180deg, rgba(13, 32, 36, .62), rgba(6, 18, 21, .72));
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  backdrop-filter: blur(16px) saturate(1.3);
  box-shadow: 0 30px 90px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .08), 0 0 70px rgba(95, 224, 196, .08);
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transform-style: preserve-3d;
  transition: transform .5s var(--ease-out);
  animation: g1-card-in 1.1s .5s var(--ease-out) backwards;
}
/* 卡片外圈繞一道流光 */
.login-card::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: conic-gradient(from var(--g1-angle, 0deg), transparent 0 62%, rgba(95, 224, 196, .95) 78%, rgba(255, 244, 214, 1) 86%, rgba(240, 207, 135, .9) 90%, transparent 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  animation: g1-orbit 5s linear infinite;
  pointer-events: none;
}
.login-card .panel-head { padding: 24px; }
.login-card .panel-body { padding: 30px 32px 28px; }
.login-identity { margin-bottom: 18px; text-align: center; }
.login-logo {
  display: block;
  width: 250px;
  max-width: 80%;
  height: auto;
  margin: -6px auto 6px;
  filter: drop-shadow(0 10px 22px rgba(0, 0, 0, .55));
  animation: g1-logo-in 1.2s .8s var(--ease-out) backwards, g1-float 6s 2s ease-in-out infinite;
}
.login-kicker { display: block; margin: 10px 0 0; font-size: 10px; letter-spacing: .3em; color: var(--gold); font-weight: 650; animation: g1-fade 1s 1.2s ease backwards; }
.login-title {
  margin: 0;
  text-align: center;
  font-family: var(--font-brush);
  font-size: 48px;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: .24em;
  text-indent: .24em;
  background: linear-gradient(100deg, #c79443 0%, #f0cf87 30%, #fffaf0 45%, #f0cf87 60%, #c79443 100%);
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 16px rgba(240, 207, 135, .3));
  /* 墨暈出現，之後金光每隔幾秒流過字面 */
  animation: g1-ink-in 1.3s 1s var(--ease-out) backwards, g1-gleam 5s 2.6s ease-in-out infinite;
}
.login-copy { margin: 10px 0 24px; text-align: center; font-size: 13px; line-height: 1.8; color: var(--muted); animation: g1-fade 1s 1.4s ease backwards; }
.login-footer { margin-top: 22px; text-align: center; font-size: 11px; color: #7a9692; line-height: 1.8; }
.login-card .brand { border: 0; padding: 0; }
.login-card .form-grid { gap: 18px; }
.login-card .form-grid > * { animation: g1-rise .7s var(--ease-out) backwards; }
.login-card .form-grid > :nth-child(1) { animation-delay: 1.3s; }
.login-card .form-grid > :nth-child(2) { animation-delay: 1.4s; }
.login-card .form-grid > :nth-child(3) { animation-delay: 1.5s; }
.login-card .form-grid > :nth-child(4) { animation-delay: 1.6s; }
.login-card .field-label { text-transform: none; }
.login-card .field input { min-height: 46px; background-color: rgba(3, 12, 15, .62); }
.login-card .button.primary { min-height: 48px; width: 100%; margin-top: 4px; font-size: 15px; letter-spacing: .1em; }
/* 主按鈕待機時每幾秒自己掃一道光 */
.login-card .button.primary::after { animation: g1-idle-shine 4.5s 3s ease-in-out infinite; }
.login-card .result-box { margin: 0; }

/* 登入成功：陣法爆開、鏡頭衝向塔樓、白光轉場 */
.login-screen.is-entering .login-array { animation: g1-array-burst 1.15s cubic-bezier(.5, 0, .2, 1) forwards; }
.login-screen.is-entering .login-hero { animation: g1-dive 1.15s cubic-bezier(.6, 0, .2, 1) forwards; }
.login-screen.is-entering .login-cloud.front { animation: g1-cloud-part 1.15s cubic-bezier(.6, 0, .2, 1) forwards; }
.login-screen.is-entering .login-card { animation: g1-card-out .6s cubic-bezier(.5, 0, .7, .4) forwards; }
.login-screen.is-entering .login-flash { animation: g1-flash 1.15s ease-in forwards; }
/* 最後收成頁面底色：Blazor 重新整理後接後台的進場，不會亮一下又暗 */
.login-flash::after { content: ""; position: absolute; inset: 0; background: #061013; opacity: 0; }
.login-screen.is-entering .login-flash::after { animation: g1-settle 1.15s ease-in forwards; }
/* 登入失敗：陣法轉紅、卡片震一下 */
.login-screen.is-denied .login-array { filter: hue-rotate(-150deg) saturate(1.8) brightness(1.15); opacity: .9; transition-duration: .15s; }
.login-screen.is-denied .login-card { animation: g1-shake .45s ease; }

/* Routes.razor 的「正在恢復」也用 login-screen：置中 */
.login-screen > .panel.panel-body { margin-inline: auto; animation: g1-fade .4s ease backwards; }

/* ============ Blazor 錯誤列 ============ */

#blazor-error-ui {
  color-scheme: dark;
  background: linear-gradient(90deg, #3d1814, #2d1311);
  color: #ffe0da;
  bottom: 0;
  border-top: 1px solid #8f3e33;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, .35);
  display: none;
  left: 0;
  padding: .85rem 3rem .85rem 1.25rem;
  position: fixed;
  width: 100%;
  z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }

/* fx.js 掛在 body 上的兩張畫布：背景漂浮靈光（內容後面）、點擊墨暈／星星等一次性特效（最上層） */
.g1-ambient { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.g1-overlay { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 2000; pointer-events: none; }

.text-danger { color: var(--danger); }
.text-muted, .muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.mobile-nav { display: none; }

/* ============ 動態 ============ */

/* 預渲染的 DOM（MainLayout data-live="0"）連上 circuit 後會被互動版整塊換掉：
   先把所有動畫停在第一格，等互動版（data-live="1"）出來才從頭播一次。正式站連線要一兩秒，不停的話進場會播一半又重來 */
[data-live="0"] *,
[data-live="0"] *::before,
[data-live="0"] *::after { animation-play-state: paused !important; }

@property --g1-angle { syntax: "<angle>"; initial-value: 0deg; inherits: false; }

@keyframes g1-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes g1-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes g1-pop { 0% { transform: rotate(45deg) scale(0); } 70% { transform: rotate(45deg) scale(1.35); } 100% { transform: rotate(45deg) scale(1); } }
@keyframes g1-spin { to { transform: rotate(360deg); } }
@keyframes g1-twinkle { from { opacity: .18; } to { opacity: .42; } }
@keyframes g1-breathe { 0%, 100% { box-shadow: 0 0 0 1px rgba(240, 207, 135, .5), 0 8px 20px rgba(0, 0, 0, .45), 0 0 18px rgba(95, 224, 196, .12); } 50% { box-shadow: 0 0 0 1px rgba(240, 207, 135, .7), 0 8px 20px rgba(0, 0, 0, .45), 0 0 32px rgba(95, 224, 196, .3); } }
@keyframes g1-blade-in { from { transform: scaleY(0); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes g1-sweep { from { background-position: 120% 0; } to { background-position: -40% 0; } }
@keyframes g1-flow { to { background-position: -200% 0; } }
@keyframes g1-pulse { 0% { box-shadow: 0 0 0 0 rgba(95, 224, 196, .55), 0 0 8px var(--brand); } 100% { box-shadow: 0 0 0 9px rgba(95, 224, 196, 0), 0 0 8px var(--brand); } }
@keyframes g1-pulse-warn { 0% { box-shadow: 0 0 0 0 rgba(244, 201, 120, .55); } 100% { box-shadow: 0 0 0 9px rgba(244, 201, 120, 0); } }
@keyframes g1-ink-in { from { opacity: 0; filter: blur(8px); letter-spacing: .3em; } to { opacity: 1; filter: none; } }
@keyframes g1-banner-in { from { opacity: 0; transform: translateX(60px) scale(1.06); } to { opacity: 1; transform: none; } }
@keyframes g1-kenburns { from { transform: scale(1); } to { transform: scale(1.08) translateX(-1.5%); } }
@keyframes g1-slash { from { background-position: 130% 0; opacity: 1; } 80% { opacity: 1; } to { background-position: -30% 0; opacity: 0; } }
@keyframes g1-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes g1-shake { 0%, 100% { transform: none; } 20% { transform: translateX(-6px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }
@keyframes g1-reveal { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes g1-grow { from { transform: scaleY(0); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes g1-grow-x { from { transform: scaleX(0); } to { transform: none; } }
@keyframes g1-press { 0% { transform: scale(.94); } 100% { transform: none; } }
@keyframes g1-nav-slash { from { transform: translateX(-30%); opacity: 0; } 20% { opacity: 1; } to { transform: translateX(130%); opacity: 0; } }
@keyframes g1-dialog-in { from { opacity: 0; transform: translateY(18px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes g1-hero-in { from { opacity: 0; transform: scale(1.12); filter: blur(6px) brightness(.6); } to { opacity: 1; transform: none; filter: none; } }
@keyframes g1-mist { from { background-position: 0% 0, 100% 0, 0 0, 0 0; } to { background-position: 100% 0, 0% 0, 0 0, 0 0; } }
@keyframes g1-card-in { from { opacity: 0; transform: translateY(30px) scale(.96); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes g1-logo-in { from { opacity: 0; transform: translateY(-14px) scale(.85); } to { opacity: 1; transform: none; } }
@keyframes g1-orbit { to { --g1-angle: 360deg; } }
@keyframes g1-cloud-bg { from { background-position-x: 0; } to { background-position-x: calc(-1 * var(--tile)); } }
@keyframes g1-cloud-x { from { transform: translateX(0); } to { transform: translateX(calc(-1 * var(--tile))); } }
@keyframes g1-gleam { 0%, 55% { background-position: 100% 0; } 100% { background-position: -150% 0; } }
@keyframes g1-idle-shine { 0%, 70% { transform: translateX(-120%); } 100% { transform: translateX(120%); } }
@keyframes g1-wave { 0% { transform: scale(.6); opacity: 0; } 15% { opacity: .9; } 100% { transform: scale(2.6); opacity: 0; } }
@keyframes g1-array-in { from { opacity: 0; scale: .6; rotate: -40deg; filter: blur(6px); } to { opacity: .46; scale: 1; rotate: 0deg; filter: none; } }
@keyframes g1-array-burst { 0% { scale: 1; opacity: .8; filter: brightness(1.2); } 35% { scale: .9; opacity: 1; filter: brightness(2.2) saturate(1.4); } 100% { scale: 3.2; opacity: 0; filter: brightness(3); } }
@keyframes g1-dive { from { transform: none; filter: none; } to { transform: scale(1.45); filter: brightness(1.6) blur(3px); } }
@keyframes g1-cloud-part { to { translate: 0 40vh; opacity: 0; } }
@keyframes g1-card-out { to { opacity: 0; transform: translateZ(-300px) rotateX(18deg) scale(.85); filter: blur(8px); } }
@keyframes g1-flash { 0%, 40% { opacity: 0; } 70% { opacity: 1; } 100% { opacity: 1; } }
@keyframes g1-settle { 0%, 72% { opacity: 0; } 100% { opacity: 1; } }
@keyframes g1-cleave {
  from { clip-path: polygon(-5% 60px, 105% 260px, 105% 260px, -5% 60px); }
  to { clip-path: polygon(-5% -3000px, 105% -2800px, 105% 3260px, -5% 3060px); }
}
@keyframes g1-slash-draw {
  0% { opacity: 1; mask-position: 100% 0; -webkit-mask-position: 100% 0; }
  45% { opacity: 1; mask-position: 0 0; -webkit-mask-position: 0 0; }
  100% { opacity: 0; mask-position: 0 0; -webkit-mask-position: 0 0; }
}
@keyframes g1-row-in { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }
@keyframes g1-hop { 0% { transform: none; } 30% { transform: translateY(-26px) rotate(-200deg) scale(1.1); } 60% { transform: translateY(-10px) rotate(-360deg) scale(1.05); } 100% { transform: rotate(-360deg); } }

/* ============ 響應式 ============ */

@media (max-width: 1200px) and (min-width: 1021px) {
  .app { grid-template-columns: 224px minmax(0, 1fr); }
  .main, .shell-topbar { padding-left: 24px; padding-right: 24px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .iap-toolbar { grid-template-columns: minmax(160px, 1fr) auto auto; }
  .segmented.tabs { grid-template-columns: repeat(3, minmax(96px, 1fr)); }
}

@media (max-width: 1020px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: relative;
    height: auto;
    overflow: visible;
    padding: 14px 20px 12px;
    gap: 12px;
    min-width: 0;
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
    background: linear-gradient(180deg, rgba(9, 24, 28, .96), rgba(5, 15, 18, .97));
  }
  .sidebar .brand { border: 0; padding: 0; }
  .sidebar .brand::after { display: none; }
  .sidebar-mascot { display: none; }
  .sidebar-foot .operator { padding-right: 0; }
  .sidebar .brand-mark { width: 36px; height: 36px; border-radius: 10px; }
  .sidebar .brand-title { font-size: 19px; }
  .sidebar .brand-subtitle { margin-top: 2px; }
  .sidebar .nav {
    display: flex;
    width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    gap: 6px;
    padding-bottom: 6px;
    scrollbar-width: thin;
  }
  .sidebar .nav-caption, .sidebar .nav-label { display: none; }
  .sidebar .nav-group { display: flex; flex: 0 0 auto; gap: 6px; }
  .sidebar .nav-group + .nav-group { margin: 0; padding-left: 6px; border-left: 1px solid var(--line-soft); }
  .sidebar .nav-button { flex: 0 0 auto; width: auto; white-space: nowrap; min-height: 38px; }
  .sidebar .nav-button:hover { transform: none; }
  .sidebar .nav-button.active::before { left: 10px; right: 10px; top: auto; bottom: -1px; width: auto; height: 2px; }
  .sidebar-foot {
    margin-top: 0;
    padding: 8px 0 0;
    display: flex;
    align-items: center;
    gap: 10px 20px;
    flex-wrap: wrap;
  }
  .sidebar-foot .operator { margin-right: auto; }
  .sidebar-foot .button { margin-top: 0 !important; }
  .mobile-nav { display: block; }
  .shell-topbar { padding: 12px 24px; min-height: 60px; }
  .topbar { grid-template-columns: 1fr; align-items: stretch; }
  .topbar-actions { justify-content: flex-start; }
  .metric-grid, .module-grid { grid-template-columns: repeat(2, minmax(160px, 1fr)); }
  .iap-platform-grid { grid-template-columns: 1fr; }
  .main { padding: 22px 24px 40px; }
  .segmented.tabs { grid-template-columns: repeat(3, minmax(96px, 1fr)); }
}

@media (max-width: 720px) {
  .topbar, .main { padding-left: 16px; padding-right: 16px; }
  .shell-topbar { padding: 10px 16px; gap: 8px; }
  .shell-meta { font-size: 11px; gap: 8px; }
  .shell-clock { display: none; }
  .shell-title { font-size: 18px; }
  .metric-grid { gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .module-grid, .kv-grid, .field-row, .field-row-3, .toolbar, .iap-toolbar, .iap-summary-grid { grid-template-columns: 1fr; }
  .panel-head, .section-head { align-items: stretch; }
  .section-head { min-height: 110px; padding: 20px 20px; border-radius: 16px; }
  .section-head > div:first-child::before { left: -8px; top: -8px; }
  .section-title { font-size: 30px; }
  .section-head::before { inset: 0; opacity: .4; }
  .section-head .section-meta { max-width: none; }
  .panel-actions, .topbar-actions { width: 100%; }
  .button { flex: 0 1 auto; }
  table { min-width: 840px; }
  .link-card { grid-template-columns: 1fr; }
  .sidebar { padding-inline: 16px; }
  .sidebar-foot { font-size: 11px; }
  .panel-head, .panel-body { padding: 16px; }
  .panel-actions { gap: 8px; }
  .panel-actions .button { flex: 1 1 auto; }
  .segmented.tabs { display: flex; flex-wrap: wrap; }
  .segmented.tabs button { flex: 1 1 calc(50% - 6px); min-width: 110px; }
  .reward-row { grid-template-columns: minmax(0, 1fr) minmax(70px, 100px) 38px; }
  .metric-card { min-height: 124px; padding: 16px; }
  .metric-card::before { left: 16px; }
  .metric-value { font-size: 28px; }
  .metric-label { font-size: 12px; }
  .app-backdrop::before { width: 560px; height: 560px; top: -180px; right: -240px; opacity: .05; }
  .app-backdrop::after { display: none; }
  .state-card { flex-direction: column; text-align: center; padding: 24px 20px; }
  .state-art { width: 140px; height: 140px; }
  .login-screen { justify-content: center; padding: 24px 16px; }
  .login-hero { background-position: 72% center; }
  .login-shade { background: linear-gradient(0deg, rgba(3, 10, 12, .8), rgba(3, 10, 12, .35)); }
  .login-array { left: 50%; width: 150vw; }
  .login-flash { background: radial-gradient(circle at 50% 50%, #f4fffb 0, rgba(159, 245, 224, .9) 18%, rgba(6, 16, 19, .96) 55%, #061013 80%); }
  .login-card .panel-body { padding: 24px 22px; }
  .login-title { font-size: 38px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .login-fx { display: none; }
}
