:root{
  --bg:#0b0b0d; --surface:#141418; --surface2:#1c1c22; --line:#2a2a33;
  --text:#ece6d8; --muted:#a09a8c; --gold:#d9b45b; --gold2:#f0d488;
  --jade:#7fb89b; --accent:#8b7fd4; --shadow:rgba(0,0,0,.5);
  --r:14px; --maxw:860px;
}
html[data-theme="light"]{
  --bg:#faf8f3; --surface:#fff; --surface2:#f2eee4; --line:#ddd7c8;
  --text:#2a251c; --muted:#6b6455; --gold:#9a7420; --gold2:#7a5c14;
  --jade:#2f7a55; --accent:#5b4fa8; --shadow:rgba(60,50,20,.12);
}
*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  background:var(--bg); color:var(--text);
  font-family:"Noto Sans TC","PingFang TC","Microsoft JhengHei","Segoe UI",system-ui,sans-serif;
  line-height:1.7; -webkit-font-smoothing:antialiased; min-height:100vh;
}
#app{max-width:var(--maxw); margin:0 auto; padding:0 16px 40px}
.hidden{display:none !important}

.topbar{display:flex; align-items:center; justify-content:space-between; gap:12px; padding:18px 0 14px; border-bottom:1px solid var(--line); flex-wrap:wrap}
.brand{display:flex; align-items:center; gap:12px}
.brand-mark{font-size:30px; color:var(--gold); line-height:1}
.brand-text{display:flex; flex-direction:column; line-height:1.2}
.brand-text strong{font-size:19px; font-weight:600; color:var(--gold2); letter-spacing:.5px}
.brand-text small{font-size:11px; color:var(--muted); letter-spacing:1px}
.top-actions{display:flex; align-items:center; gap:8px; flex-wrap:wrap}
select,button{font-family:inherit; font-size:13px}
#lang-select{background:var(--surface); color:var(--text); border:1px solid var(--line); border-radius:8px; padding:7px 8px}
.icon-btn{background:var(--surface); color:var(--gold); border:1px solid var(--line); border-radius:8px; width:34px; height:34px; cursor:pointer; font-size:16px}
.sync-box{display:flex; align-items:center; gap:6px}
.sync-status{color:var(--muted); font-size:16px; width:14px; text-align:center}
.sync-status.on{color:var(--jade)}
.login-btn{background:var(--gold); color:#1a1408; border:none; border-radius:8px; padding:7px 12px; font-weight:600; cursor:pointer}
.login-btn:hover{background:var(--gold2)}

.tabs{display:flex; gap:4px; overflow-x:auto; padding:12px 0; border-bottom:1px solid var(--line); position:sticky; top:0; background:var(--bg); z-index:5}
.tab{background:transparent; color:var(--muted); border:none; padding:9px 14px; border-radius:8px; cursor:pointer; white-space:nowrap}
.tab.active{background:var(--surface2); color:var(--gold2); font-weight:600}

.main{padding:22px 0; min-height:50vh}
h1{font-size:24px; color:var(--gold2); margin:0 0 6px; font-weight:600}
h2{font-size:18px; color:var(--text); margin:26px 0 10px; font-weight:600}
h3{font-size:15px; color:var(--gold); margin:22px 0 8px; font-weight:600}
p{margin:10px 0; color:var(--text)}
.lead{color:var(--muted); font-size:14px; margin-bottom:20px}

.card{background:var(--surface); border:1px solid var(--line); border-radius:var(--r); padding:20px; margin:14px 0}
.card.ref{border-color:#7a5c2a; background:linear-gradient(180deg,rgba(217,180,91,.06),transparent)}
.badge{display:inline-block; font-size:11px; padding:3px 9px; border-radius:20px; background:var(--surface2); color:var(--muted); border:1px solid var(--line); margin-left:8px}
.badge.ref{color:var(--gold); border-color:var(--gold)}

.grid{display:grid; grid-template-columns:repeat(auto-fill,minmax(160px,1fr)); gap:12px; margin:14px 0}
.tile{background:var(--surface); border:1px solid var(--line); border-radius:var(--r); padding:18px 14px; cursor:pointer; text-align:center; transition:border-color .15s,transform .15s}
.tile:hover{border-color:var(--gold); transform:translateY(-2px)}
.tile .ic{font-size:26px; color:var(--gold); display:block; margin-bottom:8px}
.tile .ttl{font-size:14px; color:var(--text); font-weight:600}
.tile .sub{font-size:11px; color:var(--muted); margin-top:4px}
.tile.ref .ic{color:var(--accent)}

.steps{counter-reset:st; list-style:none; padding:0; margin:12px 0}
.steps li{position:relative; padding:10px 0 10px 38px; border-bottom:1px dashed var(--line); color:var(--text)}
.steps li:before{counter-increment:st; content:counter(st); position:absolute; left:0; top:10px; width:24px; height:24px; border-radius:50%; background:var(--surface2); border:1px solid var(--gold); color:var(--gold); font-size:12px; display:flex; align-items:center; justify-content:center}
.bullets{padding-left:20px; color:var(--text)}
.bullets li{margin:6px 0}
.note{background:var(--surface2); border-left:3px solid var(--gold); padding:12px 16px; border-radius:0 8px 8px 0; margin:14px 0; font-size:14px; color:var(--muted)}
.notice{background:rgba(217,180,91,.1); border:1px solid var(--gold); border-radius:10px; padding:14px 16px; margin:14px 0; color:var(--gold2); font-size:14px}

.audio-row{display:flex; align-items:center; gap:12px; background:var(--surface2); border:1px solid var(--line); border-radius:10px; padding:12px; margin:10px 0; flex-wrap:wrap}
.audio-row .a-title{flex:1; min-width:160px; font-size:13px; color:var(--text)}
.audio-row audio{width:100%; height:36px; margin-top:6px}

.counter-panel{display:grid; grid-template-columns:repeat(auto-fit,minmax(140px,1fr)); gap:12px; margin:16px 0}
.stat{background:var(--surface); border:1px solid var(--line); border-radius:var(--r); padding:18px; text-align:center}
.stat .num{font-size:30px; color:var(--gold2); font-weight:600; line-height:1.2}
.stat .lbl{font-size:12px; color:var(--muted); margin-top:4px}
.count-list{display:grid; grid-template-columns:repeat(auto-fill,minmax(150px,1fr)); gap:10px; margin:14px 0}
.count-item{background:var(--surface); border:1px solid var(--line); border-radius:10px; padding:12px; display:flex; align-items:center; gap:8px; flex-wrap:wrap}
.count-item .nm{flex:1; font-size:12px; color:var(--text); min-width:80px}
.count-item .val{color:var(--gold2); font-weight:600; font-size:15px}
.mini-btn{background:var(--surface2); color:var(--gold); border:1px solid var(--line); border-radius:6px; width:30px; height:30px; cursor:pointer; font-size:15px}
.primary-btn{background:var(--gold); color:#1a1408; border:none; border-radius:8px; padding:10px 18px; font-weight:600; cursor:pointer; margin:6px 4px 6px 0}

textarea{width:100%; min-height:120px; background:var(--surface); color:var(--text); border:1px solid var(--line); border-radius:10px; padding:12px; font-family:inherit; font-size:14px; resize:vertical}
.note-entry{background:var(--surface); border:1px solid var(--line); border-radius:10px; padding:14px; margin:10px 0}
.note-entry .meta{font-size:11px; color:var(--muted); display:flex; justify-content:space-between; align-items:center}
.note-entry .body{white-space:pre-wrap; margin-top:8px; color:var(--text)}

.modal{position:fixed; inset:0; z-index:50; display:flex; align-items:center; justify-content:center; padding:20px}
.modal-backdrop{position:absolute; inset:0; background:rgba(0,0,0,.7)}
.modal-card{position:relative; background:var(--surface); border:1px solid var(--gold); border-radius:16px; max-width:560px; width:100%; max-height:88vh; overflow-y:auto; padding:24px; box-shadow:0 20px 60px var(--shadow)}
.modal-close{position:absolute; top:12px; right:12px; background:var(--surface2); color:var(--muted); border:1px solid var(--line); border-radius:8px; width:32px; height:32px; cursor:pointer}
.sym-hero{display:flex; gap:20px; align-items:flex-start; flex-wrap:wrap}
.sym-hero img{width:180px; height:180px; object-fit:contain; background:#fff; border-radius:10px; padding:8px}
.sym-info{flex:1; min-width:200px}
.sym-name{font-size:24px; color:var(--gold2); font-weight:600; margin:0}
.sym-pron{color:var(--muted); font-size:13px; margin:4px 0 14px}

.footer{border-top:1px solid var(--line); padding:20px 0; margin-top:30px; color:var(--muted); font-size:11px; text-align:center}
.footer p{margin:4px 0; color:var(--muted)}
@media(max-width:600px){.brand-text strong{font-size:16px}.topbar{padding:12px 0}h1{font-size:20px}.modal-card{padding:18px}.sym-hero img{width:140px;height:140px}}
