:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --primary: #2d6cdf;
  --secondary: #0f172a;
  --muted: #64748b;
  --accent: #8be9fd;
  --danger: #ef4444;
  --success: #22c55e;
  --shadow: 0 20px 40px rgba(15, 23, 42, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", "Noto Sans SC", system-ui, sans-serif;
  background: var(--bg);
  color: var(--secondary);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 10;
}

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

.logo {
  display: inline-flex;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--primary);
  color: white;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.brand-title {
  margin: 0;
  font-weight: 700;
}

.brand-subtitle {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.nav {
  display: flex;
  gap: 16px;
  align-items: center;
}

.nav-link {
  text-decoration: none;
  color: var(--secondary);
  font-weight: 600;
}

.nav-link.active {
  color: var(--primary);
}

.nav-more {
  position: relative;
}

.nav-more-button {
  border: none;
  background: none;
  font-weight: 600;
  cursor: pointer;
}

.nav-more-menu {
  position: absolute;
  right: 0;
  top: 32px;
  background: var(--surface);
  border-radius: 12px;
  box-shadow: var(--shadow);
  display: none;
  flex-direction: column;
  min-width: 160px;
  padding: 8px;
  z-index: 20;
}

.nav-more:hover .nav-more-menu {
  display: flex;
}

.nav-more-menu button {
  border: none;
  background: none;
  padding: 8px 12px;
  text-align: left;
  cursor: pointer;
}

.quick-actions button {
  border: 1px solid #e2e8f0;
  background: var(--surface);
  padding: 8px 12px;
  border-radius: 10px;
  margin-left: 8px;
}

.mobile-menu {
  display: none;
  border: none;
  background: none;
  font-size: 20px;
}

.layout {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  gap: 24px;
  padding: 32px 24px;
}

.panel {
  background: var(--surface);
  border-radius: 20px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.gallery .card,
.side .card {
  background: #f8fafc;
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 16px;
}

.card h3 {
  margin-top: 0;
}

.card button {
  margin-top: 12px;
  border: none;
  background: var(--primary);
  color: white;
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
}

.card.muted {
  opacity: 0.6;
}

.game-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
}

.game-stats {
  display: flex;
  gap: 16px;
  align-items: center;
}

.game-stats .label {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.game-body {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 24px;
  margin-top: 24px;
}

.board {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  border: 2px solid #0f172a;
  gap: 0;
  background: white;
}

.cell {
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  position: relative;
}

.cell.fixed {
  background: #e2e8f0;
  font-weight: 700;
}

.cell.active {
  outline: 2px solid var(--primary);
  z-index: 1;
}

.cell.conflict {
  background: #fee2e2;
  color: var(--danger);
}

.cell.related {
  background: #e0f2fe;
}

.notes {
  font-size: 10px;
  color: var(--muted);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  width: 100%;
  height: 100%;
  padding: 6px;
}

.notes span {
  text-align: center;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.control-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.control-row button {
  border: none;
  background: #e2e8f0;
  border-radius: 12px;
  padding: 10px;
  cursor: pointer;
  font-weight: 600;
}

.control-row .num {
  background: white;
  border: 1px solid #e2e8f0;
}

.control-row button.active {
  background: var(--primary);
  color: white;
}

.tips {
  margin-top: 20px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
}

.status {
  font-weight: 600;
  color: var(--secondary);
}

.stats ul {
  padding-left: 18px;
  color: var(--muted);
}

.strip {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  padding: 0 24px 32px;
}

.strip div {
  background: var(--surface);
  padding: 20px;
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.footer {
  text-align: center;
  padding: 24px;
  color: var(--muted);
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 1fr 2fr;
  }

  .side {
    grid-column: span 2;
  }
}

@media (max-width: 900px) {
  .nav {
    display: none;
  }

  .mobile-menu {
    display: inline-flex;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .game-body {
    grid-template-columns: 1fr;
  }

  .strip {
    grid-template-columns: 1fr;
  }

  .quick-actions {
    display: none;
  }
}

@media (max-width: 600px) {
  .game-header {
    flex-direction: column;
    gap: 12px;
  }

  .game-stats {
    flex-wrap: wrap;
  }
}
