:root { --black: #171717; --white: #fff; --background: #f5f5f3; --border: #c9c9c5; --muted: #666; --accent: #e5482d; }
* { box-sizing: border-box; }
body { margin: 0; color: var(--black); background: var(--background); font-family: system-ui, -apple-system, "Segoe UI", "Noto Sans JP", sans-serif; }
button { font: inherit; color: inherit; }
main { width: min(920px, calc(100% - 32px)); margin: 0 auto; padding: 40px 0; }
.page-header { display: flex; justify-content: space-between; align-items: start; gap: 24px; padding-bottom: 24px; border-bottom: 1px solid var(--border); }
h1 { margin: 0 0 8px; font-size: clamp(24px, 4vw, 34px); }
.page-header p { margin: 0; color: var(--muted); font-size: 14px; }
.link-button { padding: 4px 0; border: 0; border-bottom: 1px solid currentColor; background: none; cursor: pointer; white-space: nowrap; }
.progress { display: flex; align-items: center; gap: 32px; padding: 20px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.progress > div { display: flex; align-items: center; gap: 10px; }
.progress > .link-button { margin-left: auto; font-size: 12px; color: var(--muted); }
.streak { display: flex; gap: 4px; }
.streak-dot { display: block; width: 20px; height: 5px; background: #d5d5d1; }
.streak-dot.active { background: var(--accent); }
.game { display: grid; grid-template-columns: minmax(280px, 480px) minmax(240px, 1fr); gap: clamp(32px, 7vw, 72px); align-items: center; padding: 48px 0; }
.board-frame { position: relative; width: 100%; aspect-ratio: 1; }
.board { width: 100%; height: 100%; display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; padding: 2px; background: var(--black); border: 1px solid var(--black); }
.cell { position: relative; background: var(--white); }
.cell.black { background: var(--black); }
.cell.last-move::after { content: ""; position: absolute; right: 8px; bottom: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.selection-outline { position: absolute; z-index: 2; left: 0; top: 0; width: 50%; height: 50%; border: 5px solid var(--accent); pointer-events: none; opacity: 0; transition: opacity .1s; }
.selection-outline.visible { opacity: 1; }
.move-grid { position: absolute; z-index: 3; inset: 0; display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); }
.move-button { position: relative; border: 0; background: transparent; cursor: pointer; }
.move-button:focus-visible { outline: 3px solid var(--accent); outline-offset: -4px; }
.move-button:disabled { cursor: not-allowed; }
.board-hint { margin: 10px 0 0; color: var(--muted); text-align: center; font-size: 12px; }
.touch-hint { display: none; }
.controls h2 { margin: 12px 0; font-size: clamp(24px, 4vw, 34px); line-height: 1.3; }
.controls > p:not(.phase-tag) { margin: 0 0 28px; color: var(--muted); font-size: 14px; line-height: 1.7; }
.phase-tag { margin: 0; color: var(--accent); font-size: 12px; font-weight: 700; }
.order-actions { display: grid; gap: 10px; }
.primary-button, .secondary-button { width: 100%; padding: 13px 16px; border: 1px solid var(--black); cursor: pointer; font-weight: 700; }
.primary-button { color: var(--white); background: var(--black); }
.secondary-button { background: transparent; }
.primary-button:hover, .secondary-button:hover { outline: 2px solid var(--accent); outline-offset: 2px; }
.play-info { border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.play-info p { display: flex; justify-content: space-between; margin: 0; padding: 13px 0; font-size: 13px; }
.play-info p + p { border-top: 1px solid var(--border); }
.next-button { margin-top: 20px; }
dialog { width: min(480px, calc(100% - 32px)); padding: 28px; border: 1px solid var(--black); background: var(--white); }
dialog::backdrop { background: rgba(0, 0, 0, .45); }
dialog h2 { margin-top: 0; }
dialog li { margin: 10px 0; line-height: 1.6; }
.dialog-close { float: right; border: 0; background: none; font-size: 24px; cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (max-width: 680px) { main { padding: 24px 0; } .page-header { display: block; } .page-header .link-button { margin-top: 18px; } .progress { gap: 16px; flex-wrap: wrap; } .game { grid-template-columns: 1fr; padding: 32px 0; } }
@media (pointer: coarse) { .pointer-hint { display: none; } .touch-hint { display: inline; } .selection-outline { border-width: 6px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: .01ms !important; } }
