/* ==========================================================================
   小日子群島造型（scene.css）
   - 全部規則都掛在 body[data-skin="island"] 底下：經典造型（預設，不加 data-skin）
     完全不吃這個檔的任何一條規則，外觀零變動。
   - 顏色一律引用 styles.css 既有變數（--primary、--surface…），四套配色與深淺色自動跟著變。
   - 只包在 @media screen：列印輸出維持經典樣式，不印陰影。
   - 第 1 期：黏土質感的面板、按鈕、檢視切換、行程卡、輸入框、對話框。
     日期格的島嶼／房間造型在第 2、3 期加入。
   ========================================================================== */
@media screen {
  body[data-skin="island"] {
    --clay-hi: rgba(255, 255, 255, .75);
    --clay-lo: rgba(80, 60, 40, .07);
    --clay-drop: rgba(80, 60, 40, .10);
    --clay-sink: rgba(80, 60, 40, .10);
  }
  body.dark[data-skin="island"] {
    --clay-hi: rgba(255, 255, 255, .07);
    --clay-lo: rgba(0, 0, 0, .20);
    --clay-drop: rgba(0, 0, 0, .35);
    --clay-sink: rgba(0, 0, 0, .30);
  }

  /* 面板：凸起的軟陶板（上緣亮邊＋下緣暗邊＋柔和落影） */
  body[data-skin="island"] .panel {
    border-color: transparent;
    border-radius: 22px;
    box-shadow: 0 8px 18px var(--clay-drop), inset 0 2px 0 var(--clay-hi), inset 0 -3px 0 var(--clay-lo);
  }

  /* 一般按鈕：小顆軟陶，按下時往下沉 */
  body[data-skin="island"] .ghost-btn,
  body[data-skin="island"] .small-btn,
  body[data-skin="island"] .date-jump {
    border-color: transparent;
    box-shadow: 0 3px 8px var(--clay-drop), inset 0 2px 0 var(--clay-hi), inset 0 -2px 0 var(--clay-lo);
  }
  body[data-skin="island"] .ghost-btn:hover {
    box-shadow: 0 6px 14px var(--clay-drop), inset 0 2px 0 var(--clay-hi), inset 0 -2px 0 var(--clay-lo);
  }
  body[data-skin="island"] .ghost-btn:active,
  body[data-skin="island"] .small-btn:active {
    transform: translateY(2px);
    box-shadow: 0 1px 3px var(--clay-drop), inset 0 2px 4px var(--clay-sink);
  }

  /* 主要按鈕：主色軟陶，亮邊與暗邊用半透明白／黑，配色切換時自動跟著主色 */
  body[data-skin="island"] .primary-btn {
    box-shadow: 0 8px 18px color-mix(in srgb, var(--primary) 30%, transparent),
      inset 0 2px 0 rgba(255, 255, 255, .35), inset 0 -3px 0 rgba(0, 0, 0, .12);
  }
  body[data-skin="island"] .primary-btn:hover {
    box-shadow: 0 10px 22px color-mix(in srgb, var(--primary) 36%, transparent),
      inset 0 2px 0 rgba(255, 255, 255, .35), inset 0 -3px 0 rgba(0, 0, 0, .12);
  }
  body[data-skin="island"] .primary-btn:active {
    transform: translateY(2px);
    box-shadow: 0 3px 8px color-mix(in srgb, var(--primary) 24%, transparent), inset 0 2px 5px rgba(0, 0, 0, .18);
  }

  /* 檢視切換：下凹的軌道，選中的按鈕是凸起的主色小顆 */
  body[data-skin="island"] .view-switch {
    border-color: transparent;
    box-shadow: inset 0 2px 5px var(--clay-sink), inset 0 -1px 0 var(--clay-hi);
  }
  body[data-skin="island"] .view-btn.active {
    box-shadow: 0 3px 8px color-mix(in srgb, var(--primary) 30%, transparent),
      inset 0 2px 0 rgba(255, 255, 255, .35), inset 0 -2px 0 rgba(0, 0, 0, .12);
  }

  /* 行程卡：薄薄一片軟陶，置頂卡保留琥珀內框 */
  body[data-skin="island"] .task-card {
    border-color: transparent;
    border-radius: 14px;
    box-shadow: 0 3px 8px var(--clay-drop), inset 0 1px 0 var(--clay-hi);
  }
  body[data-skin="island"] .task-card:hover {
    box-shadow: 0 6px 14px var(--clay-drop), inset 0 1px 0 var(--clay-hi);
  }
  body[data-skin="island"] .task-card.pinned {
    box-shadow: inset 0 0 0 1px rgba(245, 158, 11, .55), 0 3px 8px var(--clay-drop), inset 0 1px 0 var(--clay-hi);
  }

  /* 輸入框：下凹的軟陶槽；保留邊框讓焦點狀態清楚 */
  body[data-skin="island"] input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="range"]):not([type="file"]),
  body[data-skin="island"] select,
  body[data-skin="island"] textarea {
    box-shadow: inset 0 2px 4px var(--clay-sink);
  }

  /* 對話框：大塊軟陶卡片 */
  body[data-skin="island"] dialog {
    border-radius: 26px;
    box-shadow: 0 18px 40px var(--clay-drop), inset 0 2px 0 var(--clay-hi), inset 0 -3px 0 var(--clay-lo);
  }

  /* ------------------------------------------------------------------------
     第 2 期：月與週檢視的島嶼（scene.js 的 ensureIslandDefs()／islandArtHtml()）
     ------------------------------------------------------------------------ */
  /* 島上用色：草地取 --sport（每套配色都是綠色系）、屋頂取 --primary、金色取 --accent-amber，
     所以切換配色時整片群島一起換色。暗部統一帶藍紫、亮部帶暖黃（Figma 調整版定案）。 */
  body[data-skin="island"] {
    --isl-sea-hi: #eaf6f5; --isl-sea: #c4e0e6;
    --isl-soil-hi: #eccb9c; --isl-soil-lo: #6b4a33; --isl-shade: #23305e; --isl-warm: #fff3d6; --isl-ring: rgba(255, 255, 255, .65);
    --isl-grass: color-mix(in srgb, var(--sport) 45%, #bcd68f);
    --isl-grass-hi: color-mix(in srgb, var(--isl-grass) 35%, #f4fbe0);
    --isl-grass-lo: color-mix(in srgb, var(--isl-grass) 70%, #1f5a40);
    --isl-grass-lip: color-mix(in srgb, var(--isl-grass) 55%, #24543d);
    --isl-leaf: color-mix(in srgb, var(--isl-grass) 55%, #2f7d5a);
    --isl-leaf-hi: color-mix(in srgb, var(--isl-grass) 45%, #e6f7d4);
    --isl-leaf-lo: color-mix(in srgb, var(--isl-grass) 35%, #145a44);
    --isl-wall: #fffdf4; --isl-wall-lo: #f0dfc0; --isl-wall-sh: #cbb692; --isl-wall-sh2: #a48c6c;
    --isl-roof: var(--primary);
    --isl-roof-hi: color-mix(in srgb, var(--primary) 68%, #fff);
    --isl-roof-sh: color-mix(in srgb, var(--primary) 72%, #3a2a2a);
    --isl-roof-lo: color-mix(in srgb, var(--primary) 48%, #2a1a2a);
    --isl-amber: var(--accent-amber); --isl-mint: var(--sport);
    --isl-win: #8fb9d0; --isl-lamp: #ffd66b; --isl-sand: #f1dfb4; --isl-trunk: #9a7453; --isl-chimney: #d2ab82;
    --isl-tower-hi: #fffaf0; --isl-tower-lo: #bdb0b4; --isl-lantern: #e2574c;
    --isl-sun-hi: #ffe79a; --isl-moon: #f5edc9;
    --isl-cloud: #fffdf6; --isl-cloud-sh: #c9cfe6; --isl-rain: #d0d6e6; --isl-rain-sh: #9aa3c2;
    --isl-storm: #7b8492; --isl-storm-sh: #4a4f6e; --isl-drop: #6fa8d4; --isl-snow: #ffffff; --isl-fog: rgba(140, 150, 175, .55);
  }
  body.dark[data-skin="island"] {
    --isl-sea-hi: #23394f; --isl-sea: #14243a;
    --isl-soil-hi: #7d6450; --isl-soil-lo: #33251f; --isl-shade: #070a1c; --isl-warm: #ffe9b8; --isl-ring: rgba(255, 255, 255, .18);
    --isl-grass: color-mix(in srgb, var(--sport) 30%, #2c5743);
    --isl-grass-hi: color-mix(in srgb, var(--isl-grass) 70%, #6f9c7d);
    --isl-grass-lo: color-mix(in srgb, var(--isl-grass) 70%, #0f2219);
    --isl-grass-lip: color-mix(in srgb, var(--isl-grass) 55%, #10241b);
    --isl-leaf: color-mix(in srgb, var(--isl-grass) 60%, #1d4a38);
    --isl-leaf-hi: color-mix(in srgb, var(--isl-grass) 60%, #5d8c72);
    --isl-leaf-lo: color-mix(in srgb, var(--isl-grass) 40%, #0b1d16);
    --isl-wall: #bdb19e; --isl-wall-lo: #a0947f; --isl-wall-sh: #8f8472; --isl-wall-sh2: #6c6354;
    --isl-win: #39445a; --isl-sand: #8c7f63; --isl-trunk: #5d4635; --isl-chimney: #7a6450;
    --isl-tower-hi: #d6cfc4; --isl-tower-lo: #8a8088;
    --isl-cloud: #8f97ad; --isl-cloud-sh: #5b6178; --isl-rain: #6d7590; --isl-rain-sh: #474d66;
    --isl-storm: #4c5262; --isl-storm-sh: #2a2e3d; --isl-fog: rgba(170, 180, 205, .35);
  }

  /* 海面：月／週網格整片當成海，日期格是半透明的浮島區塊，裡面的行程卡維持實心好閱讀 */
  body[data-skin="island"] .month-grid,
  body[data-skin="island"] .week-grid {
    padding: 12px;
    border-radius: 22px;
    background: linear-gradient(var(--isl-sea-hi), var(--isl-sea));
    box-shadow: inset 0 2px 6px var(--clay-sink);
  }
  body[data-skin="island"] .month-day,
  body[data-skin="island"] .week-day {
    position: relative;
    border-color: transparent;
    background: color-mix(in srgb, var(--surface-strong) 42%, transparent);
    box-shadow: inset 0 1px 0 var(--clay-hi);
  }
  /* 熱力底色改由島上的房子多寡表現，這裡統一蓋掉（mh-* 只在經典造型生效） */
  body[data-skin="island"] .month-day.mh-1,
  body[data-skin="island"] .month-day.mh-2,
  body[data-skin="island"] .month-day.mh-3 {
    background: color-mix(in srgb, var(--surface-strong) 42%, transparent);
  }
  body[data-skin="island"] .month-day.today,
  body[data-skin="island"] .week-day.today {
    background: color-mix(in srgb, var(--surface-strong) 62%, transparent);
    box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--primary) 70%, transparent), 0 6px 16px var(--clay-drop);
  }
  body[data-skin="island"] .month-day.holiday,
  body[data-skin="island"] .week-day.holiday {
    background: color-mix(in srgb, var(--danger) 8%, color-mix(in srgb, var(--surface-strong) 42%, transparent));
  }
  body[data-skin="island"] .month-day.outside { opacity: .5; filter: saturate(.6); }
  /* 今天的日期數字改成主色小膠囊 */
  body[data-skin="island"] .month-day.today .day-head > span:first-child,
  body[data-skin="island"] .week-day.today .day-head > span:last-child {
    padding: 0 8px;
    border-radius: 999px;
    color: #fff;
    background: var(--primary);
  }
  /* 天氣已經畫在島的天空，日期旁的 emoji 不重複顯示 */
  body[data-skin="island"] .month-day .weather-mini,
  body[data-skin="island"] .week-day .weather-mini { display: none; }

  /* 島嶼本身 */
  body[data-skin="island"] .isle-art {
    height: 64px;
    margin: -4px 0 6px;
    pointer-events: none;
  }
  body[data-skin="island"] .week-day .isle-art { height: 96px; }
  body[data-skin="island"] .isle-art svg {
    display: block;
    width: 100%;
    height: 100%;
    overflow: visible;
    transition: transform .28s cubic-bezier(.3, 1.4, .5, 1);
  }
  body[data-skin="island"] .month-day:hover .isle-art svg,
  body[data-skin="island"] .week-day:hover .isle-art svg { transform: translateY(-3px); }
  /* ------------------------------------------------------------------------
     第 3 期：日檢視（scene.js 的 dayRoomFor()／timelineSkyHtml()）
     ------------------------------------------------------------------------ */
  body[data-skin="island"] {
    --isl-floor-hi: #f6e8d0; --isl-floor-lo: #d8c2a0; --isl-wl-hi: #fffaf0; --isl-wl-lo: #efe1c8;
    --isl-wr-hi: #f1e4cd; --isl-wr-lo: #d6c3a5; --isl-sky-hi: #9fd6f0; --isl-sky-lo: #e2f4fb;
    --isl-pot: #c97b5a; --isl-ink: #3a3340;
    --isl-sky-night: #3a4a86; --isl-sky-dawn: #f6c49a; --isl-sky-day: #bfe6f5;
  }
  body.dark[data-skin="island"] {
    --isl-floor-hi: #574d5d; --isl-floor-lo: #3b3444; --isl-wl-hi: #443e52; --isl-wl-lo: #353040;
    --isl-wr-hi: #383240; --isl-wr-lo: #292531; --isl-sky-hi: #131a33; --isl-sky-lo: #27345c;
    --isl-pot: #8a5a44; --isl-ink: #15131a;
    --isl-sky-night: #0c1230; --isl-sky-dawn: #6a4a5a; --isl-sky-day: #2a4a6a;
  }

  /* 房間舞台：置中，高度約 170px，手機寬度以寬度為準 */
  body[data-skin="island"] .isle-room {
    margin: 0 auto 14px;
    max-width: 520px;
    border-radius: 18px;
    background: linear-gradient(var(--isl-sea-hi), var(--isl-sea));
    box-shadow: inset 0 2px 6px var(--clay-sink);
    pointer-events: none;
  }
  body[data-skin="island"] .isle-room svg { display: block; width: 100%; height: auto; max-height: 190px; }

  /* 便條牆：清單模式的行程卡像貼在牆上的便條紙，左右微微傾斜、上方一顆圖釘 */
  body[data-skin="island"] .day-task-lane .task-card {
    border-radius: 6px 6px 12px 12px;
    background: color-mix(in srgb, var(--category-color, var(--primary)) 16%, var(--surface-strong));
    box-shadow: 0 6px 12px var(--clay-drop), inset 0 1px 0 var(--clay-hi);
    transform: rotate(-.6deg);
    overflow: visible;
  }
  body[data-skin="island"] .day-task-lane .task-card:nth-child(even) { transform: rotate(.6deg); }
  body[data-skin="island"] .day-task-lane .task-card::before { border-radius: 6px 0 0 12px; }
  body[data-skin="island"] .day-task-lane .task-card::after {
    content: "";
    position: absolute;
    top: -4px;
    left: 50%;
    width: 9px;
    height: 9px;
    margin-left: -4.5px;
    border-radius: 50%;
    background: var(--category-color, var(--primary));
    box-shadow: inset -1px -2px 0 rgba(0, 0, 0, .22), inset 1px 1px 0 rgba(255, 255, 255, .5), 0 2px 3px var(--clay-drop);
    pointer-events: none;
  }
  body[data-skin="island"] .day-task-lane .task-card:hover { transform: rotate(0deg) translateY(-2px); }
  body[data-skin="island"] .day-task-lane { padding-top: 8px; }

  /* 時間軸天空：淡淡鋪在時間軸底下，行程方塊在上面 */
  body[data-skin="island"] .isl-sky {
    position: absolute;
    inset: 0;
    opacity: .32;
    pointer-events: none;
  }
  body.dark[data-skin="island"] .isl-sky { opacity: .55; }
  body[data-skin="island"] .isl-now {
    position: absolute;
    left: 0;
    right: 0;
    height: 0;
    border-top: 2px solid color-mix(in srgb, var(--isl-amber) 80%, transparent);
    z-index: 3;
    pointer-events: none;
  }
  body[data-skin="island"] .isl-now[hidden] { display: none; }
  body[data-skin="island"] .isl-now-orb {
    position: absolute;
    top: -8px;
    left: 4px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: radial-gradient(circle at 38% 35%, var(--isl-sun-hi), var(--isl-amber));
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--isl-amber) 25%, transparent);
  }
  body[data-skin="island"] .isl-now.is-night { border-top-color: color-mix(in srgb, var(--isl-moon) 70%, transparent); }
  body[data-skin="island"] .isl-now.is-night .isl-now-orb {
    background: radial-gradient(circle at 70% 30%, transparent 5px, var(--isl-moon) 5.5px);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--isl-moon) 18%, transparent);
  }

  /* 白天太陽、夜景月亮與星星；夜景時亮著的窗與燈塔發光 */
  body[data-skin="island"] .isl-night { display: none; }
  body.dark[data-skin="island"] .isl-night { display: inline; }
  body.dark[data-skin="island"] .isl-day { display: none; }
  body.dark[data-skin="island"] .isl-lit { filter: drop-shadow(0 0 2px var(--isl-lamp)); }
}

/* ------------------------------------------------------------------------
   第 4 期：角色出場框（mascot.js）。平常隱藏，有話要說才從右下角探出來。
   ------------------------------------------------------------------------ */
/* ------------------------------------------------------------------------
   第 5 期：年／列表／甘特／側欄換裝＋互動小動畫（純樣式為主；JS 只有 scene.js 的
   islandFlash()／islandBoat()／habitSproutHtml()）
   ------------------------------------------------------------------------ */
@media screen {
  /* 年檢視＝世界地圖：整片是海，12 個月各是一座島（草地＋土壤厚度），行程越多草越綠 */
  body[data-skin="island"] .year-grid {
    padding: 14px;
    border-radius: 22px;
    background: linear-gradient(var(--isl-sea-hi), var(--isl-sea));
    box-shadow: inset 0 2px 6px var(--clay-sink);
  }
  body[data-skin="island"] .mini-month {
    border: 0;
    border-radius: 26px 26px 30px 30px;
    background: linear-gradient(color-mix(in srgb, var(--isl-grass-hi) 55%, var(--surface-strong)), color-mix(in srgb, var(--isl-grass) 30%, var(--surface-strong)));
    box-shadow: 0 7px 0 var(--isl-soil-hi), 0 12px 0 var(--isl-soil-lo), 0 18px 18px var(--clay-drop), inset 0 2px 0 var(--clay-hi);
    margin-bottom: 12px;
  }
  body[data-skin="island"] .mini-month-title { color: var(--isl-ink); }
  body.dark[data-skin="island"] .mini-month-title { color: var(--text); }
  body[data-skin="island"] .mini-day.mh-1 { background: color-mix(in srgb, var(--isl-grass) 45%, transparent); }
  body[data-skin="island"] .mini-day.mh-2 { background: color-mix(in srgb, var(--isl-leaf) 70%, transparent); color: #fff; }
  body[data-skin="island"] .mini-day.mh-3 { background: var(--isl-leaf-lo); color: #fff; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .18); }
  body[data-skin="island"] .mini-day.today { background: var(--primary); color: #fff; box-shadow: 0 0 0 3px color-mix(in srgb, var(--isl-lamp) 70%, transparent); }

  /* 列表＝航線：左側一條虛線航道，每天是一個停靠站（浮標），今天是發光的燈塔 */
  body[data-skin="island"] .agenda-list {
    position: relative;
    padding: 16px 12px 16px 40px;
    border-radius: 22px;
    background: linear-gradient(var(--isl-sea-hi), var(--isl-sea));
    box-shadow: inset 0 2px 6px var(--clay-sink);
  }
  body[data-skin="island"] .agenda-list::before {
    content: "";
    position: absolute;
    top: 22px;
    bottom: 22px;
    left: 19px;
    border-left: 3px dashed color-mix(in srgb, var(--isl-drop) 75%, transparent);
  }
  body[data-skin="island"] .agenda-group { position: relative; }
  body[data-skin="island"] .agenda-group::before {
    content: "";
    position: absolute;
    top: 4px;
    left: -29px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #fff 0 18%, var(--isl-roof) 22% 58%, var(--isl-wall) 62%);
    box-shadow: 0 2px 4px var(--clay-drop);
  }
  body[data-skin="island"] .agenda-group.today::before {
    width: 18px;
    height: 18px;
    left: -31px;
    top: 2px;
    background: radial-gradient(circle, var(--isl-lamp) 0 35%, var(--primary) 40%);
    box-shadow: 0 0 0 5px color-mix(in srgb, var(--isl-lamp) 35%, transparent), 0 0 14px var(--isl-lamp);
  }
  body[data-skin="island"] .agenda-date-head { border-bottom: 2px dotted color-mix(in srgb, var(--isl-drop) 45%, transparent); }

  /* 甘特＝小火車：每格行程是一節車廂（窗戶＋車輪），格子底下是鐵軌，今天是月台 */
  body[data-skin="island"] .gantt-scroll { border: 0; border-radius: 18px; box-shadow: var(--clay-drop) 0 8px 18px, inset 0 2px 0 var(--clay-hi); }
  body[data-skin="island"] .gantt-cells {
    background-image:
      linear-gradient(to bottom, transparent 25px, color-mix(in srgb, var(--isl-trunk) 75%, transparent) 25px 27px, transparent 27px),
      repeating-linear-gradient(to right, transparent 0 9px, color-mix(in srgb, var(--isl-trunk) 30%, transparent) 9px 12px, transparent 12px 13px),
      repeating-linear-gradient(to right, transparent 0, transparent 130px, color-mix(in srgb, var(--muted) 10%, transparent) 130px, color-mix(in srgb, var(--muted) 10%, transparent) 182px);
    background-size: 100% 100%, 100% 5px, 100% 100%;
    background-position: 0 0, 0 24px, 0 0;
    background-repeat: no-repeat, repeat-x, repeat;
  }
  body[data-skin="island"] .gantt-bar {
    top: 2px;
    height: 20px;
    border-radius: 6px 6px 3px 3px;
    line-height: 20px;
    box-shadow: inset 0 2px 0 rgba(255, 255, 255, .35), inset 0 -3px 0 rgba(0, 0, 0, .18), 0 2px 3px rgba(0, 0, 0, .2);
    overflow: visible;
  }
  body[data-skin="island"] .gantt-bar::before {
    content: "";
    position: absolute;
    left: 4px;
    right: 4px;
    top: 4px;
    height: 6px;
    border-radius: 2px;
    background: color-mix(in srgb, #fff 70%, var(--isl-sky-hi));
    opacity: .85;
  }
  body[data-skin="island"] .gantt-bar::after {
    content: "";
    position: absolute;
    left: 3px;
    right: 3px;
    bottom: -4px;
    height: 6px;
    background: radial-gradient(circle at 4px 3px, var(--isl-ink) 0 2.4px, transparent 2.8px), radial-gradient(circle at calc(100% - 4px) 3px, var(--isl-ink) 0 2.4px, transparent 2.8px);
  }
  body[data-skin="island"] .gantt-today-col { background: color-mix(in srgb, var(--isl-lamp) 28%, transparent); }
  body[data-skin="island"] .gantt-links path { stroke: var(--isl-trunk); stroke-width: 2; stroke-dasharray: 2 3; opacity: .9; }
  body[data-skin="island"] .gantt-links path.blocked { stroke: var(--danger); stroke-dasharray: 4 3; }

  /* 側欄港口：倒數日＝熱氣球（當天的會飄）、習慣＝菜園、每週目標完成蓋「達成」印章 */
  body[data-skin="island"] .countdown-item { position: relative; padding-left: 34px; border-color: transparent; box-shadow: 0 3px 8px var(--clay-drop), inset 0 1px 0 var(--clay-hi); }
  body[data-skin="island"] .countdown-item::before {
    content: "";
    position: absolute;
    left: 9px;
    top: 50%;
    width: 16px;
    height: 22px;
    margin-top: -12px;
    background:
      radial-gradient(ellipse 8px 9px at 50% 38%, var(--isl-roof-hi) 0 45%, var(--isl-roof) 70%, transparent 72%) no-repeat,
      linear-gradient(var(--isl-trunk), var(--isl-trunk)) 50% 100% / 6px 4px no-repeat;
  }
  body[data-skin="island"] .countdown-item:has(.countdown-today)::before { animation: isl-balloon 2.6s ease-in-out infinite; }
  body[data-skin="island"] .habit-item { border-color: transparent; box-shadow: 0 3px 8px var(--clay-drop), inset 0 1px 0 var(--clay-hi); }
  body[data-skin="island"] .isl-sprout { display: inline-block; width: 24px; height: 24px; margin-right: 2px; vertical-align: middle; }
  body[data-skin="island"] .isl-sprout svg { display: block; width: 100%; height: 100%; }
  body[data-skin="island"] #weeklyGoalList .habit-item { position: relative; }
  body[data-skin="island"] #weeklyGoalList .habit-item:has(input:checked)::after {
    content: "達成";
    position: absolute;
    right: 40px;
    top: 50%;
    padding: 1px 6px;
    border: 2px solid color-mix(in srgb, var(--danger) 80%, transparent);
    border-radius: 6px;
    color: color-mix(in srgb, var(--danger) 85%, transparent);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 2px;
    transform: translateY(-50%) rotate(-12deg);
    opacity: .85;
    pointer-events: none;
    animation: isl-stamp .35s cubic-bezier(.3, 1.6, .5, 1);
  }

  /* 小動畫：剛完成的卡片彈一下、剛放下的卡片彈一下、拖曳中的卡片浮起 */
  body[data-skin="island"] .task-card.isl-flash-done { animation: isl-pop .55s cubic-bezier(.3, 1.6, .5, 1); }
  body[data-skin="island"] .task-card.isl-flash-drop { animation: isl-drop .5s cubic-bezier(.3, 1.6, .5, 1); }
  body[data-skin="island"] .task-card.dragging { opacity: .6; transform: rotate(-2deg) scale(1.03); box-shadow: 0 16px 28px var(--clay-drop); }

  /* 順延的小船：從左開到右，開完自己消失 */
  body[data-skin="island"] .isl-boat {
    position: fixed;
    left: 0;
    bottom: 22%;
    z-index: 950;
    display: flex;
    align-items: center;
    gap: 6px;
    pointer-events: none;
    animation: isl-sail 2.6s ease-in-out forwards;
  }
  body[data-skin="island"] .isl-boat svg { width: 96px; height: 56px; }
  body[data-skin="island"] .isl-boat span {
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--surface-strong);
    color: var(--text);
    font-weight: 700;
    font-size: 13px;
    box-shadow: 0 4px 10px var(--clay-drop);
  }
}
body:not([data-skin="island"]) .isl-boat { display: none; }
@keyframes isl-pop { 0% { transform: scale(1); } 35% { transform: scale(1.05) rotate(-1deg); box-shadow: 0 0 0 4px color-mix(in srgb, var(--isl-lamp) 55%, transparent); } 100% { transform: none; } }
@keyframes isl-drop { 0% { transform: translateY(-8px) scale(1.03); } 60% { transform: translateY(2px); } 100% { transform: none; } }
@keyframes isl-sail { 0% { transform: translateX(-140px); opacity: 0; } 12% { opacity: 1; } 85% { opacity: 1; } 100% { transform: translateX(calc(100vw + 20px)); opacity: 0; } }
@keyframes isl-balloon { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes isl-stamp { 0% { transform: translateY(-50%) rotate(-12deg) scale(1.8); opacity: 0; } 100% { transform: translateY(-50%) rotate(-12deg) scale(1); opacity: .85; } }

/* 經典造型（或角色說到一半切回經典）一律不顯示；只有群島造型下面那條會把它打開 */
.mascot-dock { display: none; }
@media screen {
  body[data-skin="island"] .mascot-dock {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 900;
    display: flex;
    align-items: flex-end;
    gap: 6px;
    max-width: min(380px, calc(100vw - 24px));
    pointer-events: none;
    opacity: 0;
    transform: translateY(18px);
    transition: opacity .22s ease, transform .3s cubic-bezier(.3, 1.4, .5, 1);
  }
  body[data-skin="island"] .mascot-dock.is-on { opacity: 1; transform: none; }
  body[data-skin="island"] .mascot-dock[hidden] { display: none; }
  body[data-skin="island"] .mascot-bubble {
    pointer-events: auto;
    flex: 1 1 auto;
    min-width: 0;
    margin-bottom: 40px;
    padding: 10px 14px;
    border: 0;
    border-radius: 18px 18px 4px 18px;
    color: var(--text);
    background: var(--surface-strong);
    text-align: left;
    font: inherit;
    font-size: 14px;
    line-height: 1.55;
    box-shadow: 0 10px 24px var(--clay-drop), inset 0 2px 0 var(--clay-hi), inset 0 -3px 0 var(--clay-lo);
    cursor: pointer;
  }
  body[data-skin="island"] .mascot-bubble:hover { transform: none; }
  body[data-skin="island"] .mascot-dock.has-action .mascot-bubble { box-shadow: 0 10px 24px var(--clay-drop), inset 0 0 0 2px color-mix(in srgb, var(--primary) 45%, transparent); }
  body[data-skin="island"] .mascot-name { display: block; margin-bottom: 2px; color: var(--primary); font-size: 13px; }
  body[data-skin="island"] .mascot-art { flex: 0 0 92px; width: 92px; height: 92px; }
  body[data-skin="island"] .mascot-art svg { display: block; width: 100%; height: 100%; overflow: visible; }
  body[data-skin="island"] .mascot-dock.is-on .mascot-art svg { animation: mascot-hop .5s cubic-bezier(.3, 1.6, .5, 1); }
  body[data-skin="island"] .mascot-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
}
@keyframes mascot-hop {
  0% { transform: translateY(14px) scale(.92); }
  60% { transform: translateY(-6px) scale(1.03); }
  100% { transform: none; }
}
/* 手機：底部導航與右下角新增鈕都在，角色改從左下角、導航列上方出來 */
@media screen and (max-width: 760px) {
  body[data-skin="island"] .mascot-dock {
    right: auto;
    left: 10px;
    /* 與右下角新增鈕同高（styles.css：body.has-bottom-nav .fab-add 為 118px），避開快速新增列與底部導航 */
    bottom: calc(env(safe-area-inset-bottom) + 118px);
    flex-direction: row-reverse;
    max-width: calc(100vw - 90px);
  }
  body[data-skin="island"] .mascot-bubble { border-radius: 18px 18px 18px 4px; font-size: 13.5px; }
  body[data-skin="island"] .mascot-art { flex-basis: 76px; width: 76px; height: 76px; }
}
@media print { .mascot-dock { display: none !important; } }
body.widget-mode .mascot-dock { display: none !important; }

/* 文字設定視窗裡的「角色」區（兩種造型都看得到，所以不掛 data-skin）。
   全域 input{width:100%} 會撐開勾選框與時間欄，這裡還原成原生寬度。 */
.mascot-settings .mascot-row { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin-top: 6px; }
.mascot-settings label.mascot-check { display: inline-flex; align-items: center; gap: 6px; margin: 0; color: var(--text); font-weight: 600; font-size: 14px; }
.mascot-settings input[type="checkbox"] { width: auto; flex: 0 0 auto; }
.mascot-settings input[type="time"] { width: auto; padding: 8px 10px; }
.mascot-settings select { width: auto; max-width: 100%; }
.mascot-settings .mascot-who { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 12px; margin-top: 8px; }
.mascot-settings .muted { margin: 4px 0 0; font-size: 12px; }
.mascot-settings .mascot-who[hidden], .mascot-settings select[hidden] { display: none; }
.overdue-notice-list { margin: 8px 0 12px; padding-left: 20px; line-height: 1.7; }

/* 桌機：同一週的島用小木橋連起來（手機單欄排列時不畫） */
@media screen and (min-width: 761px) {
  body[data-skin="island"] .week-grid > .week-day:not(:nth-child(7n))::after,
  body[data-skin="island"] .month-grid > .month-day:not(:nth-child(7n))::after {
    content: "";
    position: absolute;
    right: -9px;
    width: 8px;
    height: 4px;
    border-radius: 2px;
    background: repeating-linear-gradient(90deg, var(--isl-trunk) 0 2px, transparent 2px 3px);
    opacity: .7;
    pointer-events: none;
  }
  body[data-skin="island"] .month-grid > .month-day:not(:nth-child(7n))::after { top: 78px; }
  body[data-skin="island"] .week-grid > .week-day:not(:nth-child(7n))::after { top: 112px; }
}

/* 手機：日期格是整寬一列。島放進日期列右側的空位（日期／＋按鈕的左邊），
   日期列加高到放得下島，行程卡維持整寬不被擠窄。 */
@media screen and (max-width: 760px) {
  body[data-skin="island"] .month-day .day-head,
  body[data-skin="island"] .week-day .day-head {
    min-height: 44px;
    align-items: flex-start;
  }
  body[data-skin="island"] .isle-art,
  body[data-skin="island"] .week-day .isle-art {
    position: absolute;
    top: 4px;
    right: 62px;
    width: 76px;
    height: 50px;
    margin: 0;
  }
}

/* ==========================================================================
   互動第 1 批：側欄港口公告板（圖示＋摘要徽章）、檢視鈕島嶼圖示、手機底部導航島嶼圖示＋浮標
   圖示與徽章由 scene.js updateIslandChrome() 只在群島造型注入，經典造型沒有這些節點。
   ========================================================================== */
@media screen {
  body[data-skin="island"] [data-isl-panel] > h2 {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap; /* 標題不換行，空間不夠時由徽章縮短（…） */
  }
  body[data-skin="island"] .isl-ph-ico {
    flex: 0 0 auto;
    display: inline-flex;
    width: 24px;
    height: 24px;
  }
  body[data-skin="island"] .isl-ph-ico svg { width: 24px; height: 24px; }
  body[data-skin="island"] .isl-badge {
    margin-left: auto;
    flex: 0 1 auto;
    min-width: 0;
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--surface-soft);
    box-shadow: inset 0 1px 2px var(--clay-sink);
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  body[data-skin="island"] .isl-badge[hidden] { display: none; }
  body[data-skin="island"] .isl-badge.hot {
    background: color-mix(in srgb, var(--primary) 16%, var(--surface));
    color: var(--primary);
  }
  body[data-skin="island"] .isl-badge.ok {
    background: color-mix(in srgb, var(--isl-grass) 24%, var(--surface));
    color: var(--text);
  }

}

@media screen and (min-width: 761px) {
  /* 檢視切換鈕（桌機）：圖示在上、字在下 */
  body[data-skin="island"] .view-switch .view-btn[data-view] {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    padding: 4px 10px;
    font-size: 12px;
    line-height: 1.15;
    white-space: nowrap;
  }
  body[data-skin="island"] .isl-view-ico { width: 20px; height: 20px; }
}

@media screen and (max-width: 760px) {
  /* 手機上方的檢視鈕維持精簡（底部導航已有圖示） */
  body[data-skin="island"] .isl-view-ico { display: none; }

  /* 底部導航：日＝房間、週＝島鏈、月＝群島、列表＝航線、今天＝燈塔；選中的那格有小浮標 */
  body[data-skin="island"] .bottom-nav-btn { position: relative; }
  body[data-skin="island"] .bottom-nav-btn > :not(.isl-nav-ico) { display: none; }
  body[data-skin="island"] .bottom-nav-btn > .isl-nav-ico {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    font-size: 10px;
  }
  body[data-skin="island"] .isl-nav-ico svg { width: 26px; height: 26px; transition: transform .16s ease; }
  body[data-skin="island"] .bottom-nav-btn.active .isl-nav-ico svg { transform: translateY(-1px); }
  body[data-skin="island"] .bottom-nav-btn.active::after {
    content: "";
    position: absolute;
    top: -3px;
    left: 50%;
    width: 12px;
    height: 12px;
    margin-left: -6px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #fff 0 20%, var(--primary) 25% 60%, #fff 64%);
    box-shadow: 0 2px 4px rgba(0, 0, 0, .2);
    animation: isl-buoy 2s ease-in-out infinite;
  }
  @keyframes isl-buoy { 50% { transform: translateY(-3px); } }
}

/* ==========================================================================
   互動第 2 批：小船新增鈕＋扇形選單、拖船到島上、島上插旗
   ========================================================================== */
@media screen {
  /* 小船新增鈕 */
  body[data-skin="island"] #quickAddBtn { cursor: grab; }
  body[data-skin="island"] #quickAddBtn:active { cursor: grabbing; }
  body[data-skin="island"] .isl-ship-ico {
    width: 22px;
    height: 22px;
    margin-right: 6px;
    vertical-align: -5px;
    transform-origin: 50% 80%;
  }
  body[data-skin="island"] #quickAddBtn:hover .isl-ship-ico,
  body[data-skin="island"] #quickAddBtn[aria-expanded="true"] .isl-ship-ico { animation: isl-rock 1.6s ease-in-out infinite; }
  body[data-skin="island"] .fab-add .isl-ship-ico { width: 30px; height: 30px; margin: 0; vertical-align: 0; }
  @keyframes isl-rock { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg) translateY(-1px); } }

  /* 扇形選單（桌機：在新增鈕下方 2×2；手機：在右下新增鈕上方直排） */
  .isl-fan {
    position: fixed;
    z-index: 520;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    opacity: 0;
    transform: translateY(-6px) scale(.96);
    transition: opacity .18s ease, transform .18s ease;
  }
  .isl-fan[hidden] { display: none; }
  .isl-fan.open { opacity: 1; transform: none; }
  .isl-fan.up { grid-template-columns: 1fr; width: 132px; transform: translateY(8px) scale(.96); transform-origin: 100% 100%; }
  .isl-fan.up.open { transform: none; }
  .isl-fan button {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-height: 56px;
    padding: 8px 6px;
    border: 0;
    border-radius: 14px;
    color: var(--text);
    background: var(--surface-strong);
    box-shadow: 0 6px 14px var(--clay-drop, rgba(80, 60, 40, .12)), inset 0 2px 0 var(--clay-hi, rgba(255, 255, 255, .7)), inset 0 -2px 0 var(--clay-lo, rgba(80, 60, 40, .07));
    font: inherit;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
  }
  .isl-fan.up button { flex-direction: row; gap: 10px; min-height: 48px; padding: 6px 12px; font-size: 14px; }
  .isl-fan button:hover,
  .isl-fan button:focus-visible { background: color-mix(in srgb, var(--primary) 10%, var(--surface-strong)); }
  .isl-fan button svg { width: 26px; height: 26px; flex: 0 0 auto; }

  /* 拖著小船時，可以停靠的島亮起來 */
  body.isl-ship-dragging[data-skin="island"] [data-drop-date] {
    outline: 2px dashed color-mix(in srgb, var(--primary) 55%, transparent);
    outline-offset: -3px;
  }
  body.isl-ship-dragging[data-skin="island"] [data-drop-date]:hover {
    outline-style: solid;
    background: color-mix(in srgb, var(--primary) 10%, transparent);
  }

  /* 島上插旗：月檢視原本的「＋」與週檢視的 .isl-pin 畫成一支小旗（文字隱藏，aria-label 保留） */
  body[data-skin="island"] .month-day .day-head [data-new-date],
  body[data-skin="island"] .isl-pin {
    position: relative;
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: none;
    box-shadow: none;
    color: transparent;
    font-size: 0;
    cursor: pointer;
    transition: opacity .15s ease;
  }
  body[data-skin="island"] .month-day .day-head [data-new-date]::before,
  body[data-skin="island"] .isl-pin::before {
    content: "";
    position: absolute;
    left: 9px;
    top: 4px;
    width: 2px;
    height: 20px;
    border-radius: 1px;
    background: var(--isl-trunk);
  }
  body[data-skin="island"] .month-day .day-head [data-new-date]::after,
  body[data-skin="island"] .isl-pin::after {
    content: "+";
    position: absolute;
    left: 11px;
    top: 4px;
    width: 14px;
    height: 11px;
    padding-left: 2px;
    background: var(--primary);
    clip-path: polygon(0 0, 100% 50%, 0 100%);
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    line-height: 11px;
    transform-origin: 0 50%;
  }
  body[data-skin="island"] .month-day .day-head [data-new-date]:hover::after,
  body[data-skin="island"] .isl-pin:hover::after { animation: isl-wave .6s ease-in-out 2; }
  @keyframes isl-wave { 50% { transform: skewY(-8deg) scaleX(.9); } }
  body[data-skin="island"] .month-day .day-head [data-new-date]:active,
  body[data-skin="island"] .isl-pin:active { transform: translateY(1px); }
  /* 週檢視的旗插在島的右上角 */
  body[data-skin="island"] .week-day > .isl-pin {
    position: absolute;
    top: 34px;
    right: 6px;
    z-index: 2;
  }
}

/* 桌機（滑鼠）：旗子平常收起，滑到那一天或用鍵盤聚焦時才冒出來 */
@media screen and (hover: hover) and (pointer: fine) {
  body[data-skin="island"] .month-day .day-head [data-new-date],
  body[data-skin="island"] .week-day > .isl-pin { opacity: 0; }
  body[data-skin="island"] .month-day:hover .day-head [data-new-date],
  body[data-skin="island"] .week-day:hover > .isl-pin,
  body[data-skin="island"] .month-day .day-head [data-new-date]:focus-visible,
  body[data-skin="island"] .week-day > .isl-pin:focus-visible { opacity: 1; }
}

/* 手機：旗子常駐，點擊區放大到 40px；週檢視的旗放在島的左邊 */
@media screen and (max-width: 760px) {
  body[data-skin="island"] .month-day .day-head [data-new-date],
  body[data-skin="island"] .isl-pin { width: 40px; height: 40px; min-width: 40px; }
  body[data-skin="island"] .month-day .day-head [data-new-date]::before,
  body[data-skin="island"] .isl-pin::before { left: 15px; top: 10px; }
  body[data-skin="island"] .month-day .day-head [data-new-date]::after,
  body[data-skin="island"] .isl-pin::after { left: 17px; top: 10px; }
  body[data-skin="island"] .week-day > .isl-pin { top: 8px; right: 140px; }
}

/* ==========================================================================
   互動第 3 批：分類小旗、望遠鏡搜尋（島嶼亮起／起霧）、手機上方三列、⋯ 選單、備忘錄面板
   ========================================================================== */
@media screen {
  /* 分類小旗 */
  body[data-skin="island"] .isl-flags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
  }
  body[data-skin="island"] .isl-flag {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 34px;
    padding: 0 11px 0 9px;
    border: 0;
    border-radius: 999px;
    color: var(--text);
    background: var(--surface-strong);
    box-shadow: 0 3px 8px var(--clay-drop), inset 0 2px 0 var(--clay-hi), inset 0 -2px 0 var(--clay-lo);
    font-size: 12.5px;
    font-weight: 700;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    transition: opacity .15s ease, filter .15s ease;
  }
  body[data-skin="island"] .isl-flag i {
    width: 10px;
    height: 14px;
    display: inline-block;
    border-left: 2px solid var(--isl-trunk);
    background: var(--c);
    clip-path: polygon(0 0, 100% 25%, 0 50%);
  }
  body[data-skin="island"] .isl-flag.off { opacity: .4; filter: grayscale(.7); }
  body[data-skin="island"] .isl-flag-reset { color: var(--primary); }

  /* 望遠鏡搜尋：有結果的島亮起，其他起霧 */
  body[data-skin="island"] .month-day.isl-hit,
  body[data-skin="island"] .week-day.isl-hit {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--isl-lamp) 80%, transparent), 0 0 22px color-mix(in srgb, var(--isl-lamp) 55%, transparent);
  }
  body[data-skin="island"] .month-day.isl-fog,
  body[data-skin="island"] .week-day.isl-fog { opacity: .38; filter: grayscale(.5) blur(.3px); }

  /* 手機才用的節點，桌機先藏起來 */
  body[data-skin="island"] #islThemeBtn,
  body[data-skin="island"] #islSkinBtn,
  body[data-skin="island"] #islMoreBtn,
  body[data-skin="island"] #islRowB,
  body[data-skin="island"] #islMemoBtn { display: none; }
}

@media screen and (max-width: 760px) {
  /* 品牌列收進 ⋯ 選單；「今天」用底部燈塔、選日期改點標題 */
  body[data-skin="island"] .brand.brand-mobile,
  body[data-skin="island"] #todayBtn,
  body[data-skin="island"] #jumpDateBtn { display: none; }
  body[data-skin="island"] .controls .field:has(#categoryFlags) { display: none; }

  /* 上方變成一張軟陶板 */
  body[data-skin="island"] .main > .toolbar {
    gap: 8px;
    padding: 10px 10px 8px;
    border-radius: 22px;
    background: var(--surface-strong);
    box-shadow: 0 8px 18px var(--clay-drop), inset 0 2px 0 var(--clay-hi), inset 0 -3px 0 var(--clay-lo);
  }
  /* 第一列：‹ 標題 › 主題 換造型 ⋯（標題下面一行小字：農曆＋天氣）。撐滿整列，窄螢幕時標題字略縮 */
  body[data-skin="island"] .calendar-nav {
    display: grid;
    width: 100%;
    grid-template-columns: 34px minmax(0, max-content) minmax(0, 1fr) 34px 42px 42px 42px;
    grid-template-rows: auto auto;
    column-gap: 4px;
    row-gap: 0;
    align-items: center;
  }
  body[data-skin="island"] #prevBtn { grid-column: 1; grid-row: 1 / span 2; }
  body[data-skin="island"] #nextBtn { grid-column: 4; grid-row: 1 / span 2; }
  body[data-skin="island"] #islThemeBtn { grid-column: 5; grid-row: 1 / span 2; font-size: 19px; }
  body[data-skin="island"] #islSkinBtn { grid-column: 6; grid-row: 1 / span 2; }
  body[data-skin="island"] #islMoreBtn { grid-column: 7; grid-row: 1 / span 2; }
  body[data-skin="island"] #prevBtn,
  body[data-skin="island"] #nextBtn { min-width: 0; width: 34px; padding: 0; }
  body[data-skin="island"] #islScopeBtn,
  body[data-skin="island"] #islThemeBtn,
  body[data-skin="island"] #islSkinBtn,
  body[data-skin="island"] #islMoreBtn {
    display: grid;
    place-items: center;
    width: 42px;
    height: 44px;
    min-width: 0;
    padding: 0;
    color: var(--muted);
  }
  body[data-skin="island"] #islScopeBtn svg,
  body[data-skin="island"] #islSkinBtn svg,
  body[data-skin="island"] #islMoreBtn svg { width: 24px; height: 24px; }
  body[data-skin="island"] #islScopeBtn[aria-pressed="true"] {
    background: color-mix(in srgb, var(--primary) 16%, var(--surface));
    box-shadow: inset 0 2px 5px var(--clay-sink);
  }
  body[data-skin="island"] .calendar-nav #currentTitle {
    grid-column: 2 / 4;
    grid-row: 1;
    width: auto;
    min-width: 0;
    margin: 0;
    font-size: clamp(15px, 4.3vw, 17px);
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  body[data-skin="island"] #lunarDayLabel { grid-column: 2; grid-row: 2; min-width: 0; font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  body[data-skin="island"] #weatherDayLabel { grid-column: 3; grid-row: 2; font-size: 11.5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  body[data-skin="island"] #jumpDateInput:not(.picker-hidden) { grid-column: 1 / -1; grid-row: 3; }

  /* 第二列：望遠鏡＋分類小旗（小旗橫向捲動） */
  body[data-skin="island"] #islRowB {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
  }
  body[data-skin="island"] #islRowB > #islScopeBtn { flex: none; }
  body[data-skin="island"] #islFlagsTop {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 2px;
    scrollbar-width: none;
  }
  body[data-skin="island"] #islFlagsTop::-webkit-scrollbar { display: none; }
  body[data-skin="island"] #islFlagsTop:empty { display: none; }

  /* 第三列（只有日檢視）：清單／時間軸＋備忘鈕；其餘工具收進 ⋯ */
  body[data-skin="island"] .toolbar-actions > :not(#dayModeSwitch):not(#islMemoBtn) { display: none !important; }
  body[data-skin="island"] .toolbar-actions.isl-rowc-empty { display: none; }
  body[data-skin="island"] .toolbar-actions { flex-wrap: nowrap; }
  body[data-skin="island"] #dayModeSwitch { flex: none; }
  body[data-skin="island"] #islMemoBtn:not([hidden]) {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex: 0 1 auto;
    overflow: hidden;
    padding: 0 12px;
    font-size: 13px;
    font-weight: 700;
  }
  body[data-skin="island"] #islMemoBtn svg { width: 20px; height: 20px; flex: none; }
  body[data-skin="island"] #islMemoBtn em {
    min-width: 0;
    max-width: 130px;
    overflow: hidden;
    color: var(--muted);
    font-style: normal;
    font-weight: 600;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  /* 搜尋與篩選：平常收起，點望遠鏡才出現（不顯示收合標題） */
  body[data-skin="island"]:not(.isl-searching) .main > .controls { display: none; }
  body[data-skin="island"].isl-searching .controls > .controls-heading { display: none; }

  /* 每日備忘錄：平常收起，點「備忘」從下方拉出 */
  body[data-skin="island"]:not(.isl-memo-open) .main > .daily-memo { display: none; }
  body[data-skin="island"].isl-memo-open .main > .daily-memo {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 610;
    max-height: 80vh;
    overflow-y: auto;
    margin: 0;
    padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
    border-radius: 26px 26px 0 0;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, .22);
    animation: isl-sheet-up .25s cubic-bezier(.3, 1.2, .5, 1);
  }
  body[data-skin="island"].isl-memo-open .daily-memo > .daily-memo-head::after { content: '✕'; }

  /* ⋯ 選單（下方拉出） */
  .isl-dim {
    position: fixed;
    inset: 0;
    z-index: 600;
    background: rgba(20, 20, 30, .32);
  }
  .isl-dim[hidden] { display: none; }
  .isl-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 610;
    max-height: 80vh;
    overflow-y: auto;
    padding: 8px 14px calc(18px + env(safe-area-inset-bottom));
    border-radius: 26px 26px 0 0;
    color: var(--text);
    background: var(--surface-strong);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, .22);
    animation: isl-sheet-up .25s cubic-bezier(.3, 1.2, .5, 1);
  }
  .isl-sheet[hidden] { display: none; }
  @keyframes isl-sheet-up { from { transform: translateY(40px); opacity: .4; } }
  .isl-grab { width: 40px; height: 5px; margin: 2px auto 10px; border-radius: 3px; background: var(--border); }
  .isl-sheet-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; }
  .isl-sheet-brand img { border-radius: 10px; }
  .isl-sheet-brand small { display: block; color: var(--muted); font-size: 11.5px; font-weight: 600; }
  .isl-sheet h4 { margin: 14px 0 6px; color: var(--muted); font-size: 12px; letter-spacing: .05em; }
  .isl-grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
  .isl-grid4 button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 72px;
    padding: 8px 2px;
    border: 0;
    border-radius: 16px;
    color: var(--text);
    background: var(--surface-soft);
    font: inherit;
    font-size: 12px;
    font-weight: 700;
  }
  .isl-grid4 button span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .isl-grid4 button svg { width: 26px; height: 26px; }
  .isl-grid4 button.danger { color: var(--danger); }
  .isl-sheet-more {
    width: 100%;
    min-height: 46px;
    margin-top: 12px;
    border: 0;
    border-radius: 14px;
    color: var(--text);
    background: var(--surface-soft);
    font: inherit;
    font-weight: 800;
  }
}

/* 年檢視每天的農曆／節日小字：深綠格與今天的主色格上改用白字 */
@media screen {
  body[data-skin="island"] .mini-day.mh-2 .mini-day-sub,
  body[data-skin="island"] .mini-day.mh-3 .mini-day-sub,
  body[data-skin="island"] .mini-day.today .mini-day-sub,
  body[data-skin="island"] .mini-day.mh-2.holiday .mini-day-num,
  body[data-skin="island"] .mini-day.mh-3.holiday .mini-day-num,
  body[data-skin="island"] .mini-day.today.holiday .mini-day-num { color: inherit; opacity: .92; }
}

/* ⋯ 選單「檢視」：目前所在的檢視以主色框標示 */
@media screen and (max-width: 760px) {
  .isl-grid4 button.on { box-shadow: inset 0 0 0 2px var(--primary); }
}

/* ==========================================================================
   互動第 4 批：丟進海裡＋撈回來、桌機拖進漩渦、手機長按／桌機右鍵行程選單
   ========================================================================== */
@media screen {
  /* 撈回來：畫面下方的提示條，5 秒倒數 */
  .isl-undo-bar {
    position: fixed;
    left: 50%;
    bottom: 24px;
    z-index: 560;
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: min(460px, calc(100vw - 24px));
    padding: 10px 10px 12px 16px;
    overflow: hidden;
    transform: translateX(-50%);
    border-radius: 18px;
    color: var(--surface-strong);
    background: color-mix(in srgb, var(--text) 92%, transparent);
    box-shadow: 0 10px 26px rgba(0, 0, 0, .25);
    font-size: 14px;
    animation: isl-undo-up .25s cubic-bezier(.3, 1.2, .5, 1);
  }
  .isl-undo-bar[hidden] { display: none; }
  .isl-undo-text { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .isl-undo-bar button {
    flex: none;
    min-height: 40px;
    padding: 0 14px;
    border: 0;
    border-radius: 12px;
    color: #fff;
    background: var(--primary);
    font: inherit;
    font-weight: 800;
  }
  .isl-undo-timer {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 3px;
    width: 100%;
    background: var(--primary);
    transform-origin: 0 50%;
    animation: isl-undo-countdown 5s linear forwards;
  }
  @keyframes isl-undo-countdown { to { transform: scaleX(0); } }
  @keyframes isl-undo-up { from { transform: translate(-50%, 30px); opacity: .4; } }

  /* 漩渦：拖曳行程時才從底部浮出 */
  .isl-whirl {
    position: fixed;
    left: 50%;
    bottom: -140px;
    z-index: 550;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transform: translateX(-50%);
    transition: bottom .25s cubic-bezier(.3, 1.3, .5, 1);
    pointer-events: none;
  }
  body.isl-task-dragging .isl-whirl { bottom: 22px; pointer-events: auto; }
  .isl-whirl-sea {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    background:
      radial-gradient(ellipse at center, var(--isl-shade) 0 12%, transparent 13%),
      repeating-conic-gradient(from 0deg, var(--isl-sea) 0 20deg, var(--isl-sea-hi) 20deg 40deg);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--isl-sea-hi) 60%, transparent), 0 10px 24px rgba(0, 0, 0, .25);
    animation: isl-whirl-spin 2.4s linear infinite;
    transition: scale .15s ease;
  }
  .isl-whirl.over .isl-whirl-sea { scale: 1.18; box-shadow: 0 0 0 5px color-mix(in srgb, var(--danger) 55%, transparent), 0 12px 28px rgba(0, 0, 0, .3); }
  .isl-whirl-label {
    padding: 3px 10px;
    border-radius: 999px;
    color: var(--text);
    background: var(--surface-strong);
    box-shadow: 0 3px 8px rgba(0, 0, 0, .15);
    font-size: 12px;
    font-weight: 700;
  }
  @keyframes isl-whirl-spin { to { rotate: 360deg; } }

  /* 行程選單：桌機是游標旁的小選單 */
  .isl-task-menu {
    position: fixed;
    z-index: 620;
    width: 260px;
    padding: 10px;
    border-radius: 18px;
    color: var(--text);
    background: var(--surface-strong);
    box-shadow: 0 14px 34px rgba(0, 0, 0, .22);
  }
  .isl-task-menu[hidden] { display: none; }
  .isl-task-menu-title { margin: 0 4px 8px; overflow: hidden; font-weight: 800; white-space: nowrap; text-overflow: ellipsis; }
  .isl-task-menu-acts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .isl-task-menu-acts button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 62px;
    padding: 6px 2px;
    border: 0;
    border-radius: 14px;
    color: var(--text);
    background: var(--surface-soft);
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
  }
  .isl-task-menu-acts button:hover,
  .isl-task-menu-acts button:focus-visible { background: color-mix(in srgb, var(--primary) 12%, var(--surface-soft)); }
  .isl-task-menu-acts button.danger { color: var(--danger); }
  .isl-task-menu-acts svg { width: 26px; height: 26px; }
  /* 手機：從下方拉出 */
  .isl-task-menu.as-sheet {
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    padding: 14px 14px calc(18px + env(safe-area-inset-bottom));
    border-radius: 26px 26px 0 0;
    animation: isl-task-sheet-up .25s cubic-bezier(.3, 1.2, .5, 1);
  }
  .isl-task-menu.as-sheet .isl-task-menu-acts button { min-height: 76px; font-size: 13px; }
  @keyframes isl-task-sheet-up { from { transform: translateY(40px); opacity: .4; } }

  /* 群島手機：長按行程卡不要跳出系統選字選單 */
  body[data-skin="island"] .task-card { -webkit-touch-callout: none; }
}

@media screen and (max-width: 760px) {
  /* 撈回來提示條避開右下角新增鈕與底部導航 */
  .isl-undo-bar { left: 12px; right: 84px; bottom: calc(118px + env(safe-area-inset-bottom)); max-width: none; transform: none; animation-name: isl-undo-up-m; }
  @keyframes isl-undo-up-m { from { transform: translateY(30px); opacity: .4; } }
}

/* 修第 1 批：手機側欄兩欄被「不換行標題＋徽章」撐寬、整頁溢出被瀏覽器縮小。兩欄固定各半，標題超出就裁掉（徽章先縮成…） */
@media screen and (max-width: 760px) {
  body[data-skin="island"] .sidebar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body[data-skin="island"] .sidebar > .panel { min-width: 0; }
  body[data-skin="island"] [data-isl-panel] > h2 { overflow: hidden; }
}

/* 超窄手機（≤380px，例如 360px）：第一列間距與標題字再收一點，標題「11月14日 週六」才放得下 */
@media screen and (max-width: 380px) {
  body[data-skin="island"] .calendar-nav { column-gap: 2px; }
  body[data-skin="island"] .calendar-nav #currentTitle { font-size: 14px; letter-spacing: -.2px; }
}

/* ==========================================================================
   互動第 5 批：地圖縮放切換檢視（Ctrl＋滾輪／觸控板捏合、手機兩指捏合）
   ========================================================================== */
@media screen {
  /* 群島造型的年、月檢視：兩指捏合交給 app 切換檢視（不整頁縮放）；週、日檢視保留瀏覽器兩指放大。單指捲動照常 */
  body[data-skin="island"] #calendarView:has(.year-grid),
  body[data-skin="island"] #calendarView:has(.month-grid) { touch-action: pan-x pan-y; }
  .isl-zoom-tip {
    position: fixed;
    left: 50%;
    top: 42%;
    z-index: 640;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 999px;
    color: #fff;
    background: color-mix(in srgb, var(--primary) 88%, transparent);
    box-shadow: 0 10px 26px rgba(0, 0, 0, .25);
    font-size: 16px;
    font-weight: 800;
    opacity: 0;
    transform: translate(-50%, -50%) scale(.9);
    pointer-events: none;
  }
  .isl-zoom-tip svg { width: 26px; height: 26px; }
  .isl-zoom-tip.show { animation: isl-zoom-tip 1.1s ease forwards; }
  @keyframes isl-zoom-tip {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(.85); }
    18% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    70% { opacity: 1; }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(1.04); }
  }
}
