* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: #f4f7fc; color: #0b1a33; font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif; }
.gomoku-header { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 16px; flex-shrink: 0; min-height: 66px; padding: 10px 28px; background: #fff; border-bottom: 1px solid #e7edf5; }
.gomoku-plan { justify-self: start; display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 8px; color: #16803d; background: #eaf8ef; font-size: .8rem; font-weight: 500; }
.gomoku-plan strong { font-size: .85rem; font-style: italic; font-weight: 800; }
.gomoku-title { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 0; font-size: 1.325rem; font-weight: 700; line-height: 1.4; }
.gomoku-title-icon { display: grid; place-items: center; width: 36px; height: 36px; color: #006acd; font-size: 1.5rem; }
.gomoku-open-link { display: inline-flex; align-items: center; gap: 6px; justify-self: end; color: #69798d; font-size: .9rem; text-decoration: none; white-space: nowrap; }
.gomoku-open-link:hover { color: #006acd; }
.gomoku-main { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 24px; width: 100%; padding: 32px 24px 16px; }
.gomoku-wrapper { display: flex; flex: 1 0 auto; align-items: center; justify-content: center; width: 100%; }
.gomoku-layout { display: grid; grid-template-columns: minmax(0, 280px) minmax(0, 640px); align-items: start; gap: 24px; width: 100%; max-width: 944px; }
.settings-card, .game-card { min-width: 0; padding: 24px 22px 28px; background: #fff; border: 1px solid #e5ebf3; border-radius: 24px; box-shadow: 0 12px 40px rgba(18,61,107,.06); }
.settings-card h2, .game-heading h2 { margin: 0; font-size: 1rem; font-weight: 650; line-height: 1.5; }
.intro { margin: 10px 0 20px; color: #66758a; font-size: .82rem; line-height: 1.8; }
.field-label, legend { display: block; margin-bottom: 8px; color: #4b5a6a; font-size: .8rem; font-weight: 550; }
select { width: 100%; min-height: 42px; padding: 8px 10px; border: 1px solid #d2dce9; border-radius: 10px; background: #fff; color: #0b1a33; font: inherit; font-size: .85rem; }
.help { margin: 8px 0 0; color: #66758a; font-size: .75rem; line-height: 1.8; }
fieldset { min-width: 0; margin: 20px 0; padding: 0; border: 0; }
.color-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.color-options label { position: relative; cursor: pointer; }
.color-options input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.color-options label > span { display: flex; align-items: center; justify-content: center; gap: 7px; padding: 12px 4px; border: 1px solid #e0e7f0; border-radius: 10px; color: #66758a; font-size: .78rem; }
.color-options input:checked + span { color: #006acd; border-color: #87b9ea; background: #eef4fe; }
.color-options input:focus-visible + span { outline: 3px solid #8ec7ff; outline-offset: 2px; }
.stone { display: inline-block; flex-shrink: 0; width: 20px; height: 20px; border-radius: 50%; box-shadow: 0 2px 3px #12243b24; }
.black { background: radial-gradient(circle at 32% 27%, #596273, #1d2532 55%, #080e18); border: 1px solid #172130; }
.white { background: radial-gradient(circle at 32% 27%, #fff 15%, #f7f8fa 50%, #d2d9e3); border: 1px solid #b9c3d1; }
.gomoku-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 12px; border: 1px solid #e0e7f0; border-radius: 10px; background: #f4f7fc; color: #4b5a6a; font: inherit; font-size: .8rem; font-weight: 500; line-height: 1.5; cursor: pointer; }
.gomoku-btn:hover { color: #0b1a33; background: #eaf0f8; }
.gomoku-btn.primary { color: #fff; background: #006acd; border-color: #006acd; box-shadow: 0 4px 14px rgba(0,106,205,.15); }
.gomoku-btn.primary:hover { background: #0059b3; }
.gomoku-btn:disabled { opacity: .45; cursor: not-allowed; }
.full-width { width: 100%; }
.how-to { margin-top: 22px; padding-top: 20px; border-top: 1px solid #eef2f8; }
.how-to h3 { margin: 0 0 12px; color: #315d8d; font-size: .9rem; }
.how-to p { margin: 0 0 12px; color: #66758a; font-size: .78rem; line-height: 1.8; }
.how-to p:last-child { margin-bottom: 0; }.how-to strong { display: block; margin-bottom: 3px; color: #4b5a6a; font-weight: 600; }
.game-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.game-heading p { margin: 7px 0 0; color: #66758a; font-size: .8rem; }.game-actions { display: flex; gap: 8px; }
.players { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 10px; margin-bottom: 18px; }
.player { display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 68px; padding: 10px 12px; border: 1px solid #eef2f8; border-radius: 14px; background: #f8faff; }
.player > .stone { width: 28px; height: 28px; }.player strong { display: block; font-size: .85rem; }.player div > span { display: block; margin-top: 4px; color: #66758a; font-size: .72rem; }
.player.active { border-color: #a6ccef; background: #eef4fe; }.turn-tag { display: none; margin-left: auto; color: #006acd; font-size: .7rem; white-space: nowrap; }.player.active .turn-tag { display: inline; }.versus { color: #a6b2c3; font-size: .7rem; font-weight: 700; }
.board-frame { padding: 10px; border: 1px solid #d8c5a5; border-radius: 16px; background: #efdbb8; box-shadow: inset 0 1px 4px #96784a16; }
.gomoku-board { display: grid; grid-template-rows: repeat(15, minmax(0, 1fr)); width: 100%; aspect-ratio: 1; user-select: none; -webkit-user-select: none; }
.board-row { display: grid; grid-template-columns: repeat(15, minmax(0, 1fr)); min-height: 0; }
.board-cell { position: relative; display: grid; place-items: center; min-width: 0; min-height: 0; width: 100%; height: 100%; padding: 0; border: 0; background: transparent; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.board-cell::before { content: ''; position: absolute; inset: 0; background: linear-gradient(#ad946e, #ad946e) center / 100% 1px no-repeat, linear-gradient(#ad946e, #ad946e) center / 1px 100% no-repeat; }
.board-cell.edge-top::before { top: 50%; background-position: center top; }.board-cell.edge-bottom::before { bottom: 50%; background-position: center bottom; }.board-cell.edge-left::before { left: 50%; background-position: left center; }.board-cell.edge-right::before { right: 50%; background-position: right center; }
.board-cell.edge-top.edge-left::before { background-position: left top; }.board-cell.edge-top.edge-right::before { background-position: right top; }.board-cell.edge-bottom.edge-left::before { background-position: left bottom; }.board-cell.edge-bottom.edge-right::before { background-position: right bottom; }
.board-cell.edge-top.edge-left::before { background-position: left top; }.board-cell.edge-top.edge-right::before { background-position: right top; }.board-cell.edge-bottom.edge-left::before { background-position: left bottom; }.board-cell.edge-bottom.edge-right::before { background-position: right bottom; }
.board-cell.star::after { content: ''; position: absolute; width: 5px; height: 5px; border-radius: 50%; background: #92764f; }
.board-cell > span { position: relative; z-index: 1; display: block; width: 84%; height: 84%; border-radius: 50%; }
.board-cell .black, .board-cell .white { box-shadow: 1px 2px 3px #47351b44; }
.board-cell.last > span::after { content: ''; position: absolute; left: 50%; top: 50%; width: 19%; height: 19%; transform: translate(-50%, -50%); border-radius: 50%; background: #4da5ff; box-shadow: 0 0 0 1px #fff9; }
.board-cell.winning > span { outline: 2px solid #16803d; outline-offset: 1px; }.board-cell.winning.last > span::after { background: #44d67d; }
.gomoku-board:not(.locked) .board-cell.empty:hover > span { background: #006acd25; box-shadow: inset 0 0 0 1px #006acd55; }
.gomoku-board.locked .board-cell, .board-cell:not(.empty) { cursor: default; }
.game-result { display: flex; flex-wrap: wrap; align-items: baseline; gap: 7px 14px; margin-top: 16px; padding: 14px; border: 1px solid #d8ebdf; border-radius: 12px; background: #f0faf3; color: #16803d; }
.game-result.is-loss { color: #a45e10; border-color: #eedbbc; background: #fff8ed; }.game-result.is-draw { color: #315d8d; border-color: #d2dce9; background: #f4f7fc; }.game-result strong { font-size: 1rem; }.game-result span { font-size: .8rem; line-height: 1.7; }
.status-line { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px; margin: 14px 0; }.status-line p { margin: 0; color: #315d8d; font-size: .82rem; line-height: 1.8; }.status-line > span { color: #8895a7; font-size: .75rem; font-variant-numeric: tabular-nums; }
.board-caption { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 14px; padding-top: 12px; border-top: 1px solid #eef2f8; color: #8895a7; font-size: .7rem; line-height: 1.8; }
.gomoku-tips { flex-shrink: 0; width: 100%; max-width: 944px; margin-top: auto; padding: 18px 16px 0; border-top: 1px solid #eef2f8; color: #66758a; font-size: .82rem; line-height: 1.8; text-align: center; }.gomoku-tips p { margin: 0; }
button:focus-visible, a:focus-visible, select:focus-visible { outline: 3px solid #8ec7ff; outline-offset: 2px; }.board-cell:focus-visible { z-index: 2; outline: 2px solid #006acd; outline-offset: -1px; border-radius: 4px; }
@media (max-width: 991.98px) { .gomoku-layout { grid-template-columns: minmax(0, 240px) minmax(0, 1fr); gap: 16px; }.settings-card, .game-card { padding: 20px 16px; }.turn-tag { display: none !important; } }
@media (max-width: 767.98px) {
    .gomoku-header { padding: 8px 16px; gap: 10px; }.gomoku-plan { padding: 5px 8px; font-size: .72rem; }.gomoku-title { gap: 7px; font-size: 1.175rem; }.gomoku-title-icon { width: 32px; height: 32px; font-size: 1.3rem; }.gomoku-open-link { font-size: .8rem; }
    .gomoku-main { padding: 24px 16px 16px; gap: 20px; }.gomoku-layout { grid-template-columns: minmax(0, 1fr); max-width: 620px; }.settings-card, .game-card { padding: 18px 16px 22px; border-radius: 22px; }.how-to { display: none; }.intro { margin-bottom: 14px; }
    #gomokuSettings { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; gap: 0 14px; }.field-label, #difficulty, #difficultyHelp { grid-column: 1; }fieldset { grid-column: 2; grid-row: 1 / 4; margin: 0; }#gomokuSettings > .gomoku-btn { grid-column: 1 / -1; margin-top: 16px; }#gomokuSettings > .help:last-child { grid-column: 1 / -1; }.color-options { grid-template-columns: minmax(0, 1fr); gap: 6px; }.color-options label > span { padding: 7px 4px; }.turn-tag { display: inline !important; }
}
@media (max-width: 575.98px) {
    .gomoku-header { grid-template-columns: minmax(0, 1fr) auto; }.gomoku-title { grid-column: 1 / -1; grid-row: 1; }.gomoku-plan { grid-column: 1; grid-row: 2; }.gomoku-open-link { grid-column: 2; grid-row: 2; }
    .players { gap: 6px; }.player { gap: 7px; padding: 10px 8px; }.player > .stone { width: 22px; height: 22px; }.turn-tag { display: none !important; }.board-frame { padding: 6px; border-radius: 12px; }.gomoku-tips { padding: 18px 8px 0; font-size: .75rem; }
}
