/* うごきがみえる将棋 — スマホを先に考えたレイアウト */

:root {
  --bg: #fbf3e2;
  --bg2: #f3e2bf;
  --ink: #3b2a1a;
  --muted: #8a7255;
  --panel: rgba(255, 255, 255, 0.72);
  --panel-line: rgba(122, 85, 35, 0.22);
  --board: #f0cd8a;
  --board2: #e6bb6c;
  --line: #6f4d1f;
  --p0: #2563eb;
  --p1: #dc2626;
  --p0-soft: rgba(37, 99, 235, 0.12);
  --p1-soft: rgba(220, 38, 38, 0.12);
  --ok: #16a34a;
  --warn: #f59e0b;
  --look: rgba(249, 115, 22, 0.38);
  --sel: rgba(253, 224, 71, 0.75);
  --hint: #0ea5e9;
  --gutter: 12px;
  --rank-w: 16px;
  --bw: clamp(240px, min(calc(100vw - 2 * var(--gutter) - var(--rank-w)), calc(100vh - 330px)), 560px);
  --cell: calc(var(--bw) / 9);
  color-scheme: light;
}
@supports (height: 100dvh) {
  :root { --bw: clamp(240px, min(calc(100vw - 2 * var(--gutter) - var(--rank-w)), calc(100dvh - 330px)), 560px); }
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1d1712;
    --bg2: #2a2119;
    --ink: #f6ead4;
    --muted: #c2a986;
    --panel: rgba(255, 255, 255, 0.07);
    --panel-line: rgba(255, 230, 190, 0.16);
    --p0: #4f8cff;
    --p1: #ff5a5a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1d1712; --bg2: #2a2119; --ink: #f6ead4; --muted: #c2a986;
  --panel: rgba(255, 255, 255, 0.07); --panel-line: rgba(255, 230, 190, 0.16);
  --p0: #4f8cff; --p1: #ff5a5a; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg2); }
body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg2) 100%) no-repeat, var(--bg2);
  color: var(--ink);
  font-family: 'Zen Maru Gothic', 'Hiragino Maru Gothic ProN', 'Hiragino Sans', 'Meiryo', sans-serif;
  font-weight: 500;
  line-height: 1.5;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; opacity: 0.45; }

/* ---------- 上のバー ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px var(--gutter) 4px;
  max-width: 980px; margin: 0 auto;
}
.title { margin: 0; display: flex; align-items: baseline; gap: 4px; line-height: 1.1; }
.t-sub { font-size: 13px; font-weight: 700; color: var(--muted); }
.t-main { font-family: 'Noto Serif JP', serif; font-weight: 900; font-size: 24px; letter-spacing: 0.06em; }
.top-actions { display: flex; gap: 6px; }
.chip {
  border: 2px solid var(--panel-line); background: var(--panel);
  border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 700;
}
.chip:active { transform: scale(0.96); }

/* ---------- 全体の並び ---------- */
.layout {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 0 var(--gutter) 24px;
}
.game { display: flex; flex-direction: column; gap: 6px; width: calc(var(--bw) + var(--rank-w)); }
.side { width: calc(var(--bw) + var(--rank-w)); display: flex; flex-direction: column; gap: 10px; }

/* ---------- 状態表示 ---------- */
.status {
  min-height: 46px; padding: 6px 12px; border-radius: 14px;
  display: flex; flex-direction: column; justify-content: center;
  background: var(--panel); border: 2px solid var(--panel-line);
  font-size: 15px; font-weight: 700; line-height: 1.35;
}
.status.s0 { border-color: color-mix(in srgb, var(--p0) 45%, transparent); }
.status.s1 { border-color: color-mix(in srgb, var(--p1) 45%, transparent); }
.status .lastmv { font-size: 11px; color: var(--muted); font-weight: 500; }
.status small { font-size: 11px; color: var(--muted); }
.status.check { background: #fee2e2; border-color: var(--p1); color: #991b1b; animation: shake 0.45s; }
.status.hint { background: #e0f2fe; border-color: var(--hint); color: #075985; }
.status.end { background: #fef3c7; border-color: var(--warn); color: #78350f; }
.status.check .lastmv, .status.hint .lastmv, .status.end .lastmv { color: inherit; opacity: 0.7; }
.status .dots i {
  display: inline-block; width: 6px; height: 6px; margin-left: 4px; border-radius: 50%;
  background: currentColor; animation: blink 1.2s infinite;
}
.status .dots i:nth-child(2) { animation-delay: 0.2s; }
.status .dots i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 100% { opacity: 0.2; } 50% { opacity: 1; } }
@keyframes shake { 20% { transform: translateX(-4px); } 40% { transform: translateX(4px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }

/* ---------- プレイヤーと持ち駒 ---------- */
.player {
  display: flex; align-items: center; gap: 8px;
  min-height: calc(var(--cell) * 1.08 + 10px);
  padding: 4px 8px; border-radius: 14px;
  background: var(--panel); border: 2px solid transparent;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.player.active.s0 { border-color: var(--p0); box-shadow: 0 0 0 3px var(--p0-soft); }
.player.active.s1 { border-color: var(--p1); box-shadow: 0 0 0 3px var(--p1-soft); }
.pname { display: flex; flex-direction: column; align-items: flex-start; min-width: 56px; flex: none; line-height: 1.15; white-space: nowrap; }
.pname b { font-size: 14px; display: flex; align-items: center; gap: 4px; }
.pname small { font-size: 10px; color: var(--muted); }
.pname .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.dot.s0 { background: var(--p0); }
.dot.s1 { background: var(--p1); }
.hand { display: flex; flex-wrap: wrap; gap: 2px; flex: 1; align-items: center; min-width: 0; }
.hand .empty { font-size: 12px; color: var(--muted); }
.hand-pc {
  position: relative; width: calc(var(--cell) * 1.05); height: calc(var(--cell) * 1.05);
  padding: 0; border: none; background: none; border-radius: 10px;
}
.hand-pc svg { width: 100%; height: 100%; display: block; }
.hand-pc.on { background: var(--sel); box-shadow: 0 0 0 2px #ca8a04 inset; }
.hand-pc.hinted { animation: hintPulse 1s infinite; border-radius: 10px; }
.hand-pc .cnt {
  position: absolute; right: -2px; bottom: -2px; min-width: 18px; height: 18px; padding: 0 4px;
  border-radius: 9px; background: var(--ink); color: var(--bg); font-size: 12px; font-weight: 900; line-height: 18px;
}

/* ---------- 盤 ---------- */
.board-wrap { align-self: flex-start; }
.files { display: grid; grid-template-columns: repeat(9, var(--cell)); width: var(--bw); font-size: 11px; color: var(--muted); text-align: center; line-height: 14px; font-weight: 700; }
.board-row { display: flex; }
.ranks { display: grid; grid-template-rows: repeat(9, var(--cell)); width: var(--rank-w); font-size: 11px; color: var(--muted); align-items: center; text-align: center; font-weight: 700; }
.board {
  position: relative;
  width: var(--bw); height: var(--bw);
  display: grid; grid-template-columns: repeat(9, 1fr); grid-template-rows: repeat(9, 1fr);
  background: linear-gradient(160deg, var(--board) 0%, var(--board2) 100%);
  border: 2px solid var(--line); border-radius: 4px;
  box-shadow: 0 6px 18px rgba(80, 50, 10, 0.25), inset 0 0 30px rgba(120, 70, 10, 0.15);
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.cell {
  position: relative;
  border-right: 1px solid rgba(80, 52, 15, 0.75);
  border-bottom: 1px solid rgba(80, 52, 15, 0.75);
  cursor: pointer;
}
.cell:nth-child(9n) { border-right: none; }
.cell:nth-child(n+73) { border-bottom: none; }
.cell.star::before {
  content: ''; position: absolute; right: -3.5px; bottom: -3.5px; width: 6px; height: 6px;
  border-radius: 50%; background: var(--line); z-index: 1;
}
.cell > svg.pc {
  position: absolute; inset: 0; width: 100%; height: 100%;
  transition: transform 0.32s cubic-bezier(.3, .7, .3, 1);
  z-index: 2; pointer-events: none;
}
.cell.last-from { background: rgba(110, 70, 20, 0.16); }
.cell.last-to { background: rgba(110, 70, 20, 0.26); }
.cell.zone { background-image: linear-gradient(rgba(168, 85, 247, 0.12), rgba(168, 85, 247, 0.12)); }
.cell.look { background: var(--look); }
.cell.sel { background: var(--sel); box-shadow: inset 0 0 0 2px #ca8a04; }
.cell.tgt::after {
  content: ''; position: absolute; left: 50%; top: 50%; width: 34%; height: 34%;
  transform: translate(-50%, -50%); border-radius: 50%;
  background: var(--ok); opacity: 0.85; box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.25);
  z-index: 3; pointer-events: none; animation: pop 0.2s;
}
.cell.tgt.cap::after {
  width: 88%; height: 88%; background: transparent; opacity: 1;
  border: 3px solid var(--p1); box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.7), 0 0 12px rgba(220, 38, 38, 0.6);
  animation: capPulse 1.1s infinite;
}
.cell.hint-to { box-shadow: inset 0 0 0 3px var(--hint); animation: hintPulse 1s infinite; }
.cell.hint-from { box-shadow: inset 0 0 0 3px var(--hint); }
.cell.check { background: radial-gradient(circle, rgba(239, 68, 68, 0.7) 0%, rgba(239, 68, 68, 0.15) 70%); animation: checkPulse 0.9s infinite; }
.cell.promo-flash::before { content: ''; position: absolute; inset: 0; z-index: 4; background: radial-gradient(circle, rgba(255, 255, 255, 0.95), rgba(253, 224, 71, 0) 70%); animation: flash 0.7s forwards; pointer-events: none; }
.cell.cap-flash { animation: capFlash 0.5s; }
.badge {
  position: absolute; top: 1px; right: 1px; z-index: 5;
  width: 15px; height: 15px; border-radius: 50%;
  font-size: 11px; font-weight: 900; line-height: 15px; text-align: center; color: #fff;
  box-shadow: 0 0 0 1.5px #fff; pointer-events: none;
}
.badge.warn { background: var(--warn); color: #3b2a1a; }
.badge.hang { background: var(--p1); animation: blink 1.4s infinite; }
@keyframes pop { from { transform: translate(-50%, -50%) scale(0); } }
@keyframes capPulse { 50% { transform: translate(-50%, -50%) scale(0.9); } }
@keyframes hintPulse { 50% { box-shadow: inset 0 0 0 5px var(--hint), 0 0 12px var(--hint); } }
@keyframes checkPulse { 50% { background-color: rgba(239, 68, 68, 0.35); } }
@keyframes flash { from { opacity: 1; transform: scale(0.4); } to { opacity: 0; transform: scale(1.6); } }
@keyframes capFlash { 30% { background: rgba(239, 68, 68, 0.45); } }

/* ---------- 駒の絵 ---------- */
.pc .koma { fill: url(#wood); stroke: #8a6a3a; stroke-width: 3; stroke-linejoin: round; filter: drop-shadow(0 1.5px 1px rgba(60, 35, 5, 0.35)); }
.pc.s0 .koma { stroke: var(--p0); stroke-width: 4; }
.pc.s1 .koma { stroke: var(--p1); stroke-width: 4; }
.pc .mk { fill: var(--p0); }
.pc.s1 .mk { fill: var(--p1); }
.pc .mk-jump { fill: #fff; stroke: var(--p0); stroke-width: 3; }
.pc.s1 .mk-jump { stroke: var(--p1); }
.pc .kj {
  font-family: 'Noto Serif JP', 'Hiragino Mincho ProN', 'Yu Mincho', serif; font-weight: 900; font-size: 40px;
  text-anchor: middle; dominant-baseline: central; fill: #24170a;
}
.pc .kj.red, .dg-kj.red, b.red { fill: #c81e1e; color: #c81e1e; }
.pc .furi { display: none; font-size: 12px; font-weight: 900; text-anchor: middle; dominant-baseline: central; fill: #6b4f2a; }
body.roomy:not(.no-furi) .pc .furi { display: inline; }
body.roomy:not(.no-furi) .board .pc .kj, body.roomy:not(.no-furi) .hand .pc .kj { font-size: 36px; }

/* ---------- 下のボタン ---------- */
.controls { display: flex; gap: 10px; margin-top: 2px; }
.big {
  flex: 1; min-height: 50px; border-radius: 16px; border: 2px solid var(--panel-line);
  background: var(--panel); font-size: 17px; font-weight: 900;
  box-shadow: 0 3px 0 var(--panel-line);
}
.big:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--panel-line); }
.big.hint { background: #e0f2fe; border-color: #7dd3fc; color: #075985; box-shadow: 0 3px 0 #7dd3fc; }
.big.busy { animation: blink 1s infinite; }

/* ---------- 駒の説明カード ---------- */
.info { background: var(--panel); border: 2px solid var(--panel-line); border-radius: 16px; padding: 10px 12px; min-height: 110px; }
.card { display: grid; grid-template-columns: 52px 1fr 88px; gap: 10px; align-items: center; }
.card-pc svg { width: 52px; height: 52px; display: block; }
.card-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
.card-head b { font-family: 'Noto Serif JP', serif; font-size: 22px; font-weight: 900; }
.card-head .yomi { font-size: 13px; font-weight: 700; color: var(--muted); }
.owner { font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px; color: #fff; }
.owner.s0 { background: var(--p0); }
.owner.s1 { background: var(--p1); }
.where { font-size: 11px; color: var(--muted); }
.desc { margin: 4px 0 0; font-size: 13.5px; line-height: 1.5; }
.note { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.note.look { color: #c2410c; }
.card-dg svg { width: 88px; height: 88px; display: block; }
.tips .tip-main { margin: 0 0 6px; font-weight: 700; font-size: 14px; }
.legend { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; font-size: 12.5px; }
.legend li { display: flex; align-items: center; gap: 6px; }

/* 凡例のしるし */
.lg { display: inline-block; vertical-align: middle; flex: none; }
.lg-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.25); }
.lg-cap { width: 16px; height: 16px; border-radius: 50%; border: 3px solid var(--p1); }
.lg-warn { width: 16px; height: 16px; border-radius: 50%; background: var(--warn); color: #3b2a1a; font-size: 11px; font-weight: 900; text-align: center; line-height: 16px; }
.lg-look { width: 16px; height: 16px; border-radius: 3px; background: var(--look); }
.lg-step { width: 11px; height: 11px; border-radius: 50%; background: var(--p0); }
.lg-slide { width: 0; height: 0; border-left: 7px solid transparent; border-right: 7px solid transparent; border-bottom: 11px solid var(--p0); }
.lg-jump { width: 12px; height: 12px; border-radius: 50%; border: 3px solid var(--p0); background: #fff; }

/* うごきの図 */
.diagram .dg-line { stroke: rgba(111, 77, 31, 0.35); stroke-width: 1; fill: none; }
.diagram .dg-step { fill: rgba(37, 99, 235, 0.16); }
.diagram .dg-slide { fill: rgba(37, 99, 235, 0.10); }
.diagram.s1 .dg-step { fill: rgba(220, 38, 38, 0.16); }
.diagram.s1 .dg-slide { fill: rgba(220, 38, 38, 0.10); }
.diagram .dg-center { fill: url(#wood); stroke: #8a6a3a; stroke-width: 1.5; }
.diagram .dg-kj { font-family: 'Noto Serif JP', serif; font-weight: 900; font-size: 14px; text-anchor: middle; dominant-baseline: central; fill: #24170a; }
.diagram .dg-dot { fill: var(--p0); }
.diagram .dg-ring { fill: #fff; stroke: var(--p0); stroke-width: 3; }
.diagram .dg-arrow { stroke: var(--p0); stroke-width: 4; stroke-linecap: round; fill: none; }
.diagram .dg-head { fill: var(--p0); }
.diagram.s1 .dg-dot, .diagram.s1 .dg-head { fill: var(--p1); }
.diagram.s1 .dg-ring { stroke: var(--p1); }
.diagram.s1 .dg-arrow { stroke: var(--p1); }
.diagram { background: rgba(255, 248, 230, 0.9); border-radius: 8px; }

/* 棋譜 */
.kifu-box { background: var(--panel); border: 2px solid var(--panel-line); border-radius: 16px; padding: 8px 12px; }
.kifu-box summary { font-weight: 700; font-size: 14px; cursor: pointer; }
#kifu { margin: 6px 0 0; padding-left: 2.6em; max-height: 200px; overflow: auto; font-size: 13px; columns: 2; column-gap: 16px; }
#kifu li.s0 { color: var(--p0); }
#kifu li.s1 { color: var(--p1); }

/* ---------- ダイアログ ---------- */
dialog {
  border: none; border-radius: 22px; padding: 0;
  width: min(92vw, 480px); max-height: 88vh;
  background: var(--bg); color: var(--ink);
  box-shadow: 0 20px 60px rgba(40, 20, 0, 0.4);
}
dialog::backdrop { background: rgba(30, 18, 5, 0.5); }
dialog[open] { animation: dlgIn 0.22s ease-out; }
@keyframes dlgIn { from { transform: translateY(16px) scale(0.97); opacity: 0; } }
.dlg { padding: 18px 18px 16px; max-height: 88vh; overflow: auto; }
.dlg.wide { }
dialog:has(.wide) { width: min(94vw, 780px); }
.dlg h2 { margin: 0 0 10px; font-size: 21px; font-weight: 900; }
.dlg h3 { margin: 14px 0 4px; font-size: 16px; font-weight: 900; }
.dlg p { margin: 4px 0; font-size: 14.5px; }
.dlg ul, .dlg ol { margin: 4px 0; padding-left: 1.4em; font-size: 14.5px; }
.dlg li { margin: 3px 0; }
.dlg fieldset { border: none; margin: 0 0 12px; padding: 0; }
.dlg legend { font-weight: 900; font-size: 14px; margin-bottom: 6px; padding: 0; }
.dlg fieldset[hidden] { display: none; }
.welcome { background: #fef3c7; border-radius: 12px; padding: 8px 12px !important; color: #78350f; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg label { flex: 1 1 auto; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span {
  display: block; text-align: center; padding: 10px 10px; border-radius: 12px;
  border: 2px solid var(--panel-line); background: var(--panel); font-weight: 700; font-size: 14.5px; cursor: pointer;
}
.seg input:checked + span { border-color: var(--p0); background: var(--p0); color: #fff; }
.seg input:focus-visible + span { outline: 3px solid var(--hint); }
.dlg select {
  width: 100%; font: inherit; font-size: 15px; padding: 10px; border-radius: 12px;
  border: 2px solid var(--panel-line); background: var(--panel); color: var(--ink);
}
.dlg-buttons { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; flex-wrap: wrap; }
.dlg-buttons button, .menu button {
  min-height: 46px; padding: 8px 18px; border-radius: 14px; border: 2px solid var(--panel-line);
  background: var(--panel); font-weight: 900; font-size: 15px;
}
.dlg-buttons button[hidden] { display: none; }
button.primary { background: var(--p0); border-color: var(--p0); color: #fff; }
button.danger { color: var(--p1); border-color: color-mix(in srgb, var(--p1) 40%, transparent); }
.menu { display: flex; flex-direction: column; gap: 8px; }
.menu button { width: 100%; font-size: 16px; }
.toggle { display: flex; align-items: center; gap: 10px; padding: 10px 4px; font-size: 15px; font-weight: 700; border-bottom: 1px solid var(--panel-line); }
.toggle input { width: 24px; height: 24px; accent-color: var(--p0); flex: none; }
.legend-line { font-size: 13px !important; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.legend-line .lg { margin-left: 6px; }
.howto .lg { margin: 0 2px; }

.guide-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.g-item { display: flex; gap: 8px; align-items: flex-start; background: var(--panel); border: 2px solid var(--panel-line); border-radius: 14px; padding: 8px; }
.g-item > svg.pc { width: 46px; height: 46px; flex: none; }
.g-body { flex: 1; min-width: 0; }
.g-head { display: flex; align-items: baseline; gap: 6px; }
.g-head b { font-family: 'Noto Serif JP', serif; font-size: 20px; font-weight: 900; }
.g-head small { color: var(--muted); font-weight: 700; font-size: 13px; }
.g-body p { margin: 2px 0 0; font-size: 12.5px; line-height: 1.45; }
.g-item > .diagram { width: 76px; height: 76px; flex: none; }

.promote h2 { text-align: center; }
.promo-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.promo-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 8px;
  border-radius: 18px; border: 3px solid var(--panel-line); background: var(--panel);
}
.promo-btn.primary { background: #fef3c7; border-color: var(--warn); color: var(--ink); }
.promo-btn .pp svg { width: 56px; height: 56px; display: block; }
.promo-btn .diagram { width: 92px; height: 92px; }
.promo-btn b { font-size: 20px; font-weight: 900; }
.promo-btn small { font-size: 12px; color: var(--muted); }

.result { text-align: center; }
.result h2 { font-size: 26px; }
.result h2.win { color: #b45309; }
.result h2.lose { color: var(--muted); }
.result .dlg-buttons { justify-content: center; }

/* ---------- トースト・紙吹雪 ---------- */
.toast {
  position: fixed; left: 50%; top: 38%; z-index: 50; pointer-events: none;
  transform: translate(-50%, -50%) scale(0.6); opacity: 0;
  padding: 12px 22px; border-radius: 18px; font-size: 20px; font-weight: 900;
  background: rgba(255, 255, 255, 0.95); color: #24170a; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s, opacity 0.2s; white-space: nowrap;
}
.toast.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.toast.check { background: #dc2626; color: #fff; font-size: 30px; }
.toast.cap { background: #fff7ed; }
.toast.promo { background: #fef3c7; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 9px; height: 14px; border-radius: 2px; animation: fall 2s linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

/* ---------- 広い画面（タブレット横・パソコン） ---------- */
@media (min-width: 880px) and (min-height: 560px) {
  :root { --bw: clamp(300px, calc(100vh - 340px), 620px); }
  .layout { flex-direction: row; align-items: flex-start; justify-content: center; gap: 20px; }
  .side { width: 340px; margin-top: 52px; }
  .card { grid-template-columns: 52px 1fr; }
  .card-dg { grid-column: 1 / 3; justify-self: center; }
  .card-dg svg { width: 120px; height: 120px; }
  #kifu { max-height: 320px; }
}
@media (max-width: 370px) {
  .t-sub { display: none; }
  .chip { padding: 6px 10px; font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
