  :root {
    --bg: #faf7f0; --ink: #2b2a27; --muted: #6b675f; --line: #3b2f1e;
    --board: #e9c88a; --sel: #2f7dd1; --dest: rgba(47,125,209,.28);
    --ok: #1f8a4c; --ng: #c0392b; --miss: #e0a800; --card: #ffffff; --bd: #e2dccd;
  }
  * { box-sizing: border-box; }
  body { margin: 0; background: var(--bg); color: var(--ink);
    font-family: "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", sans-serif; }
  header { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 16px;
    border-bottom: 1px solid var(--bd); background: var(--card); }
  header h1 { font-size: 18px; margin: 0 12px 0 0; }
  .tabs button, .btn { font: inherit; font-size: 16px; padding: 8px 14px; border-radius: 10px;
    border: 1px solid var(--bd); background: var(--card); color: var(--ink); cursor: pointer; }
  .tabs button[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
  .btn.primary { background: var(--sel); color: #fff; border-color: var(--sel); }
  .btn:disabled { opacity: .45; cursor: default; }
  .name { margin-left: auto; display: flex; gap: 6px; align-items: center; font-size: 14px; color: var(--muted); }
  .name input { font: inherit; font-size: 15px; width: 9em; padding: 6px 8px; border: 1px solid var(--bd); border-radius: 8px; }
  main { display: flex; flex-wrap: wrap; gap: 20px; padding: 16px; justify-content: center; align-items: flex-start; }
  .side { width: min(360px, 100%); display: flex; flex-direction: column; gap: 12px; }
  .card { background: var(--card); border: 1px solid var(--bd); border-radius: 14px; padding: 14px; }
  .card h2 { font-size: 15px; margin: 0 0 8px; color: var(--muted); font-weight: 600; }
  .msg { font-size: 20px; font-weight: 700; min-height: 1.6em; }
  .msg.ok { color: var(--ok); } .msg.ng { color: var(--ng); }
  .sub { font-size: 14px; color: var(--muted); line-height: 1.6; }
  .grid-btns { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .grid-btns button { font: inherit; font-size: 20px; padding: 8px 0; border-radius: 10px;
    border: 1px solid var(--bd); background: #fff; cursor: pointer; }
  .grid-btns button[aria-pressed="true"] { background: var(--board); border-color: var(--line); }
  .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
  .boardwrap { --sq: min(9.4vw, 52px); display: flex; flex-direction: column; align-items: center; gap: 8px; }
  .files { display: flex; margin-right: 22px; }
  .files span { width: var(--sq); text-align: center; font-size: 13px; color: var(--muted); }
  .bwrap { display: flex; }
  .ranks { display: flex; flex-direction: column; }
  .ranks span { height: var(--sq); width: 22px; display: flex; align-items: center; justify-content: center; font-size: 13px; color: var(--muted); }
  .board { display: grid; grid-template-columns: repeat(9, var(--sq));
    grid-template-rows: repeat(9, var(--sq)); background: var(--board); border: 2px solid var(--line); }
  .sq { border: 1px solid rgba(59,47,30,.55); display: flex; align-items: center; justify-content: center;
    font-size: calc(var(--sq) * .62); cursor: pointer; position: relative; user-select: none; -webkit-user-select: none; }
  .sq.sel { background: rgba(47,125,209,.45); }
  .sq.dest::after { content: ""; position: absolute; inset: 22%; border-radius: 50%; background: var(--dest); }
  .sq.q-ok { background: rgba(31,138,76,.45); } .sq.q-ng { background: rgba(192,57,43,.45); }
  .sq.q-miss { background: rgba(224,168,0,.55); } .sq.picked { background: rgba(47,125,209,.35); }
  .sq.last { box-shadow: inset 0 0 0 3px rgba(192,57,43,.6); }
  .pc { line-height: 1; font-weight: 700; }
  .pc.w { transform: rotate(180deg); } .pc.pr { color: #b3261e; }
  .hand { display: flex; gap: 6px; flex-wrap: wrap; min-height: 48px; align-items: center; }
  .hand button { font: inherit; font-size: 24px; font-weight: 700; padding: 4px 10px; border-radius: 8px;
    border: 1px solid var(--line); background: var(--board); cursor: pointer; }
  .hand button.sel { outline: 3px solid var(--sel); }
  .hand small { font-size: 13px; margin-left: 2px; }
  .plist { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
  .plist button { font: inherit; font-size: 15px; padding: 8px 0; border-radius: 8px; border: 1px solid var(--bd); background: #fff; cursor: pointer; }
  .plist button.cur { border-color: var(--sel); border-width: 2px; }
  .plist button.done { background: #e6f4ea; }
  .modal { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: none; align-items: center; justify-content: center; }
  .modal.open { display: flex; }
  .modal .card { text-align: center; }
  .modal .row { justify-content: center; margin-top: 10px; }
  textarea { width: 100%; font: 13px ui-monospace, Menlo, monospace; border: 1px solid var(--bd); border-radius: 8px; padding: 8px; }
  details summary { cursor: pointer; color: var(--muted); font-size: 14px; }
  label.chk { font-size: 14px; display: flex; gap: 6px; align-items: center; }
  .full { width: 100%; } .hidden { display: none !important; } .mb8 { margin-bottom: 8px; } .mt10 { margin-top: 10px; } .mt6 { margin-top: 6px; }
  /* よみがな */
  rt { font-size: 0.5em; font-weight: 400; color: var(--muted); }
  .grid-btns rt, .hand rt { font-size: 0.45em; }
  body.no-yomi rt { display: none; }
  .yomi { margin-left: 8px; }
  .mv-name { margin-top: 12px; font-size: 22px; font-weight: 700; line-height: 1.9; }
  .mv-desc { display: block; font-size: 15px; font-weight: 400; color: var(--ink); line-height: 1.6; }
  /* こまの ならべかた */
  .rules { margin: 0; padding-left: 1.4em; line-height: 2.1; font-size: 15px; }
  .sq.target { background: rgba(31,138,76,.18); }
  .mv-prom { margin-top: 4px; color: var(--muted); }
  .sq .no { position: absolute; right: 2px; bottom: 1px; font-size: calc(var(--sq) * .24); color: #b3261e; font-weight: 700; line-height: 1; }
  .sq.next { box-shadow: inset 0 0 0 3px var(--ok); }
  /* まもる・せめる */
  .lsn-group { font-size: 13px; color: var(--muted); margin: 6px 0 4px; }
  #ls-list .row { margin-bottom: 4px; }
  .lsn-title { font-size: 18px; font-weight: 700; margin-bottom: 6px; line-height: 1.9; }
  .vtable { border-collapse: collapse; margin-top: 10px; width: 100%; font-size: 16px; }
  .vtable td { border: 1px solid var(--bd); padding: 4px 6px; text-align: center; }
  .vtable tr:first-child td { background: var(--board); font-weight: 700; }
  .side-label { font-size: 15px; font-weight: 700; color: var(--muted); align-self: flex-start; }
  .src { font-size: 12px; color: var(--muted); }

.time { font-size: 18px; font-variant-numeric: tabular-nums; margin-top: 4px; min-height: 1.6em; }
.hand-w button { transform: rotate(180deg); }
.kifu { max-height: 260px; overflow-y: auto; font-size: 16px; line-height: 1.8; font-variant-numeric: tabular-nums; }
.kifu span { display: inline-block; min-width: 7.5em; }
.kifu .no { color: var(--muted); font-size: 12px; margin-right: 4px; min-width: 0; }
.wide { width: min(980px, 100%); display: flex; flex-direction: column; gap: 12px; }
/* 後から display を指定した クラスにも .hidden が 効くように（詳細度を 上げる） */
.wide.hidden, .row.hidden, .side.hidden, .card.hidden, .btn.hidden { display: none; }
.wide textarea, .wide .txt { width: 100%; font: inherit; font-size: 16px; padding: 8px; border: 1px solid var(--bd); border-radius: 8px; }
.wide select { font: inherit; font-size: 15px; margin-left: 6px; }
.lg-scroll { overflow-x: auto; }
table.lg { border-collapse: collapse; font-size: 15px; }
table.lg th, table.lg td { border: 1px solid var(--line); padding: 0; text-align: center; min-width: 2.6em; height: 2.4em; }
table.lg th { background: #f3ead7; padding: 2px 6px; white-space: nowrap; }
table.lg td.self { background: #d8d2c4; }
table.lg td.rank { font-weight: 700; }
.lg-cell { width: 100%; height: 100%; min-height: 2.4em; font: inherit; font-size: 20px; border: 0; background: #fff; cursor: pointer; }
.lg-cell.rW { color: var(--ok); } .lg-cell.rL { color: var(--ink); } .lg-cell.rD { color: var(--miss); }
.lg-round { margin: 4px 0; line-height: 1.8; } .lg-round .fin { color: var(--muted); text-decoration: line-through; }
label.btn { display: inline-block; }
main.no-board .boardwrap { display: none; }
@media print {
  header, .no-print, .boardwrap, .side { display: none !important; }
  main { padding: 0; } .card { border: 0; }
  .lg-cell { font-size: 18px; }
}
.cp-scroll { overflow-x: auto; }
.cp-grid { display: flex; gap: 14px; align-items: stretch; }
.cp-col { display: flex; flex-direction: column; justify-content: space-around; gap: 10px; min-width: 8.5em; }
.cp-rh { font-size: 13px; color: var(--muted); text-align: center; font-weight: 600; }
.cp-m { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.cp-p { font: inherit; font-size: 15px; text-align: left; padding: 6px 8px; border: 0; background: #fff; cursor: pointer; min-height: 2.2em; }
.cp-p + .cp-p { border-top: 1px solid var(--bd); }
.cp-p:disabled { cursor: default; color: var(--muted); }
.cp-p.won { font-weight: 700; color: var(--ok); background: #eef8f1; }
.cp-p.lost { color: var(--muted); text-decoration: line-through; }
.cp-champ { padding: 10px 8px; font-weight: 700; font-size: 17px; text-align: center; min-height: 2.6em; justify-content: center; }
.cp-third { margin-top: 14px; max-width: 10em; }
#kind-league[aria-pressed="true"], #kind-cup[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
@media print { .cp-p { color: #000 !important; } .cp-p.lost { text-decoration: none; } }
#side-play .btn[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.board.flip .pc { transform: rotate(180deg); } .board.flip .pc.w { transform: none; }
.cp-bye { flex-direction: row; align-items: center; justify-content: space-between; border-style: dashed; background: #faf7f0; }
.cp-bye .cp-p { cursor: default; background: transparent; }
.cp-seed { font-size: 12px; color: var(--muted); padding: 0 8px; white-space: nowrap; }
