/* Noto Sans TC 子集（scripts/build_font_subset.py 產生） */
@font-face {
  font-family: "Noto Sans TC";
  font-weight: 700;
  font-display: swap;
  src: url("./fonts/NotoSansTC-700.woff2") format("woff2");
}
@font-face {
  font-family: "Noto Sans TC";
  font-weight: 900;
  font-display: swap;
  src: url("./fonts/NotoSansTC-900.woff2") format("woff2");
}

/* 色票（與 js/palette.js 同步） */
:root {
  --sea: #6fbfc3;
  --bg: #8fcfd1;
  --soil: #c79a6b;
  --grass: #a8cf7c;
  --wall: #fff3e4;
  --accent: #e0703f;
  --text: #2a2420;
  --card: #fff8f1;
  --font: "Noto Sans TC", "PingFang TC", "Heiti TC", "Microsoft JhengHei", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font-family: var(--font); }
#stage { position: fixed; inset: 0; }
#stage canvas { display: block; touch-action: none; }
.error {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
  max-width: min(360px, calc(100% - 32px)); padding: 20px 24px; border-radius: 16px;
  background: var(--card); box-shadow: 0 8px 24px rgba(42, 36, 32, .18);
  font-weight: 700; line-height: 1.6; text-align: center;
}

/* 左上品牌標題卡 */
.brand {
  position: fixed; left: 16px; top: 16px; z-index: 2;
  padding: 12px 18px 12px 16px; border-radius: 16px;
  background: var(--card); box-shadow: 0 6px 18px rgba(42, 36, 32, .16);
  border-left: 6px solid var(--accent);
  pointer-events: none;
}
.brand h1 { margin: 0; font-size: 22px; font-weight: 900; letter-spacing: .02em; line-height: 1.2; }
.brand p { margin: 4px 0 0; font-size: 12px; font-weight: 700; opacity: .7; }
.brand .num { font-family: var(--mono); }
@media (max-width: 480px) {
  .brand { padding: 10px 14px 10px 12px; }
  .brand h1 { font-size: 18px; }
}

/* ---------- UI 層 ---------- */
.ui { position: fixed; inset: 0; pointer-events: none; z-index: 3; }
.ui > * { pointer-events: auto; }
.labels { position: absolute; inset: 0; pointer-events: none; }
.label {
  position: absolute; left: 0; top: 0; pointer-events: auto;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px 5px 6px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--card); color: var(--text); font: 700 13px/1 var(--font);
  box-shadow: 0 3px 10px rgba(42, 36, 32, .18); white-space: nowrap;
  transition: background .15s, color .15s;
}
.label-no { font-family: var(--mono); font-size: 11px; padding: 2px 5px; border-radius: 999px; background: var(--accent); color: #fff; }
.label.active, .label:hover { background: var(--accent); color: #fff; }
.label.dim { opacity: .4; }
.label.dim:hover { opacity: 1; }
.label.active .label-no, .label:hover .label-no { background: var(--card); color: var(--accent); }

.overview-btn {
  position: fixed; right: 16px; top: 16px; padding: 10px 16px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--card); color: var(--text); font: 900 14px/1 var(--font); box-shadow: 0 6px 18px rgba(42, 36, 32, .16);
}
.overview-btn:hover { background: var(--accent); color: #fff; }

.hint {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  padding: 8px 14px; border-radius: 999px; background: rgba(42, 36, 32, .72); color: #fff;
  font: 700 13px/1 var(--font); white-space: nowrap; transition: opacity .4s;
}
.hint.gone { opacity: 0; pointer-events: none; }

.card {
  position: fixed; left: 50%; bottom: 0; transform: translate(-50%, 110%);
  width: min(520px, calc(100% - 24px)); margin-bottom: 12px;
  padding: 16px 18px 14px; border-radius: 20px; background: var(--card); color: var(--text);
  box-shadow: 0 12px 32px rgba(42, 36, 32, .22); transition: transform .26s cubic-bezier(.2, .8, .2, 1);
  padding-bottom: calc(14px + env(safe-area-inset-bottom));
}
.card.open { transform: translate(-50%, 0); }
.card-head { display: flex; align-items: center; gap: 10px; }
.card-no { font-family: var(--mono); font-size: 12px; padding: 3px 7px; border-radius: 999px; background: var(--accent); color: #fff; }
.card-title { margin: 0; flex: 1; font-size: 20px; font-weight: 900; }
.card-close { border: 0; background: transparent; font: 700 24px/1 var(--font); color: var(--text); cursor: pointer; padding: 0 4px; opacity: .6; }
.card-close:hover { opacity: 1; }
.card-summary { margin: 8px 0 12px; font-size: 14px; font-weight: 700; opacity: .8; line-height: 1.5; }
.card-summary.pending { opacity: .55; }
.card-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0; }
.stat { background: #fff; border-radius: 12px; padding: 10px 8px; text-align: center; }
.stat dt { font-size: 12px; font-weight: 700; opacity: .65; white-space: nowrap; overflow: hidden; }
.card-stats.two-col { grid-template-columns: repeat(2, 1fr); }
.card-stats.single { grid-template-columns: 1fr; }
.stat dd { margin: 4px 0 0; font-size: 20px; font-weight: 700; }
.stat dd.num { font-family: var(--mono); }
.stat dd.pending { font-size: 14px; opacity: .55; }
.card-foot { display: flex; justify-content: space-between; gap: 10px; margin-top: 10px; font-size: 12px; font-weight: 700; opacity: .6; }
.card-updated { font-family: var(--mono); }
.card-flows::before { content: '⇢ '; color: var(--accent); }
.card-flows:empty { display: none; }
@media (max-width: 480px) {
  .card { padding: 14px 14px 12px; }
  .card-title { font-size: 18px; }
  .stat dd { font-size: 18px; }
  .label { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .card, .hint, .label { transition: none; }
}
