:root {
  --bg: #0b1220;
  --panel: rgba(255, 255, 255, 0.06);
  --panel2: rgba(255, 255, 255, 0.08);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.72);
  --border: rgba(255, 255, 255, 0.14);
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.45);

  --boardBlue1: #1a2da8;
  --boardBlue2: #13227f;

  --hole: rgba(0, 0, 0, 0.30);
  --hole2: rgba(255, 255, 255, 0.07);

  --red: #ff4d6d;
  --yellow: #ffd166;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--text);
  background: radial-gradient(1200px 800px at 20% 10%, rgba(80, 120, 255, 0.18), transparent 60%),
              radial-gradient(900px 650px at 90% 10%, rgba(0, 255, 170, 0.14), transparent 55%),
              radial-gradient(900px 650px at 40% 100%, rgba(255, 180, 0, 0.10), transparent 60%),
              var(--bg);
}

.app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px;
}

.topbar {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.topbarLeft{
  min-width: 220px;
}

.topbarCenter{
  flex: 1;
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 0 10px;
}

.brand{
  font-family: ui-rounded, "Segoe Print", "Segoe Script", "Bradley Hand", "Comic Sans MS", ui-sans-serif;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.8px;
  background: linear-gradient(90deg, rgba(255, 209, 102, 0.95), rgba(124, 92, 255, 0.95));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 10px 26px rgba(0,0,0,0.35);
}

.topbar h1 {
  margin: 0;
  font-size: 18px;
}

.status {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
}

.info {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
}

.actions {
  display: flex;
  gap: 8px;
}

.toggle {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel2);
  cursor: pointer;
  user-select: none;
  font-weight: 800;
  color: var(--text);
}

.toggle input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--panel2);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 800;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.main {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 16px;
  margin-top: 16px;
}

@media (max-width: 940px) {
  .main { grid-template-columns: 1fr; }
  .topbarCenter{display:none}
}

.boardPanel {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 16px;
}

.board {
  width: min(76vh, 700px);
  max-width: 100%;
  aspect-ratio: 7 / 6;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: repeat(6, 1fr);
  gap: 10px;
  padding: 14px;
  border-radius: 14px;
  background: linear-gradient(180deg, var(--boardBlue1), var(--boardBlue2));
  border: 1px solid rgba(255, 255, 255, 0.14);
  position: relative;
}

.cell {
  position: relative;
  border-radius: 999px;
  background: radial-gradient(circle at 35% 30%, var(--hole2), transparent 55%),
              radial-gradient(circle at 50% 70%, rgba(0,0,0,0.25), transparent 62%),
              var(--hole);
  display: grid;
  place-items: center;
  cursor: pointer;
  user-select: none;
}

.cell:focus {
  outline: 2px solid rgba(255, 255, 255, 0.32);
  outline-offset: -2px;
}

.disc {
  width: 86%;
  height: 86%;
  border-radius: 999px;
  box-shadow: inset 0 8px 14px rgba(255,255,255,0.14), inset 0 -12px 20px rgba(0,0,0,0.35), 0 16px 24px rgba(0,0,0,0.28);
}

.disc.red {
  background: radial-gradient(circle at 30% 25%, rgba(255,255,255,0.35), transparent 45%),
              var(--red);
}

.disc.yellow {
  background: radial-gradient(circle at 30% 25%, rgba(255,255,255,0.35), transparent 45%),
              var(--yellow);
}

.cell.hint {
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.16);
}

.cell.hint::after {
  content: "";
  width: 20%;
  height: 20%;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
}

.boardOverlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(2px);
}

.boardOverlayCard {
  width: min(520px, 88%);
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(15, 20, 35, 0.75);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  text-align: center;
}

.boardOverlayTitle {
  font-size: 18px;
  font-weight: 900;
}

.boardOverlaySubtitle {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.legend {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.legendRow {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.swatch {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  box-shadow: inset 0 2px 5px rgba(255,255,255,0.15), inset 0 -4px 7px rgba(0,0,0,0.35);
}

.swatch.red { background: var(--red); }
.swatch.yellow { background: var(--yellow); }

.side {
  display: grid;
  gap: 16px;
}

.card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 14px 16px;
}

.card h2 {
  margin: 0 0 10px 0;
  font-size: 15px;
}

.card p {
  margin: 8px 0;
  color: var(--muted);
  line-height: 1.35;
}

.aiRow {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 12px;
  align-items: start;
}

.aiAvatar {
  width: 56px;
  height: 56px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 35% 35%, rgba(255,255,255,0.50), transparent 45%),
    radial-gradient(circle at 50% 70%, rgba(0,0,0,0.18), transparent 55%),
    linear-gradient(180deg, #ffd2a6, #f1b98d);
  position: relative;
  box-shadow: inset 0 3px 10px rgba(255,255,255,0.14), inset 0 -10px 16px rgba(0,0,0,0.22), 0 14px 22px rgba(0,0,0,0.30);
}

.aiAvatar::before {
  content: "";
  position: absolute;
  inset: -2px -2px 18px -2px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 50% 15%, rgba(255,255,255,0.10), transparent 60%),
    linear-gradient(180deg, #2a2a2a, #101010);
  clip-path: ellipse(65% 55% at 50% 25%);
  opacity: 0.95;
}

.aiAvatar::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background:
    radial-gradient(circle at 38% 52%, rgba(0,0,0,0.85) 0 2.6px, transparent 3px),
    radial-gradient(circle at 62% 52%, rgba(0,0,0,0.85) 0 2.6px, transparent 3px),
    radial-gradient(circle at 36% 50%, rgba(255,255,255,0.65) 0 1.1px, transparent 1.3px),
    radial-gradient(circle at 60% 50%, rgba(255,255,255,0.65) 0 1.1px, transparent 1.3px),
    radial-gradient(ellipse at 50% 72%, rgba(0,0,0,0.60) 0 6px, transparent 6.6px),
    radial-gradient(ellipse at 50% 69%, rgba(255,255,255,0.18) 0 8px, transparent 8.6px);
  opacity: 0.85;
}

.aiDialog {
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.35;
  min-height: 44px;
}
