:root {
  --ink: #102033;
  --muted: #587086;
  --line: #dce7ef;
  --blue: #1268d7;
  --cyan: #12b8d6;
  --leaf: #4f9f83;
  --wood: #e5bd73;
  --wood-dark: #b77d34;
  --panel: rgba(255, 255, 255, 0.92);
  --shadow: 0 22px 60px rgba(16, 32, 51, 0.14);
  --radius: 8px;
  font-family: "PingFang SC", "Microsoft YaHei", "Heiti SC", Arial, sans-serif;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.86)),
    radial-gradient(circle at 15% 8%, rgba(18, 184, 214, 0.16), transparent 28%),
    linear-gradient(135deg, #f5faf8, #eef5fb 48%, #fbf7ef);
  min-height: 100vh;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.file-mode-warning {
  display: none;
  padding: 12px clamp(16px, 5vw, 72px);
  color: #7a3d00;
  border-bottom: 1px solid rgba(186, 117, 31, 0.28);
  background: #fff4df;
  font-weight: 800;
}

.file-mode .file-mode-warning {
  display: block;
}

.file-mode-warning a {
  color: var(--blue);
  text-decoration: underline;
}

.go-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 72px;
  padding: 12px clamp(16px, 5vw, 72px);
  background: rgba(255, 255, 255, 0.86);
  border-bottom: 1px solid rgba(220, 231, 239, 0.9);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(18, 104, 215, 0.16);
  box-shadow: 0 8px 18px rgba(16, 32, 51, 0.08);
}

.brand-mark img {
  display: block;
  width: auto;
  height: auto;
  max-width: 86%;
  max-height: 86%;
  object-fit: contain;
}

.brand strong,
.brand small {
  display: block;
  line-height: 1.2;
}

.brand small,
.eyebrow,
.side-panel small,
.score-card span {
  color: var(--muted);
}

.go-header nav {
  display: flex;
  gap: clamp(12px, 3vw, 30px);
  color: #39546a;
  font-weight: 700;
}

.go-shell {
  padding: clamp(24px, 4vw, 56px);
}

.go-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
  max-width: 1280px;
  margin: 0 auto 28px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--cyan);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(42px, 6vw, 72px);
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 12px;
  font-size: 22px;
  line-height: 1.25;
}

.go-hero p:not(.eyebrow) {
  max-width: 760px;
  color: #425b70;
  font-size: 18px;
  line-height: 1.8;
}

.mode-switch,
.board-size-switch,
.control-bar,
.room-actions,
.chat-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.mode-switch button,
.board-size-switch button,
.control-bar button,
.room-actions button,
.chat-form button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: #fff;
  font-weight: 800;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.mode-switch button {
  padding: 10px 16px;
}

.board-size-switch {
  align-items: center;
  justify-content: center;
  margin: 0 0 14px;
  color: var(--muted);
  font-weight: 800;
}

.board-size-switch button {
  min-height: 36px;
  padding: 7px 12px;
}

.mode-switch .is-active,
.board-size-switch .is-active,
.control-bar button:hover,
.room-actions button:hover,
.chat-form button {
  color: #fff;
  border-color: var(--ink);
  background: var(--ink);
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(240px, 0.58fr) minmax(640px, 2fr) minmax(220px, 0.55fr);
  gap: 18px;
  max-width: 1600px;
  margin: 0 auto;
  align-items: start;
}

.side-panel,
.board-zone {
  border: 1px solid rgba(220, 231, 239, 0.95);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.side-panel {
  padding: 18px;
}

.board-zone {
  padding: clamp(14px, 3vw, 26px);
}

.panel-heading.compact {
  margin-top: 18px;
}

.lesson-list {
  display: grid;
  gap: 10px;
}

.lesson-item,
.ai-level-item {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 4px 10px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-align: left;
  background: #fff;
}

.lesson-item span,
.ai-level-item span {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: #fff;
  background: var(--leaf);
  font-weight: 900;
}

.lesson-item.is-active,
.ai-level-item.is-active {
  border-color: var(--leaf);
  background: #f3fbf7;
}

.ai-level-list {
  display: grid;
  gap: 10px;
}

.ai-level-item {
  grid-template-columns: 64px 1fr;
  gap: 6px 14px;
  align-items: start;
}

.ai-level-item span {
  width: 48px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--ink), #28506e);
  font-size: 13px;
}

.ai-level-item.is-active span {
  background: linear-gradient(135deg, var(--leaf), var(--cyan));
}

.game-status {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  color: var(--muted);
}

.game-status strong {
  color: var(--ink);
}

.go-board {
  --board-size: 9;
  --board-edge: 4.35%;
  --board-step: 11.4125%;
  position: relative;
  width: min(100%, 820px);
  aspect-ratio: 1;
  margin: 0 auto;
  border: 1px solid #a86f2c;
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 22% 18%, rgba(255, 255, 255, 0.28), transparent 18%),
    radial-gradient(circle at 76% 72%, rgba(166, 100, 30, 0.14), transparent 24%),
    linear-gradient(135deg, #f2cf8d, var(--wood));
  box-shadow: inset 0 0 0 5px rgba(255, 255, 255, 0.16), 0 20px 42px rgba(89, 55, 18, 0.22);
}

.board-lines {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.board-line {
  position: absolute;
  display: block;
  background: rgba(65, 38, 13, 0.78);
}

.board-line.vertical {
  top: var(--board-edge);
  bottom: var(--board-edge);
  width: 2px;
  transform: translateX(-1px);
}

.board-line.horizontal {
  left: var(--board-edge);
  right: var(--board-edge);
  height: 2px;
  transform: translateY(-1px);
}

.board-point {
  position: absolute;
  z-index: 1;
  display: grid;
  place-items: center;
  width: var(--board-step);
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  background: transparent;
  transform: translate(-50%, -50%);
}

.board-point.is-hint:not(.has-stone)::after {
  content: "";
  width: 36%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(18, 104, 215, 0.34);
  box-shadow: 0 0 0 7px rgba(18, 104, 215, 0.08);
}

.star {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(63, 36, 10, 0.74);
}

.stone {
  display: block;
  width: 86%;
  aspect-ratio: 1;
  border-radius: 50%;
  transform: scale(0.94);
  animation: stoneIn 170ms ease-out;
}

.stone.black {
  background: radial-gradient(circle at 32% 28%, #687180, #10151c 58%, #020305);
  box-shadow: inset -8px -10px 16px rgba(0, 0, 0, 0.48), 0 5px 10px rgba(0, 0, 0, 0.26);
}

.stone.white {
  background: radial-gradient(circle at 30% 24%, #fff, #edf1f4 58%, #b7c1ca);
  box-shadow: inset -8px -10px 16px rgba(102, 119, 135, 0.16), 0 5px 10px rgba(0, 0, 0, 0.18);
}

.stone.last {
  outline: 3px solid var(--cyan);
  outline-offset: -7px;
}

@keyframes stoneIn {
  from {
    opacity: 0;
    transform: scale(0.56);
  }
  to {
    opacity: 1;
    transform: scale(0.94);
  }
}

.control-bar {
  justify-content: center;
  margin-top: 16px;
}

.control-bar button,
.room-actions button,
.chat-form button {
  padding: 9px 13px;
}

.tutor-card,
.score-card,
.room-panel,
.chat-log {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.tutor-card {
  padding: 18px;
  min-height: 116px;
  font-size: 18px;
  line-height: 1.8;
}

.score-card,
.room-panel {
  padding: 14px;
  margin-top: 12px;
}

.score-card strong,
.score-card span {
  display: block;
}

.room-actions {
  margin-bottom: 12px;
}

.room-code strong {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.room-roles {
  display: grid;
  gap: 6px;
  margin: 10px 0;
}

.chat-log {
  display: grid;
  gap: 8px;
  max-height: 150px;
  overflow: auto;
  padding: 12px;
  margin-top: 12px;
}

.chat-log p {
  margin: 0;
}

.chat-log strong {
  margin-right: 8px;
}

.chat-empty,
.room-empty {
  color: var(--muted);
}

.chat-form {
  margin-top: 10px;
}

.chat-form input {
  flex: 1 1 160px;
  min-height: 42px;
  min-width: 0;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

@media (max-width: 1240px) {
  .go-hero,
  .game-layout {
    grid-template-columns: 1fr;
  }

  .side-panel:first-child {
    order: 2;
  }
}

@media (max-width: 680px) {
  .go-header {
    position: static;
    align-items: flex-start;
    flex-direction: column;
  }

  .go-header nav {
    width: 100%;
    justify-content: space-between;
    font-size: 14px;
  }

  .go-shell {
    padding: 18px 12px 32px;
  }

  .tutor-card {
    font-size: 16px;
  }
}
