:root {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Yu Gothic", system-ui, sans-serif;
  color: #222523; background: #f3f0e8;
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, select, input { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .35; cursor: not-allowed; }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 3px solid #d15f36; outline-offset: 3px; }
[hidden] { display: none !important; }
.shell { max-width: 1200px; margin: 0 auto; padding: 28px 28px 45px; }
.mast { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding-bottom: 20px; border-bottom: 2px solid #262723; margin-bottom: 26px; }
h1 { font-size: clamp(29px, 4vw, 43px); line-height: 1.12; letter-spacing: -.09em; font-weight: 880; margin: 0; }
.brand-dot { color: #cb592f; }
.brand p { font-size: 13px; margin: 8px 0 0; color: #565b55; }
.engine-label { text-align: right; display: grid; grid-template-columns: 9px auto; align-items: center; column-gap: 8px; row-gap: 4px; white-space: nowrap; }
.engine-indicator { width: 8px; height: 8px; background: #aaa; border-radius: 50%; }
.engine-indicator.ready { background: #4f8259; }
.engine-label b { font-size: 12px; font-weight: 750; letter-spacing: -.015em; }
.engine-label small { grid-column: 2; font-size: 11px; color: #676d64; }
.layout { display: grid; grid-template-columns: minmax(0, 700px) minmax(260px, 370px); gap: clamp(20px, 3.5vw, 45px); align-items: start; }
.board-header { display: flex; justify-content: space-between; gap: 10px; align-items: center; min-height: 54px; }
.board-header > div:first-child { display: grid; gap: 3px; }
.board-header #turnLabel { font-size: 17px; font-weight: 800; }
.board-header small { color: #61665e; font-size: 11px; }
.board-tools { display: flex; align-items: center; gap: 12px; }
.board-tools strong { font-size: 12px; white-space: nowrap; }
#hintQuick { border: 1px solid #aaa69b; color: #343933; background: transparent; font-weight: 750; border-radius: 3px; padding: 8px 11px; font-size: 11px; white-space: nowrap; }
#hintQuick[aria-pressed="true"] { background: #2c4637; color: #fff; border-color: #2c4637; }
.board-container { position: relative; border: 5px solid #74523a; box-shadow: 0 7px 19px #24170d18; background: #dfbc85; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.board-container svg { width: 100%; display: block; touch-action: none; }
.board-line { stroke: #6b4a2c; stroke-width: 1.45; }
.star { fill: #6c4a32; }
.stone-black { fill: #141715; stroke: #303330; stroke-width: 1.2; filter: drop-shadow(1px 2px 1px #31231260); }
.stone-white { fill: #faf8ed; stroke: #a49c8e; stroke-width: 1.5; filter: drop-shadow(1px 2px 1px #31231250); }
.intersect { fill: transparent; cursor: crosshair; }
.hint-circle { fill: #2f805d; stroke: #fffdf3; stroke-width: 1.6; opacity: .95; pointer-events: none; }
.hint-rank { fill: #fff; text-anchor: middle; font-size: 19px; font-weight: 800; pointer-events: none; }
.last-ring { fill: none; stroke: #d46d35; stroke-width: 3.3; pointer-events: none; }
.preview-ring { fill: none; stroke: #d45b31; stroke-width: 3.3; pointer-events: none; }
.game-status { padding: 14px 1px 12px; min-height: 72px; }
#message { font-size: 14px; font-weight: 650; line-height: 1.5; min-height: 21px; margin: 0 0 10px; }
.status-line { display: flex; justify-content: space-between; gap: 15px; font-size: 12px; color: #5b6059; }
.actions { display: flex; gap: 9px; align-items: stretch; }
.actions button, .result-actions button { border: 1px solid #b5afa4; padding: 13px 15px; border-radius: 3px; color: #242623; font-weight: 700; background: transparent; min-height: 48px; }
.actions .primary, .result-actions .primary { flex: 1; background: #272d26; border-color: #272d26; color: #fff; }
.actions .quiet { margin-left: auto; border-color: transparent; text-decoration: underline; text-underline-offset: 3px; font-size: 12px; }
.actions #startBtn[hidden], .actions #endTurn[hidden] { display: none; }
.sidebar { border-left: 1px solid #c6c3b9; padding-left: 24px; }
.sidebar section { padding-bottom: 23px; margin-bottom: 23px; border-bottom: 1px solid #ccc7bd; }
.section-heading { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; margin-bottom: 18px; }
.section-heading h2 { margin: 0; font-size: 18px; font-weight: 820; letter-spacing: -.035em; }
.section-heading p { font-size: 10px; color: #76756c; margin: 0; white-space: nowrap; }
.field { display: flex; justify-content: space-between; align-items: center; margin: 16px 0 8px; gap: 8px; font-size: 13px; }
.field output { font-weight: 850; color: #b74e2b; }
select { background: #faf8f2; color: #292c28; border: 1px solid #b8b1a4; padding: 9px 7px; border-radius: 3px; max-width: 205px; }
input[type=range] { width: 100%; accent-color: #ba5733; cursor: pointer; }
.setup-note, .helper-text, .power-help { color: #6a6b62; font-size: 12px; line-height: 1.7; margin: 14px 0 0; }
.powers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.powers button { background: #eeeadf; border: 1px solid #b7b0a3; border-radius: 3px; text-align: left; min-height: 96px; padding: 12px; display: flex; flex-direction: column; gap: 5px; position: relative; }
.powers button b { font-weight: 850; font-size: 14px; }
.power-desc { font-size: 11px; line-height: 1.4; color: #596059; }
.charge { font-size: 11px; color: #ac4927; font-weight: 850; margin-top: auto; }
.powers button.chosen { background: #f3d8c6; border: 2px solid #bf542d; padding: 11px; }
.powers button:disabled { opacity: .42; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; font-size: 13px; cursor: pointer; gap: 15px; }
.toggle-row input { width: 19px; height: 19px; accent-color: #ae502f; }
.record-line { margin-top: 18px; padding-top: 15px; border-top: 1px solid #d0cbbf; font-size: 12px; line-height: 1.8; }
.result-panel { margin-top: 19px; padding: 24px; border-top: 3px solid #242b24; background: #e8e4d9; }
.result-panel.won { border-top-color: #bc5530; background: #f4e1d3; }
.result-kicker { color: #675b51; font-size: 11px; font-weight: 800; letter-spacing: .09em; margin: 0 0 9px; }
.result-panel h2 { font-size: 36px; letter-spacing: -.06em; margin: 0 0 9px; }
#resultDetail { color: #4d5148; line-height: 1.7; font-size: 14px; margin: 0 0 18px; }
.result-actions { display: flex; gap: 10px; }
footer { margin-top: 27px; border-top: 1px solid #c6c0b5; padding-top: 14px; font-size: 11px; line-height: 1.6; color: #6a6f66; }
footer a { color: inherit; text-underline-offset: 3px; }
@media(max-width:850px) {
  .shell { padding: 14px 16px 35px; }
  .layout { grid-template-columns: 1fr; gap: 22px; }
  .sidebar { border-left: 0; padding-left: 0; display: grid; grid-template-columns: 1fr 1fr; column-gap: 22px; }
  .secondary-section { grid-column: 1/-1; }
}
@media(max-width:600px) {
  .shell { padding: 13px 12px 30px; }
  .mast { margin-bottom: 14px; padding-bottom: 14px; }
  h1 { font-size: 32px; }
  .brand p { font-size: 11px; line-height: 1.45; max-width: 230px; }
  .engine-label { column-gap: 5px; }
  .engine-label b { font-size: 10px; }
  .engine-label small { font-size: 9px; }
  .board-header { min-height: 54px; }
  .board-header #turnLabel { font-size: 14px; }
  .board-tools { gap: 7px; }
  .board-tools strong { font-size: 11px; }
  #hintQuick { padding: 8px 7px; font-size: 10px; }
  .board-container { border-width: 3px; }
  .sidebar { display: flex; flex-direction: column; gap: 0; }
  .sidebar section { margin-bottom: 20px; }
  .actions button { padding: 10px 12px; font-size: 12px; }
  .result-panel { padding: 17px; }
  .result-panel h2 { font-size: 31px; }
}
.quick-powers { display: none; }
@media(max-width:850px) {
  .quick-powers { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 5px; margin-top: 10px; }
  .quick-powers button { background: #e7e2d5; border: 1px solid #ada699; border-radius: 3px; min-height: 49px; padding: 7px 3px; font-weight: 800; font-size: 12px; }
  .quick-powers small { display: inline-block; font-size: 10px; padding-left: 3px; color: #9b4c2d; }
  .quick-powers .chosen { border: 2px solid #ac4a29; color: #9c462a; background: #f4dfcc; }
  .powers-section { display: none; }
}
/* Result actions must retain readable Japanese text at narrow mobile widths. */
.result-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}
.result-actions button {
  min-width: 0;
  min-height: 46px;
  padding: 11px 10px;
  font-size: 13px;
  line-height: 1.35;
  white-space: normal;
  word-break: keep-all;
}
.result-actions .primary {
  grid-column: 1 / -1;
  width: 100%;
}
.result-actions #share {
  grid-column: 1 / -1;
  justify-self: end;
  min-height: 36px;
  padding: 6px 2px;
  text-decoration: underline;
  text-underline-offset: 3px;
  border-color: transparent;
  background: transparent;
}
.game-status.is-done { min-height: 0; padding: 10px 1px 12px; }
/* One restrained line of advantage data rather than a dashboard. */
.help-open { border:1px solid #a9a498; background:transparent; color:#34362f; border-radius:3px; padding:9px 12px; font-size:12px; white-space:nowrap; font-weight:750; }
.situation { padding:12px 0 15px; margin-bottom:10px; border-top:1px solid #c8c2b8; border-bottom:1px solid #c8c2b8; }
.situation-top,.situation-tools,.odds-labels,.situation-details { display:flex; justify-content:space-between; align-items:center; gap:9px; }
.situation-top h2 { font-size:14px; margin:0; font-weight:800; }
.situation-top h2 small { font-size:11px; color:#74766b; font-weight:450; padding-left:6px; }
.situation-tools button { padding:6px 9px; min-height:32px; border:1px solid #b4ae9f; border-radius:3px; background:transparent; font-size:11px; color:#32372e; font-weight:700; }
.situation-tools button[aria-pressed=true] { background:#343e35; color:#fff; }
.odds-labels { font-size:12px; margin-top:12px; font-weight:750; }
.odds-track { height:9px; background:#f4f1e9; border:1px solid #b0aa9c; overflow:hidden; margin-top:5px; }
.odds-black { height:100%; background:#323a34; transition:width .24s ease; }
.situation-details { font-size:12px; margin-top:9px; }
.situation-details strong { font-size:13px; }
.situation-caveat { font-size:10px; line-height:1.65; margin:10px 0 0; color:#6d7069; }
.territory-dark { fill:#273a2b; pointer-events:none; }
.territory-light { fill:#fafcf1; stroke:#a6ad9c; stroke-width:1; pointer-events:none; }
.guide { background:#e9e7de; padding:13px 16px; border-left:3px solid #b65a37; margin:0 0 16px; }
.guide-heading { display:flex; justify-content:space-between; align-items:center; color:#555b51; font-size:11px; }
.guide h2 { margin:6px 0 4px; font-size:16px; }
.guide p { font-size:13px; line-height:1.65; margin:0 0 11px; }
.guide button { font-size:12px; background:transparent; border:0; text-decoration:underline; text-underline-offset:3px; padding:5px; }
.guide #guideNext { background:#29332b; color:#fff; text-decoration:none; padding:9px 14px; font-weight:700; }
.guide-target { outline:3px solid #bc613e !important; outline-offset:3px; }
.rules-dialog { width:min(620px,calc(100% - 24px)); max-height:min(86dvh,840px); overflow:auto; padding:22px; border:1px solid #837c6e; border-radius:3px; background:#f3f0e8; color:#282a25; box-shadow:0 20px 70px #17191550; }
.rules-dialog::backdrop { background:rgba(25,28,24,.5); }
.rules-heading { display:flex; justify-content:space-between; gap:10px; align-items:center; border-bottom:1px solid #ada99f; padding-bottom:12px; }
.rules-heading h2 { margin:0; font-size:20px; }
.rules-heading button,.rules-actions button { padding:9px 12px; border:1px solid #979185; background:transparent; color:inherit; border-radius:3px; font-size:12px; font-weight:700; }
.rules-body section { margin-top:18px; }
.rules-body h3 { margin:0 0 4px; font-size:14px; }
.rules-body p { font-size:13px; line-height:1.8; margin:0; }
.rules-actions { display:flex; justify-content:space-between; gap:12px; padding-top:20px; }
.rules-actions #helpDone { background:#28322a; color:#fff; border-color:#28322a; }
@media(max-width:600px){
 .mast{gap:7px;}
 .brand p {max-width:190px;}
 .help-open { padding:7px; font-size:11px; }
 .situation-top h2 small {display:block; padding:3px 0 0;}
 .situation-details { align-items:start; flex-wrap:wrap; }
 .rules-dialog { padding:15px; }
 .rules-actions button { min-height:42px; }
}
.guide { position:sticky; top:0; z-index:20; max-width:100%; margin:0 0 14px; box-shadow:0 4px 12px #25282020; }
.guide-target { scroll-margin-top:170px; }
#boardContainer { scroll-margin-top:170px; }
#setupSection,#mainActions,#quickPowers,#situation,#startBtn {scroll-margin-top:180px;}
