:root {
  --bg: #14161f;
  --panel: #1c2030;
  --panel-2: #242a3d;
  --line: #343b55;
  --text: #dfe4f0;
  --muted: #8d95ad;
  --accent: #6aa7ff;
  --ok: #4cc38a;
  --warn: #e8b84a;
  --bad: #e5534b;
  --plate: #1d2340;
  --plate-line: #8fa0d8;
  --pix: "Consolas", "Courier New", monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 "Microsoft JhengHei", "PingFang TC", "Noto Sans TC", system-ui, sans-serif;
}
.muted { color: var(--muted); font-size: 13px; }
.sub { font-size: 13px; color: var(--muted); font-weight: 400; margin-left: 6px; }

/* ---------- 標題列 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px;
  padding: 10px 18px;
  background: var(--plate);
  border-bottom: 4px solid #0c0f1c;
  box-shadow: inset 0 -2px 0 var(--plate-line);
}
.brand { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; }
h1 { margin: 0; font: 700 22px/1.2 var(--pix); letter-spacing: 3px; color: #fff; text-shadow: 2px 2px 0 #000; }
.chair { font-size: 16px; letter-spacing: 2px; color: #ffd76a; }
.actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.pix-btn {
  background: #2b3358; color: #fff; border: 0; padding: 6px 14px; cursor: pointer;
  font-family: inherit; font-size: 14px; font-weight: 700; line-height: 1.3;
  box-shadow: inset -3px -3px 0 #161b33, inset 3px 3px 0 #4a578f, 0 0 0 2px #0c0f1c;
}
.pix-btn:hover { filter: brightness(1.15); }
.pix-btn:active { box-shadow: inset 3px 3px 0 #161b33, 0 0 0 2px #0c0f1c; }
.pix-btn:disabled { opacity: .55; cursor: wait; }
#refresh { background: #2f7a55; box-shadow: inset -3px -3px 0 #1a4a33, inset 3px 3px 0 #4fb383, 0 0 0 2px #0c0f1c; }

/* ---------- 分頁 ---------- */
.tabs {
  display: flex; gap: 6px; padding: 10px 18px 0; overflow-x: auto;
  border-bottom: 2px solid var(--line); background: var(--bg);
}
.tab {
  flex: none; background: var(--panel); color: var(--muted); border: 2px solid var(--line); border-bottom: 0;
  padding: 6px 16px; font: inherit; cursor: pointer;
}
.tab.active { background: var(--panel-2); color: #fff; border-color: var(--plate-line); }
main { max-width: 1400px; margin: 0 auto; padding: 16px 18px 40px; }
.tab-page { display: none; }
.tab-page.active { display: block; }

/* ---------- 辦公室 ---------- */
.office-viewport {
  position: relative; overflow: auto;
  height: calc(100vh - 170px); min-height: 360px;
  background: #0e1018; border: 4px solid #0c0f1c; box-shadow: 0 0 0 2px var(--line);
}
.office-sizer { position: relative; margin: 0 auto; }
.office { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
#office-bg { display: block; image-rendering: pixelated; }
.zoom-pad {
  position: sticky; top: 8px; left: 8px; z-index: 10; float: left; width: 0; height: 0;
}
.zoom-pad .pix-btn { display: block; width: 40px; height: 40px; margin-bottom: 8px; padding: 0; font-size: 22px; }
.zoom-pad .pix-btn.small { font-size: 16px; }
.legend { margin-top: 8px; }
.lg.g { color: #3fd16b; } .lg.y { color: #f2c94c; } .lg.r { color: #ef4b4b; }

.station {
  position: absolute; width: 172px; height: 236px;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  cursor: pointer;
}
.bubble {
  position: relative; width: 160px; margin-bottom: 9px; padding: 4px 7px 5px;
  background: #fffdf3; color: #2a2a35; font-size: 12.5px; line-height: 1.35;
  box-shadow: 0 0 0 2px #2a2a35, 3px 3px 0 2px rgba(0,0,0,.35);
}
.bubble::after {
  content: ""; position: absolute; left: 50%; bottom: -8px; margin-left: -5px;
  border: 5px solid transparent; border-top: 6px solid #2a2a35;
}
.bubble .task {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 1.35em; word-break: break-all;
}
.bubble .task.empty { color: #9a98a8; }
.pbar { display: flex; align-items: center; gap: 5px; margin-top: 3px; font: 700 11px/1 var(--pix); color: #2b5fb8; }
.pbar .track { flex: 1; height: 7px; background: #d8def0; box-shadow: 0 0 0 1px #2a2a35; }
.pbar .fill { height: 100%; background: #3b82f6; box-shadow: inset 0 -2px 0 #1d4fb0; }

.plate {
  background: var(--plate); border: 2px solid var(--plate-line); box-shadow: 0 0 0 2px #0c0f1c;
  padding: 1px 9px 2px; text-align: center; line-height: 1.3; max-width: 170px;
}
.plate .name { color: #fff; font-size: 14px; font-weight: 700; white-space: nowrap; }
.plate .title { color: #8fb6ff; font-size: 12px; white-space: nowrap; }

.hp { display: flex; align-items: center; gap: 4px; height: 16px; margin: 5px 0 1px; font: 700 11px/1 var(--pix); }
.pheart { width: 14px; height: 12px; image-rendering: pixelated; display: block; filter: drop-shadow(1px 1px 0 #000); }
.qheart { position: relative; display: block; }
.qheart .pheart { width: 21px; height: 18px; }
.qheart i {
  position: absolute; left: 0; right: 0; top: 0; text-align: center;
  font: 700 12px/16px var(--pix); font-style: normal; color: #6b4a00;
}
.hp .track { width: 72px; height: 9px; background: #2a1f1f; box-shadow: 0 0 0 2px #0c0f1c; display: flex; }
.hp .fill { height: 100%; box-shadow: inset 0 -3px 0 rgba(0,0,0,.25), inset 0 2px 0 rgba(255,255,255,.3); }
.hp .fill.g { background: #3fd16b; } .hp .fill.y { background: #f2c94c; } .hp .fill.r { background: #ef4b4b; }
.hp .val { color: #fff; text-shadow: 1px 1px 0 #000; }
.hp .est, .hp .hint { color: #ffe9a8; font: 11px/1.2 "Microsoft JhengHei", "PingFang TC", sans-serif; text-shadow: 1px 1px 0 #000; }
.hp .hint { max-width: 120px; }
.hp .standby { color: #cfd6ea; font-size: 12px; font-family: "Microsoft JhengHei", sans-serif; text-shadow: 1px 1px 0 #000; }

.sprite { position: relative; width: 96px; height: 84px; }
.sprite canvas { width: 96px; height: 84px; image-rendering: pixelated; display: block; }
.station.sleeping .sprite canvas { filter: grayscale(.85) brightness(.85); }
.station.macmini .bubble, .station.macmini .plate { filter: grayscale(1); opacity: .8; }
.station.macmini .sprite canvas { filter: grayscale(1) brightness(.8); }
.station.low .sprite canvas { animation: blink .9s steps(2, start) infinite; }
@keyframes blink { 50% { opacity: .35; } }

.fx { position: absolute; pointer-events: none; font-family: var(--pix); font-weight: 700; }
.fx.zzz { left: 58px; top: -6px; color: #cfe0ff; text-shadow: 1px 1px 0 #000; }
.fx.zzz span { position: absolute; animation: zz 2.4s linear infinite; opacity: 0; }
.fx.zzz span:nth-child(2) { animation-delay: .8s; font-size: 15px; }
.fx.zzz span:nth-child(3) { animation-delay: 1.6s; font-size: 18px; }
@keyframes zz { 0% { transform: translate(0, 10px); opacity: 0; } 20% { opacity: 1; } 100% { transform: translate(14px, -18px); opacity: 0; } }
.fx.alert {
  left: 41px; top: -14px; width: 14px; height: 18px; color: #fff; background: #e5263b; text-align: center;
  font-size: 14px; line-height: 18px; box-shadow: 0 0 0 2px #0c0f1c; animation: hop .6s steps(2) infinite;
}
@keyframes hop { 50% { transform: translateY(-3px); } }
.fx.sweat { width: 6px; height: 8px; background: #7cc8ff; box-shadow: 0 0 0 1px #1f5d8f; animation: drip 1s linear infinite; }
.fx.sweat.s1 { left: 30px; top: 6px; }
.fx.sweat.s2 { left: 62px; top: 2px; animation-delay: .5s; }
@keyframes drip { 0% { transform: translateY(0); opacity: 1; } 100% { transform: translateY(12px); opacity: 0; } }

/* 小卡片 */
.tip {
  position: fixed; z-index: 50; width: 290px; max-width: calc(100vw - 16px);
  background: var(--plate); color: var(--text); padding: 10px 12px; font-size: 13px; line-height: 1.5;
  border: 2px solid var(--plate-line); box-shadow: 0 0 0 2px #0c0f1c, 6px 6px 0 rgba(0,0,0,.45);
  pointer-events: none;
}
.tip h3 { margin: 0 0 2px; font-size: 15px; color: #fff; }
.tip h4 { margin: 8px 0 2px; font-size: 13px; color: var(--accent); }
.tip .row { display: flex; justify-content: space-between; gap: 10px; }
.tip .row span:first-child { color: var(--muted); }
.tip .warn { color: var(--warn); font-size: 12px; }

/* ---------- 其他分頁（沿用第一版） ---------- */
.panel { background: var(--panel); border: 2px solid var(--line); padding: 16px 18px; }
h2 { font-size: 17px; margin: 0 0 12px; font-weight: 600; }
.panel-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.panel-head h2 { margin: 0; }
select {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
  padding: 4px 8px; font: inherit; margin-left: 6px;
}
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 500; font-size: 13px; }
td.check { text-align: center; }
#tab-progress th:nth-child(n+2):nth-child(-n+6) { text-align: center; }
#schedule-body td:nth-child(2) { white-space: normal; }
.yes { color: var(--ok); font-weight: 700; }
.no { color: #4a5262; }
.empty { color: var(--muted); padding: 14px 4px; }
.err { color: var(--bad); font-size: 13px; }
.badge { display: inline-block; padding: 1px 9px; font-size: 12px; background: var(--panel-2); }
.badge.draft { color: var(--muted); }
.badge.scheduled { color: var(--warn); }
.badge.published { color: var(--ok); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.tile { background: var(--panel-2); border: 1px solid var(--line); overflow: hidden; }
.tile img, .tile video { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: contain; background: #0b0d11; }
.tile audio { display: block; width: 100%; margin-top: 8px; }
.tile .audio-box { padding: 18px 10px 10px; }
.tile .meta { padding: 6px 10px 8px; font-size: 12px; color: var(--muted); word-break: break-all; }
.tile .meta b { color: var(--text); font-weight: 500; }

.bar { height: 10px; background: #2b3240; overflow: hidden; margin: 4px 0 2px; }
.bar > span { display: block; height: 100%; background: var(--accent); }
.metric { margin-bottom: 14px; }
.metric .label { display: flex; justify-content: space-between; }

/* ---------- 手機直式 ---------- */
@media (max-width: 600px) {
  .topbar { padding: 8px 12px; }
  h1 { font-size: 19px; }
  .chair { font-size: 14px; }
  .actions { width: 100%; justify-content: space-between; }
  .tabs { padding: 8px 10px 0; }
  .tab { padding: 6px 12px; }
  main { padding: 10px 8px 30px; }
  .office-viewport { height: calc(100vh - 190px); }
  .legend { font-size: 12px; }
  .panel { padding: 12px; }
}

/* v3：奶油色冒險公會，全部使用本機字型與原創 Canvas。 */
:root {--bg:#f7f1e7;--panel:#fffdf7;--panel-2:#f4eadc;--line:#d9c8b6;--text:#584b53;--muted:#796c73;--accent:#668da5;--ok:#41856c;--warn:#977021;--bad:#b85265;--plate:#f2d7b5;--plate-line:#b9977d;--pix:"Microsoft JhengHei",system-ui,sans-serif;}
body {background:radial-gradient(ellipse at top left,#fce3e9,transparent 55%),var(--bg);}
.topbar {background:#fffaf0ed;border-bottom:1px solid var(--line);box-shadow:0 3px 18px #8f736610;padding:17px 24px;}
h1 {color:#67555d;text-shadow:none;letter-spacing:1px;}
.chair {color:#8a705e;font-size:14px;letter-spacing:1px;}
.pix-btn,#refresh {color:#584b53;background:#d2e8db;border:1px solid #a6bcb0;border-radius:12px;box-shadow:0 3px 0 #adc3b5;padding:8px 15px;}
.pix-btn:active {box-shadow:none;transform:translateY(2px);}
.pix-btn:focus-visible,.tab:focus-visible,#happy-rabbit:focus-visible {outline:3px solid #9b718e;outline-offset:4px;}
.tabs {background:transparent;border:0;gap:10px;padding-top:18px;}
.tab {border:1px solid var(--line);border-radius:22px;padding:8px 20px;background:#fffaf0;}
.tab.active {background:#e8cad9;color:#604958;border-color:#c79fb4;box-shadow:0 3px 0 #d3b1c1;}
main {max-width:1200px;padding-top:22px;}
.guild-heading {display:flex;align-items:center;justify-content:space-between;gap:16px;margin:0 2px 18px;}
.eyebrow {font-size:10px;letter-spacing:3px;color:#92705d;font-weight:700;}
.guild-heading h2 {font-size:23px;margin:5px 0 3px;letter-spacing:1px;}
.guild-heading p {font-size:13px;color:var(--muted);margin:0;}
.guild-seal {background:#e0ebd9;color:#627953;border:1px solid #bfd0b3;border-radius:18px;padding:7px 15px;white-space:nowrap;font-size:12px;}
.office-viewport {height:calc(100vh - 290px);min-height:470px;background:#e9d9c2;border:7px solid #e1c1a0;border-radius:24px;box-shadow:0 0 0 1px #ba9579,0 12px 28px #a58a7020;}
#office-bg,.sprite canvas {image-rendering:auto;}
.bubble {border:1px solid #b9a8a5;border-radius:12px;background:#fffcf4;box-shadow:0 3px 0 #aa8e7826;padding:7px 9px;}
.bubble::after {border-top-color:#b9a8a5;}
.plate {border-radius:8px;border:1px solid #a8856b;background:linear-gradient(#f8e2bf,#e8c79e);box-shadow:0 3px 0 #a8886a44;padding:3px 9px;}
.plate .name {color:#614d47;font-size:13px;}.plate .title {color:#856850;font-size:11px;}
.pbar {color:#647e9d;font-size:10px;gap:4px;}.pbar b {font-size:9px;white-space:nowrap;}
.pbar .track,.hp .track {border-radius:8px;background:#e1d8cb;box-shadow:0 0 0 1px #a79285;overflow:hidden;}
.pbar .fill {display:block;background:linear-gradient(#c1e1ed,#86b2cf);box-shadow:inset 0 2px 0 #ffffff66;}
.hp .fill.g {background:#8bc6a4;}.hp .fill.y {background:#e9c875;}.hp .fill.r {background:#df8999;}
.hp .val,.hp .hint,.hp .est,.hp .standby {color:#65534e;text-shadow:none;}.hp .hint {font-size:10px;}
.pheart {filter:none;}.fx.zzz {color:#6e7994;text-shadow:1px 1px #fff;}
.tip {border:1px solid #b99e8d;border-radius:14px;background:#fffcf2;box-shadow:0 8px 30px #71565333;max-height:calc(100dvh - 16px);overflow:auto;pointer-events:auto;}
.tip h3 {color:#64515d;}.tip .warn {color:#916828;}
.panel,.tile {border-radius:16px;box-shadow:0 5px 18px #a58a7010;}.badge,select,.bar {border-radius:8px;}.bar {background:#e5ddcf;}
#happy-rabbit {position:absolute;width:72px;height:84px;padding:0;background:none;border:0;cursor:pointer;z-index:4;border-radius:40%;touch-action:manipulation;}
#happy-rabbit canvas {width:72px;height:84px;display:block;}
.rabbit-cheer {position:absolute;z-index:8;width:225px;background:#fff9ef;color:#975c78;border:1px solid #d1a7b6;border-radius:16px;padding:9px 12px;font-size:12px;text-align:center;pointer-events:none;box-shadow:0 4px 12px #a0786922;}
.rabbit-cheer.pop {animation:cheer-pop .35s ease-out;}@keyframes cheer-pop {from {transform:translateY(8px) scale(.85);opacity:0;}to {transform:none;opacity:1;}}
@media(max-width:600px) {.guild-heading h2 {font-size:18px;}.guild-seal {display:none;}.guild-heading {margin-bottom:14px;}.office-viewport {height:calc(100dvh - 315px);min-height:430px;border-width:4px;border-radius:16px;}.topbar {padding:12px;}.tabs {gap:7px;}.tab {padding:7px 14px;}.guild-heading p {font-size:12px;}}
.gpuline {display:flex;flex-wrap:wrap;justify-content:center;gap:2px 5px;max-width:170px;margin:1px 0 2px;font:700 10px/1.35 var(--pix);color:#5f6f86;}
.gpuline span {background:#eef3f6;border:1px solid #b9c7d2;border-radius:6px;padding:0 4px;white-space:nowrap;}
.gpuline .stale {background:#fbe3d9;border-color:#d99a87;color:#a1503c;font-family:"Microsoft JhengHei","PingFang TC",sans-serif;}
@media(prefers-reduced-motion:reduce) {*,*::before,*::after {animation:none!important;}}
