:root {
  color-scheme: light;
  --ink: #273d35;
  --muted: #607168;
  --cream: #f4ead5;
  --paper: #fffaf0;
  --green: #437967;
  --green-dark: #245242;
  --green-pale: #e3f0e8;
  --gold: #e9b753;
  --line: #d8ccb4;
  --board: #dfbd83;
  --background-warm: #fff8e6;
  --intro-start: #e0eddb;
  --intro-end: #f7f3df;
}
* { box-sizing: border-box; }
body { margin: 0; background: radial-gradient(circle at 5% 4%, var(--background-warm) 0, transparent 30%), var(--cream); color: var(--ink); font: 16px/1.55 "Hiragino Kaku Gothic ProN","Yu Gothic",Meiryo,sans-serif; }
button, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
:focus-visible { outline: 3px solid #ed9d39; outline-offset: 3px; }
.page { max-width: 1220px; margin: 0 auto; padding: 22px clamp(16px, 3vw, 42px) 28px; }
.site-header { display: flex; align-items: center; gap: 13px; margin-bottom: 22px; }
.brand-mark { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 16px; background: var(--green); color: white; font-size: 28px; font-weight: 900; transform: rotate(-9deg); box-shadow: 2px 3px 0 #b6c7b8; }
.site-header h1 { margin: 0; font-size: clamp(19px, 2.3vw, 26px); line-height: 1.3; letter-spacing: .03em; }
.eyebrow { margin: 0 0 3px; color: var(--green); font-size: 11px; font-weight: 900; letter-spacing: .16em; }
.intro { min-height: 215px; padding: 30px clamp(20px, 4vw, 48px); display: flex; align-items: center; justify-content: space-between; overflow: hidden; border-radius: 26px; background: linear-gradient(112deg, var(--intro-start), var(--intro-end) 72%); border: 1px solid #d0dfcc; box-shadow: 0 9px 26px #56735a12; margin-bottom: 23px; }
.intro .tag { margin: 0 0 6px; display: inline-block; color: var(--green-dark); font-size: 13px; font-weight: 800; letter-spacing: .08em; }
.intro h2 { margin: 0; font-size: clamp(26px, 3.5vw, 40px); line-height: 1.27; letter-spacing: .03em; }
.intro h2 span { color: var(--green); }
.intro p:last-child { max-width: 540px; margin: 14px 0 0; color: var(--muted); font-size: 14px; }
.mascot { display: block; width: 158px; min-width: 158px; height: 174px; object-fit: contain; margin: -12px 16px -18px 18px; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 290px; align-items: start; gap: 22px; }
.game-panel,.card { background: var(--paper); border: 1px solid #e2d6bf; border-radius: 22px; box-shadow: 0 5px 18px #8367430e; }
.game-panel { padding: clamp(16px, 2.7vw, 28px); min-width: 0; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; }
.panel-heading h2,.card h2 { margin: 0; font-size: 22px; }
.rule-pill { background: var(--green-pale); color: var(--green-dark); font-weight: 800; font-size: 13px; padding: 5px 12px; border-radius: 30px; }
.status-bar { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; gap: 10px; }
.turn-badge { display: flex; align-items: center; gap: 8px; padding: 7px 13px; background: #e7f0e7; border-radius: 10px; font-weight: 800; }
.stone-indicator { width: 16px; height: 16px; border-radius: 50%; display: inline-block; border: 1px solid #526158; }
.stone-indicator.black { background: #263833; }
.stone-indicator.white { background: white; }
.move-count { font-weight: 800; color: var(--muted); font-size: 13px; }
.message { min-height: 27px; margin: 12px 0; font-size: 14px; color: var(--green-dark); font-weight: 700; }
.pattern-message { margin: -3px 0 12px; padding: 8px 12px; border-radius: 10px; background: #fff0c7; color: #795018; font-size: 14px; font-weight: 800; }
.pattern-message[hidden] { display: none; }
.result-panel { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 10px 0 16px; padding: 14px 16px; border: 1px solid #b5d5bc; border-radius: 14px; background: var(--green-pale); }
.result-panel[hidden] { display: none; }
.result-title { margin: 0; color: var(--green-dark); font-size: 18px; font-weight: 900; }
.result-panel .button { flex: none; }
.board-scroll { overflow: auto; max-width: 100%; background: #ead1a0; border: 8px solid #c99962; border-radius: 12px; box-shadow: inset 0 0 0 2px #bd874d; scrollbar-color: #8c7555 #ead1a0; }
.board { display: grid; grid-template-columns: repeat(19, 36px); grid-template-rows: repeat(19, 36px); width: max-content; padding: 14px; margin: auto; background: var(--board); }
.point { border: 0; padding: 0; width: 36px; height: 36px; display: grid; place-items: center; position: relative; background: linear-gradient(#876f4c, #876f4c) center / 100% 1px no-repeat, linear-gradient(#876f4c, #876f4c) center / 1px 100% no-repeat; border-radius: 0; touch-action: manipulation; }
.point:hover:not(:disabled) { background-color: #f7e8ba; }
.point.selected { background-color: #fff0a9; }
.point.selected.forbidden { background-color: #f6b9a8; }
.point:focus-visible { z-index: 2; }
.piece { width: 27px; height: 27px; display: block; border-radius: 50%; position: relative; z-index: 1; }
.point.black .piece { background: radial-gradient(circle at 32% 25%, #5c6c60, #1e2b25 70%); box-shadow: 0 2px 3px #0004; }
.point.white .piece { background: radial-gradient(circle at 32% 25%, #fff, #e4e6da 70%); border: 1px solid #7e8172; box-shadow: 0 2px 3px #0003; }
.point.last .piece { box-shadow: 0 0 0 3px #ef9e3d, 0 2px 3px #0003; }
.point.opponent-last .piece { box-shadow: 0 0 0 3px #d56b20, 0 0 0 5px #fff7de, 0 2px 3px #0004; }
.point.opponent-last .piece::after { content: ""; position: absolute; width: 8px; height: 8px; left: 50%; top: 50%; transform: translate(-50%, -50%); border-radius: 50%; background: #d56b20; border: 1px solid #fff7de; }
.point.winning .piece { box-shadow: 0 0 0 3px #60aa76, 0 2px 3px #0003; }
.point.selected:not(.black):not(.white)::before { content: ""; position: absolute; z-index: 1; width: 14px; height: 14px; border: 3px solid var(--green); border-radius: 50%; background: #fff4c0; }
.point.selected.forbidden::before { border-color: #a42d23; background: #ffdbd0; }
.board-hint { min-height: 24px; margin-top: 14px; display: flex; align-items: center; justify-content: space-between; gap: 8px 18px; flex-wrap: wrap; }
.opponent-last-guide { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 800; color: #6e4b29; }
.opponent-last-guide[hidden] { display: none; }
.opponent-last-symbol { display: inline-block; width: 14px; height: 14px; flex: none; border-radius: 50%; background: #d56b20; border: 2px solid #fff7de; box-shadow: 0 0 0 2px #d56b20; }
.selection-text { font-size: 14px; font-weight: 800; color: var(--muted); }
.button { border: 0; border-radius: 12px; font-weight: 800; padding: 11px 17px; transition: transform .15s ease, background .15s ease; }
.button:hover:not(:disabled) { transform: translateY(-2px); }
.button-primary { color: white; background: var(--green-dark); }
.button-primary:hover:not(:disabled) { background: #386d58; }
.button-secondary { width: 100%; color: white; background: var(--green); }
.button-secondary:hover:not(:disabled) { background: var(--green-dark); }
.side-panel { display: grid; gap: 17px; }
.card { padding: 21px; }
.card h2 { margin-bottom: 16px; font-size: 19px; }
.card label { display: block; margin: 14px 0 5px; font-size: 13px; font-weight: 800; }
.card select { width: 100%; min-height: 43px; border: 1px solid #c5cbbf; border-radius: 9px; padding: 6px 10px; background: white; color: var(--ink); }
.card .button { margin-top: 19px; }
.note { color: var(--muted); font-size: 12px; line-height: 1.7; margin: 13px 0 0; }
.howto ol { padding-left: 1.35em; margin: 0; font-size: 14px; }
.howto li + li { margin-top: 8px; }
.privacy-note { padding: 17px 19px; color: #4e6c5c; font-size: 12px; line-height: 1.7; background: #e8f1e6; border-radius: 16px; }
.site-footer { display: flex; flex-direction: column; align-items: center; gap: 9px; text-align: center; color: #879185; font-size: 12px; padding: 20px 10px 24px; }
.portal-link { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 6px 14px; border: 1px solid #b8c9c4; border-radius: 999px; background: rgba(255, 255, 255, .6); color: var(--muted); text-decoration: none; font-size: .78rem; font-weight: 700; line-height: 1.3; }
.portal-link:hover { background: #fff; color: var(--ink); border-color: #8da9a0; }
.portal-link:focus-visible { outline: 3px solid #ee8d5f; outline-offset: 3px; }
@media (max-width: 930px) { .layout { grid-template-columns: minmax(0, 1fr); } .side-panel { grid-template-columns: 1fr 1fr; } .privacy-note { grid-column: 1 / -1; } }
@media (max-width: 620px) { .page { padding: 13px 12px 25px; } .site-header { margin-bottom: 14px; } .intro { padding: 22px; min-height: 150px; border-radius: 20px; } .intro h2 { font-size: 26px; } .intro p:last-child { font-size: 12px; } .mascot { width: 86px; min-width: 86px; height: 94px; margin: 0 0 0 8px; } .game-panel { padding: 15px 11px; border-radius: 17px; } .board-scroll { border-width: 6px; } .selection-text { min-height: 22px; } .side-panel { grid-template-columns: 1fr; } .privacy-note { grid-column: auto; } }
@media (prefers-reduced-motion: reduce) { .button { transition: none; } }

.confirm-dialog { border: 1px solid #d9cbb1; border-radius: 20px; padding: 24px; max-width: min(420px, calc(100vw - 28px)); color: var(--ink); background: var(--paper); box-shadow: 0 18px 60px #1b352c55; }
.confirm-dialog::backdrop { background: #1d322b99; }
.confirm-dialog h2 { margin: 0 0 10px; font-size: 21px; }
.confirm-dialog p { color: var(--muted); margin: 0 0 22px; font-size: 14px; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.button-muted { color: var(--green-dark); background: var(--green-pale); }
@media (max-width: 620px) { .result-panel { align-items: stretch; flex-direction: column; } .result-panel .button { width: 100%; } }
