.gomoku-body {
  min-height: 100dvh;
  overflow-x: hidden;
}

.gomoku-app {
  width: min(680px, 100%);
  margin: 0 auto;
  padding: 0 14px calc(20px + env(safe-area-inset-bottom));
}

.gomoku-top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  background: rgba(15, 18, 22, .88);
  backdrop-filter: blur(16px);
}

.back-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  background: rgba(21, 26, 32, .6);
  text-decoration: none;
  font-size: 28px;
  line-height: 1;
  padding-bottom: 3px;
}

.back-btn:hover { color: var(--text); }

.gomoku-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.gomoku-brand strong {
  display: block;
  font-size: 16px;
  letter-spacing: .02em;
}

.gomoku-brand span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.fish-avatar {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  overflow: hidden;
  flex: 0 0 auto;
  background: linear-gradient(145deg, var(--fish), var(--fish-2));
}

.fish-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.small-btn {
  width: auto;
  min-height: 38px;
  padding: 6px 12px;
  border-radius: 11px;
  font-size: 12px;
  cursor: pointer;
}

.gomoku-main {
  padding-top: 4px;
}

.score-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 4px 2px 12px;
}

.score-item {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: 7px;
  min-width: 78px;
}

.score-item.right {
  justify-content: end;
  text-align: right;
  grid-template-columns: 1fr auto;
}

.score-item.right .stone-dot { order: 2; }

.score-item b {
  font-size: 13px;
  font-weight: 700;
}

.score-item small {
  grid-column: 1 / -1;
  color: #65727e;
  font-size: 10px;
  line-height: 1.2;
  margin-top: 2px;
}

.stone-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .5);
}

.stone-dot.black { background: radial-gradient(circle at 32% 28%, #58616c, #05070a 65%); }
.stone-dot.white { background: radial-gradient(circle at 32% 28%, #ffffff, #b9c4cc 70%); }

.turn-pill {
  flex: 0 0 auto;
  min-width: 94px;
  text-align: center;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(92, 200, 194, .3);
  background: rgba(92, 200, 194, .09);
  color: #9fe7e1;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
}

.turn-pill.thinking {
  color: #ffd479;
  border-color: rgba(255, 212, 121, .28);
  background: rgba(255, 212, 121, .08);
}

.turn-pill.over {
  color: #ffb0b0;
  border-color: rgba(255, 122, 122, .28);
  background: rgba(255, 122, 122, .08);
}

.board-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 22px;
  padding: 7px;
  border: 1px solid rgba(92, 200, 194, .16);
  background:
    linear-gradient(145deg, rgba(30, 44, 48, .82), rgba(12, 20, 24, .96));
  box-shadow:
    0 20px 60px rgba(0, 0, 0, .5),
    inset 0 1px 0 rgba(255, 255, 255, .04);
  touch-action: manipulation;
}

.board-wrap::before {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 15px;
  pointer-events: none;
  border: 1px solid rgba(160, 225, 220, .06);
}

#board {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 15px;
  cursor: crosshair;
}

.board-glow {
  position: absolute;
  inset: 15% 10% -8%;
  z-index: 0;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(92, 200, 194, .18), transparent 68%);
  filter: blur(24px);
  pointer-events: none;
}

.fish-line {
  min-height: 22px;
  margin: 12px 4px 10px;
  color: #b9c6d1;
  font-size: 13px;
  line-height: 1.6;
  text-align: center;
}

.gomoku-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 2px;
}

.difficulty {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--muted);
  font-size: 11px;
}

.difficulty select {
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  padding: 0;
}

.difficulty select option {
  background: #151a20;
  color: var(--text);
}

.gomoku-controls .ghost {
  background: transparent;
}

.gomoku-controls .ghost:disabled {
  opacity: .38;
  cursor: not-allowed;
}

.gomoku-tip {
  margin: 14px 0 0;
  color: #56636f;
  font-size: 10px;
  line-height: 1.5;
  text-align: center;
}

.result-toast {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(3, 6, 9, .7);
  backdrop-filter: blur(8px);
}

.result-card {
  width: min(340px, 100%);
  padding: 24px;
  border: 1px solid rgba(92, 200, 194, .22);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(27, 34, 42, .98), rgba(16, 22, 28, .98));
  box-shadow: 0 24px 80px rgba(0, 0, 0, .6);
  text-align: center;
}

.result-avatar {
  width: 64px;
  height: 64px;
  margin: 0 auto 12px;
  border-radius: 20px;
  overflow: hidden;
  background: linear-gradient(145deg, var(--fish), var(--fish-2));
}

.result-avatar img { width: 100%; height: 100%; object-fit: cover; }

.result-card h2 {
  margin: 0 0 6px;
  font-size: 22px;
}

.result-card p {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 13px;
}

.result-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.result-actions .primary {
  width: auto;
  margin: 0;
  min-height: 42px;
  padding: 0 20px;
}

.result-actions .ghost {
  display: grid;
  place-items: center;
  text-decoration: none;
}

@media (max-width: 430px) {
  .gomoku-app { padding-inline: 10px; }
  .score-strip { gap: 6px; }
  .score-item { min-width: 66px; }
  .score-item b { font-size: 12px; }
  .turn-pill { min-width: 84px; padding-inline: 9px; }
}
