:root {
  color-scheme: light;
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  color: #26251f;
  background: #f5f3ee;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; padding: 36px 18px; }
.game { width: min(100%, 1160px); margin: 0 auto; }
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.game-layout { display: grid; grid-template-columns: minmax(0, 734px) minmax(330px, 1fr); align-items: start; gap: 20px; }
.eyebrow { margin: 0 0 7px; color: #827d70; font-size: 11px; font-weight: 700; letter-spacing: .18em; }
h1 { margin: 0; font-size: clamp(25px, 5vw, 34px); letter-spacing: .04em; }
.subtitle { margin: 8px 0 0; color: #777367; font-size: 14px; }
.turn-card { min-width: 130px; padding: 12px 16px; border: 1px solid #e5e1d8; border-radius: 14px; background: #fffefa; }
.turn-label { display: block; color: #827d70; font-size: 12px; }
.turn-value { display: flex; align-items: center; gap: 9px; margin-top: 7px; font-size: 17px; font-weight: 700; }
.turn-result { display: block; margin-top: 7px; color: #456b5c; font-size: 12px; font-weight: 650; }
.turn-result:empty { display: none; }
.stone { display: inline-block; width: 18px; height: 18px; border-radius: 50%; }
.stone.black { background: #26251f; }
.stone.white { background: #fff; border: 1px solid #aaa69b; }
.board-panel { padding: clamp(12px, 3vw, 24px); border: 1px solid #e5e1d8; border-radius: 20px; background: #fffefa; box-shadow: 0 10px 35px #37301a0b; }
.coordinate-board { width: 100%; max-width: 686px; margin: 0 auto; }
.coordinate-top { display: grid; grid-template-columns: repeat(19, 1fr); width: calc(100% - 26px); height: 20px; margin-left: 26px; padding: 0 3.15%; align-items: center; color: #777367; font-size: 11px; line-height: 1; text-align: center; }
.coordinate-body { position: relative; display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 4px; align-items: stretch; }
.coordinate-side { position: absolute; inset: 3.15% auto 3.15% 0; display: grid; width: 22px; grid-template-rows: repeat(19, 1fr); align-items: center; justify-items: center; color: #777367; font-size: 10px; line-height: 1; }
.board-wrap { grid-column: 2; position: relative; isolation: isolate; overflow: hidden; width: 100%; max-width: 660px; min-width: 0; margin: 0; aspect-ratio: 1; padding: 0; background: #d9aa67; border-radius: 4px; }
.board-wrap::after { position: absolute; z-index: 0; inset: 5.6158%; border: 2px solid #554329; content: ""; pointer-events: none; }
.board { position: absolute; z-index: 1; inset: 3.15%; display: grid; grid-template-columns: repeat(19, minmax(0, 1fr)); grid-template-rows: repeat(19, minmax(0, 1fr)); background: transparent; }
.point { --vertical-line-size: 100% 100%; --vertical-line-position: center center; --horizontal-line-size: 100% 100%; --horizontal-line-position: center center; -webkit-appearance: none; appearance: none; position: relative; display: grid; place-items: center; min-width: 0; min-height: 0; padding: 0; border: 0; background-color: transparent; background-image: linear-gradient(to right, transparent calc(50% - .5px), #554329 calc(50% - .5px), #554329 calc(50% + .5px), transparent calc(50% + .5px)), linear-gradient(to bottom, transparent calc(50% - .5px), #554329 calc(50% - .5px), #554329 calc(50% + .5px), transparent calc(50% + .5px)); background-size: var(--vertical-line-size), var(--horizontal-line-size); background-position: var(--vertical-line-position), var(--horizontal-line-position); background-repeat: no-repeat; cursor: pointer; }
#board > .point:nth-child(-n + 19) { --vertical-line-size: 100% 50%; --vertical-line-position: center bottom; }
#board > .point:nth-child(n + 343) { --vertical-line-size: 100% 50%; --vertical-line-position: center top; }
#board > .point:nth-child(19n + 1) { --horizontal-line-size: 50% 100%; --horizontal-line-position: right center; }
#board > .point:nth-child(19n) { --horizontal-line-size: 50% 100%; --horizontal-line-position: left center; }
.point:hover { background-color: #ffffff24; }
.point:focus-visible { z-index: 1; outline: 2px solid #40695b; outline-offset: -3px; }
.territory-marker { position: absolute; inset: 0; z-index: 0; width: 38%; height: 38%; margin: auto; border-radius: 50%; pointer-events: none; }
.territory-marker.territory-black { background: #26251f66; }
.territory-marker.territory-white { border: 1px solid #817b6d; background: #ffffffb8; }
.territory-marker.territory-uncertain { width: 54%; height: 54%; border: 1px dashed #6f685a; background: #ffffff30; }
.life-ring { position: absolute; inset: 2%; z-index: 3; border: 2px solid transparent; border-radius: 50%; pointer-events: none; }
.life-ring.life-alive { border-color: #418565; }
.life-ring.life-dead { border-color: #b44949; }
.life-ring.life-uncertain { border-color: #777367; border-style: dashed; }
.hoshi { position: absolute; z-index: 1; width: 5px; height: 5px; border-radius: 50%; background: #554329; pointer-events: none; }
.stone-piece { z-index: 2; width: 84%; height: 84%; border-radius: 50%; pointer-events: none; }
.stone-piece.black { background: radial-gradient(circle at 35% 30%, #555 0, #171717 65%); box-shadow: 1px 2px 3px #0006; }
.stone-piece.white { border: 1px solid #b8b4aa; background: radial-gradient(circle at 35% 30%, #fff 0, #eee 70%); box-shadow: 1px 2px 3px #0004; }
.hint { margin: 14px 0 0; color: #827d70; text-align: center; font-size: 13px; }
.controls { display: flex; justify-content: center; gap: 12px; margin-top: 20px; }
.side-panel .controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 0; }
.button { min-width: 112px; padding: 11px 18px; border: 0; border-radius: 10px; font: inherit; font-size: 14px; font-weight: 650; cursor: pointer; }
.button:focus-visible { outline: 3px solid #8da99b; outline-offset: 2px; }
.button-secondary { color: #4b493f; background: #e8e5dc; }
.button-primary { color: white; background: #456b5c; }
.message { min-height: 20px; margin: 14px 0 0; color: #777367; text-align: center; font-size: 13px; }
.capture-panel { width: min(100%, 686px); margin: 16px auto 0; padding: 14px 16px; border: 1px solid #e5e1d8; border-radius: 14px; background: #fffefa; }
.capture-heading { margin: 0 0 10px; color: #777367; font-size: 12px; font-weight: 650; }
.capture-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.capture-stat { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-radius: 10px; background: #f5f3ee; }
.capture-name { display: flex; min-width: 0; align-items: center; gap: 7px; color: #4b493f; font-size: 13px; white-space: nowrap; }
.capture-name .stone { width: 14px; height: 14px; flex: 0 0 auto; }
.capture-count { color: #26251f; font-size: 20px; line-height: 1; }
.capture-note { margin: 10px 0 0; color: #827d70; font-size: 11px; }
.side-panel { display: flex; min-width: 0; flex-direction: column; gap: 12px; }
.status-panel { padding: 14px 16px; border: 1px solid #e5e1d8; border-radius: 14px; background: #fffefa; }
.side-panel-heading { margin: 0 0 10px; color: #777367; font-size: 12px; font-weight: 650; }
.status-panel .turn-card { min-width: 0; }
.status-panel .hint { margin: 10px 0 0; text-align: left; font-size: 12px; }
.status-panel .message { margin: 8px 0 0; text-align: left; line-height: 1.5; }
.autosave-status { margin: 8px 0 0; color: #456b5c; font-size: 11px; line-height: 1.45; }
.autosave-panel { padding: 14px 16px; border: 1px solid #cbd9cf; border-radius: 14px; background: #f5faf6; }
.autosave-panel[hidden] { display: none; }
.autosave-note { margin: 0 0 10px; color: #5f5b50; font-size: 12px; line-height: 1.5; }
.autosave-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.autosave-actions .button { min-width: 0; padding: 9px 12px; font-size: 12px; }
.record-panel { width: min(100%, 686px); margin: 16px auto 0; padding: 14px 16px; border: 1px solid #e5e1d8; border-radius: 14px; background: #fffefa; }
.side-panel .capture-panel, .side-panel .record-panel { width: 100%; margin: 0; }
.side-panel .record-panel { display: flex; height: 420px; min-height: 0; flex-direction: column; }
.score-panel { padding: 14px 16px; border: 1px solid #e5e1d8; border-radius: 14px; background: #fffefa; }
.score-panel[hidden] { display: none; }
.life-analysis-panel { max-height: 360px; padding: 14px 16px; border: 1px solid #e5e1d8; border-radius: 14px; background: #fffefa; }
.life-analysis-panel[hidden] { display: none; }
.life-problem-panel { padding: 14px 16px; border: 1px solid #e5e1d8; border-radius: 14px; background: #fffefa; }
.life-problem-panel[hidden] { display: none; }
.life-analysis-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.life-analysis-heading .capture-heading { margin: 0; }
.life-analysis-note, .life-analysis-limit { margin: 0 0 8px; color: #827d70; font-size: 10px; line-height: 1.45; }
.life-analysis-search-info { margin: 0 0 8px; color: #456b5c; font-size: 10px; font-weight: 650; }
.life-analysis-list { max-height: 270px; overflow-y: auto; }
.life-result-item { padding: 8px 9px; border-bottom: 1px solid #eeeae2; }
.life-result-item h3 { margin: 0 0 4px; color: #4b493f; font-size: 12px; }
.life-result-item p { margin: 0; color: #777367; font-size: 10px; line-height: 1.5; }
.life-result-item .life-final-status { margin-top: 3px; color: #4b493f; font-weight: 650; }
.life-result-item .life-analysis-reason { margin-top: 3px; color: #777367; }
.life-analysis-actions { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.life-action-button { padding: 5px 7px; border: 1px solid #ded9ce; border-radius: 7px; color: #4b493f; background: #f5f3ee; font: inherit; font-size: 10px; cursor: pointer; }
.life-action-button:hover { background: #e8e5dc; }
.life-result-alive h3 { color: #418565; }
.life-result-dead h3 { color: #b44949; }
.life-ring.life-manual { border-width: 3px; }
.problem-current-side { margin: 0 0 7px; color: #4b493f; font-size: 12px; font-weight: 700; }
.problem-side-buttons, .problem-action-buttons { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.problem-side-buttons .life-action-button[aria-pressed="true"] { border-color: #456b5c; color: #345848; background: #e4eee8; }
.problem-action-buttons .button { min-width: 0; padding: 8px 10px; font-size: 11px; }
.problem-suggestion { max-height: 240px; overflow-y: auto; }
.problem-suggestion > strong { display: block; color: #9e3636; font-size: 13px; }
.problem-suggestion > p, .problem-recommendation p { margin: 5px 0; color: #5f5b50; font-size: 11px; line-height: 1.45; }
.problem-recommendation { padding: 8px 9px; border-bottom: 1px solid #eeeae2; }
.problem-recommendation-best { border-left: 3px solid #456b5c; }
.problem-recommendation h3 { margin: 0 0 5px; color: #345848; font-size: 13px; }
.problem-reasons { margin: 5px 0 0; padding-left: 17px; color: #777367; font-size: 10px; line-height: 1.45; }
.problem-result-note { color: #827d70 !important; font-size: 10px !important; }
.problem-move-marker { position: absolute; z-index: 4; inset: 18%; display: grid; place-items: center; color: #b03e32; font-size: clamp(10px, 2vw, 19px); line-height: 1; text-shadow: 0 0 2px #fff; pointer-events: none; }
.problem-move-marker.problem-alternative { color: #456b5c; opacity: .72; font-size: clamp(10px, 1.6vw, 16px); }
.dead-confirmation-marker { position: absolute; z-index: 4; inset: 18%; display: grid; place-items: center; border: 2px solid #b44949; border-radius: 50%; color: #9e3636; background: #fff8; font-size: clamp(8px, 1.2vw, 13px); font-weight: 800; pointer-events: none; }
.score-section { margin-top: 10px; padding-top: 9px; border-top: 1px solid #eeeae2; }
.score-section > h3 { margin: 0 0 7px; color: #777367; font-size: 11px; }
.score-sides { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.score-side { padding: 9px 10px; border-radius: 10px; background: #f5f3ee; }
.score-side h3, .score-side h4 { margin: 0 0 6px; color: #4b493f; font-size: 12px; }
.score-side p { display: flex; justify-content: space-between; gap: 6px; margin: 3px 0; color: #777367; font-size: 11px; }
.score-side strong { color: #26251f; }
.score-detail { margin: 9px 0 0; color: #4b493f; font-size: 11px; }
.score-winner { margin: 9px 0 0; color: #456b5c; font-size: 14px; font-weight: 700; }
.score-note { margin: 8px 0 0; color: #827d70; font-size: 10px; line-height: 1.45; }
.territory-legend { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 9px; color: #777367; font-size: 10px; }
.territory-legend span { display: inline-flex; align-items: center; gap: 4px; }
.territory-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.territory-swatch.territory-black { background: #26251f88; }
.territory-swatch.territory-white { border: 1px solid #aaa69b; background: #fff; }
.territory-swatch.territory-uncertain { border: 1px dashed #777367; }
.record-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; color: #777367; }
.record-heading h2 { margin: 0; font-size: 13px; }
.record-heading span { font-size: 11px; }
.record-view-controls { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.history-view-status { margin: 0; color: #456b5c; font-size: 12px; font-weight: 650; }
.latest-position-button { min-width: 0; padding: 6px 10px; font-size: 11px; }
.latest-position-button[hidden] { display: none; }
.replay-controls { display: flex; gap: 8px; margin: 0 0 6px; }
.replay-button { min-width: 0; padding: 7px 11px; font-size: 12px; }
.replay-button[hidden] { display: none; }
.move-list { max-height: 120px; overflow-y: auto; margin: 0; padding: 0 8px 0 0; list-style: none; }
.side-panel .move-list { height: 216px; min-height: 0; max-height: 216px; flex: 0 0 216px; }
.move-list li { height: 27px; border-bottom: 1px solid #eeeae2; }
.move-record-button { width: 100%; height: 26px; padding: 6px 4px; border: 0; background: transparent; color: #4b493f; font: inherit; font-size: 12px; line-height: 14px; text-align: left; cursor: pointer; }
.move-record-button:hover, .move-list li.is-viewing .move-record-button { border-radius: 6px; background: #e8e5dc; }
.move-record-button:focus-visible { outline: 2px solid #8da99b; outline-offset: -2px; }
.move-empty { margin: 0; color: #827d70; font-size: 12px; }
.move-empty[hidden] { display: none; }
@media (max-width: 560px) { body { padding: 22px 10px; } .page-header { align-items: flex-start; } .turn-card { min-width: 104px; padding: 10px 12px; } .subtitle { max-width: 210px; line-height: 1.5; } .board-panel { padding: 10px; border-radius: 14px; } .controls { gap: 8px; } .button { min-width: 0; flex: 1; } }
@media (max-width: 560px) { .capture-panel { padding: 12px; } .capture-stats { gap: 8px; } .capture-stat { padding: 9px 10px; } .capture-name { gap: 5px; font-size: 12px; } }
@media (max-width: 560px) { .record-panel { padding: 12px; } .move-list { max-height: 110px; } }
@media (max-width: 1120px) { .game-layout { grid-template-columns: minmax(0, 1fr); gap: 16px; } .side-panel { width: 100%; } }
