:root {
  --bg: #fff8ef;
  --paper: #fffdf8;
  --surface: #ffe7d2;
  --surface-strong: #ffd4ad;
  --card: rgba(255, 255, 255, 0.88);
  --line: #e8c8a8;
  --text: #2d211b;
  --muted: #6e5a4f;
  --accent: #ff8a5b;
  --accent-strong: #ff7043;
  --accent-soft: #fff0e6;
  --success: #5d9f6e;
  --shadow: 0 18px 45px rgba(132, 94, 64, 0.15);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 16px;
  --max-width: 1200px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(255, 215, 169, 0.7), transparent 30%),
    radial-gradient(circle at top right, rgba(255, 184, 160, 0.55), transparent 25%),
    var(--bg);
  color: var(--text);
  font-family: "Baloo 2", "Noto Sans SC", sans-serif;
}

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

button,
input,
textarea,
select {
  font: inherit;
}

img {
  max-width: 100%;
  display: block;
}

.shell {
  width: min(calc(100% - 32px), var(--max-width));
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(16px);
  background: rgba(255, 248, 239, 0.8);
  border-bottom: 1px solid rgba(232, 200, 168, 0.6);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 1.15rem;
  font-weight: 700;
}

.brand-badge {
  width: 52px;
  height: 52px;
  border-radius: 18px;
  background: linear-gradient(135deg, #ffdfb5, #ffb9a0);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow);
}

.site-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.site-nav a {
  padding: 10px 16px;
  border-radius: 999px;
  color: var(--muted);
  transition: 0.2s ease;
}

.site-nav a:hover,
.site-nav a.is-active {
  background: var(--paper);
  color: var(--text);
  box-shadow: 0 8px 18px rgba(126, 92, 54, 0.08);
}

.page {
  padding: 32px 0 96px;
}

.hero {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 28px;
  align-items: stretch;
}

.hero-card,
.card,
.panel,
.board-card {
  background: var(--card);
  border: 1px solid rgba(232, 200, 168, 0.75);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: 34px;
  background:
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.65), transparent 32%),
    linear-gradient(135deg, #fff4de, #ffd6c4);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  color: #a76535;
  font-size: 0.9rem;
}

.hero-copy h1,
.page-title {
  margin: 16px 0 10px;
  font-size: clamp(2.2rem, 5vw, 4rem);
  line-height: 0.95;
}

.page-title {
  font-size: clamp(1.8rem, 4vw, 3rem);
}

.hero-copy p,
.section-lead,
.muted {
  color: var(--muted);
  line-height: 1.7;
}

.hero-actions,
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

.button,
.ghost-button,
.mini-button {
  border: none;
  cursor: pointer;
  transition: 0.2s ease;
}

.button {
  padding: 14px 22px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: white;
  box-shadow: 0 14px 25px rgba(255, 112, 67, 0.24);
}

.ghost-button {
  padding: 14px 22px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  border: 1px solid rgba(232, 200, 168, 0.8);
}

.mini-button {
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--text);
}

.button:hover,
.ghost-button:hover,
.mini-button:hover {
  transform: translateY(-2px);
}

.hero-visual {
  position: relative;
  overflow: hidden;
  padding: 28px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at bottom left, rgba(255, 210, 120, 0.75), transparent 28%),
    linear-gradient(160deg, #ffe3cb, #fff6ea);
}

.cat-stage {
  position: relative;
  width: min(100%, 340px);
  aspect-ratio: 1;
}

.cat-stage svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 16px 24px rgba(121, 80, 54, 0.2));
}

.floating-note {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(232, 200, 168, 0.8);
  box-shadow: 0 12px 18px rgba(118, 86, 57, 0.08);
  font-size: 0.92rem;
}

.floating-note.note-1 { top: 12px; right: 6px; }
.floating-note.note-2 { bottom: 22px; left: 0; }

.section {
  margin-top: 30px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.card {
  padding: 24px;
}

.card h3,
.panel h3,
.board-card h3 {
  margin: 0 0 8px;
}

.icon-chip {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #fff4de, #ffd5bf);
  margin-bottom: 14px;
  font-size: 1.4rem;
}

.stats-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.stat-pill {
  padding: 18px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(232, 200, 168, 0.7);
}

.stat-pill strong {
  display: block;
  font-size: 2rem;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 22px;
}

.split-layout {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 20px;
}

.panel {
  padding: 24px;
}

.list {
  display: grid;
  gap: 12px;
}

.list-item {
  padding: 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(232, 200, 168, 0.75);
}

.stack {
  display: grid;
  gap: 14px;
}

.form-grid {
  display: grid;
  gap: 14px;
}

.field-label {
  display: grid;
  gap: 8px;
  color: var(--muted);
}

.input,
.textarea {
  width: 100%;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(232, 200, 168, 0.9);
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
}

.textarea {
  min-height: 140px;
  resize: vertical;
}

.pill {
  display: inline-flex;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: #9a5b30;
  font-size: 0.9rem;
}

.article-card h3,
.session-card h3 {
  margin: 0 0 8px;
}

.article-card small,
.session-card small,
.helper {
  color: var(--muted);
}

.stats-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.game-shell {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 22px;
}

.board-card {
  padding: 22px;
}

.board-card canvas,
.board-card .board-grid {
  margin-top: 18px;
}

.board-grid {
  display: grid;
  gap: 2px;
  justify-content: start;
}

.gobang-cell,
.mines-cell {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  background: #ffe7cb;
  color: var(--text);
}

.gobang-cell[data-piece="black"] {
  background: #2f221b;
}

.gobang-cell[data-piece="white"] {
  background: #fffdf8;
  border: 1px solid rgba(72, 50, 36, 0.2);
}

.mines-cell.is-open {
  background: #fffdf9;
}

.chat-widget-root {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
}

.chat-toggle {
  width: 68px;
  height: 68px;
  border-radius: 24px;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent), #ff6e70);
  color: white;
  box-shadow: 0 18px 30px rgba(255, 112, 67, 0.34);
}

.chat-window {
  width: min(92vw, 360px);
  height: min(72vh, 540px);
  margin-bottom: 14px;
  display: none;
  flex-direction: column;
  overflow: hidden;
  border-radius: 28px;
  background: rgba(255, 253, 248, 0.96);
  border: 1px solid rgba(232, 200, 168, 0.9);
  box-shadow: var(--shadow);
}

.chat-window.is-open {
  display: flex;
}

.chat-head,
.chat-foot {
  padding: 16px 18px;
  background: rgba(255, 240, 230, 0.9);
}

.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: grid;
  gap: 12px;
}

.bubble {
  max-width: 88%;
  padding: 12px 14px;
  border-radius: 18px;
  line-height: 1.6;
}

.bubble.user {
  margin-left: auto;
  background: linear-gradient(135deg, var(--accent), #ff7b7b);
  color: white;
}

.bubble.assistant {
  background: white;
  border: 1px solid rgba(232, 200, 168, 0.8);
}

.bubble.human {
  background: #e9fff0;
  border: 1px solid rgba(93, 159, 110, 0.25);
}

.chat-form {
  display: grid;
  gap: 10px;
}

.chat-form-row {
  display: flex;
  gap: 10px;
}

.chat-form input {
  flex: 1;
}

.status-note {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--muted);
}

@media (max-width: 980px) {
  .hero,
  .split-layout,
  .game-shell,
  .card-grid,
  .stats-strip,
  .stats-board {
    grid-template-columns: 1fr;
  }

  .topbar-inner,
  .page-header {
    align-items: start;
    flex-direction: column;
  }
}
