/* Hallmark · redesign: lessons + section pages · genre: modern-minimal (inherits site) · pre-emit critique: P4 H4 E4 S4 R4 V3 */
/* Spell checker, misspellings pages, typing lessons */
.pp-page { max-width: 920px; width: 100%; min-width: 0; box-sizing: border-box; margin: 0 auto; padding: 24px 20px 48px; }
.pp-hero { margin-bottom: 20px; max-width: 680px; }
.pp-hero h1 { font-size: clamp(1.6rem, 4vw, 2.3rem); margin: 0 0 6px; }
.pp-hero p { color: var(--text-secondary, #6b7280); margin: 0; }
.pp-card { border: 1px solid var(--border, #e5e7eb); border-radius: 14px; padding: 16px; background: var(--surface, #fff); }
.pp-btn { font: inherit; font-weight: 600; border-radius: 8px; padding: 9px 16px; cursor: pointer; border: 1px solid var(--primary, #2563eb); background: var(--primary, #2563eb); color: #fff; text-decoration: none; display: inline-block; }
.pp-btn.secondary { background: transparent; color: var(--primary, #2563eb); }
.pp-btn:disabled { opacity: .45; cursor: not-allowed; }
.pp-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
#scInput { width: 100%; box-sizing: border-box; min-height: 140px; font: inherit; font-size: 1.05rem; padding: 12px; border-radius: 12px; border: 1px solid var(--border, #d1d5db); background: transparent; color: inherit; resize: vertical; }
#scOutput { white-space: pre-wrap; word-break: break-word; line-height: 1.9; min-height: 3em; }
#scOutput mark { background: #fee2e2; color: #991b1b; border-radius: 4px; padding: 0 2px; text-decoration: underline wavy #dc2626; }
[data-theme="dark"] #scOutput mark { background: #7f1d1d; color: #fecaca; }
#scSummary { font-weight: 600; margin: 12px 0 6px; }
#scList { list-style: none; padding: 0; margin: 0; }
#scList s { color: #dc2626; }
#scList button { font: inherit; font-size: .85rem; border: 1px solid currentColor; background: transparent; color: var(--primary, #2563eb); border-radius: 6px; padding: 0 8px; cursor: pointer; margin-left: auto; }
#scList li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; padding: 6px 0; border-bottom: 1px solid var(--border, #eee); }
#scList li a { font-size: .85rem; color: var(--text-secondary, #6b7280); }
.ms-cats { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin: 16px 0; }
.ms-cat { display: block; text-decoration: none; color: inherit; border: 1px solid var(--border, #e5e7eb); border-radius: 14px; padding: 14px 16px; }
.ms-cat:hover { border-color: var(--primary, #2563eb); }
.ms-cat strong { display: block; font-size: 1.1rem; }
.ms-cat small { color: var(--text-secondary, #6b7280); }
.ms-table { width: 100%; border-collapse: collapse; margin: 12px 0; table-layout: fixed; }
.ms-table th, .ms-table td { border-bottom: 1px solid var(--border, #e5e7eb); padding: 8px 6px; text-align: left; word-break: break-word; }
.ms-table td:first-child { color: #dc2626; text-decoration: line-through; }
.ms-table td:nth-child(2) { color: #15803d; font-weight: 600; }
.ms-tip { border-left: 4px solid var(--primary, #2563eb); padding: 8px 12px; margin: 12px 0; border-radius: 0; }
/* lessons */
.ls-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 860px) { .ls-layout { grid-template-columns: minmax(0, 1fr); } }
.ls-seg { display: inline-flex; border: 1px solid var(--border, #d1d5db); border-radius: 10px; padding: 3px; gap: 2px; }
.ls-seg button { font: inherit; border: 0; background: transparent; color: inherit; padding: 6px 12px; border-radius: 7px; cursor: pointer; }
.ls-seg button[aria-pressed="true"] { background: var(--text-main, #1d1d1f); color: var(--bg, #fff); }
.ls-overall { color: var(--text-secondary, #6b7280); font-size: .9rem; margin: 12px 0 8px; }
#lsList { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 2px; }
@media (max-width: 860px) { #lsList { flex-direction: row; overflow-x: auto; padding-bottom: 4px; } #lsList .ls-t, #lsList .ls-done { display: none; } }
#lsList button { width: 100%; display: flex; align-items: center; gap: 10px; font: inherit; text-align: left; border: 0; background: transparent; color: inherit; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
#lsList button:hover { background: var(--surface-hover, rgba(0,0,0,.04)); }
#lsList button[aria-pressed="true"] { background: var(--surface-hover, rgba(0,0,0,.06)); font-weight: 600; }
#lsList button[aria-disabled="true"] { color: var(--text-secondary, #9ca3af); cursor: not-allowed; }
.ls-n { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: .85rem; border: 1px solid currentColor; }
#lsList button[aria-pressed="true"] .ls-n { background: var(--primary, #2563eb); border-color: var(--primary, #2563eb); color: #fff; }
.ls-t { flex: 1; min-width: 0; }
.ls-done { font-size: .78rem; color: #15803d; }
.ls-board { position: relative; border: 1px solid var(--border, #e5e7eb); border-radius: 12px; padding: 20px; background: var(--surface, #fff); cursor: text; min-width: 0; }
.ls-step { margin: 0; color: var(--text-secondary, #6b7280); font-size: .9rem; }
.ls-head h2 { font-size: 1.4rem; margin: 2px 0 10px; }
.ls-keys { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: .9rem; color: var(--text-secondary, #6b7280); }
#lsKeys { display: flex; flex-wrap: wrap; gap: 6px; color: var(--text-main, #111); }
#lsKeys kbd { font: inherit; font-size: 1.15rem; min-width: 34px; height: 34px; display: grid; place-items: center; border-radius: 6px; border: 1px solid rgba(0,0,0,.15); }
#lsProgress { width: 100%; height: 6px; margin: 16px 0 4px; appearance: none; border: 0; border-radius: 3px; background: rgba(0,0,0,.08); overflow: hidden; }
#lsProgress::-webkit-progress-bar { background: rgba(0,0,0,.08); }
#lsProgress::-webkit-progress-value { background: var(--primary, #2563eb); transition: width .15s; }
#lsProgress::-moz-progress-bar { background: var(--primary, #2563eb); }
.ls-type { position: relative; min-height: 120px; margin: 8px 0; }
#lsText { font-family: "Sarabun", "IBM Plex Sans Thai", sans-serif; font-size: 2rem; line-height: 1.9; display: flex; flex-wrap: wrap; align-items: baseline; }
#lsText span { padding: 0 1px; }
#lsText span.gap { width: .7em; border-bottom: 2px dotted rgba(0,0,0,.2); align-self: center; height: .2em; margin: 0 .15em; }
#lsText span.ok { color: rgba(0,0,0,.28); }
#lsText span.gap.ok { border-color: transparent; }
#lsText span.cur { color: #fff; background: var(--primary, #2563eb); border-radius: 6px; padding: 0 6px; }
#lsText span.gap.cur { background: var(--primary, #2563eb); height: .5em; border: 0; }
#lsText.shake span.cur { animation: lsShake .2s; background: #dc2626; }
@keyframes lsShake { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
.ls-focus { position: absolute; inset: 0; width: 100%; font: inherit; font-weight: 600; font-size: 1.05rem; color: var(--primary, #2563eb); background: var(--surface, #fff); border: 2px dashed var(--primary, #2563eb); border-radius: 10px; cursor: pointer; }
.ls-focus[hidden], #lsResult[hidden], #lsMobileNote[hidden] { display: none; }
.ls-result { position: absolute; inset: 0; background: var(--surface, #fff); display: flex; flex-direction: column; justify-content: center; }
.ls-result h3 { font-size: 1.5rem; margin: 0 0 4px; }
.ls-result p { margin: 0 0 8px; color: var(--text-secondary, #4b5563); }
#lsInput { position: absolute; opacity: 0; width: 1px; height: 1px; left: 0; top: 0; }
.ls-hint { min-height: 1.6em; font-size: 1.1rem; margin: 4px 0 12px; }
.ls-hint strong { display: inline-block; min-width: 1.4em; text-align: center; border: 1px solid currentColor; border-radius: 6px; padding: 0 4px; }
.ls-stats { display: flex; gap: 28px; margin: 0 0 14px; }
.ls-stats div { display: flex; flex-direction: column-reverse; }
.ls-stats dt { font-size: .8rem; color: var(--text-secondary, #6b7280); }
.ls-stats dd { margin: 0; font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.ls-kb { display: flex; flex-direction: column; gap: 4px; overflow-x: auto; }
.kb-row { display: flex; gap: 4px; }
.kb-row:nth-child(2) { padding-left: 20px; } .kb-row:nth-child(3) { padding-left: 32px; } .kb-row:nth-child(4) { padding-left: 50px; } .kb-row:nth-child(5) { padding-left: 50px; }
.key { position: relative; flex: none; width: 38px; height: 42px; border-radius: 6px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 1rem; line-height: 1.05; color: #1f2937; border: 1px solid rgba(0,0,0,.12); transition: opacity .15s; }
.key small { font-size: .62rem; opacity: .6; }
.key.bump::after { content: ""; position: absolute; bottom: 5px; width: 10px; height: 2px; border-radius: 1px; background: currentColor; opacity: .55; }
.key.space { width: 300px; font-size: .8rem; } .key.shift { width: 82px; font-size: .8rem; background: #f3f4f6; }
.key.dim { opacity: .3; }
.key.next { opacity: 1; box-shadow: 0 0 0 3px var(--primary, #2563eb); font-weight: 700; z-index: 1; }
.f-L5, .f-R5 { background: #fbe1e4; } .f-L4, .f-R4 { background: #fdf0c4; } .f-L3, .f-R3 { background: #d8f0e0; } .f-L2, .f-R2 { background: #dbe7fd; } .f-T { background: #ececec; }
.ls-hands { display: flex; justify-content: center; align-items: flex-end; gap: 6px; margin-top: 16px; height: 76px; }
.finger { width: 30px; border-radius: 14px 14px 6px 6px; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 4px; font-size: .68rem; color: #374151; border: 1px solid rgba(0,0,0,.1); transition: transform .15s; }
.finger[data-finger$="5"] { height: 44px; } .finger[data-finger$="4"] { height: 58px; } .finger[data-finger$="3"] { height: 66px; } .finger[data-finger$="2"] { height: 58px; }
.finger[data-finger="T"] { height: 34px; width: 52px; margin: 0 14px; border-radius: 14px; }
.finger.active { box-shadow: 0 0 0 3px var(--primary, #2563eb); transform: translateY(-6px); font-weight: 700; }
#lsMobileNote { background: #fff7ed; color: #9a3412; border-radius: 10px; padding: 10px 14px; margin-bottom: 12px; }
[data-theme="dark"] .key, [data-theme="dark"] .finger { color: #111827; }
[data-theme="dark"] #lsText span.ok { color: rgba(255,255,255,.3); }
[data-theme="dark"] .ls-focus, [data-theme="dark"] .ls-result { background: var(--surface, #1c1c1e); }
@media (prefers-reduced-motion: reduce) { .key, .finger, #lsProgress::-webkit-progress-value { transition: none; } #lsText.shake span.cur { animation: none; } }
@media (max-width: 640px) { .pp-page { padding: 12px 12px 40px; } .key { width: 26px; height: 34px; font-size: .8rem; } .key.space { width: 160px; } .key.shift { width: 52px; } .kb-row:nth-child(n) { padding-left: 0; } .ls-board { padding: 14px; } #lsText { font-size: 1.5rem; } }
/* word count */
.wc-label { display: block; font-weight: 600; margin-bottom: 6px; }
#wcInput { width: 100%; box-sizing: border-box; min-height: 180px; font: inherit; font-size: 1.05rem; padding: 12px; border-radius: 10px; border: 1px solid var(--border, #d1d5db); background: transparent; color: inherit; resize: vertical; }
.wc-note { background: #fff7ed; color: #9a3412; border-radius: 8px; padding: 8px 12px; }
.wc-note[hidden], #wcTopWrap[hidden], .st-result[hidden] { display: none; }
.wc-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin: 16px 0; }
.wc-stats div { display: flex; flex-direction: column-reverse; padding: 10px 0; border-top: 1px solid var(--border, #e5e7eb); }
.wc-stats dt { font-size: .85rem; color: var(--text-secondary, #6b7280); }
.wc-stats dd { margin: 0; font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.wc-stats .wc-main dd { font-size: 2.4rem; color: var(--primary, #2563eb); }
.wc-sub { font-size: 1rem; margin: 8px 0; }
.wc-top { display: flex; flex-wrap: wrap; gap: 6px 16px; padding-left: 1.2em; margin: 0 0 8px; }
.wc-top li span + span { color: var(--text-secondary, #6b7280); margin-left: 6px; font-size: .85rem; }
/* speed test */
.st-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.st-live { display: flex; gap: 24px; margin: 0; }
.st-live div { display: flex; flex-direction: column-reverse; }
.st-live dt { font-size: .8rem; color: var(--text-secondary, #6b7280); }
.st-live dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
#stTime { font-size: 1.6rem; color: var(--primary, #2563eb); }
.st-words { font-family: "Sarabun", "IBM Plex Sans Thai", sans-serif; font-size: 1.6rem; line-height: 2.1; display: flex; flex-wrap: wrap; gap: 0 .6em; min-height: 6.3em; max-height: 6.3em; overflow: hidden; }
.st-words span.ok { color: #15803d; }
.st-words span.bad { color: #dc2626; text-decoration: line-through; }
.st-words span.cur { background: var(--primary, #2563eb); color: #fff; border-radius: 6px; padding: 0 6px; }
.st-words span.cur.typo { background: #dc2626; }
.st-inputrow { display: flex; gap: 8px; margin-top: 12px; }
#stInput { flex: 1; min-width: 0; font: inherit; font-size: 1.2rem; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--border, #d1d5db); background: transparent; color: inherit; }
.st-result { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border, #e5e7eb); }
.st-verdict { font-weight: 600; margin: 0 0 8px; }
.st-final dd { font-size: 2rem; }
@media (max-width: 640px) { .st-words { font-size: 1.25rem; } }
.ms-words { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px 16px; padding-left: 1.2em; margin: 12px 0; }
.ms-crumbs { font-size: .9rem; color: var(--text-secondary, #6b7280); margin: 8px 0 0; }
.ms-crumbs a { color: inherit; }
.ms-answer { margin: 16px 0; }
.ms-verdict { font-size: 1.3rem; margin: 0 0 6px; }
.ms-right { color: #15803d; }
.ms-wrong { color: #dc2626; text-decoration: line-through; }
.tn-grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .tn-grid { grid-template-columns: 1fr 1fr; } }
.tn-grid textarea { width: 100%; box-sizing: border-box; min-height: 140px; font: inherit; font-size: 1.1rem; padding: 12px; border-radius: 12px; border: 1px solid var(--border, #d1d5db); background: transparent; color: inherit; resize: vertical; }
.tn-note { min-height: 1.4em; color: var(--text-secondary, #6b7280); margin: 6px 0 0; }
.tn-table { width: 100%; border-collapse: collapse; table-layout: fixed; margin: 12px 0; text-align: center; }
.tn-table td, .tn-table th { border: 1px solid var(--border, #e5e7eb); padding: 6px 2px; }
.td-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.td-row input[type=text] { flex: 1 1 220px; min-width: 0; font-size: 1.1rem; padding: 10px 12px; border: 1px solid var(--border, #d1d5db); border-radius: 10px; background: transparent; color: inherit; }
.td-out { font-size: 1.15rem; font-weight: 600; min-height: 1.5em; margin: 4px 0 0; }
.td-msg { color: #b45309; min-height: 1.4em; }
.td-list { list-style: none; padding: 0; margin: 8px 0 0; }
.td-list li { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border, #e5e7eb); }
.td-label { grid-column: 1 / -1; font-size: .85rem; color: var(--text-secondary, #6b7280); }
.td-text { font-size: 1.1rem; word-break: break-word; }
.td-copy { padding: 6px 12px; }
.td-check { display: flex; gap: 6px; align-items: center; }
.ms-search { margin: 16px 0; }
.ms-search input { width: 100%; box-sizing: border-box; font: inherit; font-size: 1.15rem; padding: 12px 14px; border: 1px solid var(--border, #d1d5db); border-radius: 12px; background: transparent; color: inherit; margin-top: 6px; }
.ms-result { min-height: 1.5em; margin-top: 10px; }
.ms-result p { margin: 4px 0; }
.ms-result-main { font-size: 1.15rem; }
.ms-suggest { list-style: none; padding: 0; margin: 6px 0 0; display: grid; gap: 6px; }
.ms-fact { margin: 2px 0; }
.ms-words + h3, .article-section h3 + .ms-words { margin-top: 6px; }
[data-theme="dark"] .ms-right { color: #4ade80; }
[data-theme="dark"] .ms-wrong { color: #f87171; }
[data-theme="dark"] .td-msg { color: #fbbf24; }
[data-theme="dark"] [class*="f-L"], [data-theme="dark"] [class*="f-R"], [data-theme="dark"] .f-T { color: #111827; }
[data-theme="dark"] .key:not([class*="f-"]) { background: #3a3a3c; color: #f5f5f7; border-color: rgba(255,255,255,.15); }
[data-theme="dark"] .ms-table td:first-child { color: #f87171; }
[data-theme="dark"] .ms-table td:nth-child(2) { color: #4ade80; }
/* Lesson keyboard on small screens: 13 keys share the row width, so the board never overflows. */
@media (max-width: 640px) {
  .ls-kb { overflow: visible; }
  .kb-row { gap: 2px; }
  .key { flex: none; width: calc((100% - 24px) / 13); height: 40px; font-size: clamp(11px, 3.4vw, 15px); }
  .key small { font-size: clamp(8px, 2.2vw, 10px); opacity: .75; }
  .kb-row:nth-child(3) { padding-left: 3%; } .kb-row:nth-child(4) { padding-left: 7%; }
  .key.shift { width: calc((100% - 24px) / 13 * 2); }
  .key.space { width: 52%; }
  .key.dim { opacity: .4; }
}
/* Lesson list scrolls sideways on narrow screens: fade the edge so it is clear there is more. */
@media (max-width: 860px) {
  #lsList { scroll-snap-type: x proximity; -webkit-mask-image: linear-gradient(to right, #000 85%, transparent); mask-image: linear-gradient(to right, #000 85%, transparent); padding-right: 32px; }
  #lsList li { scroll-snap-align: start; flex: none; }
  #lsList button { min-height: 44px; }
}
[data-theme="dark"] #lsMobileNote, [data-theme="dark"] .wc-note { background: rgba(251, 146, 60, .14); color: #fdba74; }
/* PDF to Word */
.p2w-drop { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 160px; padding: 24px; border: 2px dashed var(--border); border-radius: 14px; text-align: center; cursor: pointer; }
.p2w-drop:hover, .p2w-drop.is-over { border-color: var(--primary); background: var(--surface-hover, rgba(0, 113, 227, .05)); }
.p2w-drop:focus-within { outline: 2px solid var(--primary); outline-offset: 2px; }
.p2w-drop[aria-busy="true"] { opacity: .6; pointer-events: none; }
.p2w-input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.p2w-cta { font-weight: 700; font-size: 1.1rem; color: #fff; background: var(--primary); padding: 12px 22px; border-radius: 10px; min-height: 44px; display: inline-flex; align-items: center; }
.p2w-hint { color: var(--text-secondary); font-size: .92rem; }
.p2w-opts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; margin: 14px 0 4px; }
.p2w-opts select { font: inherit; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); color: var(--text-main); min-height: 44px; }
.p2w-status { min-height: 1.4em; margin: 10px 0 0; }
.p2w-status[data-kind="error"] { color: #b45309; }
[data-theme="dark"] .p2w-status[data-kind="error"] { color: #fbbf24; }
.p2w-summary { font-weight: 600; margin: 8px 0 10px; }
.p2w-download { display: inline-flex; align-items: center; min-height: 44px; }
.p2w-preview { margin-top: 8px; padding: 18px 20px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); max-height: 460px; overflow: auto; font-size: 1rem; line-height: 1.7; }
.p2w-preview p { margin: 0 0 6px; }
.p2w-break { border: 0; border-top: 1px dashed var(--border); margin: 14px 0; }

/* English pages (/en/) */
.en-date { flex: 1 1 200px; min-width: 0; font-size: 1.05rem; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; background: transparent; color: inherit; min-height: 44px; }
.td-out.is-error { color: #b45309; font-weight: 500; font-size: 1rem; }
[data-theme="dark"] .td-out.is-error { color: #fbbf24; }
.en-amount { width: 100%; font-size: 1.4rem; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: transparent; color: inherit; margin: 6px 0 2px; }
.en-outs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.en-out { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.en-out p { font-size: 1.15rem; font-weight: 600; line-height: 1.5; margin: 0; flex: 1; overflow-wrap: anywhere; color: var(--text-main); }
.en-out p.is-empty { color: var(--text-secondary); font-weight: 400; font-size: 1rem; }
.en-out .pp-btn { align-self: flex-start; }
.en-out .pp-btn:disabled { opacity: .5; cursor: not-allowed; }
.en-table td, .en-table th { text-align: left; padding: 6px 8px; }
.en-examples { table-layout: auto; }
@media (max-width: 640px) { .en-outs { grid-template-columns: 1fr; } .en-examples { font-size: .9rem; } }
.en-fix-out { min-height: 160px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; font-size: 1.1rem; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text-main); }
.en-fix-out.is-empty { color: var(--text-secondary); }
.kb-text { width: 100%; min-height: 120px; font-size: 1.5rem; line-height: 1.6; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: transparent; color: inherit; resize: vertical; }
.kb-keys { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; padding: 10px; border-radius: 14px; background: var(--surface-hover, rgba(0,0,0,.04)); user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.kb-keys .kb-row { display: flex; gap: 6px; justify-content: center; }
.kb-key { position: relative; flex: 1 1 0; min-width: 0; max-width: 58px; height: 52px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text-main); cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; font: inherit; transition: background-color .1s ease, transform .1s ease; }
.kb-key:hover { border-color: var(--primary); }
.kb-key:active, .kb-key.is-down { background: var(--primary); color: #fff; transform: translateY(1px); }
.kb-key:active .kb-en, .kb-key.is-down .kb-en { color: rgba(255,255,255,.8); }
.kb-key:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.kb-th { font-size: 1.35rem; line-height: 1; }
.kb-en { position: absolute; top: 3px; left: 5px; font-size: 10.5px; color: var(--text-secondary); }
.kb-wide { flex: 1.6 1 0; max-width: 96px; font-size: 13px; font-weight: 600; }
.kb-space { flex: 4 1 0; max-width: 360px; }
.kb-shift[aria-pressed="true"] { background: var(--primary); color: #fff; border-color: var(--primary); }
.pp-btn.is-off { pointer-events: none; opacity: .5; }
@media (max-width: 640px) {
  .kb-keys { padding: 6px 4px; gap: 5px; margin-inline: -8px; }
  .kb-keys .kb-row { gap: 3px; }
  .kb-key { height: 46px; border-radius: 6px; }
  .kb-th { font-size: 1.1rem; }
  .kb-en { font-size: 8.5px; top: 2px; left: 3px; }
  .kb-wide { font-size: 11px; flex-basis: 0; }
}
.al-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; margin-top: 12px; }
.al-card { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 6px; min-height: 104px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text-main); cursor: pointer; font: inherit; border-top-width: 3px; }
.al-card:hover, .al-card[aria-pressed="true"] { border-color: var(--primary); }
.al-card[aria-pressed="true"] { background: var(--surface-hover); }
.al-card:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.al-mid { border-top-color: #0a84ff; } .al-high { border-top-color: #bf5af2; } .al-low { border-top-color: #30b158; }
.al-letter { font-size: 2.2rem; line-height: 1.2; }
.al-say { font-size: 13px; font-weight: 600; }
.al-mean { font-size: 12px; color: var(--text-secondary); text-align: center; line-height: 1.3; }
.al-detail { display: flex; gap: 16px; align-items: center; margin-top: 12px; padding: 12px 16px; border: 1px solid var(--border); border-radius: 12px; }
.al-dletter { font-size: 3.4rem; line-height: 1.1; }
.al-dname { font-size: 1.1rem; font-weight: 600; margin: 0 0 4px; }
.al-dfacts { margin: 0; color: var(--text-secondary); }
.al-table-wrap { overflow-x: auto; }
.al-table { min-width: 560px; }
.al-big { font-size: 1.4rem; }
.al-inline { font-size: 1.2rem; letter-spacing: .08em; }
.tc-samples { align-items: center; }
.tc-out { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 10px; }
.tc-syl { border: 1px solid var(--border); border-left: 4px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.tc-mid { border-left-color: #8e8e93; } .tc-low { border-left-color: #0a84ff; } .tc-falling { border-left-color: #ff9f0a; } .tc-high { border-left-color: #bf5af2; } .tc-rising { border-left-color: #30b158; } .tc-unusual { border-left-color: #ff453a; }
.tc-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; }
.tc-word { font-size: 2rem; line-height: 1.2; }
.tc-tone { font-size: 1.1rem; font-weight: 700; }
.tc-thname { color: var(--text-secondary); }
.tc-steps { margin: 6px 0 0 18px; padding: 0; color: var(--text-secondary); line-height: 1.55; }
@media (max-width: 640px) { .al-grid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); } .al-letter { font-size: 1.9rem; } }
.al-card[hidden] { display: none; }
.al-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin: 10px 0 0; font-size: 13.5px; color: var(--text-secondary); }
.al-key { display: inline-flex; align-items: center; gap: 6px; color: var(--text-main); font-weight: 600; }
.al-key::before { content: ""; width: 14px; height: 4px; border-radius: 2px; background: currentColor; }
.al-key.al-mid::before { background: #0a84ff; } .al-key.al-high::before { background: #bf5af2; } .al-key.al-low::before { background: #30b158; }
.ls-map { margin: 6px 0 0; font-size: 14px; }
.en-more { margin-top: 28px; }
@media (max-width: 640px) {
  .en-more .mt-row { display: grid; grid-template-columns: 1fr; overflow: visible; margin-inline: 0; padding-inline: 0; }
  .en-more .mt-card { width: auto; }
  .en-more .mt-desc { white-space: normal; }
}
.en-more .mt-desc { white-space: normal; overflow: visible; }
/* /en/ hub quick box */
.hq-label { display: block; font-size: 1.05rem; font-weight: 700; margin-bottom: 6px; }
.hq-hint { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; color: var(--text-secondary); font-size: 14px; }
.hq-hint[hidden] { display: none; }
.hq-out { list-style: none; padding: 0; margin: 12px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.hq-out:empty { display: none; }
.hq-card { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; }
.hq-title { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.hq-value { margin: 0; font-size: 1.15rem; font-weight: 600; line-height: 1.45; overflow-wrap: anywhere; flex: 1; }
.hq-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.hq-none { color: var(--text-secondary); padding: 6px 2px; }
.en-group { margin-top: 20px; }
.en-group .mt-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 860px) { .en-group .mt-row { grid-template-columns: 1fr; } }
.hq-actions { align-items: center; }
.hq-open { display: inline-flex; align-items: center; min-height: 44px; padding: 0 6px; color: var(--primary); font-weight: 600; font-size: 14px; text-decoration: none; }
.hq-open:hover { text-decoration: underline; }
/* English tool switcher under the header */
.en-subnav { border-bottom: 1px solid var(--border); background: var(--surface); }
.en-subnav-row { display: flex; gap: 4px; max-width: 1100px; margin: 0 auto; padding: 6px 16px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.en-subnav-row::-webkit-scrollbar { display: none; }
.en-subnav a { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px; border-radius: 10px; color: var(--text-secondary); font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.en-subnav a svg { width: 18px; height: 18px; }
.en-subnav a:hover { color: var(--text-main); background: var(--surface-hover); }
.en-subnav a[aria-current="page"] { color: var(--primary); background: var(--surface-hover); box-shadow: inset 0 -2px 0 var(--primary); }
.en-subnav a:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
@media (pointer: coarse), (max-width: 640px) { .en-subnav a { min-height: 44px; } }
@media (min-width: 1100px) { .en-subnav-row { justify-content: center; } }
@media (min-width: 900px) { .en-subnav a { padding: 0 10px; } }
@media (max-width: 1099px) { .en-subnav-row { -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 16px, #000 calc(100% - 28px), transparent 100%); mask-image: linear-gradient(90deg, transparent 0, #000 16px, #000 calc(100% - 28px), transparent 100%); } }
@media (min-width: 900px) { .en-subnav a svg { display: none; } .en-subnav-row { gap: 2px; } }
