:root { color-scheme: light; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", sans-serif; color: #24332c; background: #f5f4ef; line-height: 1.65; }
* { box-sizing: border-box; }
body { margin: 0; }
main { max-width: 760px; padding: 24px 16px 48px; margin: auto; }
a { color: #386951; text-underline-offset: 3px; }
header { margin-bottom: 20px; }
header a { font-size: .85rem; }
.heading { display: flex; align-items: center; gap: 14px; }
h1 { font-family: serif; font-size: 2.3rem; letter-spacing: .15em; margin: 14px 0 0; }
.tag { background: #e0e8df; border-radius: 20px; padding: 1px 12px; font-size: .8rem; }
header p { margin: 4px 0; color: #5f6d64; }
.subtitle { display: inline-block; font-size: .85rem; margin-left: 12px; }
.game { padding: 18px; background: #fff; border: 1px solid #dcded6; border-radius: 12px; }
.status-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
#turn { font-size: 1.1rem; }
#phase, .small { font-size: .8rem; color: #637168; }
#status { min-height: 3em; font-size: .9rem; margin: 8px 0; }
h2 { font-size: .85rem; margin: 0 0 8px; font-weight: 600; }
.hand-panel { border: 1px solid #e4e5df; border-radius: 8px; padding: 10px; background: #f8f9f5; }
.hand-panel.active { border-color: #3f7358; background: #f0f6ef; }
.hand { display: flex; flex-wrap: wrap; gap: 5px; }
button, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid #cdd3ca; border-radius: 6px; padding: 7px 12px; background: #fff; touch-action: manipulation; }
button:hover:not(:disabled) { background: #eef3eb; }
button:disabled { opacity: .4; cursor: default; }
button:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid #2d7aaa; outline-offset: 2px; }
.hand button { display: flex; align-items: center; gap: 7px; padding: 3px 8px; min-height: 39px; }
.hand button.selected { outline: 2px solid #386951; background: #d9ead7; }
.hand .symbol { font: bold 1.3rem serif; }
.hand .count { font-size: .75rem; }
.hand .opponent { transform: rotate(180deg); }
#board-wrap { margin: 10px auto; max-width: 540px; }
#files { display: grid; grid-template-columns: repeat(9, 1fr); padding-right: 18px; text-align: center; color: #637168; font-size: .7rem; }
.board-frame { display: grid; grid-template-columns: 1fr 18px; }
#ranks { display: grid; grid-template-rows: repeat(9, 1fr); text-align: right; color: #637168; font-size: .7rem; }
#ranks span { display: flex; align-items: center; justify-content: flex-end; }
#board { display: grid; grid-template-columns: repeat(9, 1fr); border: 2px solid #978765; background: #e9d6ae; }
.square { position: relative; min-width: 0; aspect-ratio: 1; border: 0; border-right: 1px solid #b3a07a; border-bottom: 1px solid #b3a07a; border-radius: 0; padding: 2px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 1px; background: transparent; }
.square:nth-child(9n) { border-right: 0; }
.square:nth-child(n+73) { border-bottom: 0; }
.square:hover { background: #dfc797 !important; }
.square.selected { background: #cfdeb2; box-shadow: inset 0 0 0 3px #386951; }
.square.candidate { background: #d5dfb4; }
.square.candidate::after { content: ""; position: absolute; right: 3px; bottom: 3px; width: 7px; height: 7px; border-radius: 50%; background: #386951; }
.square.target { box-shadow: inset 0 0 0 3px #ac6c27; }
.stone { display: flex; align-items: center; justify-content: center; font: bold clamp(16px, 3.7vw, 27px) serif; line-height: 1; width: 68%; aspect-ratio: 1; border-radius: 50%; border: 1px solid #847254; background: #fcf7e9; color: #242e28; }
.stone.owner-1 { color: #fff; background: #34463c; border-color: #34463c; transform: rotate(180deg); }
.square.stacked .stone { width: 48%; }
.under { display: flex; gap: 2px; line-height: 1; }
.under span { font: bold clamp(9px, 2vw, 12px) serif; color: #34463c; padding: 1px 3px; border: 1px solid #a99d80; border-radius: 2px; background: #fcf7e9; }
.under .owner-1 { color: #fff; background: #34463c; }
.controls { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
#ready, #action-buttons button:first-child { background: #386951; color: #fff; border-color: #386951; }
#ready:hover:not(:disabled), #action-buttons button:first-child:hover { background: #29503c; }
.action-panel { padding: 12px; margin-top: 12px; background: #f5f1e5; border: 1px solid #d9c898; border-radius: 8px; }
.action-panel p { margin: 0; font-size: .85rem; }
.inspection, .last { font-size: .8rem; color: #637168; margin-bottom: 0; }
.last { min-height: 1.6em; }
details { border: 1px solid #dcded6; padding: 14px 18px; margin-top: 16px; border-radius: 10px; background: #fff; font-size: .9rem; }
summary { cursor: pointer; font-weight: 600; }
details[open] summary { margin-bottom: 12px; }
select { padding: 4px 8px; border: 1px solid #cdd3ca; border-radius: 4px; background: #fff; }
.movement-help { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.movement-help figure { margin: 0; text-align: center; font-size: .8rem; }
.movement-help svg { display: block; width: 100%; max-width: 170px; margin: auto; }
[hidden] { display: none !important; }
@media (max-width: 480px) {
  main { padding: 16px 8px 32px; }
  .game { padding: 12px 8px; }
  .controls { gap: 6px; }
  .controls button { padding: 6px 9px; font-size: .85rem; }
  .hand-panel { padding: 8px; }
  .hand button { padding: 3px 7px; }
  .subtitle { display: block; margin-left: 0; }
  .movement-help { gap: 4px; }
}
