/* ── 顏色變數：改這裡就能換整站配色 ── */
:root {
  --bg: #08080c; --panel: #14141c; --line: #2a2a36;
  --fg: #f2f2f5; --mute: #9090a0;
  --S: #ec008c; --L: #3fc8b0; --M: #ffd23f;   /* 三種卡片的代表色 */
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font-family: Inter, "Noto Sans TC", sans-serif; line-height: 1.6;
}
/* 星空畫布固定在最底層，不擋滑鼠點擊 */
#sky { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }
main { position: relative; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }

/* 導覽列 */
.nav { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center;
  padding: 14px 20px; background: #08080ccc; backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.logo { font-weight: 800; letter-spacing: .08em; }
.links { display: flex; gap: 16px; align-items: center; font-size: 14px; }
.btn-line { border: 1px solid var(--line); padding: 6px 14px; border-radius: 99px; }

/* 音樂按鈕：三條小柱子在播放時會跳動 */
.music { display: flex; align-items: center; gap: 6px; background: none; border: 1px solid var(--line);
  border-radius: 99px; padding: 5px 12px; font-size: 11px; letter-spacing: .12em; }
.music em { font-style: normal; color: var(--mute); }
.music[aria-pressed="true"] { border-color: #fff; box-shadow: 0 0 14px #ffffff33; }
.music[aria-pressed="true"] em { color: var(--L); }
.eq { display: flex; align-items: flex-end; gap: 2px; height: 12px; }
.eq i { width: 2px; height: 4px; background: currentColor; }
.music[aria-pressed="true"] .eq i { animation: eq .8s ease-in-out infinite alternate; }
.eq i:nth-child(2) { animation-delay: .2s !important; }
.eq i:nth-child(3) { animation-delay: .4s !important; }
@keyframes eq { from { height: 3px } to { height: 12px } }
@media (max-width: 480px) { .music b { display: none; } }

/* 畫面切換：只顯示 body[data-view] 對應的那一個 */
.view { display: none; max-width: 1100px; margin: 0 auto; padding: 28px 16px 80px; }
body[data-view="home"] #view-home,
body[data-view="cards"] #view-cards,
body[data-view="app"] #view-app { display: block; }

/* 首頁 */
.hero { min-height: 70vh; display: grid; place-content: center; text-align: center; }
.hero h1 { font-size: clamp(56px, 13vw, 140px); line-height: .9; margin: 0; letter-spacing: -.03em;
  background: linear-gradient(180deg, #fff, #8a8a99); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sub { color: var(--mute); }
.pill { justify-self: center; margin-top: 16px; background: #fff; color: #000; font-weight: 700;
  padding: 12px 28px; border-radius: 99px; box-shadow: 0 0 30px #ec008c88; }

/* 分頁按鈕 */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 20px; }
.tab { background: var(--panel); border: 1px solid var(--line); padding: 6px 16px; border-radius: 99px; }
.tab.on { background: var(--c, #fff); color: #000; border-color: transparent; font-weight: 700; }

/* 卡片網格 */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 10px; text-align: left; transition: transform .2s, border-color .2s; }
.card:hover { transform: translateY(-3px); border-color: var(--c); }
.card .meta { padding: 8px 4px 2px; font-size: 14px; }
.card .meta i { font-style: normal; color: var(--c); font-weight: 800; margin-right: 6px; }

/* 卡片預覽小圖（全部用 CSS 畫，不需要圖檔） */
.thumb { aspect-ratio: 16/9; border-radius: 8px; overflow: hidden; position: relative; background: #1d1d26; }
.thumb.style-prev { padding: 10% 8%; display: flex; flex-direction: column; justify-content: center; }
.thumb.style-prev .t { font-weight: 800; font-size: 18px; }
.thumb.style-prev .dots { display: flex; gap: 4px; margin-top: 8px; }
.thumb.style-prev .dots span { width: 14px; height: 14px; border-radius: 50%; border: 1px solid #0002; }
.thumb .b { position: absolute; background: #ffffff30; border-radius: 3px; }
.thumb .b.hi { background: var(--L); }
.thumb.motion-prev { display: grid; place-items: center; }
.thumb.motion-prev .ball { width: 26%; aspect-ratio: 1; border-radius: 10px; background: var(--M); }
.card:hover .ball, .detail .ball { animation: var(--anim) 1.2s infinite; }
@keyframes M01 { from { opacity: 0 } to { opacity: 1 } }
@keyframes M02 { from { opacity: 0; transform: translateY(30px) } to { opacity: 1; transform: none } }
@keyframes M03 { 0% { transform: scale(.3) } 70% { transform: scale(1.15) } 100% { transform: scale(1) } }
@keyframes M04 { 0%,100% { transform: translateX(-40%) } 50% { transform: translateX(40%) } }

/* 工作台步驟 */
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 24px; }
.step { background: var(--panel); border: 1px solid var(--line); border-radius: 99px; padding: 8px; font-size: 14px; }
.step.on { background: #fff; color: #000; font-weight: 700; }
.field { display: block; margin: 14px 0; }
.field span { display: block; font-size: 13px; color: var(--mute); margin-bottom: 4px; }
input, textarea, select { width: 100%; background: var(--panel); color: var(--fg); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; font: inherit; }
textarea { min-height: 120px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.btn { background: #fff; color: #000; border: 0; border-radius: 99px; padding: 10px 22px; font-weight: 700; }
.btn.ghost { background: transparent; color: var(--fg); border: 1px solid var(--line); }
.slot { width: 100%; background: var(--panel); border: 1px dashed var(--line); border-radius: 14px; padding: 14px; text-align: left; }
.slot.filled { border-style: solid; border-color: var(--c); }
.pages { display: grid; gap: 10px; }
.page { display: grid; grid-template-columns: 50px 1fr 1fr 1fr 44px; gap: 8px; align-items: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.page.cur { border-color: #fff; }
.page .mini { border: 1px solid var(--line); border-radius: 8px; padding: 8px; font-size: 13px; background: transparent; text-align: left; }
.prompt { white-space: pre-wrap; background: #000; border: 1px solid var(--line); border-radius: 12px; padding: 16px;
  font-family: ui-monospace, monospace; font-size: 13px; max-height: 60vh; overflow: auto; }

/* 彈出視窗 */
.sheet { position: fixed; inset: 0; background: #000a; z-index: 10; display: grid; place-items: end center; }
.sheet[hidden] { display: none; }
.sheet-box { width: min(900px, 100%); max-height: 88vh; overflow: auto; background: #101018; border: 1px solid var(--line);
  border-radius: 20px 20px 0 0; padding: 18px; animation: M02 .3s ease-out; }
.sheet-box header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.x { background: none; border: 1px solid var(--line); border-radius: 50%; width: 34px; height: 34px; }
.detail { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; }
.detail ul { padding-left: 18px; color: var(--mute); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(80px); background: #fff; color: #000;
  padding: 10px 20px; border-radius: 99px; font-weight: 700; transition: transform .3s; z-index: 20; }
.toast.show { transform: translateX(-50%); }

/* 加上 print 畫面的切換規則 */
body[data-view="print"] #view-print { display: block; }

/* 掃描視窗 */
.scan-box { position: relative; aspect-ratio: 4/3; max-height: 60vh; margin: 0 auto; background: #000; border-radius: 14px; overflow: hidden; }
.scan-box video { width: 100%; height: 100%; object-fit: cover; }
.scan-frame { position: absolute; inset: 18% 22%; border: 2px solid #fffc; border-radius: 16px; box-shadow: 0 0 0 999px #0007; }
.scan-line { position: absolute; left: 22%; right: 22%; height: 2px; background: var(--S); box-shadow: 0 0 12px var(--S);
  animation: scanline 2s ease-in-out infinite alternate; }
@keyframes scanline { from { top: 19% } to { top: 81% } }
.scan-msg { text-align: center; color: var(--mute); margin: 12px 0 0; }
.scan-msg.ok { color: var(--L); font-weight: 700; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.hint-sm { font-size: 13px; color: var(--mute); margin-top: 10px; }
.mini.scan { display: grid; place-items: center; padding: 6px; }
.slot-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }

/* 列印卡片 */
.print-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin-top: 20px; }
.pcard { background: #fff; color: #111; border-radius: 12px; padding: 12px; display: grid; grid-template-columns: 1fr 92px;
  gap: 10px; align-items: center; border-top: 8px solid var(--c); break-inside: avoid; }
.pcard .id { font-weight: 900; font-size: 22px; color: var(--c); line-height: 1; }
.pcard .zh { font-weight: 700; margin-top: 4px; }
.pcard .k { font-size: 11px; color: #777; letter-spacing: .1em; }
.pcard .qr svg { width: 92px; height: 92px; display: block; }
@media print {
  body { background: #fff; }
  #sky, .nav, .no-print, .toast, .sheet { display: none !important; }
  .view { padding: 0; max-width: none; }
  .print-grid { grid-template-columns: repeat(3, 1fr); gap: 6mm; }
  .pcard { border: 1px dashed #999; border-top: 8px solid var(--c); -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

@media (max-width: 640px) {
  .hide-sm { display: none; }
  .detail { grid-template-columns: 1fr; }
  .page { grid-template-columns: 1fr; }
  .steps { grid-template-columns: repeat(2, 1fr); }
}
