
  * { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
  html { height: 100%; }
  body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: linear-gradient(160deg, #101a2b 0%, #22384f 100%);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    justify-content: safe center;
    min-height: 100vh; min-height: 100svh; padding: 12px; user-select: none;
  }
  .panel {
    position: relative;
    /* 棋盘是正方形且 9 阶：--cs 必须同时受宽度与可用高度反推约束，
       否则矮视口下棋盘底部被 overflow 裁掉，滚也滚不到。
       两行 svh/vh —— 只写 svh 的话，不支持的浏览器整条作废。 */
    --cs: min(46px, calc((100vw - 56px) / 9), calc((100vh - 320px) / 9));
    --cs: min(46px, calc((100vw - 56px) / 9), calc((100svh - 320px) / 9));
    width: calc(var(--cs) * 9 + 24px);
    background: rgba(255,255,255,.05);
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 18px; padding: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,.4);
  }
  .topbar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
  .stat {
    flex: 1; background: rgba(255,255,255,.07); border-radius: 10px;
    padding: 4px 8px; text-align: center; color: #fff; min-width: 0;
  }
  .stat small { display: block; font-size: 9px; font-weight: 700; letter-spacing: 1px; opacity: .55; }
  .stat span { font-size: 15px; font-weight: 800; letter-spacing: .5px; }
  #mute-btn {
    flex: 0 0 auto; width: 44px; height: 44px; border-radius: 10px; padding: 0;
    background: rgba(255,255,255,.07); border: none; color: #fff;
    font-size: 17px; cursor: pointer;
  }
  .board {
    position: relative; width: calc(var(--cs) * 9); height: calc(var(--cs) * 9);
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    grid-template-rows: repeat(9, 1fr);
    background: rgba(255,255,255,.10);
    border: 2px solid rgba(255,255,255,.45);
    border-radius: 8px; overflow: hidden;
  }
  .cell {
    display: flex; align-items: center; justify-content: center;
    font-size: calc(var(--cs) * .58); font-weight: 700;
    color: #cfe4ff; background: rgba(10,20,34,.62);
    border-right: 1px solid rgba(255,255,255,.10);
    border-bottom: 1px solid rgba(255,255,255,.10);
    cursor: pointer; transition: background .1s ease;
  }
  .cell.fixed { color: #ffffff; font-weight: 800; background: rgba(20,36,56,.82); }
  .cell.peer { background: rgba(74,144,255,.16); }
  .cell.same { background: rgba(74,144,255,.30); }
  .cell.sel  { background: rgba(74,144,255,.52); box-shadow: inset 0 0 0 2px #9cc4ff; }
  .cell.bad  { color: #ff8a8a; }
  .cell:nth-child(9n) { border-right: none; }
  .cell:nth-child(n+73) { border-bottom: none; }
  /* 3×3 宫格粗线 —— 用 box-shadow 画，避免多占一格像素破坏网格 */
  .cell.bx-right { box-shadow: inset -2px 0 0 rgba(255,255,255,.45); }
  .cell.bx-bottom { box-shadow: inset 0 -2px 0 rgba(255,255,255,.45); }
  .cell.bx-right.bx-bottom { box-shadow: inset -2px 0 0 rgba(255,255,255,.45), inset 0 -2px 0 rgba(255,255,255,.45); }
  .cell.sel.bx-right { box-shadow: inset 0 0 0 2px #9cc4ff, inset -2px 0 0 rgba(255,255,255,.45); }
  .cell.sel.bx-bottom { box-shadow: inset 0 0 0 2px #9cc4ff, inset 0 -2px 0 rgba(255,255,255,.45); }
  .cell.sel.bx-right.bx-bottom { box-shadow: inset 0 0 0 2px #9cc4ff, inset -2px 0 0 rgba(255,255,255,.45), inset 0 -2px 0 rgba(255,255,255,.45); }
  .pad { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-top: 10px; }
  .pad button {
    min-height: 44px; border-radius: 10px; border: none; cursor: pointer; padding: 0;
    background: rgba(255,255,255,.10); color: #fff;
    font-size: 18px; font-weight: 800; font-family: inherit;
    transition: background .12s ease;
  }
  .pad button:active { background: rgba(74,144,255,.55); }
  .pad button.erase { font-size: 12px; letter-spacing: 1px; }
  .modes { display: flex; gap: 8px; margin-top: 8px; }
  .modes button {
    flex: 1; min-height: 44px; border-radius: 10px; border: none; cursor: pointer;
    background: rgba(255,255,255,.08); color: rgba(255,255,255,.72);
    font-size: 13px; font-weight: 700; font-family: inherit; letter-spacing: .5px;
    transition: background .15s ease, color .15s ease;
  }
  .modes button.on { background: #4a90ff; color: #fff; }
  .actions { display: flex; gap: 8px; margin-top: 8px; }
  .actions button {
    flex: 1; min-height: 48px; border-radius: 12px; border: none; cursor: pointer;
    font-size: 15px; font-weight: 800; letter-spacing: 1px; font-family: inherit;
    transition: transform .12s ease, box-shadow .12s ease;
  }
  .actions button:active { transform: scale(.96); }
  .btn-primary { background: #4a90ff; color: #fff; box-shadow: 0 4px 0 #2a63bd; }
  .btn-ghost { background: rgba(255,255,255,.14); color: #fff; box-shadow: 0 4px 0 rgba(0,0,0,.25); }
  .overlay {
    position: absolute; inset: 0; border-radius: 18px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 8px; text-align: center; padding: 18px;
    background: rgba(10, 18, 30, .86); backdrop-filter: blur(3px); color: #fff; z-index: 6;
  }
  .hidden { display: none !important; }
  .over-title { font-size: 22px; font-weight: 800; letter-spacing: 2px; }
  .over-sub { font-size: 13px; opacity: .75; line-height: 1.7; }
  .over-sub b { color: #ffd76e; }
  .final-line { font-size: 15px; font-weight: 700; }
  .final-line b { font-size: 24px; }
  .new-record {
    background: #ffd76e; color: #5a3e00; font-size: 12px; font-weight: 800;
    padding: 4px 14px; border-radius: 999px; animation: pulse 1s ease-in-out infinite;
  }
  @keyframes pulse { 0%,100% { transform: scale(1) } 50% { transform: scale(1.08) } }
  .over-btns { display: flex; gap: 8px; margin-top: 6px; width: 100%; }
  .over-btns button {
    flex: 1; min-height: 48px; border-radius: 12px; border: none; cursor: pointer;
    font-size: 15px; font-weight: 800; font-family: inherit;
  }
  .icon-big { font-size: 40px; }
  .footer {
    margin-top: 10px; color: rgba(255,255,255,.55); font-size: 12px;
    text-align: center; line-height: 1.9; max-width: 460px;
  }
  .footer a { color: rgba(255,255,255,.78); text-decoration: none; display: inline-block; min-width: 44px; min-height: 44px; line-height: 44px; }
  .footer a:hover { color: #ffd76e; }
  .side { display: contents; }

  /* 横屏矮视口：面板改成「棋盘在左、控件在右」两栏，否则 9 阶棋盘按高度反推会小到不可用 */
  @media (orientation: landscape) and (max-height: 560px) {
    .panel {
      --cs: min(40px, calc((100vh - 210px) / 9));
      --cs: min(40px, calc((100svh - 210px) / 9));
      width: auto; max-width: calc(100vw - 24px);
      display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px;
    }
    .topbar { width: 100%; margin-bottom: 0; }
    .board { flex: 0 0 auto; }
    .side { display: flex; flex-direction: column; gap: 8px; flex: 0 0 auto; }
    .pad { grid-template-columns: repeat(5, 44px); gap: 4px; margin-top: 0; }
    .modes { margin-top: 0; }
    .actions { margin-top: 0; }
    .footer { margin-top: 6px; }
  }

.footer{font-size:11px;margin-top:8px}button:focus-visible{outline:3px solid #d9ff8e;outline-offset:3px}@media(prefers-reduced-motion:reduce){*{animation:none!important}}
.frame-inline-0{margin-top:6px;padding:12px 28px;}
.frame-inline-0{margin-top:6px;padding:12px 28px;}