* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; background: #FBF1E3; color: #5A3A22;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif;
  -webkit-user-select: none; user-select: none; }
body { min-height: 100vh; min-height: 100dvh; overflow-x: hidden; }
.game { min-height: 100vh; min-height: 100dvh; width: 100%; max-width: 520px; margin: 0 auto;
  display: flex; flex-direction: column; align-items: center; justify-content: space-evenly; gap: 16px;
  padding: calc(env(safe-area-inset-top, 0px) + 16px) 14px calc(env(safe-area-inset-bottom, 0px) + 20px); }
.turn { display: flex; flex: none; align-items: center; gap: 14px; padding: 12px 24px; max-width: 100%; background: #FFF8EE;
  border-radius: 999px; box-shadow: 0 4px 14px rgba(140, 90, 40, .14);
  font-size: 20px; font-weight: 700; letter-spacing: 0; }
.turn-stone { width: 28px; height: 28px; border-radius: 50%; flex: none; }
.turn-stone.black { background: radial-gradient(circle at 35% 30%, #6e6862, #1a1715 55%, #0b0a09); }
.turn-stone.white { background: radial-gradient(circle at 35% 30%, #fff, #f1ede5 60%, #d6cfc2); box-shadow: inset 0 0 0 1px #cfc6b6; }
.board-wrap { position: relative; flex: none; width: 100%; aspect-ratio: 1 / 1;
  background: linear-gradient(135deg, #F5D49A, #E9B873); border-radius: 12px;
  box-shadow: 0 10px 24px rgba(120, 70, 20, .25), inset 0 0 0 3px rgba(170, 110, 50, .35); }
#board { position: absolute; left: 2.5%; top: 2.5%; display: block; width: 95%; height: 95%; touch-action: none; cursor: pointer; }
.btn { display: block; flex: none; width: 72%; max-width: 360px; min-height: 56px; border: 0; border-radius: 999px;
  background: linear-gradient(#8E5B34, #6C4122); color: #FFF4E4; font-size: 20px; font-weight: 700;
  letter-spacing: 0; box-shadow: 0 6px 14px rgba(108, 65, 34, .3); cursor: pointer; font-family: inherit; }
.btn:active { transform: scale(.97); }
.btn:focus-visible, #board:focus-visible { outline: 3px solid #FF8A3D; outline-offset: 4px; }
.mask { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 20px; overflow-y: auto; background: rgba(70, 40, 15, .38); z-index: 10; }
.mask[hidden] { display: none; }
.result { width: 100%; max-width: 380px; background: #FFFCF7; border-radius: 22px; padding: 28px 24px 24px;
  text-align: center; box-shadow: 0 16px 40px rgba(70, 40, 15, .3); }
.result .mp-icon { font-size: 52px; color: #F2B630; }
.result-title { margin: 6px 0 22px; font-size: 30px; font-weight: 800; letter-spacing: 0; }
.result .btn { width: 100%; }

/* Keep the playing surface square even in WebViews without aspect-ratio. */
.board-wrap::before { content: ""; display: block; padding-top: 100%; pointer-events: none; }

.game-header { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.play-hint { margin: 0; text-align: center; font-size: 14px; line-height: 1.4; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

.turn { min-height: 52px; }
.countdown { flex: none; min-width: 48px; text-align: end; color: #795333;
  font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.countdown[hidden] { display: inline; visibility: hidden; }
#turnText { min-width: 5em; }
#board[data-turn="white"] { cursor: wait; }
#board[data-turn="ended"] { cursor: default; }
.game-actions { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.game-tools { display: flex; gap: 10px; }
.tool { min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid #dfbb9a;
  background: #fff8ee; color: #5a3a22; font: inherit; cursor: pointer; }
.tool .mp-icon { margin-inline-end: 4px; vertical-align: middle; }
.tool:disabled { opacity: .55; cursor: default; }
.tool:focus-visible { outline: 3px solid #FF8A3D; outline-offset: 2px; }
@media (max-width: 320px) { .turn { padding-inline: 16px; gap: 8px; } }
