/* Shared look for every PK game: start screen, settings dialog, arena, feedback, results, and per-type pieces.
   Sizes are in rem, so the whole game scales with the root font size: larger on big screens, larger still in 投屏 mode. */
:root {
  --paper: #f6f3e9;
  --card: #fffdf8;
  --ink: #263e37;
  --muted: #5f6b5d;
  --p1-ink: #3d6886;
  --p2-ink: #8a4f67;
  --green: #497654;
  --green-dark: #355a3e;
  --green-soft: #eaf0df;
  --line: #dfe6d5;
  --p1: #6f95b0;
  --p2: #b07f93;
  --gold: #d9aa35;
  --gold-soft: #fff1ba;
  --right: #e2f0dc;
  --right-line: #6c9b63;
  --wrong: #fbeee6;
  --wrong-line: #c47a5b;
  --focus: #c79d4b;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; font-size: clamp(16px, 0.45vw + 10px, 20px); }
html.pk-present { font-size: clamp(18px, 1.2vw + 2px, 30px); }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; line-height: 1.65; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; opacity: .6; }
button:focus-visible, a:focus-visible, input:focus-visible, summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
[hidden] { display: none !important; }
.muted { font-size: 0.875rem; color: var(--muted); }

/* ---------- start screen ---------- */
.pk-start { min-height: 100vh; padding: 1.5rem; }
.pk-top { max-width: 68.75rem; margin: auto; min-height: 3.25rem; display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.pk-home { font-size: 0.9375rem; color: var(--green); text-decoration: none; display: inline-flex; align-items: center; min-height: 2.75rem; }
.pk-card { max-width: 40.625rem; margin: 0.625rem auto 1.875rem; padding: 2.25rem 2.75rem; background: var(--card); border: 1px solid #e5e9dc; border-radius: 26px; box-shadow: 0 16px 48px #30442a09; text-align: center; }
.pk-eyebrow { font-size: 0.875rem; letter-spacing: 2px; color: var(--muted); margin: 0 0 1.25rem; }
.pk-emblem { width: 5rem; height: 5rem; display: grid; place-items: center; margin: 0 auto 1.125rem; background: var(--green-soft); color: #57754c; border-radius: 24px; font-weight: 700; font-size: 1.75rem; }
.pk-title { font-size: clamp(1.6875rem, 1rem + 3vw, 2.375rem); line-height: 1.4; margin: 0 0 0.75rem; }
.pk-description { font-size: 0.9375rem; line-height: 1.8; color: #68776e; margin: 0 0 1.625rem; }
.pk-stats { display: grid; grid-template-columns: repeat(3, 1fr); padding: 1.125rem 0; background: #f1f4e9; border-radius: 16px; margin-bottom: 1.375rem; }
.pk-stats strong { display: block; font-size: 1.5625rem; line-height: 1.3; color: #47633f; }
.pk-stats span { display: block; font-size: 0.875rem; color: var(--muted); margin-top: 0.3125rem; }
.pk-stats > div + div { border-left: 1px solid #dbe4ce; }
.pk-modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.375rem; padding: 0.3125rem; background: #f1f4e9; border-radius: 14px; margin-bottom: 1.375rem; }
.pk-mode { border: 0; border-radius: 10px; background: transparent; padding: 0.625rem 0.375rem; font-size: 0.9375rem; color: #4b6347; min-height: 2.75rem; }
.pk-mode[aria-checked="true"] { background: var(--card); color: var(--ink); font-weight: 700; box-shadow: 0 2px 6px #30442a1a; }
.pk-rules { text-align: left; background: white; border: 1px solid #edf0e5; border-radius: 16px; padding: 1.125rem 1.375rem; margin-bottom: 1.625rem; }
.pk-rules h2 { font-size: 0.9375rem; margin: 0 0 0.625rem; }
.pk-rules p { font-size: 0.875rem; line-height: 1.85; margin: 0.375rem 0; color: #53635b; }
.pk-rules p.pk-highlight { margin: 0 0 0.625rem; padding: 0.6rem 0.9rem; border-left: 5px solid #e08a2e; border-radius: 10px;
  background: #fff3d6; color: #5a3a10; font-size: 1rem; font-weight: 700; line-height: 1.6; }
.pk-scoring { color: var(--muted) !important; }
.pk-mode-note { color: var(--green) !important; }
.pk-primary { width: 100%; padding: 1rem 1.5rem; border: 0; border-radius: 14px; background: var(--green); color: white; font-weight: 700; font-size: 1.125rem; box-shadow: 0 5px 0 var(--green-dark); }
.pk-error { color: #aa3c46; min-height: 1.25rem; font-size: 0.875rem; margin: 0.875rem 0 0; }
.pk-settings-toggle { background: var(--card); color: #465f4e; border: 1px solid #d8e2d1; padding: 0.625rem 1rem; border-radius: 12px; min-height: 2.75rem; font-size: 0.875rem; white-space: nowrap; }

/* ---------- settings dialog ---------- */
.pk-dialog { padding: 1.625rem; border: 1px solid #e1e7d6; border-radius: 22px; width: min(26.875rem, calc(100vw - 1.75rem)); color: var(--ink); background: var(--card); font-size: 0.9375rem; box-shadow: 0 20px 80px #172d2340; max-height: 90vh; overflow-y: auto; }
.pk-dialog::backdrop { background: #172d2360; }
.pk-dialog-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.375rem; }
.pk-dialog-head h2 { font-size: 1.3125rem; margin: 0; }
.pk-close { border: 0; background: transparent; color: #425b4c; font-size: 1.75rem; min-width: 2.75rem; min-height: 2.75rem; }
.pk-label { display: block; margin-bottom: 0.5rem; }
.pk-dialog input[type=number] { width: 100%; padding: 0.75rem; border: 1px solid #cdd9c6; border-radius: 10px; font-size: 1.125rem; background: white; }
.pk-presets { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }
.pk-preset, .pk-reset { min-height: 2.75rem; padding: 0.5625rem 0.75rem; border: 1px solid #d9e1cf; background: #f3f6ed; border-radius: 9px; color: #4b6347; font-size: 0.875rem; }
.pk-help { font-size: 0.875rem; color: var(--muted); line-height: 1.7; }
.pk-rank-note { text-align: center; font-size: 1rem; font-weight: 650; color: var(--green-dark); background: var(--green-soft); border-radius: 0.75rem; padding: 0.625rem 1rem; margin: 0 0 1.125rem; }
.pk-switch { display: flex; align-items: center; justify-content: space-between; padding: 1rem 0; border-bottom: 1px solid #e7ecdf; }
.pk-switch input { width: 1.375rem; height: 1.375rem; accent-color: var(--green); }
.pk-actions { display: flex; gap: 0.75rem; margin-top: 1.25rem; }
.pk-actions > * { flex: 1; }
.pk-save { background: var(--green); border: 0; border-radius: 10px; color: white; padding: 0.75rem; font-size: 0.9375rem; }

/* ---------- game screen ---------- */
.pk-header { display: flex; align-items: center; flex-wrap: wrap; gap: 0.75rem 1.125rem; max-width: 93.75rem; margin: auto; padding: 1.125rem 1.5rem; }
.pk-header h1 { font-size: 1.375rem; margin: 0; }
.pk-header .pk-settings-toggle { margin-left: auto; }
.pk-timer { padding: 0.375rem 0.9375rem; background: var(--card); border: 1px solid var(--line); border-radius: 14px; white-space: nowrap; }
.pk-timer strong { font-size: 1.5rem; color: #976b32; font-variant-numeric: tabular-nums; }
.pk-arena { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; max-width: 93.75rem; padding: 0 1.5rem 1.5rem; margin: auto; align-items: start; }
.pk-arena.solo { grid-template-columns: minmax(0, 53.75rem); justify-content: center; }
.pk-player { background: var(--card); border: 1px solid var(--line); border-top: 5px solid var(--p1); border-radius: 22px; padding: 1.375rem; min-width: 0; box-shadow: 0 7px 25px #2b402508; }
.pk-player.second { border-top-color: var(--p2); }
.pk-player-head { display: flex; align-items: center; justify-content: space-between; padding-bottom: 0.875rem; border-bottom: 1px solid #e7ecdf; margin-bottom: 1rem; }
.pk-player-head h2 { margin: 0; font-size: 1.1875rem; color: var(--p1-ink); }
.pk-player.second .pk-player-head h2 { color: var(--p2-ink); }
.pk-arena.solo .pk-player-head h2 { color: inherit; }
.pk-score { padding: 0.25rem 1.125rem; border-radius: 12px; background: #f0f4e8; font-size: 1.625rem; color: var(--green); font-weight: 700; font-variant-numeric: tabular-nums; }
.pk-source { color: var(--muted); font-size: 0.875rem; margin: 0 0 0.375rem; }
.pk-instruction { color: #53635b; font-size: 0.875rem; margin: 0 0 0.75rem; }
.pk-task { font-size: 1.0625rem; font-weight: 700; color: #26352d; margin: 0 0 0.25rem; }
.pk-task + .pk-instruction { margin-bottom: 0.5rem; }
.pk-tips-box { text-align: left; background: #fff8e1; border: 1px solid #f0d98c; border-left: 6px solid var(--gold); border-radius: 16px; padding: 1.125rem 1.375rem 1.25rem; margin-bottom: 1.25rem; box-shadow: 0 6px 18px rgba(176, 132, 20, 0.12); }
.pk-tips-title { font-size: 1.125rem; font-weight: 800; color: #6d4f05; margin: 0 0 0.75rem; }
.pk-tips { list-style: none; counter-reset: tip; margin: 0; padding: 0; }
.pk-tips > li { counter-increment: tip; position: relative; padding-left: 2.25rem; margin: 0.5rem 0; font-size: 1.125rem; font-weight: 600; line-height: 1.75; color: #2a2a1f; }
.pk-tips > li::before { content: counter(tip); position: absolute; left: 0; top: 0.2rem; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--green); color: white; font-size: 0.875rem; font-weight: 700; line-height: 1.5rem; text-align: center; }
.pk-subtips { list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.375rem 0 0.25rem; padding: 0; }
.pk-tips .pk-subtips li { background: white; border: 1px solid #ecd58a; border-radius: 999px; padding: 0.125rem 0.75rem; font-size: 1rem; font-weight: 600; line-height: 1.7; color: #3b3a2c; }
.pk-key { color: #b4400e; font-weight: 800; background: linear-gradient(transparent 62%, #ffd98a 62%); padding: 0 0.0625rem; }
@media (max-width: 600px) { .pk-tips-box { padding: 0.875rem 1rem 1rem; } .pk-tips > li { font-size: 1.0625rem; } }
.pk-notice { min-height: 1.375rem; margin: 0.625rem 0; color: #ab533d; font-size: 0.875rem; }
.pk-controls { display: flex; gap: 0.5rem; margin-top: 0.875rem; }
.pk-controls button { flex: 1; min-width: 0; }
.primary { border: 0; border-radius: 12px; background: var(--green); color: white; padding: 0.8125rem 1.25rem; font-weight: 600; font-size: 1.0625rem; }
.primary:hover:not(:disabled) { background: #3f6949; }
.pk-advance { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 0.375rem; color: var(--muted); font-size: 0.9375rem; }
.pk-advance i { display: block; width: min(100%, 18rem); height: 0.375rem; border-radius: 999px; background: #e7e9df; overflow: hidden; }
.pk-advance i::after { content: ""; display: block; height: 100%; background: linear-gradient(90deg, #9be15d, #3f8f55); transform: scaleX(0); transform-origin: left; animation: pk-advance var(--wait, 1000ms) linear forwards; }
@keyframes pk-advance { to { transform: scaleX(1); } }
@media (prefers-reduced-motion: reduce) { .pk-advance i { display: none; } }
.secondary { border: 0; border-radius: 12px; background: #e9eee1; color: #3f5546; padding: 0.75rem; font-size: 1rem; }
.pk-feedback { padding: 1rem 1.125rem; border-radius: 14px; margin: 0.75rem 0; font-size: 0.9375rem; line-height: 1.7; border: 1px solid var(--right-line); background: var(--right); overflow-wrap: anywhere; }
.pk-feedback.wrong { border-color: var(--wrong-line); background: var(--wrong); }
.pk-feedback p { margin: 0.5rem 0; }
.pk-feedback strong { font-size: 1.0625rem; }
.pk-feedback details { font-size: 0.875rem; color: var(--muted); }
.pk-feedback summary { cursor: pointer; }
.pk-waiting { text-align: center; padding: 3.75rem 0.9375rem; color: var(--muted); }

/* ---------- results ---------- */
.pk-results { margin: 0 auto 2.5rem; padding: 1.75rem; max-width: 53.75rem; background: var(--card); border: 1px solid var(--line); border-radius: 22px; }
.pk-results h2 { font-size: 1.6875rem; text-align: center; margin: 0 0 1.125rem; }
.pk-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(12.5rem, 1fr)); gap: 0.75rem; margin-bottom: 1.125rem; }
.pk-summary-player { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 1rem; border-radius: 16px; background: #f1f4e9; border-top: 4px solid var(--p1); }
.pk-summary-player.second { border-top-color: var(--p2); }
.pk-summary-player strong { font-size: 1.75rem; color: var(--green); }
.pk-summary-player span { font-size: 0.875rem; color: var(--muted); }
.pk-wrong-list { border: 1px solid var(--line); border-radius: 14px; padding: 0.75rem 1rem; margin: 0.75rem 0; }
.pk-wrong-list summary { font-weight: 700; cursor: pointer; }
.pk-wrong-item { border-top: 1px solid #edf0e5; padding: 0.625rem 0; font-size: 0.9375rem; }
.pk-wrong-item p { margin: 0.25rem 0; }
.pk-wrong-q { font-weight: 600; }
.pk-wrong-why { color: var(--muted); font-size: 0.875rem; }
.pk-why { padding: 0.4rem 0.7rem; border-left: 4px solid #e08a2e; border-radius: 8px; background: #fff3d6; color: #5a3a10; font-weight: 600; }
.pk-result-actions { display: flex; gap: 0.75rem; justify-content: center; margin-top: 1.125rem; }
.pk-result-actions button { min-width: 10rem; }

/* ---------- shared question pieces ---------- */
.prompt { font-size: 1.5rem; line-height: 1.8; margin: 0.5rem 0 1rem; padding: 1rem 1.125rem; background: white; border: 1px solid #edf0e5; border-radius: 16px; overflow-wrap: anywhere; white-space: pre-wrap; }
.options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.625rem; margin: 0.875rem 0; }
.options-list { grid-template-columns: 1fr; }
.options-many { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card { padding: 0.75rem 0.875rem; border: 1px solid #d4dec9; border-radius: 12px; background: #f7f9f2; font-size: 1.25rem; min-height: 3.25rem; overflow-wrap: anywhere; text-align: center; }
.options-list .card { text-align: left; font-size: 1.125rem; }
.card.selected { background: var(--gold-soft); border: 2px solid var(--gold); padding: 0.6875rem 0.8125rem; }
.card.right { background: var(--right); border: 2px solid var(--right-line); opacity: 1; }
.card.wrong { background: var(--wrong); border: 2px solid var(--wrong-line); opacity: 1; }
mark { background: #ffe797; color: inherit; border-bottom: 3px solid #da9c16; padding: 0 0.25rem; }
.letter-blank { display: inline-block; min-width: 1.4em; border-bottom: 2px solid currentColor; text-align: center; color: #9a6a12; }
.preview { font-size: 0.9375rem; line-height: 1.7; background: #eef4f6; padding: 0.5rem 0.625rem; border-radius: 8px; margin: 0.5rem 0; overflow-wrap: anywhere; }

/* blanks (的地得、标点) */
.blank-sentence { line-height: 2.4; }
.blank { display: inline-block; vertical-align: middle; min-width: 2.2em; height: 1.7em; margin: 0 0.1875rem; padding: 0 0.25rem; border: 0; border-bottom: 3px solid #8aa0b4; border-radius: 6px 6px 0 0; background: #f2f6f9; font-size: inherit; line-height: 1.6; color: #1f4f7a; font-weight: 700; }
.blank.active { background: var(--gold-soft); border-bottom-color: var(--gold); }
.blank.right { background: var(--right); border-bottom-color: var(--right-line); color: #2f6b33; opacity: 1; }
.blank.wrong { background: var(--wrong); border-bottom-color: var(--wrong-line); color: #9c3f2a; text-decoration: line-through; opacity: 1; }
.blank-holder { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; line-height: 1.3; }
.blank-fix { font-size: .7em; color: #2f6b33; font-weight: 700; }
.tray { grid-template-columns: repeat(auto-fill, minmax(3.5rem, 1fr)); }
.tray-key { font-size: 1.5rem; padding: 0.5rem; }
.tray-back { font-size: 1rem; grid-column: span 2; }

/* tiles (缩写、扩写、被字句、陈述句) */
.answer-line { background: #eef3f6; border-radius: 14px; min-height: 4.5rem; padding: 0.75rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0.375rem; font-size: 1.125rem; }
.q-tiles .options { display: flex; flex-wrap: wrap; }
.q-tiles .card { font-size: 1.125rem; min-height: 2.875rem; padding: 0.5625rem 0.8125rem; }
.card.kept { color: #14532d; background: #dff1e3; border: 2px solid #4f9a63; font-weight: 600; }

/* edit marks (修改病句) */
.symbol-tray { display: flex; justify-content: center; gap: 0.625rem; margin-bottom: 0.25rem; }
.symbol-button { display: flex; flex-direction: column; align-items: center; width: 4.375rem; padding: 0.25rem; border: 2px solid #dce5e0; border-radius: 10px; background: white; color: #bf3930; }
.symbol-button svg { width: 3.5rem; height: 2.125rem; }
.symbol-button span { font-size: 0.8125rem; color: var(--ink); }
.symbol-button.selected { background: var(--gold-soft); border-color: var(--gold); }
.edit-hint { font-size: 0.875rem; color: #53635b; margin: 0.375rem 0; min-height: 1.5em; }
.edit-board { position: relative; display: flex; flex-wrap: wrap; align-content: flex-start; align-items: center; padding: 0.5rem 0.5rem 1.125rem; min-height: 7.5rem; background: white; border: 1px solid #edf0e5; border-radius: 16px; }
.word-wrap, .gap-wrap { position: relative; display: inline-flex; margin-top: 2.375rem; margin-bottom: 0.3125rem; flex: 0 0 auto; }
.word { min-width: 1.875rem; min-height: 2.625rem; padding: 0.3125rem 0.1875rem; border: 1px solid #d6e0e9; border-radius: 7px; background: #f7fafc; font-size: 1.1875rem; line-height: 1.5; }
.word.selected { background: var(--gold-soft); border-color: #c58c00; }
.edit-board button:disabled { opacity: 1; }
.gap { width: 0.875rem; height: 2.625rem; padding: 0; border: none; background: transparent; position: relative; }
.gap.insertable::after { content: ''; position: absolute; left: 0.3125rem; top: 0.375rem; width: 0.25rem; height: 1.875rem; border-radius: 2px; background: #9fb8d0; }
.gap.selected::after { background: #dd8623; }
.mark-svg { position: absolute; width: calc(100% + 0.5rem); height: 4.25rem; left: -0.25rem; top: -1.5625rem; color: #be3832; pointer-events: none; overflow: visible; }
.annotation { position: absolute; bottom: calc(100% + 0.3125rem); left: 50%; transform: translateX(-50%); background: #fff5e1; border: 1px solid #d58a47; border-radius: 5px; color: #ae3029; font-size: 0.9375rem; white-space: nowrap; padding: 0 0.1875rem; z-index: 3; }
.correction-label { border: 2px solid #be3832; border-radius: 20px; background: #fff; padding: 0 0.375rem; min-width: 1.625rem; text-align: center; bottom: calc(100% + 0.75rem); }
/* 扩写: words added with a 增补号 sit in the line above a ∧ */
.expand-board { align-items: flex-end; }
.expand-board .word-wrap, .expand-board .gap-wrap { margin-top: 0.5rem; }
.expand-board .gap-wrap.filled { flex-direction: column; align-items: center; margin: 0.25rem 0.125rem 0.3125rem; }
.expand-word { border: 2px solid #be3832; border-radius: 20px; background: #fff; color: #ae3029; font-size: 1.0625rem; font-weight: 600; line-height: 1.5; padding: 0.125rem 0.625rem; min-height: 2.25rem; white-space: nowrap; }
.expand-caret { width: 1.75rem; height: 1.5rem; color: #be3832; margin-top: 0.125rem; }
.q-expand .symbol-button { cursor: default; }
.swap-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; color: #bd3833; }
.word-cards { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; padding: 0.5rem 0; }
.word-card { min-width: 3.25rem; min-height: 2.75rem; border: 2px solid #cad9e4; border-radius: 9px; background: white; font-size: 1.1875rem; padding: 0.25rem 0.625rem; }
.word-card.selected { background: var(--gold-soft); border-color: #cb8d00; }

/* figures and measure (数学) */
.figure { margin: 0.25rem 0 0.5rem; }
.map-wrap { max-width: 24.375rem; margin: auto; }
.map-wrap svg, .measure-visual svg, .ruler-zoom svg { display: block; width: 100%; height: auto; fill: var(--ink); }
.figure-legend { text-align: center; font-size: 0.875rem; color: #53635b; margin: 0.375rem 0; }
.ruler-zooms { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.ruler-zoom { background: #f8f8f0; border: 1px solid #e5eadc; border-radius: 10px; }
.answer-fields { display: flex; justify-content: center; gap: 1.125rem; flex-wrap: wrap; margin: 1.125rem 0 0.875rem; }
.answer-part { display: flex; align-items: center; gap: 0.5rem; font-size: 1.125rem; }
.answer-part input { width: 5.3125rem; min-height: 3rem; background: white; border: 1px solid #cfdac5; border-radius: 10px; text-align: center; font-size: 1.4375rem; }
.answer-part input.active { border: 2px solid var(--green); background: #f7faf2; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; max-width: 21.25rem; margin: 0 auto; }
.key { border: 1px solid #d5deca; background: #f3f6eb; border-radius: 10px; font-size: 1.25rem; min-height: 2.875rem; }
.key:active { background: #e3edd9; }

@media (max-width: 800px) {
  .pk-header { padding: 0.875rem; }
  .pk-header h1 { font-size: 1.1875rem; }
  .pk-arena { grid-template-columns: 1fr; padding: 0 0.75rem 1.25rem; gap: 1.125rem; }
  .pk-player { padding: 1rem; }
  .pk-results { margin: 0 0.75rem 1.875rem; padding: 1.25rem; }
  .options-many { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .pk-start { padding: 0.875rem; }
  .pk-card { padding: 1.625rem 1.125rem; border-radius: 22px; margin-top: 0; }
  .pk-rules { padding: 0.875rem 1rem; }
  .pk-emblem { width: 4rem; height: 4rem; font-size: 1.5rem; border-radius: 19px; }
  .pk-mode { font-size: 0.875rem; }
  .prompt { padding: 0.75rem 0.875rem; }
  .ruler-zooms { grid-template-columns: 1fr; }
  .pk-result-actions { flex-direction: column; }
  .pk-result-actions button { width: 100%; }
  .prompt { font-size: 1.3rem; }
  .pk-header { gap: 0.5rem; padding: 0.625rem 0.75rem; flex-wrap: nowrap; }
  .pk-header h1 { flex: 1; min-width: 0; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .pk-header .pk-home span, .pk-present-toggle { display: none; }
  .pk-timer { padding: 0.25rem 0.625rem; }
  .pk-settings-toggle { padding: 0.5rem 0.75rem; }
  .symbol-button { width: 3.875rem; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto !important; } }


/* ---------- toolbar: 投屏 + 设置 ---------- */
.pk-tools { display: flex; gap: 0.5rem; align-items: center; }
.pk-header .pk-tools { margin-left: auto; }
.pk-present-toggle { background: var(--card); color: #465f4e; border: 1px solid #d8e2d1; padding: 0.625rem 1rem; border-radius: 12px; min-height: 2.75rem; font-size: 0.875rem; white-space: nowrap; }
.pk-present-toggle[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: white; }

/* ---------- 投屏 mode: big type, no side chrome, timer centered, both players fill the screen ---------- */
.pk-present .pk-header { display: grid; grid-template-columns: 1fr auto 1fr; max-width: none; padding: 0.75rem 1.5rem; }
.pk-present .pk-header .pk-home { display: none; }
.pk-present .pk-header .pk-tools { justify-self: end; }
.pk-present .pk-timer { padding: 0.25rem 1.25rem; border-width: 2px; }
.pk-present .pk-timer strong { font-size: 2.25rem; }
.pk-present .pk-arena { max-width: none; }
.pk-present .pk-arena.solo { grid-template-columns: minmax(0, 60rem); }
.pk-present .pk-player { border-top-width: 8px; }
.pk-present .pk-player-head h2 { font-size: 1.5rem; }
.pk-present .pk-score { font-size: 2rem; }
.pk-present .pk-results { max-width: 60rem; }
.pk-present .pk-summary-player strong { font-size: 2.5rem; }
@media (max-width: 800px) { .pk-present .pk-header { display: flex; } }

/* ---------- free trial ---------- */
.pk-trial-note { background: var(--gold-soft); border: 1px solid #ecd58a; color: #6d5310; border-radius: 12px; padding: 0.625rem 0.875rem; font-size: 0.9375rem; margin: 0 0 1.25rem; }
.pk-contact { text-align: center; }
.pk-contact p { color: var(--muted); margin: 0 0 0.875rem; }
.pk-contact img { display: block; width: auto; max-width: min(100%, 17.5rem); max-height: 48vh; height: auto; margin: 0 auto; border-radius: 14px; border: 1px solid var(--line); }
.pk-contact .pk-actions { margin-top: 1rem; }
.pk-home-button { display: inline-flex; align-items: center; justify-content: center; min-height: 2.75rem; text-decoration: none; }
.pk-result-actions .pk-home-button { min-width: 10rem; }

/* ---------- online PK rooms ---------- */
.pk-modes.two { grid-template-columns: repeat(2, 1fr); }
.pk-modes.four { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 480px) { .pk-modes.four { grid-template-columns: repeat(2, 1fr); } }
.pk-av { --av: 2.5rem; width: var(--av); height: var(--av); border-radius: 50%; flex-shrink: 0; display: inline-grid; place-items: center; overflow: hidden; font-weight: 700; font-size: calc(var(--av) * 0.42); line-height: 1; color: #fff; background: #8ba182; }
.pk-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pk-av.c0 { background: #7c9a6d; } .pk-av.c1 { background: #c39a4b; } .pk-av.c2 { background: #6c8fa7; } .pk-av.c3 { background: #b47e66; } .pk-av.c4 { background: #8d7fb0; } .pk-av.c5 { background: #5f9c94; }
.pk-online { text-align: left; }
.pk-online-or { text-align: center; color: var(--muted); font-size: 0.875rem; margin: 1rem 0 0.5rem; }
.pk-online-join { display: flex; gap: 0.5rem; }
.pk-online-join input { flex: 1; min-width: 0; font-size: 1.125rem; letter-spacing: 0.2em; text-align: center; padding: 0.625rem 0.75rem; border: 1px solid var(--line); border-radius: 12px; background: #fff; min-height: 2.75rem; }
.pk-online-join button, .pk-online-room button { border-radius: 12px; padding: 0.625rem 1.125rem; min-height: 2.75rem; border: 1px solid var(--line); background: var(--card); color: var(--green-dark); font-weight: 650; white-space: nowrap; }
.pk-online-room button { background: var(--green); border-color: var(--green); color: #fff; }
.pk-online-class h3 { font-size: 0.9375rem; margin: 1.25rem 0 0.5rem; color: var(--muted); font-weight: 600; }
.pk-online-room { display: flex; align-items: center; gap: 0.75rem; padding: 0.625rem 0.75rem; border: 1px solid var(--line); border-radius: 14px; margin-top: 0.5rem; background: #fbfcf7; }
.pk-online-who { flex: 1; min-width: 0; display: flex; flex-direction: column; text-align: left; }
.pk-online-who strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pk-online-name-line { display: flex; align-items: center; gap: 0.375rem; min-width: 0; }
.pk-online-name-line strong { min-width: 0; }
.pk-online-who small { color: var(--muted); font-size: 0.8125rem; }
.pk-lobby-label { color: var(--muted); margin: 0; font-size: 0.9375rem; }
.pk-lobby-code { font: 800 clamp(2.75rem, 2rem + 4vw, 4.5rem)/1.15 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: 0.18em; color: var(--green-dark); margin: 0.25rem 0 0.75rem; padding-left: 0.18em; }
.pk-lobby .secondary { border-radius: 12px; padding: 0.625rem 1.25rem; min-height: 2.75rem; border: 1px solid var(--line); background: var(--card); color: var(--green-dark); font-weight: 650; }
.pk-lobby-count { font-size: 1.125rem; margin: 1.5rem 0 0.75rem; }
.pk-lobby-players { list-style: none; padding: 0; margin: 0 0 1.25rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr)); gap: 0.625rem; }
.pk-lobby-players li { display: flex; flex-direction: column; align-items: center; gap: 0.375rem; padding: 0.75rem 0.5rem; border-radius: 14px; background: #f1f4e9; font-size: 0.9375rem; overflow-wrap: anywhere; }
.pk-lobby-players li.me { outline: 2px solid var(--green); }
.pk-lobby-players .pk-av { --av: 3.25rem; }
.pk-lobby-status { font-size: 1.125rem; font-weight: 650; color: var(--muted); margin: 0.5rem 0; }
.pk-lobby-status.go { font-size: 2rem; color: var(--green); }
.pk-online-bar { max-width: 93.75rem; margin: 0 auto 0.75rem; padding: 0 1.5rem; display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; justify-content: center; }
.pk-online-chip { display: inline-flex; align-items: center; gap: 0.4375rem; padding: 0.25rem 0.75rem 0.25rem 0.25rem; border-radius: 999px; background: var(--card); border: 1px solid var(--line); font-size: 0.9375rem; max-width: 12rem; }
.pk-online-chip .pk-av { --av: 1.875rem; }
.pk-online-chip.me { border-color: var(--green); background: var(--green-soft); }
.pk-online-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pk-online-chip strong { color: var(--green-dark); }
.pk-online-notice { flex-basis: 100%; text-align: center; color: #aa3c46; font-size: 0.875rem; margin: 0; }
.pk-online-rank { list-style: none; margin: 0 0 1rem; padding: 0; }
.pk-online-rank li { display: flex; align-items: center; gap: 0.75rem; padding: 0.625rem 0.75rem; border-top: 1px solid var(--line); }
.pk-online-rank li:first-child { border-top: 0; }
.pk-online-rank li.me { background: var(--green-soft); border-radius: 14px; }
.pk-online-rankno { width: 2rem; text-align: center; font-size: 1.25rem; font-weight: 800; color: var(--muted); }
.pk-online-rank li:nth-child(-n+3) .pk-online-rankno { color: var(--gold); }
.pk-online-points { font-size: 1.25rem; font-weight: 750; color: var(--green-dark); white-space: nowrap; text-align: right; }
.pk-online-points small { display: block; font-size: 0.75rem; color: #9a7413; font-weight: 600; }
/* 段位 pill, same as social.css */
.tier { --t1: #b46a3c; --t2: #f0c39d; display: inline-flex; flex: none; padding: 0 0.5rem; border-radius: 999px; background: linear-gradient(135deg, var(--t2), var(--t1)); color: #fff; font-size: 0.75rem; font-weight: 800; line-height: 1.5; white-space: nowrap; text-shadow: 0 1px 1px rgba(0,0,0,.25); }
.t-silver { --t1: #7d8995; --t2: #d7dee6; }
.t-gold { --t1: #d98b00; --t2: #ffd75e; }
.t-platinum { --t1: #1f9b8c; --t2: #8fe3d8; }
.t-diamond { --t1: #2f6fe0; --t2: #9cc8ff; }
.t-star { --t1: #7a45e6; --t2: #cdb2ff; }
.t-king { --t1: #d6352b; --t2: #ffb36b; }
.t-glory { --t1: #c2185b; --t2: #ffd75e; }
@media (max-width: 600px) { .pk-online-bar { padding: 0 0.75rem; } .pk-online-chip { max-width: 9rem; font-size: 0.875rem; } }
button.pk-home { border: 0; background: transparent; padding: 0; }
.pk-practice-note { background: var(--gold-soft); border: 1px solid #ecd58a; color: #6d5310; border-radius: 12px; padding: 0.625rem 0.875rem; font-size: 0.9375rem; line-height: 1.7; margin: 0 0 1rem; text-align: left; }
.pk-practice-note a { color: var(--green-dark); font-weight: 700; }
.pk-lobby .pk-invite-main { border: 0; border-radius: 12px; padding: 0.625rem 1.5rem; min-height: 2.75rem; background: var(--gold); color: #3d2e05; font-weight: 750; box-shadow: 0 3px 0 #b88b1f; }
.pk-toast { position: fixed; left: 50%; bottom: 2.5rem; z-index: 1000; transform: translate(-50%, 1rem); max-width: calc(100vw - 2rem); padding: 0.75rem 1.375rem; border-radius: 999px; background: var(--green-dark); color: #fff; font-weight: 700; font-size: 1.0625rem; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22); opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; text-align: center; }
.pk-toast.bad { background: #9a3b2f; }
.pk-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- unit picker (banks with ui.units: 期末综合 or one unit) ---------- */
.pk-units { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.375rem; padding: 0.3125rem; background: #f1f4e9; border-radius: 14px; margin-bottom: 0.5rem; }
.pk-unit { flex: 1 1 3.25rem; border: 0; border-radius: 10px; background: transparent; padding: 0.5rem 0.5rem; font-size: 0.9375rem; color: #4b6347; min-height: 2.75rem; white-space: nowrap; }
.pk-unit:first-child { flex-basis: 6rem; }
.pk-unit[aria-checked="true"] { background: var(--card); color: var(--ink); font-weight: 700; box-shadow: 0 2px 6px #30442a1a; }
.pk-unit-note { font-size: 0.875rem; color: var(--green); margin: 0 0 1rem; }
