/* 伺服器經濟（開發部檔，js/18z-server-store.js）：等伺服器回應時的遮罩，與購買魔王幣的確認視窗。 */
/* 層級：作者的 #metaDialog 之上、帳號面板（.tw-account-overlay 120）之上，遮罩最上面——等回應時什麼都不能按。 */
.tw-eco-overlay {
  position: fixed; inset: 0; z-index: 140; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: #070b1366; color: #f0e8d4; font-size: 13px; letter-spacing: .04em;
}
.tw-eco-overlay[hidden] { display: none; }
.tw-eco-spinner {
  width: 34px; height: 34px; border-radius: 50%; border: 3px solid #f0e8d433; border-top-color: #e3c181;
  animation: tw-eco-spin .8s linear infinite;
}
@keyframes tw-eco-spin { to { transform: rotate(360deg); } }

.tw-eco-dialog {
  position: fixed; inset: 0; z-index: 130; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: #070b13bd;
}
.tw-eco-dialog[hidden] { display: none; }
.tw-eco-sheet {
  width: min(460px, 94vw); max-height: 90dvh; overflow: auto; overscroll-behavior: contain;
  border: 1px solid #797285; border-radius: 15px; background: #242734; color: #f0e8d4; padding: 20px 22px;
  box-shadow: 0 20px 100px #0007; font-size: 13px; line-height: 1.7;
}
.tw-eco-sheet h2 { font-size: 20px; margin: 0 0 8px; }
.tw-eco-sheet p { margin: 4px 0; color: #c2bdc9; font-size: 12px; }
.tw-eco-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 16px; }
.tw-eco-actions button { font-size: 12px; padding: 8px 14px; }
.tw-eco-actions button.quiet { opacity: .75; }

/* 任務頁（線上時接管作者「任務尚未開放」那塊；Core/Quest） */
.tw-quests { display: flex; flex-direction: column; gap: 8px; width:100%;height:100%;margin:0; text-align: left; }
.tw-quests h3 { font-size: 14px; color: #e3c181; margin: 6px 0 0; }
.tw-quest-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; border-radius: 10px; background: #34262b; border: 1px solid #8c634c; font-size: 12px; }
.tw-quest-row.done { border-color: #acd9ba66; }
.tw-quest-row > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tw-quest-row b { font-size: 13px; color: #f0e8d4; }
.tw-quest-row small { color: #a5a6ad; }
.tw-quest-row .tw-quest-meta { display: flex; gap: 10px; align-items: center; flex-shrink: 0; }
.tw-quest-row .tw-quest-reward { color: #ffd77c; white-space: nowrap; }
.tw-quest-row button { font-size: 12px; padding: 6px 12px; white-space: nowrap; }
.tw-quest-row button:disabled { opacity: .45; }
.tw-quests .tw-quest-note { color: #a5a6ad; font-size: 11px; margin: 4px 0 0; }
/* 通行證（伺服器版）：沿用作者 .pass-title13／.pass-level13 的外觀，只補進度條與領取鈕 */
.tw-pass-actions { display: flex; flex-direction: row; gap: 6px; align-items: stretch; }
.tw-pass-actions button { font-size: 12px; white-space: normal; justify-content: center; min-width: 0; }
.tw-pass-bar { display: flex; align-items: center; gap: 8px; padding: 0; font-size: 12px; color: #efd296; }
.tw-pass-bar .tw-pass-track { flex: 1; height: 10px; border-radius: 6px; background: #2d233d; border: 1px solid #735272; overflow: hidden; }
.tw-pass-bar .tw-pass-fill { height: 100%; background: linear-gradient(90deg, #b367e9, #ecc778); transition: width .3s; }
.pass-level13 .tw-pass-free-btn { font-size: 9px; padding: 5px; }
@media(max-height:560px) and (min-aspect-ratio:1/1) { .tw-pass-actions button { font-size: 11px; min-width: 0; padding: 7px; } .tw-pass-bar { padding: 0; font-size: 11px; } }
.pass-level13 .tw-pass-glyph { font-size: 30px; line-height: 1; color: #ecc778; }
.pass-level13 .tw-pass-glyph.cosmetic { color: #dc8bff; }
.pass-level13 .tw-pass-glyph.projectileTokens { color: #8bddfa; }
/* Full-height reward tracks now scroll horizontally only; keep the original safe padding around server controls. */
#meta .pass-scroll13 { touch-action: pan-x; }
#meta .meta-body.pass-body15 > .pass-title13, #meta .meta-body.pass-body15 > .pass-controls13, #meta .meta-body.pass-body15 > .pass-message13 { padding-right:0;box-sizing:border-box; }
/* 任務卡右欄：獎勵在上、按鈕在下，都靠右、按鈕固定寬（10-07：「全部完成加碼」獎勵字比較長，按鈕置中在下面就歪了） */
.tw-quest-row .tw-quest-meta { flex-direction: column; align-items: flex-end; gap: 6px; }
.tw-quest-row button { min-width: 96px; text-align: center; justify-content: center; }
/* 紅點：有完成未領的任務／通行證（18z twEcoBadgeTick） */
.tw-dot { position: relative; }
.tw-dot::after { content: ''; position: absolute; top: -4px; right: -4px; width: 11px; height: 11px; border-radius: 50%; background: #ff4d4f; box-shadow: 0 0 0 2px #1d1a29; pointer-events: none; z-index: 2; }

/* 正式 build 開機探不到後端（offline 模式，掃描表 A2）：大廳頂端的離線條，局內不顯示；在作者的 #toast（z 55）之下、不蓋對話框 */
.tw-eco-offline {
  position: fixed; top: calc(env(safe-area-inset-top, 0px) + 10px); right: calc(env(safe-area-inset-right, 0px) + 60px); z-index: 50;   /* 大廳右上、齒輪左邊：那段是空的，不壓到左上的體力／魔王幣 */
  max-width: min(46vw, 420px); padding: 6px 14px; border-radius: 999px; background: #3a1d1dd9; color: #f5d9c8; font-size: 12px; letter-spacing: .04em;
  pointer-events: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tw-eco-offline[hidden] { display: none; }

/* 開機同步餘額期間（mode syncing，掃描表 B2）：作者的開始鈕變暗、右下角補一行「同步中…」（文字來自 data/server-store.json 的 startSyncing，18z 寫進 data 屬性） */
#menu [data-r15="start"].tw-syncing, #menu [data-r15="coop-start"].tw-syncing { opacity: .55; position: relative; }
#menu .tw-syncing::after { content: attr(data-tw-syncing); position: absolute; right: 12px; bottom: 4px; font-size: 11px; letter-spacing: .06em; opacity: .9; }
