/* 曙光學習 — 島上平板殼（island-shell）
 * 用途：knowledge.html / node.html 等學習頁「獨立開啟」時，把頁面包進島嶼隨身平板的
 * 裝置框，讓直連開啟也有「在島上打開平板」的感覺。島內 iframe 內嵌時絕不啟用
 * （js/core/island-shell.js 自行判 window.self !== window.top，防雙框）。
 * 數值來源：島頁 pages/island-survival.html 的 #tabFrame / #tabScreen /
 * #tabWalletBadge / #tabWinBar 原始 CSS（逐項對照後移植，加 ish- 前綴避免撞站台 class）。
 * 尺寸（2026-11-08 使用者指示放大版）：框寬 min(96vw, 170vh)、高 95dvh；
 * 框外氛圍只剩一圈薄邊；內容主欄回到各頁原生 max-width。
 */

/* ---- 開機遮罩：殼 JS 載入前先藏內容，避免無框版面閃一幀（JS 失敗時 inline 計時器會自動解除） ---- */
html.ish-boot body > #topbar,
html.ish-boot body > main,
html.ish-boot body > .main,
html.ish-boot body > .gc-layout,
html.ish-boot body > .login-wrap,
html.ish-boot body > .ob-wrap,
html.ish-boot body > .editor-layout,
html.ish-boot body > header.lp-topbar,
html.ish-boot body > .editor-topbar { visibility: hidden; }

body.ish-on { overflow: hidden; }
body.ish-on .time-bg { display: none !important; } /* 站台時段圖書館背景讓位給殼氛圍 */

/* ============ 框外：島嶼氛圍（意象，非實機畫面；色盤跟 theme 時段 slot 走） ============ */
.ish-ambience { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none;
  background: linear-gradient(180deg, #0b1c33 0%, #0e2a44 34%, #123a54 58%, #0d2f45 100%); }
.ish-ambience .ish-sea { position: absolute; left: 0; right: 0; bottom: 0; height: 34%;
  background: linear-gradient(180deg, rgba(64,140,170,.20), rgba(10,30,50,.55));
  border-top: 1px solid rgba(160,210,235,.14); }
.ish-ambience .ish-sea::after { content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(180deg, transparent 0 13px, rgba(180,220,245,.045) 13px 14px); }
.ish-ambience .ish-isle { position: absolute; bottom: -4%; width: 560px; max-width: 60vw; opacity: .5;
  filter: blur(7px) brightness(.62) saturate(.85); }
.ish-ambience .ish-isle-l { left: -140px; }
.ish-ambience .ish-isle-r { right: -160px; bottom: -7%; width: 640px; opacity: .38; transform: scaleX(-1); }
.ish-ambience .ish-orb { position: absolute; top: 5%; right: 9%; width: 58px; height: 58px; border-radius: 50%;
  background: radial-gradient(circle at 42% 38%, #fff6d8, #f0d48a 58%, #dcb964);
  box-shadow: 0 0 54px 20px rgba(240,212,138,.26); opacity: .9; }
.ish-ambience .ish-stars { position: absolute; inset: 0 0 40% 0;
  background-image:
    radial-gradient(1.6px 1.6px at 12% 22%, rgba(255,255,255,.75), transparent 60%),
    radial-gradient(1.2px 1.2px at 28% 10%, rgba(255,255,255,.5), transparent 60%),
    radial-gradient(1.8px 1.8px at 46% 26%, rgba(255,255,255,.65), transparent 60%),
    radial-gradient(1.1px 1.1px at 61% 12%, rgba(255,255,255,.45), transparent 60%),
    radial-gradient(1.5px 1.5px at 88% 30%, rgba(255,255,255,.6), transparent 60%),
    radial-gradient(1.1px 1.1px at 5% 42%, rgba(255,255,255,.4), transparent 60%),
    radial-gradient(1.3px 1.3px at 70% 38%, rgba(255,255,255,.4), transparent 60%); }
.ish-ambience .ish-fog { position: absolute; left: -10%; right: -10%; bottom: 16%; height: 120px;
  background: radial-gradient(60% 100% at 50% 50%, rgba(190,220,240,.13), transparent 70%); filter: blur(6px); }
/* 氛圍頂光（各時段的主光源色暈） */
.ish-ambience::before { content: ""; position: absolute; inset: 0;
  background: radial-gradient(1100px 480px at 78% -8%, rgba(240,200,110,.20), transparent 60%); }

/* ---- 時段變體（data-slot 由殼 JS 依 theme.js 相同的時段邊界設定，並跟 dawn:slot 事件同步） ---- */
.ish-ambience[data-slot="dawn"] { background: linear-gradient(180deg, #2c2a4a 0%, #6b4a63 30%, #c97e5d 58%, #7a5348 100%); }
.ish-ambience[data-slot="dawn"]::before { background: radial-gradient(1100px 520px at 76% -6%, rgba(255,190,120,.38), transparent 60%); }
.ish-ambience[data-slot="dawn"] .ish-orb { background: radial-gradient(circle at 42% 38%, #fff3d0, #ffc98a 58%, #f09a5a); box-shadow: 0 0 54px 22px rgba(255,170,100,.32); }
.ish-ambience[data-slot="dawn"] .ish-stars { opacity: .25; }
.ish-ambience[data-slot="dawn"] .ish-isle { filter: blur(7px) brightness(.55) saturate(.9); }
.ish-ambience[data-slot="morning"],
.ish-ambience[data-slot="noon"],
.ish-ambience[data-slot="afternoon"] { background: linear-gradient(180deg, #7fb2dd 0%, #a8cbe8 32%, #c3dcee 56%, #8fb8cf 100%); }
.ish-ambience[data-slot="morning"]::before,
.ish-ambience[data-slot="noon"]::before,
.ish-ambience[data-slot="afternoon"]::before { background: radial-gradient(1100px 520px at 78% -8%, rgba(255,236,170,.45), transparent 60%); }
.ish-ambience[data-slot="morning"] .ish-orb,
.ish-ambience[data-slot="noon"] .ish-orb,
.ish-ambience[data-slot="afternoon"] .ish-orb { background: radial-gradient(circle at 42% 38%, #fffbe8, #ffe9a0 58%, #f7cf5e); box-shadow: 0 0 60px 24px rgba(255,230,150,.45); }
.ish-ambience[data-slot="morning"] .ish-stars,
.ish-ambience[data-slot="noon"] .ish-stars,
.ish-ambience[data-slot="afternoon"] .ish-stars { opacity: 0; }
.ish-ambience[data-slot="morning"] .ish-sea,
.ish-ambience[data-slot="noon"] .ish-sea,
.ish-ambience[data-slot="afternoon"] .ish-sea { background: linear-gradient(180deg, rgba(120,180,210,.35), rgba(50,100,140,.4)); border-top-color: rgba(255,255,255,.35); }
.ish-ambience[data-slot="morning"] .ish-isle,
.ish-ambience[data-slot="noon"] .ish-isle,
.ish-ambience[data-slot="afternoon"] .ish-isle { filter: blur(7px) brightness(.88) saturate(.95); opacity: .45; }
.ish-ambience[data-slot="afternoon"] { background: linear-gradient(180deg, #6f9fd2 0%, #a3c3e2 32%, #d9c9a8 58%, #7ba3bd 100%); }
.ish-ambience[data-slot="dusk"] { background: linear-gradient(180deg, #1f2145 0%, #4b3560 30%, #a85f4e 56%, #54383d 100%); }
.ish-ambience[data-slot="dusk"]::before { background: radial-gradient(1100px 520px at 76% -4%, rgba(255,150,90,.36), transparent 60%); }
.ish-ambience[data-slot="dusk"] .ish-orb { background: radial-gradient(circle at 42% 38%, #ffe9c4, #ffb066 58%, #e2703a); box-shadow: 0 0 54px 22px rgba(255,140,80,.34); }
.ish-ambience[data-slot="dusk"] .ish-stars { opacity: .4; }
.ish-ambience[data-slot="dusk"] .ish-isle { filter: blur(7px) brightness(.5) saturate(.9); }

/* ============ 舞台與平板框（移植島頁 #tabFrame） ============ */
.ish-stage { position: fixed; inset: 0; z-index: 1; display: grid; place-items: center; pointer-events: none; }
.ish-frame { pointer-events: auto; position: relative; display: flex; flex-direction: column;
  width: min(96vw, 170vh); height: 95vh; height: 95dvh;
  background: linear-gradient(180deg, #4a4f57, #26292f);
  border-radius: 30px; padding: 16px 16px 20px;
  box-shadow: 0 24px 60px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.3); }
/* 下巴刻字（借島頁 PC 框 #pcFrame::after 的品牌刻字語言） */
.ish-frame::after { content: "曙光學習 · 隨身平板"; position: absolute; left: 0; right: 0; bottom: 2px;
  text-align: center; font-size: 10px; letter-spacing: .22em; color: #838b95; pointer-events: none; }

/* 螢幕（移植島頁 #tabScreen） */
.ish-screen { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative;
  background: linear-gradient(160deg, #1d2f47, #101c2e); border-radius: 16px; overflow: hidden; }

/* ---- 裝置狀態列（時段＋真時鐘＋星砂；不放假電量） ---- */
.ish-status { flex: none; display: flex; align-items: center; gap: 10px;
  padding: 8px 14px 6px; font-size: 12px; color: #9db8d8; font-weight: 700; font-variant-numeric: tabular-nums; }
.ish-status .ish-phase { display: inline-flex; align-items: center; gap: 5px; }
.ish-status .ish-clock { color: #eaf2ff; font-size: 12.5px; }
.ish-status .ish-spacer { flex: 1; }

/* 星砂膠囊（移植島頁 #tabWalletBadge，含星星粒子） */
.ish-wallet { position: relative; display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 13px; border-radius: 999px; min-width: 104px; justify-content: center; overflow: hidden;
  background: rgba(253,243,218,.95); border: 1.5px solid #e8a33d; color: #5f3a08;
  font-weight: 800; font-size: 13.5px; box-shadow: 0 3px 10px rgba(30,20,5,.35); font-variant-numeric: tabular-nums; }
.ish-wallet .ish-wstars { position: absolute; inset: 0; pointer-events: none; }
.ish-wallet .ish-wstars i { position: absolute; display: block; opacity: .3;
  background: radial-gradient(circle, #ffe9a8 0%, #f2b64f 55%, #dd9422 100%);
  clip-path: polygon(50% 0%, 63% 37%, 100% 50%, 63% 63%, 50% 100%, 37% 63%, 0% 50%, 37% 37%); }
.ish-wallet .ish-wstars i:nth-child(1) { left: 10%; top: 56%; width: 8px; height: 8px; }
.ish-wallet .ish-wstars i:nth-child(2) { left: 26%; top: 20%; width: 5.5px; height: 5.5px; }
.ish-wallet .ish-wstars i:nth-child(3) { left: 44%; top: 64%; width: 9px; height: 9px; }
.ish-wallet .ish-wstars i:nth-child(4) { left: 63%; top: 24%; width: 5px; height: 5px; }
.ish-wallet .ish-wstars i:nth-child(5) { left: 80%; top: 58%; width: 7px; height: 7px; }
.ish-wallet .ish-wallet-txt { position: relative; z-index: 1; }

/* ---- 視窗列（移植島頁 #tabWinBar） ---- */
.ish-winbar { flex: none; display: flex; align-items: center; gap: 10px;
  background: rgba(8,14,24,.68); color: #eaf2ff; padding: 8px 12px; font-size: 13.5px; font-weight: 800; }
.ish-winbar .ish-home-btn { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.25); color: #fff;
  border-radius: 8px; font-size: 12.5px; font-weight: 700; padding: 5px 10px; text-decoration: none; flex: none; }
.ish-winbar .ish-title { flex: 1; text-align: center; letter-spacing: .06em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 回島嶼：實體感暖金鈕（按下沉） */
.ish-winbar .ish-island-btn { flex: none; display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 900; color: #5f3a08; text-decoration: none;
  background: linear-gradient(180deg, #fdf3da, #f3dfae); border: 1.5px solid #c99b4a; border-radius: 999px;
  padding: 6px 14px; box-shadow: 0 3px 0 #a87f4f, 0 5px 10px rgba(0,0,0,.35); }
.ish-winbar .ish-island-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #a87f4f, 0 3px 6px rgba(0,0,0,.3); }
.ish-winbar .ish-close-btn { width: 28px; height: 28px; border-radius: 8px; border: 1px solid rgba(255,255,255,.25);
  background: rgba(255,255,255,.08); color: #fff; font-size: 13px; cursor: pointer; flex: none; font-family: inherit; }
/* 圓盤功能收編（ORBNAV・2026-11-15）：視窗列工具鈕組——深淺色／聊天／靈獸，
   規格比照關閉鈕；靈獸鈕圓形金邊（呼應圓盤上的靈獸鈕）；聊天未讀紅點同 ui.js 規格 */
.ish-winbar .ish-utils { flex: none; display: inline-flex; align-items: center; gap: 6px; }
.ish-winbar .ish-util-btn { position: relative; width: 28px; height: 28px; border-radius: 8px; border: 1px solid rgba(255,255,255,.25);
  background: rgba(255,255,255,.08); color: #fff; font-size: 14px; cursor: pointer; flex: none; font-family: inherit;
  display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.ish-winbar .ish-util-btn:hover { background: rgba(255,255,255,.16); }
.ish-winbar .ish-util-btn .ico-svg { width: 16px; height: 16px; }
.ish-winbar .ish-pet-btn { border-radius: 50%; border-color: #c99b4a; overflow: hidden; }
.ish-winbar .ish-pet-btn img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ish-winbar .ish-util-btn.has-unread::after { content: ""; position: absolute; top: 2px; right: 2px; width: 9px; height: 9px;
  border-radius: 50%; background: #ef4444; box-shadow: 0 0 0 2px rgba(0,0,0,.35); }
.ish-winbar .ish-util-btn[aria-expanded="true"] { background: rgba(255,255,255,.22); border-color: #c99b4a; }

/* ---- SETHUB：Quick Settings Popover（齒輪鈕下拉；深淺色／語言／站台字體，寫與設定中心同一批正本） ---- */
.ish-quick { position: absolute; top: 86px; right: 12px; z-index: 40; width: 302px; max-width: calc(100vw - 24px);
  background: rgba(9,15,27,.97); border: 1px solid rgba(255,255,255,.18); border-radius: 14px;
  padding: 13px 16px 15px; color: #eaf2ff; box-shadow: 0 18px 44px rgba(0,0,0,.55); font-size: 13px; }
.ish-quick[hidden] { display: none; }
.ish-quick-title { font-weight: 900; font-size: 13.5px; letter-spacing: .08em; margin-bottom: 2px; }
.ish-quick-row { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 0; border-bottom: 1px dashed rgba(255,255,255,.12); }
.ish-quick-lab { flex: none; font-weight: 700; }
.ish-seg { display: inline-flex; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.16);
  border-radius: 999px; padding: 2px; flex: none; }
.ish-seg button { border: none; background: transparent; color: #b9c9de; font: inherit; font-size: 12.5px;
  padding: 5px 11px; border-radius: 999px; cursor: pointer; }
.ish-seg button.on { background: #c99b4a; color: #241a05; font-weight: 800; }
.ish-quick select { background: rgba(255,255,255,.07); color: #eaf2ff; border: 1px solid rgba(255,255,255,.16);
  border-radius: 8px; padding: 6px 8px; font: inherit; font-size: 13px; max-width: 150px; }
.ish-quick-open { display: block; margin-top: 12px; text-align: center; text-decoration: none;
  font-size: 13px; font-weight: 900; color: #5f3a08;
  background: linear-gradient(180deg, #fdf3da, #f3dfae); border: 1.5px solid #c99b4a; border-radius: 999px;
  padding: 8px 14px; box-shadow: 0 3px 0 #a87f4f, 0 5px 10px rgba(0,0,0,.35); }
.ish-quick-open:active { transform: translateY(2px); box-shadow: 0 1px 0 #a87f4f, 0 3px 6px rgba(0,0,0,.3); }
@media (max-width: 640px) { .ish-quick { top: 76px; right: 8px; } }

/* ---- 內容捲動區：問候列（#topbar）與主內容（main）都住在這裡 ---- */
.ish-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; position: relative;
  scrollbar-width: thin; scrollbar-color: rgba(232,163,61,.5) transparent; }
.ish-body::-webkit-scrollbar { width: 8px; }
.ish-body::-webkit-scrollbar-thumb { background: rgba(232,163,61,.45); border-radius: 99px; }
/* 淺色主題（白天時段）時螢幕內改暖紙色，避免深色字落在深藍螢幕上讀不到（顯示紅線） */
html[data-theme="light"] .ish-body { background: linear-gradient(168deg, #f8f3e8, #efe7d5); }

/* 意象標示晶片：貼在框下方的氛圍薄邊上 */
.ish-note { position: fixed; left: 50%; transform: translateX(-50%); bottom: 3px; z-index: 3; pointer-events: none;
  font-size: 10.5px; color: rgba(225,238,252,.8); background: rgba(8,16,28,.5);
  border: 1px solid rgba(255,255,255,.16); border-radius: 999px; padding: 3px 11px; white-space: nowrap; }

/* ============ 手機版：框全幅化，只留狀態列＋視窗列（mock 判斷，尺寸案不變） ============ */
@media (max-width: 640px) {
  .ish-frame { width: 100vw; height: 100dvh; border-radius: 0; padding: 0; box-shadow: none; background: #101c2e; }
  .ish-frame::after { display: none; }
  .ish-screen { border-radius: 0; }
  .ish-ambience .ish-isle, .ish-ambience .ish-orb { display: none; }
  .ish-note { display: none; }
  .ish-wallet { min-width: 0; padding: 4px 10px; font-size: 12.5px; }
  .ish-winbar { gap: 6px; padding: 7px 8px; }
  .ish-winbar .ish-home-btn { padding: 5px 8px; font-size: 11.5px; }
  .ish-winbar .ish-title { font-size: 12.5px; }
  .ish-winbar .ish-island-btn { padding: 5px 10px; font-size: 11.5px; }
  .ish-winbar .ish-utils { gap: 4px; }
  .ish-winbar .ish-util-btn { width: 26px; height: 26px; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  .ish-winbar .ish-island-btn:active { transform: none; }
}
/* 殼模式導覽收合（使用者 2026-11-08 親定）：圓盤與左欄收起來，不與平板框重疊；
   殼關閉（body 移除 .ish-on）後自動恢復。手機 dock 未在指示內，維持現行。 */
body.ish-on #sector-nav,
body.ish-on #nav-collapse-arrow,
body.ish-on #tb-sidebar,
body.ish-on #tb-sidebar-panel { display: none !important; }

/* login 頁主題切換鈕（shell2 全站推廣）：它以 viewport fixed 定位，殼模式下原位
   會壓在框右上角的星砂膠囊上；改停到螢幕內右下角，功能不變。 */
body.ish-on .login-theme-toggle { top: auto; bottom: 42px; right: 44px; }
@media (max-width: 640px) {
  body.ish-on .login-theme-toggle { bottom: 20px; right: 16px; }
}

/* ===== 全站統一捲軸（SCROLLBAR・2026-11-14）：與 css/tokens.css 同規格——只載本表的頁（如 island-chat）也吃得到 ===== */
* { scrollbar-width: thin; scrollbar-color: rgba(180, 140, 80, 0.5) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: rgba(180, 140, 80, 0.45); border-radius: 99px; }
*::-webkit-scrollbar-thumb:hover { background: rgba(180, 140, 80, 0.68); }
*::-webkit-scrollbar-button { display: none; }
