/* 網頁共用外殼（今日、設定、更新紀錄、說明、訂閱與付款、訂單查詢）：顏色、頂列、內容欄。頂列由 web.js 的 siteTop() 產生 */
:root {
  --bg: #f4ecda;
  --surface: #fcf7eb;
  --surface-subtle: #f7f0e0;
  --line: rgba(122, 90, 18, 0.22);
  --line-strong: rgba(122, 90, 18, 0.5);
  --divider: rgba(122, 90, 18, 0.13);
  --text: #2a2418;
  --muted: #655a44;
  --primary: #7a5a12;
  --primary-ink: #fcf7eb;
  --ripple: rgba(122, 90, 18, 0.12);
  --ok: #3f8a4a;
  --wait: #c48a1a;
  --bad: #b8432f;
  --idle: #8a7f72;
  --sans: 'Microsoft JhengHei', 'PingFang TC', 'Noto Sans TC', sans-serif;
  /* 內容欄寬與頂列高度：每頁一樣，換頁不跳 */
  --col: 960px;
  --top-h: 56px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0a08;
    --surface: #15130e;
    --surface-subtle: #1b1812;
    --line: rgba(232, 200, 120, 0.18);
    --line-strong: rgba(232, 200, 120, 0.4);
    --divider: rgba(232, 200, 120, 0.1);
    --text: #ece3cf;
    --muted: #a99d84;
    --primary: #d9b96a;
    --primary-ink: #15130e;
    --ripple: rgba(217, 185, 106, 0.14);
    --ok: #6cbf78;
    --wait: #e2a33a;
    --bad: #e07a66;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { scrollbar-gutter: stable; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--sans); }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* 頂列：寬螢幕一列（標題、分頁、角色與帳號），窄螢幕分頁換到第二列 */
.top { position: sticky; top: 0; z-index: 10; background: var(--bg); border-bottom: 1px solid var(--divider); padding-top: env(safe-area-inset-top); }
.top .bar { width: min(var(--col), 100%); height: var(--top-h); margin: 0 auto; padding: 0 12px; display: flex; align-items: center; gap: 0 8px; }
.top .brand { flex: none; display: inline-flex; align-items: center; gap: 8px; height: 40px; margin-right: 8px; color: var(--text); font-size: 16px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.top .brand img { width: 24px; height: 24px; }
.top .sitenav { flex: 1; min-width: 0; align-self: stretch; display: flex; gap: 0; font-size: 15px; overflow-x: auto; scrollbar-width: none; }
.top .sitenav::-webkit-scrollbar { display: none; }
.top .tab { position: relative; flex: none; display: inline-flex; align-items: center; padding: 0 12px; color: var(--muted); font-weight: 500; text-decoration: none; white-space: nowrap; }
.top .tab:hover { color: var(--text); }
.top .tab.on { color: var(--text); }
.top .tab.on::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: 0; height: 3px; border-radius: 2px; background: var(--primary); }
.top svg { width: 22px; height: 22px; }
.top .me-slot { flex: none; display: flex; align-items: center; gap: 2px; margin-left: auto; }
.top .signin { display: none; }
.guest .top .tab:not([data-public]) { display: none; }
.guest .top .signin { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line-strong); color: var(--primary); font-size: 14px; font-weight: 600; text-decoration: none; }
.guest .top .signin:hover { background: var(--ripple); }

/* 內容欄：每頁同寬、置中 */
.page { width: min(var(--col), 100%); margin: 0 auto; padding: 12px 12px 16px; }

@media (max-width: 759px) {
  :root { --top-h: 96px; }
  .top .bar { flex-wrap: wrap; align-content: flex-start; }
  .top .brand { height: 52px; margin-right: 0; }
  .top .me-slot { height: 52px; }
  .top .sitenav { order: 3; flex: 0 0 calc(100% + 24px); height: 44px; margin: 0 -12px; padding: 0 2px; }
}

/* 角色下拉與帳號選單 */
.drop { position: relative; }
.menu-btn { height: 40px; display: inline-flex; align-items: center; gap: 6px; padding: 0 6px 0 10px; border: 0; border-radius: 10px; background: none; color: var(--text); }
.menu-btn:hover, .menu-btn[aria-expanded='true'] { background: var(--ripple); }
.menu-btn .name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: 15px; }
.top .menu-btn .caret { width: 18px; height: 18px; color: var(--muted); }
.menu { position: absolute; z-index: 20; top: calc(100% + 6px); right: 0; min-width: 260px; max-width: calc(100vw - 16px); padding: 6px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 12px 32px -12px rgba(42, 36, 24, 0.35); display: grid; gap: 2px; font-size: 14px; line-height: 1.5; }
.menu .item { min-height: 44px; display: flex; align-items: center; gap: 10px; padding: 6px 10px; border: 0; border-radius: 10px; background: none; color: var(--text); text-align: left; text-decoration: none; font-size: 14px; }
.menu .item:hover { background: var(--ripple); }
.menu .item .texts { flex: 1; display: grid; min-width: 0; }
.menu .item small { color: var(--muted); font-size: 12px; white-space: nowrap; }
.top .menu .check { width: 18px; height: 18px; color: var(--primary); }
.menu .pick-row { display: flex; align-items: center; }
.menu .pick-row .item { flex: 1; min-width: 0; }
.menu .renew { flex: none; display: inline-flex; align-items: center; min-height: 44px; padding: 0 10px; border-radius: 10px; color: var(--primary); font-size: 13px; text-decoration: none; }
.menu .renew:hover { background: var(--ripple); }
.menu .item.new-char { border-top: 1px solid var(--divider); border-radius: 0 0 10px 10px; color: var(--primary); }
.menu .plus { width: 8px; text-align: center; }
.menu .who { padding: 8px 10px; color: var(--muted); font-size: 13px; border-bottom: 1px solid var(--divider); margin-bottom: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--idle); }
.dot.ok, .dot.online { background: var(--ok); }
.dot.running, .dot.wait { background: var(--wait); }
.dot.bad { background: var(--bad); }
@media (max-width: 520px) {
  .menu-btn .name { max-width: 96px; }
}

/* 提示 */
.toast { position: fixed; z-index: 30; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 12px); max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 12px; background: #2a2418; color: #fcf7eb; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity 0.18s, transform 0.18s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
