/* 桃源秘境（2026-10-03.9，js/realm.js、js/realm-alert.js）：由 index.html 在 rift.css 後面載入
   桃花粉＋傳送門紫；狀態：平穩（綠）、騷動（黃）、危險（橘）、失控（紅）；羊皮紙（淺色）＋夜戰；手機一欄、電腦兩欄，不能橫向捲動
   結果面板（openSheet）是掛在 body 底下的，所以顏色變數也放在 .rl-sheet 上 */
.realm-page, .rl-sheet {
  --rl: #c2457a; --rl-2: #7a4fd0; --rl-ink: #8a2556; --rl-soft: rgba(194, 69, 122, 0.08); --rl-line: rgba(194, 69, 122, 0.36);
  --rl-calm: #2e8a57; --rl-stir: #b88a10; --rl-danger: #d2641f; --rl-breach: #c0392b;
}
:root[data-theme="night"] .realm-page, :root[data-theme="night"] .rl-sheet {
  --rl: #ff8ab8; --rl-2: #b48cff; --rl-ink: #ffc0da; --rl-soft: rgba(255, 138, 184, 0.1); --rl-line: rgba(255, 138, 184, 0.4);
  --rl-calm: #5fd07a; --rl-stir: #f0c040; --rl-danger: #ff9a4a; --rl-breach: #ff6a5a;
}
.realm-page .card h2::before { background: var(--rl); }
.rl-st-calm { --st: var(--rl-calm); }
.rl-st-stir { --st: var(--rl-stir); }
.rl-st-danger { --st: var(--rl-danger); }
.rl-st-breach { --st: var(--rl-breach); }

/* 版面：手機一欄（傳送門 → 作戰 → 守門人 → 隊伍 → 最近的事 → 排行 → 說明）；電腦兩欄 */
.rl-gate { order: 1; }
.rl-stage { order: 2; }
.rl-sta { order: 3; }
.rl-party { order: 4; }
.rl-events { order: 5; }
.rl-top { order: 6; }
.rl-info { order: 7; }

/* 傳送門：狀態牌子、累積量的條 */
.rl-stage-tag { font-size: 13px; font-weight: 800; padding: 2px 10px; border-radius: 999px; color: #fff; background: var(--st); white-space: nowrap; }
.rl-gauge { position: relative; height: 22px; margin: 8px 0 6px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line-2); overflow: hidden; }
.rl-gauge-fill { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: linear-gradient(90deg, color-mix(in srgb, var(--st) 55%, #fff), var(--st));
  transition: width 0.6s ease; }
.rl-st-breach .rl-gauge-fill { animation: rl-pulse 1.4s ease-in-out infinite; }
.rl-gauge-mark { position: absolute; top: 0; bottom: 0; width: 2px; background: rgba(0, 0, 0, 0.35); }
.rl-gauge-mark.cap { width: 3px; background: var(--rl-breach); }
.rl-gauge-txt { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-size: 12.5px; color: var(--text); text-shadow: 0 0 3px var(--surface); }
.rl-gauge-txt b { font-size: 14px; }
.rl-load { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 4px 0; }
.rl-tip { margin: 4px 0 8px; }
.rl-breach { margin: 8px 0; padding: 9px 12px; border-radius: 10px; border: 2px solid var(--rl-breach); background: color-mix(in srgb, var(--rl-breach) 10%, var(--surface)); }
.rl-breach > b { color: var(--rl-breach); font-size: 15px; }
.rl-breach p { margin: 4px 0; }
.rl-fx { margin: 4px 0 0; padding-left: 18px; columns: 2 220px; column-gap: 18px; }
.rl-fx li { break-inside: avoid; }
.rl-siege { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-top: 8px; padding: 8px 12px; border-radius: 10px; background: var(--rl-soft); border: 1px dashed var(--rl-line); }
.rl-siege.on { border-style: solid; border-color: var(--rl-2); background: color-mix(in srgb, var(--rl-2) 10%, var(--surface)); }
.rl-siege-n { font-size: 18px; color: var(--rl-2); }
@keyframes rl-pulse { 50% { filter: brightness(1.25); } }

/* 作戰：三波、按鈕 */
.rl-waves { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 8px 0 4px; }
.rl-wave { display: flex; flex-direction: column; gap: 2px; padding: 6px 8px; border-radius: 9px; background: var(--rl-soft); border: 1px solid var(--rl-line); min-width: 0; }
.rl-wave.elite { border-color: var(--rl-2); background: color-mix(in srgb, var(--rl-2) 9%, var(--surface)); }
.rl-wave.inv { border-color: var(--rl-breach); background: color-mix(in srgb, var(--rl-breach) 8%, var(--surface)); }
.rl-wave b { font-size: 13px; color: var(--rl-ink); }
.rl-rule { margin: 4px 0 8px; }
.rl-acts { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }
.rl-acts .btn { flex: 1 1 180px; }
.btn.rl-go-gate { background: linear-gradient(180deg, #e0507a, #a82852); border-color: #7a1a3a; color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 220, 230, 0.35), 0 3px 0 #5c1330; }
.btn.rl-go-gate:disabled { filter: grayscale(0.7); opacity: 0.6; }
.btn.rl-go-gate.hot:not(:disabled) { animation: rf-wb-pulse 1.8s ease-in-out infinite; }
:root[data-theme="night"] .btn.rl-go-gate { background: linear-gradient(180deg, #ff6a92, #c8325a); border-color: #a02848; box-shadow: 0 3px 0 #6a1a30; }
.rl-allies { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 8px 0 0; }
.rl-ally { display: inline-flex; align-items: center; gap: 2px; }
.rl-ally svg, .rl-ally canvas, .rl-ally img { width: 22px; height: auto; }

/* 守門人 */
.rl-sta-cur { display: flex; align-items: center; gap: 10px; margin: 8px 0; padding: 8px 10px; border-radius: 10px; background: var(--rl-soft); border: 1px solid var(--rl-line); }
.rl-sta-cur > div { flex: 1; min-width: 0; }
.rl-sta-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; margin-top: 6px; }
.rl-sta-hero { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 4px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--surface);
  cursor: pointer; font: inherit; color: var(--text); min-width: 0; }
.rl-sta-hero span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rl-sta-hero:hover:not(:disabled) { border-color: var(--rl); }
.rl-sta-hero.on { border: 2px solid var(--rl); background: var(--rl-soft); }

/* 最近的事 */
.rl-ev-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.rl-ev { padding: 6px 10px; border-radius: 9px; border-left: 3px solid var(--rl-line); background: var(--surface-2); }
.rl-ev.held, .rl-ev.calm { border-left-color: var(--rl-calm); }
.rl-ev.broke { border-left-color: var(--rl-danger); }
.rl-ev.on { border-left-color: var(--rl-2); }

/* 結果面板 */
.rl-shares { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.rl-share { padding: 1px 8px; border-radius: 999px; background: var(--rl-soft); border: 1px solid var(--rl-line); }

/* 全站的警示列（快要失控、失控）：頁首下面一條，點了去 #/realm */
.realm-bar { display: flex; align-items: center; gap: 6px; margin: 0 auto; max-width: 1200px; padding: 6px 10px; }
.realm-bar[hidden] { display: none; }
.realm-bar-main { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; padding: 7px 12px; border-radius: 10px;
  color: #fff; text-decoration: none; font-size: 13.5px; line-height: 1.45; }
.realm-bar.breach .realm-bar-main { background: linear-gradient(90deg, #a8281c, #c8442a); box-shadow: 0 0 0 2px rgba(255, 120, 90, 0.5); animation: rl-pulse 1.6s ease-in-out infinite; }
.realm-bar.danger .realm-bar-main { background: linear-gradient(90deg, #b8560f, #d27a1f); }
.realm-bar-main b { font-size: 14px; }
.realm-bar-go { margin-left: auto; font-weight: 800; white-space: nowrap; text-decoration: underline; }
.realm-bar-x { flex: none; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--surface); color: var(--muted); font-size: 18px; cursor: pointer; }
@media (prefers-reduced-motion: reduce) {
  .rl-st-breach .rl-gauge-fill, .realm-bar.breach .realm-bar-main, .btn.rl-go-gate.hot:not(:disabled) { animation: none; }
}
