:root {
  --bg: #f6f8fb;
  --panel: #ffffff;
  --text: #1a2230;
  --muted: #6b7688;
  --border: #e3e8ef;
  --primary: #4f46e5;
  --primary-d: #4338ca;
  --accent: #0ea5e9;
  --shadow: 0 1px 3px rgba(16,24,40,.08), 0 1px 2px rgba(16,24,40,.06);
}
body.dark {
  --bg: #0f1420;
  --panel: #171d2b;
  --text: #e6eaf2;
  --muted: #93a0b5;
  --border: #283042;
  --shadow: 0 1px 3px rgba(0,0,0,.4);
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.5;
}
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; gap: 12px; align-items: center;
  padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--border); box-shadow: var(--shadow);
}
.brand { font-weight: 800; font-size: 18px; color: var(--primary); text-decoration: none; white-space: nowrap; }
.search { flex: 1; max-width: 720px; margin: 0 auto; padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text); font-size: 15px; }
.search:focus { outline: 2px solid var(--primary); }
.icon-btn { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; cursor: pointer; font-size: 16px; }
.layout { display: flex; align-items: flex-start; max-width: 1280px; margin: 0 auto; }
.sidebar { width: 230px; flex-shrink: 0; position: sticky; top: 61px; height: calc(100vh - 61px); overflow-y: auto; padding: 14px 10px; border-right: 1px solid var(--border); }
.cat-link { display: flex; justify-content: space-between; align-items: center; width: 100%; text-align: left; background: none; border: none; color: var(--text); padding: 9px 12px; border-radius: 8px; cursor: pointer; font-size: 14px; margin-bottom: 2px; }
.cat-link:hover, .cat-link.active { background: var(--primary); color: #fff; }
.badge { font-size: 11px; background: rgba(255,255,255,.25); padding: 1px 7px; border-radius: 999px; }
.cat-link:not(.active) .badge { background: var(--bg); color: var(--muted); }
.main { flex: 1; padding: 20px 24px; min-width: 0; }
.footer { text-align: center; color: var(--muted); font-size: 13px; padding: 24px; border-top: 1px solid var(--border); }
.section-title { font-size: 15px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 22px 0 10px; }
.page-title { font-size: 26px; margin: 0 0 12px; display: flex; align-items: center; gap: 10px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; align-items: stretch; }
.card { display: block; padding: 14px 14px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; color: var(--text); text-decoration: none; font-size: 14px; font-weight: 500; box-shadow: var(--shadow); transition: transform .08s, border-color .08s; }
.card:hover { transform: translateY(-2px); border-color: var(--primary); color: var(--primary); }
.cat-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.cat-card { text-align: left; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px; cursor: pointer; box-shadow: var(--shadow); }
.cat-card:hover { border-color: var(--primary); }
.cat-card-name { font-weight: 700; font-size: 15px; }
.cat-card-count { color: var(--muted); font-size: 13px; margin-top: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip { background: var(--panel); border: 1px solid var(--border); border-radius: 999px; padding: 6px 14px; cursor: pointer; color: var(--text); font-size: 13px; }
.chip:hover { border-color: var(--primary); color: var(--primary); }
.hint { color: var(--muted); font-size: 13px; }
.breadcrumb { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.breadcrumb a { color: var(--primary); text-decoration: none; }
.tool-title { font-size: 24px; margin: 0 0 4px; }
.tool-desc { color: var(--muted); margin: 0 0 16px; }
.tool-panel { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 20px; box-shadow: var(--shadow); max-width: 720px; }
.tool-form { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 120px; }
.field-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.inp { padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--bg); color: var(--text); font-size: 14px; width: 100%; font-family: inherit; }
.inp:focus { outline: 2px solid var(--primary); }
.area { min-height: 120px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.result-label { font-size: 13px; color: var(--muted); font-weight: 600; align-self: center; }
.result { background: var(--bg); border: 1px dashed var(--border); border-radius: 9px; padding: 12px 14px; white-space: pre-wrap; word-break: break-all; font-family: ui-monospace, Menlo, monospace; font-size: 14px; min-height: 44px; }
.btn { background: var(--primary); color: #fff; border: none; border-radius: 9px; padding: 10px 16px; cursor: pointer; font-size: 14px; font-weight: 600; }
.btn:hover { background: var(--primary-d); }
.btn.ghost { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.preview-img { max-width: 100%; border-radius: 8px; margin-top: 8px; border: 1px solid var(--border); }
.preview-frame { width: 100%; height: 320px; border: 1px solid var(--border); border-radius: 8px; margin-top: 8px; background: #fff; }
.preview-canvas { max-width: 100%; border: 1px solid var(--border); border-radius: 8px; margin-top: 8px; }
@media (max-width: 760px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; position: static; height: auto; border-right: none; border-bottom: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: 4px; }
  .cat-link { width: auto; }
}
.topbar-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
#lang-label { font-size: 12px; font-weight: 700; }
.ai-config { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; }
.ai-config-title { font-weight: 700; margin: 0 0 4px; font-size: 15px; }
.ai-config-desc { color: var(--muted); font-size: 13px; margin: 0 0 12px; line-height: 1.5; }
.ai-config-hint { color: var(--accent); font-size: 12.5px; margin: 12px 0 0; line-height: 1.5; font-weight: 600; }
.ai-banner { background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 14%, var(--bg)), var(--bg)); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 12px; padding: 12px 16px; margin-bottom: 16px; font-size: 13.5px; line-height: 1.55; color: var(--text); }
.ai-advanced { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 10px 16px; margin-bottom: 16px; }
.ai-advanced summary { cursor: pointer; font-weight: 600; font-size: 14px; user-select: none; }
.ai-advanced .chk { display: flex; align-items: center; gap: 8px; font-size: 13.5px; margin: 12px 0; color: var(--text); }
.timer-display { font-size: 42px; font-weight: 800; font-variant-numeric: tabular-nums; text-align: center; padding: 12px; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; }

/* ---------- Random Name Picker (随机点名) ---------- */
.np-wrap { display: flex; flex-direction: column; gap: 14px; }
.np-stage {
  display: flex; align-items: center; justify-content: center;
  min-height: 180px; padding: 24px; border-radius: 18px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff; box-shadow: var(--shadow); transition: transform .15s ease;
  overflow: hidden; text-align: center;
}
.np-name { font-size: clamp(32px, 8vw, 72px); font-weight: 800; letter-spacing: 1px; line-height: 1.15; word-break: break-word; }
.np-stage.np-spinning .np-name { opacity: .85; filter: blur(.4px); }
.np-stage.np-hit { animation: npPop .5s ease; }
@keyframes npPop { 0% { transform: scale(.9); } 50% { transform: scale(1.06); } 100% { transform: scale(1); } }
.np-counter { text-align: center; color: var(--muted); font-size: 13.5px; }
.np-controls { display: flex; gap: 10px; justify-content: center; }
.np-pick { font-size: 17px; padding: 12px 34px; }
.np-opt { display: flex; align-items: center; gap: 8px; justify-content: center; font-size: 13.5px; color: var(--text); }
.np-history { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: center; min-height: 8px; }
.np-history-label { color: var(--muted); font-size: 13px; }
.np-chip { background: var(--bg); border: 1px solid var(--border); border-radius: 999px; padding: 3px 12px; font-size: 13px; color: var(--text); }
.np-import { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 10px 16px; }
.np-import summary { cursor: pointer; font-weight: 600; font-size: 14px; user-select: none; }
.np-import textarea { margin-top: 10px; }
.np-hint { color: var(--muted); font-size: 12.5px; margin: 8px 0; line-height: 1.5; }

/* ---------- Random Group Maker (随机分组) ---------- */
.group-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-top: 16px; }
.group-card { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow); }
.group-head { display: flex; justify-content: space-between; align-items: center; font-weight: 700; margin-bottom: 10px; color: var(--primary); }
.group-count { background: var(--bg); color: var(--muted); border-radius: 999px; padding: 1px 9px; font-size: 12px; font-weight: 600; }
.group-members { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- Classroom Timer (课堂计时器) ---------- */
.timer-wrap { display: flex; flex-direction: column; gap: 14px; align-items: center; }
.timer-big { font-size: clamp(56px, 16vw, 120px); font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: 2px; color: var(--text); line-height: 1; }
.timer-big.timer-warn { color: #f59e0b; }
.timer-big.timer-done { color: #ef4444; animation: npPop .5s ease; }
.timer-bar { width: 100%; max-width: 420px; height: 10px; background: var(--bg); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.timer-bar-fill { height: 100%; width: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); transition: width .3s linear; }
.timer-presets { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip-btn { background: var(--bg); border: 1px solid var(--border); border-radius: 999px; padding: 6px 14px; cursor: pointer; font-size: 13px; color: var(--text); }
.chip-btn:hover { border-color: var(--primary); color: var(--primary); }
.timer-inputs { justify-content: center; }
.timer-mins { max-width: 90px; text-align: center; }

/* ---------- Unit Converter (单位换算) ---------- */
.cv-form { gap: 16px; }
.cv-io { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 12px; align-items: end; }
.cv-io .btn { height: 42px; }
.cv-result-card { background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 10%, var(--panel)), var(--panel)); border: 1px solid var(--border); border-radius: 16px; padding: 22px 20px; text-align: center; box-shadow: var(--shadow); }
.cv-result-value { font-size: clamp(34px, 8vw, 56px); font-weight: 800; color: var(--primary); line-height: 1.1; word-break: break-all; font-variant-numeric: tabular-nums; }
.cv-result-unit { color: var(--muted); font-size: 15px; margin-top: 4px; }
.cv-result-foot { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: center; margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--border); }
.cv-formula { color: var(--text); font-size: 14px; }
@media (max-width: 640px) { .cv-io { grid-template-columns: 1fr 1fr; } }

/* ================= Tabs / topbar / sidebar ================= */
.top-tabs { display: flex; gap: 4px; flex-shrink: 0; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 3px; }
.top-tab { border: none; background: transparent; color: var(--muted); font-size: 13.5px; font-weight: 600; padding: 7px 12px; border-radius: 8px; cursor: pointer; white-space: nowrap; font-family: inherit; }
.top-tab:hover { color: var(--primary); }
.top-tab.active { background: var(--primary); color: #fff; box-shadow: var(--shadow); }
.quota-badge { font-size: 12px; color: var(--muted); background: var(--bg); border: 1px solid var(--border); border-radius: 999px; padding: 5px 10px; white-space: nowrap; }
.quota-badge.bad { color: #dc2626; border-color: #fecaca; background: #fef2f2; }
.side-sep { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 12px 12px 4px; font-weight: 700; }
.tool-panel.wide { max-width: 980px; }
.card { position: relative; }
.card-tag { display: inline-block; margin-left: 6px; font-size: 10px; font-weight: 800; letter-spacing: .05em; color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, var(--panel)); padding: 1px 6px; border-radius: 5px; vertical-align: middle; }

.home-hero .page-title { margin-bottom: 4px; }
.home-more { margin: 18px 0 4px; color: var(--muted); font-size: 14px; }
.home-more a { color: var(--primary); font-weight: 700; text-decoration: none; }
.home-more a:hover { text-decoration: underline; }
@media (max-width: 900px) { .top-tabs { order: 3; width: 100%; } .topbar { flex-wrap: wrap; } .search { min-width: 120px; } .quota-badge { display: none; } }

/* ================= Toolkit / generic docs ================= */
.tk-status { color: var(--muted); font-size: 13px; min-height: 18px; margin: 8px 0; }
.tk-net-hint { background: color-mix(in srgb, var(--accent) 10%, var(--bg)); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 10px; padding: 10px 14px; font-size: 13px; color: var(--text); margin: 0 0 14px; }
.doc-out { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.doc-out .result { width: 100%; max-height: 420px; overflow: auto; }
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; width: 100%; }
.doc-card { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.doc-card .preview-img { width: 100%; }
.qr-canvas, .preview-canvas { max-width: 100%; border: 1px solid var(--border); border-radius: 10px; background: #fff; image-rendering: pixelated; }
.pick-canvas { cursor: crosshair; }
.swatch { width: 40px; height: 40px; border-radius: 8px; border: 1px solid var(--border); flex-shrink: 0; background: transparent; }
.print-frame { visibility: hidden; }

/* ================= Unit hub ================= */
.uh-favs { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.uh-favs .result-label { white-space: nowrap; }
.uh-table { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; max-height: 380px; overflow-y: auto; }
.uh-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; text-align: left; background: var(--panel); border: none; border-bottom: 1px solid var(--border); padding: 8px 14px; font-size: 13.5px; color: var(--text); font-family: inherit; }
button.uh-row { cursor: pointer; }
button.uh-row:hover { background: color-mix(in srgb, var(--primary) 8%, var(--panel)); color: var(--primary); }
.uh-head { position: sticky; top: 0; background: var(--bg); font-weight: 700; color: var(--muted); font-size: 12.5px; z-index: 1; }
.uh-num { font-family: ui-monospace, Menlo, monospace; word-break: break-all; }

/* ================= Sudoku ================= */
.sdk-home { background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 18px; box-shadow: var(--shadow); }
.sdk-tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.sdk-tab { border: none; background: transparent; color: var(--muted); font-size: 14px; font-weight: 700; padding: 10px 16px; cursor: pointer; border-bottom: 2px solid transparent; font-family: inherit; }
.sdk-tab:hover { color: var(--primary); }
.sdk-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.sdk-controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 12px; }
.sdk-controls .field { min-width: 130px; flex: 1; }
.sdk-controls .row { flex: 1 1 100%; }
.sdk-status { color: var(--muted); font-size: 13.5px; margin-bottom: 12px; min-height: 20px; }
.sdk-preview { min-height: 180px; }
.sdk-placeholder { display: flex; align-items: center; justify-content: center; min-height: 180px; color: var(--muted); background: var(--bg); border: 1px dashed var(--border); border-radius: 12px; font-size: 14px; }
.sdk-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.sdk-card { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 10px; }
.sdk-card-title { font-size: 12px; color: var(--muted); font-weight: 700; margin-bottom: 6px; }
.sdk-grid { display: grid; grid-template-columns: repeat(9, 1fr); grid-template-rows: repeat(9, 1fr); aspect-ratio: 1; width: 100%;
  background: var(--panel); border: 2px solid var(--text); border-radius: 4px; overflow: hidden; }
.sdk-cell { display: flex; align-items: center; justify-content: center; position: relative;
  border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
  font-size: clamp(10px, 1.5vw, 17px); font-weight: 600; color: var(--text); user-select: none; cursor: pointer; }
.sdk-card .sdk-cell { font-size: clamp(9px, 1.2vw, 14px); }
.sdk-cell.br-top { border-top: 2px solid var(--text); }
.sdk-cell.br-left { border-left: 2px solid var(--text); }
.sdk-cell.br-bottom { border-bottom: none; }
.sdk-cell.br-right { border-right: none; }
.sdk-cell.given { color: var(--text); font-weight: 700; }
.sdk-cell.user { color: var(--primary); }
.sdk-cell.empty { color: var(--muted); }
.sdk-cell.related { background: color-mix(in srgb, var(--primary) 6%, var(--panel)); }
.sdk-cell.same { background: color-mix(in srgb, var(--accent) 16%, var(--panel)); }
.sdk-cell.selected { background: color-mix(in srgb, var(--primary) 26%, var(--panel)); box-shadow: inset 0 0 0 2px var(--primary); }
.sdk-cell.error { color: #dc2626; background: #fee2e2; }
.sdk-notes { position: absolute; inset: 1px; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); font-size: 7px; color: var(--muted); pointer-events: none; }
.sdk-notes span { display: flex; align-items: center; justify-content: center; }
.sdk-game-wrap { display: flex; justify-content: center; margin: 12px 0; }
.sdk-game-grid { display: grid; grid-template-columns: repeat(9, 1fr); grid-template-rows: repeat(9, 1fr); aspect-ratio: 1;
  width: min(100%, 460px); background: var(--panel); border: 2px solid var(--text);
  border-radius: 4px; overflow: hidden; }
.sdk-game-grid .sdk-cell { font-size: clamp(15px, 3.4vw, 24px); }
.sdk-pad { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; max-width: 460px; margin: 0 auto; }
.sdk-num { font-size: 16px; font-weight: 700; padding: 10px 0; }
.sdk-num.on, .sdk-tab .on { background: var(--primary); color: #fff; }
.sdk-stats { display: flex; gap: 20px; font-size: 13px; color: var(--muted); margin: 4px 0 10px; }
.sdk-stat { font-weight: 800; color: var(--primary); font-variant-numeric: tabular-nums; }
.sdk-msg { background: var(--bg); border-left: 3px solid var(--border); border-radius: 8px; padding: 9px 12px; font-size: 13.5px; margin-bottom: 10px; }
.sdk-msg.ok { border-left-color: #16a34a; background: #f0fdf4; color: #166534; }
.sdk-msg.warn { border-left-color: #f59e0b; background: #fffbeb; color: #92400e; }
body.dark .sdk-msg.ok { background: #14251c; color: #86efac; }
body.dark .sdk-msg.warn { background: #2b2313; color: #fcd34d; }
@media (max-width: 640px) { .sdk-pad { grid-template-columns: repeat(5, 1fr); } .sdk-controls .field { min-width: 100px; } }

/* ================= AI quota box ================= */
.quota-box { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; }
.quota-box.exceeded { border-color: #fecaca; background: #fef2f2; }
body.dark .quota-box.exceeded { background: #2a1717; border-color: #7f1d1d; }
.quota-title { font-weight: 700; font-size: 13.5px; margin-bottom: 8px; }
.quota-bar { height: 8px; background: var(--panel); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.quota-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--primary), var(--accent)); transition: width .3s ease; }
.quota-text { color: var(--muted); font-size: 12.5px; margin-top: 8px; }

/* ================= Table data animation ================= */
.anim-help { background: var(--bg); border-left: 3px solid var(--primary); border-radius: 8px; padding: 10px 12px; font-size: 13px; color: var(--muted); line-height: 1.7; margin-bottom: 14px; }
.anim-form .row { margin-bottom: 10px; }
.anim-data { min-height: 170px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; white-space: pre; line-height: 1.6; }
.anim-stage { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 10px; margin: 14px 0; }
.anim-canvas { display: block; width: 100%; height: auto; background: #fff; border-radius: 8px; }
.anim-controls, .anim-export { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.anim-range { flex: 1 1 140px; min-width: 120px; accent-color: var(--primary); }
.anim-time { font-size: 13px; color: var(--muted); min-width: 46px; text-align: right; font-variant-numeric: tabular-nums; }
.anim-bar { height: 8px; background: var(--panel); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; margin: 10px 0; }
.anim-bar-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--primary), var(--accent)); transition: width .2s; }
.anim-engine { font-size: 12px; color: var(--muted); line-height: 1.6; margin-top: 8px; }
@media (max-width: 700px) { .anim-form .row { flex-wrap: wrap; } .anim-form .field { min-width: 140px; } }

/* Long tool lists stay fluid: off-screen cards are skipped while rendering. */
.card { content-visibility: auto; contain-intrinsic-size: auto 56px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* Chart option row */
.anim-check-row { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin: 0 0 12px; cursor: pointer; }
.anim-check { width: 16px; height: 16px; accent-color: var(--primary); }
.anim-form .row .field { min-width: 150px; }
.anim-canvas { aspect-ratio: 16 / 9; }
.anim-checks { gap: 18px !important; flex-wrap: wrap; }

/* Browser games */
.gm { display: flex; flex-direction: column; gap: 10px; }
.gm-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 18px; font-weight: 700; }
.gm-score { font-size: 13px; font-weight: 600; color: var(--primary); }
.gm-desc { font-size: 13px; color: var(--muted); }
.gm-stage { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 180px; padding: 12px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; }
.gm-grid { display: grid; gap: 4px; width: min(100%, 420px); }
.gm-cell { display: flex; align-items: center; justify-content: center; aspect-ratio: 1; border-radius: 6px; background: var(--panel); border: 1px solid var(--border); font-size: 16px; font-weight: 700; cursor: pointer; user-select: none; transition: background .12s, transform .08s; }
.gm-cell:hover { transform: scale(1.04); }
.gm-cell.hidden { background: #cbd5e1; color: transparent; }
.gm-cell.open { background: #f8fafc; }
.gm-cell.mine { background: #fee2e2; }
.gm-cell.flag { background: #fef3c7; }
.gm-cell.snake, .gm-cell.paddle { background: #0ea5e9; color: #fff; }
.gm-cell.food, .gm-cell.mole, .gm-cell.ball { background: #f59e0b; color: #fff; }
.gm-cell.wall { background: #334155; border-color: #334155; }
.gm-cell.goal { background: #dcfce7; }
.gm-cell.lit { background: #fde68a; }
.gm-cell.done, .gm-cell.blank { opacity: .45; }
.gm-cell.tile { background: #e0e7ff; color: #312e81; }
.gm-cell.pad { min-height: 70px; }
.gm-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.gm-actions .btn { padding: 6px 14px; font-size: 14px; }
.gm-input { max-width: 160px; }
.gm-status { min-height: 22px; font-size: 13px; color: var(--text); }
.gm-word { font-size: 34px; font-weight: 800; margin: 8px 0; min-height: 44px; }
.gm-pad { display: flex; align-items: center; justify-content: center; width: min(100%, 420px); min-height: 140px; border-radius: 10px; background: #e2e8f0; font-size: 20px; font-weight: 700; cursor: pointer; user-select: none; }
.gm-pad.wait { background: #f59e0b; color: #fff; }
.gm-pad.go { background: #16a34a; color: #fff; }
@media (max-width: 700px) { .gm-grid { width: 100%; } .gm-cell { font-size: 13px; } }
