/* 嘸蝦米查碼頁（/typingnote/zi/，由 cloudflare/typingnote-pages 的函式產生）。共用 token 在 /styles.css。 */
.zi-main { max-width: 860px; padding-top: 32px; padding-bottom: 48px; }
.zi-title { font-size: clamp(1.5rem, 4vw, 2rem); font-weight: 800; line-height: 1.35; margin: 0 0 16px; color: var(--ink); }
.zi-lede { color: var(--ink-soft); line-height: 1.8; margin: 0 0 12px; }
.zi-examples { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; color: var(--ink-soft); margin: 0 0 20px; }
.zi-examples a { padding: 4px 12px; border-radius: var(--radius-pill); background: var(--accent-soft); color: var(--accent); font-weight: 700; }

.zi-search { margin: 0 0 20px; }
.zi-search-label { display: block; font-size: .88rem; color: var(--ink-soft); margin-bottom: 8px; }
.zi-search-row { display: flex; gap: 8px; }
.zi-search input {
    flex: 1; min-width: 0; font: inherit; font-size: 1.15rem; padding: 10px 14px;
    border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink);
}
.zi-search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.zi-search .btn { flex: none; width: auto; } /* 全站手機版 .btn 會撐滿整列，搜尋列要並排 */

.zi-hint { padding: 12px 16px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--ink); margin: 0 0 20px; }
.zi-more summary { cursor: pointer; display: inline-block; }
.zi-note { color: var(--ink-soft); font-size: .92rem; line-height: 1.7; }

.zi-result {
    display: flex; gap: 20px; align-items: flex-start; padding: 20px; margin: 0 0 20px;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.zi-glyph {
    flex: none; width: 96px; height: 96px; display: grid; place-items: center; font-size: 64px; line-height: 1;
    border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--paper); color: var(--ink);
}
.zi-detail { flex: 1; min-width: 0; }

.zi-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.zi-table th { text-align: left; font-weight: 600; color: var(--muted); font-size: .8rem; padding: 0 8px 6px 0; }
.zi-table td { padding: 8px 8px 8px 0; border-top: 1px solid var(--line); vertical-align: top; }
.zi-code { font-family: var(--font-mono); font-weight: 700; letter-spacing: .08em; color: var(--ink); white-space: nowrap; }
.zi-table a { text-decoration: none; }

.zi-tag { display: inline-block; font-size: .75rem; font-weight: 700; padding: 2px 8px; margin: 0 4px 2px 0; border-radius: var(--radius-pill); white-space: nowrap; }
.zi-tag-split { background: #dcfce7; color: #166534; }
.zi-tag-split_alt { background: #e0f2fe; color: #075985; }
.zi-tag-short { background: #fce7f3; color: #9d174d; }
.zi-tag-select { background: #fef9c3; color: #854d0e; }
.zi-tag-aux { background: #ede9fe; color: #5b21b6; }
.zi-tag-crowd_only { background: var(--surface-2); color: var(--ink-soft); }
.zi-crowd { font-size: .8rem; color: var(--muted); white-space: nowrap; }

.zi-same a { display: inline-block; min-width: 1.6em; text-align: center; margin: 0 2px; font-size: 1.05rem; color: var(--ink); }
.zi-same-label { display: none; font-size: .8rem; color: var(--muted); }
.zi-more { font-size: .8rem; color: var(--accent) !important; }

.zi-facts { display: flex; flex-wrap: wrap; gap: 6px 20px; margin: 14px 0 0; font-size: .92rem; }
.zi-facts div { display: flex; gap: 6px; }
.zi-facts dt { color: var(--muted); }
.zi-facts dd { margin: 0; color: var(--ink); }

.zi-crowd-only { margin: 0 0 20px; padding: 16px 20px; border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.zi-crowd-only h2 { font-size: 1.05rem; margin: 0 0 6px; }
.zi-crowd-only ul { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 8px 18px; }

.zi-grid { list-style: none; padding: 0; margin: 0 0 12px; display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; }
.zi-cell { display: flex; flex-direction: column; align-items: center; padding: 10px 4px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); text-decoration: none; }
.zi-cell:hover { border-color: var(--accent); text-decoration: none; }
.zi-cell-char { font-size: 1.8rem; line-height: 1.2; color: var(--ink); }
.zi-cell-meta { font-size: .75rem; color: var(--muted); }

.zi-list-char { font-size: 1.5rem; width: 3em; }
.zi-list-code { display: inline-flex; align-items: center; gap: 6px; margin: 0 14px 4px 0; }
.zi-list .zi-tag { margin: 0; }

.zi-legend { margin: 0 0 24px; font-size: .9rem; color: var(--ink-soft); }
.zi-legend summary { cursor: pointer; font-weight: 600; color: var(--ink); }
.zi-legend ul { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; }
.zi-legend li { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.zi-promo { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; justify-content: space-between; padding: 18px 20px; margin: 8px 0 20px; border-radius: var(--radius); background: var(--accent-soft); }
.zi-promo p { margin: 0; flex: 1 1 260px; line-height: 1.7; color: var(--ink); }

.zi-attribution { font-size: .82rem; line-height: 1.75; color: var(--ink-soft); border-top: 1px solid var(--line); padding-top: 16px; }
.zi-attribution p { margin: 0 0 8px; }
.zi-attribution a { text-decoration: underline; text-underline-offset: 3px; }

/* 手寫查字（change add-website-handwriting-lookup）：按「手寫」在搜尋框下方展開。
   寫字格子做成習字簿的米字格（朱紅虛線，沿用試作頁），一看就知道要在裡面寫一個字。 */
body.zi [hidden] { display: none !important; }
.zi-hw-toggle[aria-expanded="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.zi-hw {
    --zi-hw-red: #c83e32;
    display: grid; grid-template-columns: minmax(0, 280px) 1fr; gap: 16px 20px; align-items: start;
    margin: -8px 0 24px; padding: 16px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface);
}
.zi-hw-pad-wrap { position: relative; }
.zi-hw-pad {
    display: block; width: 100%; aspect-ratio: 1; touch-action: none; cursor: crosshair;
    background: #fffdf8; border: 3px solid var(--zi-hw-red); border-radius: 4px;
}
.zi-hw-status { position: absolute; inset: auto 8px 10px; margin: 0; text-align: center; font-size: .88rem; line-height: 1.5; color: var(--ink-soft); }
.zi-hw-side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.zi-hw-hint { margin: 0; font-size: .92rem; line-height: 1.7; color: var(--ink-soft); }
.zi-hw-cands { display: grid; grid-template-columns: repeat(4, 56px); gap: 8px; margin: 0; padding: 0; list-style: none; }
.zi-hw-cands li { width: 56px; height: 56px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); }
.zi-hw-cands li.is-empty { border-style: dashed; background: transparent; }
.zi-hw-cands a { display: grid; place-items: center; width: 100%; height: 100%; font-size: 1.8rem; color: var(--ink); text-decoration: none; border-radius: 7px; }
.zi-hw-cands a:hover { background: var(--accent-soft); }
.zi-hw-cands a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.zi-hw-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.zi-hw-actions .btn { width: auto; padding: 8px 16px; }


/* 網友投票（change add-website-lookup-code-votes）：票數前面是唱票的「正」字，票數幾畫就畫幾畫，
   和灰色的「網友打過 N 人次」（App 實打）一眼分得開。投票鈕是小外框鈕，腳本執行時才出現。 */
.zi-vote { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 6px; }
.zi-vote:not(:has(> :not([hidden]))) { display: none; }
.zi-vote-count { display: inline-flex; align-items: center; gap: 4px; font-size: .8rem; font-weight: 600; color: var(--ink-soft); white-space: nowrap; }
.zi-vote-n { font-family: var(--font-mono); font-weight: 700; color: var(--ink); }
.zi-tally { width: 15px; height: 15px; flex: none; fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linecap: round; }
.zi-vote-wrong .zi-tally { stroke: #b45309; }
.zi-tally[data-n="0"] path,
.zi-tally[data-n="1"] path:nth-child(n+2),
.zi-tally[data-n="2"] path:nth-child(n+3),
.zi-tally[data-n="3"] path:nth-child(n+4),
.zi-tally[data-n="4"] path:nth-child(n+5) { display: none; }
.zi-vote-btn {
    font: inherit; font-size: .78rem; line-height: 1.5; padding: 2px 10px; cursor: pointer;
    border: 1px solid var(--line-strong); border-radius: var(--radius-pill); background: var(--surface); color: var(--ink-soft);
}
.zi-vote-btn:hover { border-color: var(--accent); color: var(--accent); }
.zi-vote-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.zi-vote-btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.zi-vote-btn:disabled { opacity: .55; cursor: default; }
.zi-vote-status { display: block; width: fit-content; margin: 6px 0 0; padding: 4px 10px; font-size: .85rem; line-height: 1.6; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--ink); }
.zi-vote-status.is-error { background: #fef2f2; color: #991b1b; }
.zi-vote-turnstile { position: fixed; bottom: 0; right: 0; }

.zi-rule-vote { margin: 0 0 20px; padding: 16px 20px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); }
.zi-rule-vote h2 { font-size: 1.05rem; margin: 0 0 6px; }
.zi-rule-vote ul, .zi-proposed ul { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 8px; }
.zi-rule-vote li, .zi-proposed li, .zi-crowd-only li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.zi-rule-vote .zi-vote, .zi-crowd-only .zi-vote { margin-top: 0; }

.zi-propose { margin-top: 14px; }
.zi-propose label { display: block; font-weight: 600; font-size: .92rem; color: var(--ink); margin-bottom: 6px; }
.zi-propose-row { display: flex; gap: 8px; max-width: 320px; }
.zi-propose input {
    flex: 1; min-width: 0; font-family: var(--font-mono); font-size: 1.05rem; letter-spacing: .08em; text-transform: uppercase;
    padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink);
}
.zi-propose input::placeholder { text-transform: none; letter-spacing: 0; }
.zi-propose input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.zi-propose .btn { flex: none; width: auto; }
.zi-propose .zi-note { margin: 6px 0 0; }

@media (max-width: 560px) {
    .zi-result { flex-direction: column; padding: 16px; }
    .zi-glyph { width: 80px; height: 80px; font-size: 52px; }
    .zi-table thead { display: none; }
    .zi-table tr { display: block; padding: 8px 0; border-top: 1px solid var(--line); }
    .zi-table td { display: block; border: 0; padding: 2px 0; }
    .zi-same-label { display: inline; }
    .zi-search-row .btn { padding-inline: 14px; }
    .zi-hw { grid-template-columns: 1fr; padding: 12px; }
    .zi-hw-pad-wrap { width: min(100%, 320px); margin: 0 auto; }
    .zi-hw-cands { grid-template-columns: repeat(4, 1fr); }
    .zi-hw-cands li { width: auto; aspect-ratio: 1; height: auto; }
}
