/* c10 彩蛋：琥珀 OS（覆蓋層）＋養成琥珀（桌面寵物）。
   入口：點封面期數條碼 NO.0626／連點頁尾「© 2026 村正琥珀」5 下／在鍵盤上打 0626。
   視窗外觀沿用 c12 琥珀 OS（白視窗、深藍標題列、圖示磚），顏色只用 c10 角色表裡的色：
   夜 #111830、藍 #25316D、代表色 #9ED1ED（桌布＝這是村正琥珀的桌面）、ink #141B33、sub #4E587A、線 #DCE2EB、白。
   桌面上的琥珀用他本人的 v3e 全身動畫（正常比例），不另外畫人。 */

/* ---------- 入口提示：條碼每隔幾秒有一道掃描光（減少動態時不動） ---------- */
.c-issue { overflow: hidden; }
.c-issue::after { content: ""; position: absolute; top: 0; bottom: 0; left: -30%; width: 22%; background: linear-gradient(90deg, transparent, rgba(255,255,255,.75), transparent); transform: skewX(-12deg); animation: egg-scan 7s ease-in-out 3s infinite; pointer-events: none; }
@keyframes egg-scan { 0%, 82% { left: -30%; } 100% { left: 115%; } }

/* ---------- 覆蓋層 ---------- */
.kos { position: fixed; inset: 0; z-index: 200; overflow: hidden; color: #141B33; font: 400 18px/1.8 "Noto Sans TC", system-ui, sans-serif; --kbar: 56px; }
.kos[hidden] { display: none; }
/* r1：預設桌布只用角色表的兩色（代表色＋藍地板），不再有表外的漸層色；拿掉半透明標準字浮水印（工作列已有原色標準字） */
.kos-wall { position: absolute; inset: 0 0 var(--kbar) 0; background: linear-gradient(180deg, #9ED1ED 0 calc(100% - 150px), #25316D calc(100% - 150px) 100%); transition: background .4s; }
.kos[data-wall="night"] .kos-wall { background: linear-gradient(180deg, #111830 0%, #25316D 78%, #9ED1ED 78.4%, #9ED1ED 79%, #25316D 79.4%); }
.kos[data-wall="landing"] .kos-wall { background: radial-gradient(circle at 78% 22%, #25316D 0 9%, transparent 9.2%), linear-gradient(180deg, #25316D 0%, #111830 100%); }
.kos .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.kos button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; }
.kos :focus-visible { outline: 3px solid #25316D; outline-offset: 2px; }
.kos-bar :focus-visible, .kos-ico:focus-visible, #kosBoot :focus-visible { outline-color: #fff; }

.kos-desk { position: absolute; inset: 0 0 var(--kbar) 0; }
.kos-icons { list-style: none; padding: 0; margin: 0; position: absolute; left: 12px; top: 12px; display: grid; grid-template-columns: 112px; gap: 4px; z-index: 2; }
.kos .kos-ico { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 112px; min-height: 100px; padding: 6px 2px; border-radius: 12px; color: #fff; transition: background .12s; }
.kos-ico:hover { background: rgba(17,24,48,.3); }
.kos-ico:active { transform: scale(.96); }
.kos-tile { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 14px; background: #fff; color: #25316D; box-shadow: 0 3px 0 #25316D; overflow: hidden; }
.kos-tile svg { width: 34px; height: 34px; }
.kos-tile img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 4%; }
.kos-lbl { font-size: 16px; font-weight: 700; line-height: 1.25; background: #111830; padding: 2px 8px; border-radius: 6px; white-space: nowrap; }

/* 工作列 */
.kos-bar { position: absolute; left: 0; right: 0; bottom: 0; height: var(--kbar); background: #111830; color: #fff; display: flex; align-items: center; gap: 10px; padding: 0 10px 0 14px; z-index: 30; }
.kos-bar img { height: 30px; width: auto; flex: none; }
.kos-chips { display: flex; gap: 8px; flex: 1; min-width: 0; overflow: hidden; margin-left: 6px; }
.kos-chip { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border-radius: 20px; background: #25316D; font-size: 16px; line-height: 1.25; white-space: nowrap; }
.kos-chip b { font-variant-numeric: tabular-nums; }
.kos-chip i { display: block; width: 10px; height: 10px; border-radius: 50%; background: #9ED1ED; flex: none; }
.kos-exit { flex: none; height: 44px; padding: 0 16px; border-radius: 10px; background: #fff !important; color: #141B33 !important; font-weight: 900 !important; font-size: 17px !important; }
.kos-exit:hover { background: #9ED1ED !important; }

/* 視窗（沿用 c12 外觀） */
.kos-wins { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.kwin { position: absolute; pointer-events: auto; display: flex; flex-direction: column; background: #fff; border-radius: 12px; box-shadow: 0 14px 34px rgba(17,24,48,.45), 0 0 0 2px #111830; overflow: hidden; outline: none; }
.kwin[hidden] { display: none; }
.ktb { display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 6px 0 14px; background: #4E587A; color: #fff; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; flex: none; }
.kwin.is-top .ktb { background: #25316D; }
.ktb.dragging { cursor: grabbing; }
.ktb h3 { font-size: 17px; font-weight: 700; line-height: 1.25; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 0; }
.ktb button { width: 44px; height: 44px; border-radius: 8px; color: #fff; font-size: 18px; line-height: 1; }
.ktb button:hover { background: #fff; color: #25316D; }
.ktb :focus-visible { outline-color: #fff; outline-offset: -3px; }
.kbody { padding: 16px 20px 20px; overflow: auto; flex: 1; min-height: 0; }
.kbody p { margin: 0 0 10px; }
.k-big { font-size: 24px; font-weight: 900; line-height: 1.25; margin-bottom: 8px !important; }
.k-sub { font-size: 16px; color: #4E587A; line-height: 1.8; }
.k-note { font-size: 15px; color: #4E587A; line-height: 1.8; text-wrap: balance; background: #EEF3F8; padding: 6px 10px; border-radius: 8px; }
.kbtn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 16px; border-radius: 10px; background: #141B33 !important; color: #fff !important; font-weight: 700; font-size: 17px; line-height: 1.25; }
.kbtn:hover { background: #25316D !important; }
.kbtn.ghost { background: #fff !important; color: #141B33 !important; box-shadow: inset 0 0 0 2px #141B33; }
.kbtn.ghost:hover { background: #DCE2EB !important; }
.kbtn:active { transform: scale(.97); }
.kbtn[disabled] { opacity: .45; cursor: not-allowed; }
.k-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* 狀態條 */
.k-stats { display: grid; gap: 10px; margin: 6px 0 4px; }
.k-stat { display: grid; grid-template-columns: 4.2em 1fr 2.6em; align-items: center; gap: 10px; font-size: 16px; line-height: 1.25; }
.k-stat span { font-weight: 700; }
.k-stat b { text-align: right; font-variant-numeric: tabular-nums; }
.k-meter { height: 14px; border-radius: 7px; background: #DCE2EB; overflow: hidden; }
.k-meter i { display: block; height: 100%; width: 50%; border-radius: 7px; background: #25316D; transition: width .4s; }
.k-meter.aff i { background: #9ED1ED; box-shadow: inset 0 0 0 2px #25316D; }
.k-mood { font-size: 16px; line-height: 1.8; color: #141B33; margin-top: 8px !important; }

/* 吧台選單 */
.k-menu { list-style: none; padding: 0; margin: 4px 0 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.k-menu button { width: 100%; min-height: 52px; padding: 6px 10px; border-radius: 10px; box-shadow: inset 0 0 0 2px #141B33 !important; text-align: left; display: flex; flex-direction: column; justify-content: center; }
.k-menu button:hover { background: #EEF3F8 !important; }
.k-menu button b { font-size: 17px; line-height: 1.25; }
.k-menu button small { font-size: 14px; line-height: 1.25; color: #4E587A; }
.k-menu .sake { box-shadow: inset 0 0 0 2px #4E587A !important; }

/* 收藏 */
.k-col { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.k-col li { padding: 8px 12px; border-radius: 10px; background: #EEF3F8; line-height: 1.8; font-size: 16px; }
.k-col li b { display: block; font-size: 16px; line-height: 1.25; margin-bottom: 2px; }
.k-col li.locked { background: #fff; box-shadow: inset 0 0 0 2px #DCE2EB; color: #4E587A; }
.k-col q { quotes: "「" "」"; font-weight: 700; }
.k-col small { display: block; font-size: 14px; color: #4E587A; line-height: 1.8; }
.k-walls { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.k-walls button { min-height: 44px; padding: 0 12px; border-radius: 10px; box-shadow: inset 0 0 0 2px #141B33 !important; font-size: 16px; font-weight: 700; }
.k-walls button[aria-pressed="true"] { background: #141B33 !important; color: #fff !important; }
.k-bin li { text-decoration: line-through; color: #4E587A; padding: 6px 0; border-bottom: 2px solid #DCE2EB; font-size: 17px; line-height: 1.8; }
.k-bin { list-style: none; padding: 0; margin: 0 0 8px; }

/* 提示 */
.kos-toast { position: absolute; left: 50%; top: 14px; bottom: auto; transform: translateX(-50%); background: #111830; color: #fff; font-size: 17px; line-height: 1.8; padding: 8px 18px; border-radius: 24px; z-index: 40; opacity: 0; pointer-events: none; max-width: calc(100% - 32px); text-align: center; box-shadow: 0 0 0 2px #9ED1ED; transition: opacity .2s; }
.kos-toast.on { opacity: 1; }

/* 開機 */
#kosBoot { position: absolute; inset: 0; z-index: 60; background: #111830; color: #C9D2E8; display: grid; place-items: center; padding: 24px; }
#kosBoot[hidden] { display: none; }
#kosBoot .in { width: min(600px, 100%); }
#kosBoot img { height: 56px; width: auto; margin-bottom: 18px; }
#kosBoot pre { font: 16px/1.8 ui-monospace, Menlo, Consolas, monospace; white-space: pre-wrap; min-height: 9em; margin: 0; }
#kosBoot .barx { height: 10px; border-radius: 5px; background: #25316D; margin: 12px 0 16px; overflow: hidden; }
#kosBoot .barx i { display: block; height: 100%; width: 0; background: #9ED1ED; }
#kosBoot button { min-height: 48px; padding: 0 18px; border-radius: 10px; background: #fff; color: #141B33; font-weight: 700; }

/* ---------- 桌面上的琥珀（用戶 11/26：本人正常比例，不用 Q 版）：v3e 全身待機動畫縮小版 80×240；表情在對話泡泡裡用正式立繪頭像 ---------- */
.pet-floor { position: absolute; left: 0; right: 0; bottom: 0; height: 262px; z-index: 20; pointer-events: none; }
.pet { position: absolute; left: 0; bottom: 6px; width: 80px; height: 240px; pointer-events: auto; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; outline: none; }
.pet:focus-visible .pet-bob { outline: 3px solid #fff; outline-offset: 4px; border-radius: 12px; }
.pet.dragging { cursor: grabbing; }
.pet-bob { position: absolute; inset: 0; transform-origin: 50% 100%; }
.pet-shadow { position: absolute; left: 10px; right: 10px; bottom: -4px; height: 10px; border-radius: 50%; background: rgba(17,24,48,.32); }
.pet-vid { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; object-position: bottom; pointer-events: none; }
/* 走路＝整體位移（egg.js）＋輕微彈跳 */
.pet.walking .pet-bob { animation: pet-walk .42s ease-in-out infinite alternate; }
@keyframes pet-walk { from { translate: 0 0; } to { translate: 0 -5px; } }
/* 睡著：動畫停住、稍微暗一點、冒 Z */
.pet.sleeping .pet-vid { filter: brightness(.82); }
.pet-zzz { position: absolute; right: -10px; top: 0; font: 900 20px/1 "Noto Sans TC", sans-serif; color: #fff; text-shadow: 2px 2px 0 #25316D; display: none; }
.pet.sleeping .pet-zzz { display: block; animation: pet-z 2s ease-in-out infinite; }
@keyframes pet-z { 0% { opacity: 0; transform: translate(0, 6px); } 40% { opacity: 1; } 100% { opacity: 0; transform: translate(8px, -14px); } }
.pet-say { position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; width: max-content; max-width: min(300px, 78vw); background: #fff; color: #141B33; font-size: 16px; font-weight: 700; line-height: 1.6; padding: 8px 12px 8px 8px; border-radius: 12px; box-shadow: 0 0 0 2px #111830, 0 6px 16px rgba(17,24,48,.3); opacity: 0; visibility: hidden; transition: opacity .2s, visibility .2s; pointer-events: none; text-align: left; }
.pet-say p { margin: 0; text-wrap: balance; }
/* 表情頭像：正式立繪（笑／閉眼／睜眼）裁頭部，正常比例 */
.pet-face { position: relative; flex: none; width: 44px; height: 44px; border-radius: 50%; overflow: hidden; background: #25316D; box-shadow: 0 0 0 2px #9ED1ED; }
.pet-face img { position: absolute; max-width: none; height: auto; }
.pet-say::after { content: ""; position: absolute; left: 50%; bottom: -8px; margin-left: -8px; border: 8px solid transparent; border-bottom: 0; border-top-color: #fff; }
.pet-say.on { opacity: 1; visibility: visible; }
.pet.say-l .pet-say { left: 0; transform: none; }
.pet.say-l .pet-say::after { left: var(--ax, 32px); margin-left: 0; }
.pet.say-r .pet-say { left: auto; right: 0; transform: none; }
.pet.say-r .pet-say::after { left: auto; right: 24px; margin-left: 0; }
.pet-heart { position: absolute; left: 50%; top: 4px; width: 16px; height: 16px; margin-left: -8px; pointer-events: none; color: #9ED1ED; filter: drop-shadow(0 0 1px #25316D) drop-shadow(0 0 1px #25316D); }
.pet-food { position: absolute; z-index: 25; padding: 4px 10px; border-radius: 14px; background: #fff; color: #141B33; font-size: 15px; font-weight: 700; line-height: 1.6; box-shadow: 0 0 0 2px #141B33; pointer-events: none; white-space: nowrap; }

/* ---------- 雜誌角落的小寵物（關掉 OS 後還在；可收起） ---------- */
/* r1：桌機只在內文欄右邊留白裡（寬度／縮放由 egg.js 依留白算，--ps）；控制鈕直排在他頭上方，不跟頭重疊 */
.pet-dock { position: fixed; right: 4px; bottom: 12px; z-index: 45; width: 64px; height: 244px; pointer-events: none; --ps: .6; }
.pet-dock[hidden] { display: none; }
.pet-dock .pet { bottom: 0; transform: scale(var(--ps)); transform-origin: 50% 100%; }
.pet-dock .pet.say-r .pet-say { font-size: 15px; transform: scale(calc(1 / var(--ps))); transform-origin: 100% 100%; text-wrap: balance; }
.pet-dock-ctl { position: absolute; right: 0; top: 0; display: flex; flex-direction: column; gap: 4px; pointer-events: auto; opacity: 0; visibility: hidden; transition: opacity .15s, visibility .15s; }
.pet-dock:hover .pet-dock-ctl, .pet-dock:focus-within .pet-dock-ctl, .pet-dock.show-ctl .pet-dock-ctl { opacity: 1; visibility: visible; }
.pet-dock-ctl button { width: 44px; height: 44px; padding: 0; border: 0; border-radius: 10px; background: #111830; color: #fff; font: 700 15px/1.25 "Noto Sans TC", sans-serif; cursor: pointer; box-shadow: 0 0 0 2px #9ED1ED; }
.pet-dock-ctl button:hover, .pet-tab:hover { background: #25316D; }
/* 手機／留白太窄：點頂端頭像鈕才從右下探出來（peek），一捲動就收回 */
.pet-dock.peek { right: 6px; bottom: 6px; width: 96px; height: 220px; --ps: .48; }
/* 收起時：頂端導覽列裡的頭像鈕（在 bar 裡，永遠不會蓋到內文） */
.pet-tab { flex: none; width: 44px; height: 44px; margin: 0 14px 0 auto; padding: 0; border: 0; border-radius: 10px; overflow: hidden; display: grid; place-items: center; background: #25316D; cursor: pointer; box-shadow: 0 0 0 2px #9ED1ED; }
.pet-tab[hidden] { display: none; }
.pet-tab img { width: 40px; height: 40px; object-fit: cover; object-position: 50% 4%; }

/* ---------- 手機 ---------- */
@media (max-width: 700px) {
  .kos { --kbar: 52px; }
  .kos-icons { left: 8px; right: 8px; top: 8px; grid-template-columns: repeat(4, 1fr); gap: 2px; }
  .kos .kos-ico { width: auto; min-height: 92px; }
  .kos-tile { width: 50px; height: 50px; }
  .kos-lbl { font-size: 14px; padding: 2px 6px; }
  .kos-chip { padding: 0 10px; font-size: 15px; }
  .kos-chip.c-energy { display: none; }
  .kos-bar img { height: 24px; }
  /* 手機：視窗一次一個、蓋在圖示上方，下面留地板給琥珀（可以邊開吧台邊看他吃） */
  .kwin { left: 8px !important; right: 8px !important; width: auto !important; top: 8px !important; bottom: auto !important; max-height: calc(100% - 262px); height: auto !important; }
  .ktb { cursor: default; }
  .pet-floor { height: 250px; }
  /* r2：提示條位置由 egg.js placeToast() 找空位（不壓標題列、關閉鈕、琥珀） */
  .kos-toast { font-size: 16px; border-radius: 16px; text-wrap: balance; }
}

@media (prefers-reduced-motion: reduce) {
  .c-issue::after { display: none; }
  .pet.walking .pet-bob, .pet.walking .pet-head, .pet.sleeping .pet-zzz { animation: none !important; }
}
html.still .c-issue::after { display: none; }

/* ---------- r4：矮畫面的 OS（琥珀等比縮小、泡泡反向放大回原字級；桌面很矮時泡泡放人旁邊） ---------- */
.pet-floor .pet { transform: scale(var(--pk, 1)); transform-origin: 50% 100%; }
.pet-floor .pet .pet-say { transform: translateX(-50%) scale(var(--ik, 1)); transform-origin: 50% 100%; }
.pet-floor .pet.say-l .pet-say { transform: scale(var(--ik, 1)); transform-origin: 0 100%; }
.pet-floor .pet.say-r .pet-say { transform: scale(var(--ik, 1)); transform-origin: 100% 100%; }
.pet-floor .pet.say-side .pet-say, .pet-floor .pet.say-side-l .pet-say { bottom: auto; top: 0; transform: scale(var(--ik, 1)); max-width: 240px; }
.pet-floor .pet.say-side .pet-say { left: calc(100% + 10px); right: auto; transform-origin: 0 0; }
.pet-floor .pet.say-side-l .pet-say { right: calc(100% + 10px); left: auto; transform-origin: 100% 0; }
.pet.say-side .pet-say::after, .pet.say-side-l .pet-say::after { display: none; }
/* 手機探頭：琥珀站最右邊，兩顆鈕直排在他左邊（不在頭上） */
.pet-dock.peek { width: 100px; height: 124px; }
.pet-dock.peek .pet-dock-ctl { top: auto; bottom: 0; left: 0; right: auto; }
/* 小遊戲入口是連結（a），外觀跟其他圖示一樣 */
.kos a.kos-ico { text-decoration: none; }
