:root{
  --bg:#EEF1F6; --surface:#FFFFFF; --ink:#1B2331; --muted:#5B6577; --line:#D3DAE4;
  --sticker:#FFD84A; --pink:#FF7EA6; --focus:#2F6FEB;
  --sans:system-ui,-apple-system,"PingFang TC","Noto Sans TC","Microsoft JhengHei",sans-serif;
  --glyph:system-ui,-apple-system,"PingFang TC","Noto Sans TC","Microsoft JhengHei","Segoe UI Symbol","Apple Symbols","Noto Sans Symbols 2","Noto Sans Symbols","Apple Color Emoji","Segoe UI Emoji","Noto Color Emoji",sans-serif;
  --emoji:"Apple Color Emoji","Segoe UI Emoji","Noto Color Emoji",var(--glyph);
  --r:10px;
}
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{margin:0;background:var(--bg);color:var(--ink);font:16px/1.7 var(--sans);font-feature-settings:"palt" 0}
a{color:inherit}
:focus-visible{outline:3px solid var(--focus);outline-offset:2px}

/* 頂欄 */
.bar{position:sticky;top:0;z-index:20;background:rgba(238,241,246,.92);backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px);border-bottom:1px solid var(--line)}
.bar-in{max-width:1120px;margin:0 auto;padding:10px 20px;display:flex;align-items:center;gap:16px;flex-wrap:wrap}
.brand{display:flex;align-items:center;gap:8px;text-decoration:none;font-weight:800;font-size:18px;letter-spacing:.02em}
.brand-mark{width:28px;height:28px;border-radius:6px;background:var(--sticker);display:grid;place-items:center;transform:rotate(-6deg);font-size:16px;line-height:1;box-shadow:2px 2px 0 var(--ink)}
.nav{display:flex;gap:4px;overflow-x:auto;scrollbar-width:none;flex:1 1 auto}
.nav::-webkit-scrollbar{display:none}
.nav a{white-space:nowrap;text-decoration:none;padding:6px 10px;color:var(--muted);font-size:15px;border-bottom:2px solid transparent}
.nav a:hover{color:var(--ink)}
.nav a[aria-current=page]{color:var(--ink);font-weight:700;border-bottom-color:var(--ink)}

main{max-width:1120px;margin:0 auto;padding:28px 20px 80px}
h1{text-wrap:balance;font-size:clamp(28px,4.4vw,44px);line-height:1.2;margin:0 0 10px;font-weight:800;letter-spacing:.01em}
.lede{color:var(--muted);margin:0 0 20px;max-width:40em}
h2{font-size:21px;line-height:1.35;margin:40px 0 4px;font-weight:800}
h2 .cnt{font-size:14px;font-weight:400;color:var(--muted);margin-left:8px}
.sub{color:var(--muted);font-size:14px;margin:0 0 12px}
h3{font-size:15px;color:var(--muted);font-weight:700;margin:20px 0 8px}

/* 搜尋與工具列 */
.tools{display:flex;gap:12px;align-items:center;flex-wrap:wrap;margin:0 0 8px}
.search{flex:1 1 320px;position:relative}
.search input{width:100%;font:inherit;font-size:17px;padding:12px 16px 12px 46px;border:1px solid var(--line);border-radius:999px;background:#fff;color:var(--ink)}
.search input:focus{border-color:var(--ink);outline:none}
.search::before{content:"";position:absolute;left:17px;top:50%;width:18px;height:18px;transform:translateY(-50%);background:var(--muted);-webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='10.5' cy='10.5' r='6.5'/%3E%3Cpath d='M15.5 15.5 21 21'/%3E%3C/svg%3E") center/contain no-repeat;mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='10.5' cy='10.5' r='6.5'/%3E%3Cpath d='M15.5 15.5 21 21'/%3E%3C/svg%3E") center/contain no-repeat}
.toggle{display:flex;align-items:center;gap:6px;font-size:14px;color:var(--muted);cursor:pointer;user-select:none}
.toggle input{width:18px;height:18px;accent-color:var(--ink)}
.chips{display:flex;gap:6px;overflow-x:auto;padding:12px 0 4px;scrollbar-width:thin}
.chips a{white-space:nowrap;text-decoration:none;font-size:14px;padding:4px 10px;color:var(--muted)}
.chips a:hover{color:var(--ink);text-decoration:underline}
.empty{display:none;padding:24px;background:#fff;border-radius:var(--r);color:var(--muted);margin-top:16px}
.empty.on{display:block}

/* 字元方塊 */
.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(54px,1fr));gap:6px}
.grid.wide{grid-template-columns:repeat(auto-fill,minmax(150px,1fr));grid-auto-flow:dense}
.grid.wide .w2{grid-column:span 2}
.grid.wide .w3{grid-column:span 3}
.t{position:relative;font-family:var(--glyph);font-size:26px;line-height:1;min-height:54px;padding:6px;border:1px solid var(--line);border-radius:8px;background:var(--surface);color:var(--ink);cursor:pointer;display:grid;place-items:center;transition:transform .08s}
.grid.wide .t{font-family:var(--sans);font-size:17px;line-height:1.35;min-height:58px;white-space:pre-wrap;overflow-wrap:anywhere;padding:8px 10px}
.t:hover{background:#F6F8FB}
.t:active{transform:translateY(1px)}
.t.e{font-family:var(--emoji)}
.t.done{background:#E3E8F0;animation:stamp .3s ease-out}
.t.tofu{border-style:dashed;opacity:.45}
.hide-tofu .t.tofu{display:none}
.t[hidden],.sec[hidden]{display:none}
.sec{scroll-margin-top:76px}
@keyframes stamp{0%{transform:scale(1)}40%{transform:scale(.94)}100%{transform:scale(1)}}

/* 最近使用 */
.recent{margin:20px 0 0}
.recent[hidden]{display:none}
.recent-h{display:flex;justify-content:space-between;align-items:center;font-size:14px;color:var(--muted);margin-bottom:8px}
.recent-h button{font:inherit;font-size:13px;color:var(--muted);background:none;border:0;text-decoration:underline;cursor:pointer}
.rgrid{display:flex;flex-wrap:wrap;gap:6px}
.rgrid .t{min-height:44px;min-width:44px;font-size:20px;padding:6px 12px;white-space:pre;max-width:100%;overflow-x:auto}

/* 首頁 */
.hero{padding:16px 0 8px}
.hero h1{font-size:clamp(32px,5.6vw,60px);max-width:16em;text-wrap:balance}
.doors{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:12px;margin:28px 0 8px}
.door{display:block;text-decoration:none;background:#fff;border-radius:12px;padding:18px}
.door:hover .door-t{text-decoration:underline}
.door-g{font-family:var(--glyph);font-size:30px;line-height:1.6;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.door-t{font-weight:800;font-size:19px;margin-top:6px}
.door-d{color:var(--muted);font-size:14px}

/* IG 字體 */
.fontin{width:100%;font:inherit;font-size:20px;padding:14px 16px;border:1px solid var(--line);border-radius:12px;background:#fff;min-height:64px;resize:vertical}
.fontin:focus{border-color:var(--ink);outline:none}
.flist{display:flex;flex-direction:column;margin-top:16px;border-top:1px solid var(--line)}
.frow{display:grid;grid-template-columns:120px 1fr auto;gap:12px;align-items:center;padding:12px 4px;border-bottom:1px solid var(--line)}
.frow .fname{font-size:14px;color:var(--muted)}
.frow .fout{font-family:var(--glyph);font-size:20px;overflow-wrap:anywhere;line-height:1.4;white-space:pre-wrap}
.frow button{font:inherit;font-size:14px;padding:6px 14px;border-radius:999px;border:1px solid var(--line);background:#fff;cursor:pointer;white-space:nowrap;color:var(--ink)}
.frow button:hover{border-color:var(--ink)}
.frow.done .fout{opacity:.5}
.note{color:var(--muted);font-size:15px;margin:16px 0;max-width:44em}

/* 說明與 FAQ */
.about{margin-top:56px;max-width:44em}
.about p{margin:0 0 12px}
details{border-top:1px solid var(--line);padding:12px 0}
summary{cursor:pointer;font-weight:700}
details p{margin:8px 0 0;color:var(--muted)}

/* 提示 */
.toast{position:fixed;left:50%;bottom:24px;transform:translate(-50%,20px);opacity:0;background:var(--ink);color:#fff;padding:10px 18px;border-radius:999px;font-size:15px;pointer-events:none;transition:opacity .15s,transform .15s;z-index:50;max-width:90vw;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.toast.on{opacity:1;transform:translate(-50%,0)}

footer{max-width:1120px;margin:0 auto;padding:24px 20px 48px;color:var(--muted);font-size:13px;border-top:1px solid var(--line)}
footer a{color:var(--muted)}

@media (max-width:600px){
  .bar-in{padding:8px 14px;gap:8px}
  .nav .lg{display:none}
  .nav{gap:0}
  .nav a{padding:6px 7px;font-size:14px}
  main{padding:20px 14px 64px}
  .grid{grid-template-columns:repeat(auto-fill,minmax(48px,1fr));gap:5px}
  .t{font-size:24px;min-height:48px}
  .grid.wide{grid-template-columns:repeat(auto-fill,minmax(130px,1fr))}
  .grid.wide .w2,.grid.wide .w3,.grid.wide .m2{grid-column:1/-1}
  .sec{scroll-margin-top:112px}
  .frow{grid-template-columns:1fr auto}
  .frow .fname{grid-column:1/-1}
}
@media (prefers-reduced-motion:reduce){
  *{animation:none!important;transition:none!important}
}

/* 廣告位：空的時候不顯示；放進廣告後保留高度避免版面跳動 */
.ad{margin:28px 0;min-height:100px;display:flex;justify-content:center;align-items:center;overflow:hidden}
.ad:empty{display:none}
.more{margin:8px 0 0;font-size:14px}
