:root {
  --bg: #302e2b;
  --sidebar: #262522;
  --panel: #262522;
  --panel-soft: #353330;
  --panel-dark: #1f1e1b;
  --text: #f7f6f1;
  --muted: #b9b6ae;
  --green: #81b64c;
  --green-dark: #6fa843;
  --light-square: #eeeed2;
  --dark-square: #769656;
  --amber-light: #f1dca4;
  --amber-dark: #9f6a25;
  --danger: #c94f3d;
  --radius: 6px;
  --font: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
}

button {
  font: inherit;
}

.hidden {
  display: none !important;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 218px;
  background: var(--sidebar);
  display: flex;
  flex-direction: column;
  padding: 22px 14px;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 24px;
}

.brand-piece {
  color: var(--green);
  font-size: 38px;
  line-height: 1;
}

.nav {
  display: grid;
  gap: 4px;
}

.nav-item,
.plain-row {
  min-height: 48px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: #d8d5cf;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  text-align: left;
  font-weight: 750;
  font-size: 18px;
  cursor: pointer;
}

.nav-item:hover,
.nav-item.active,
.plain-row:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.nav-flyout {
  position: absolute;
  left: 218px;
  top: 208px;
  width: 376px;
  max-height: calc(100vh - 250px);
  overflow: auto;
  padding: 14px 10px;
  background: #1d1c19;
  border-radius: 0 6px 6px 0;
  box-shadow: 16px 22px 42px rgba(0, 0, 0, 0.36);
  z-index: 20;
}

.flyout-item {
  width: 100%;
  min-height: 50px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #dedbd5;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 12px;
  text-align: left;
  font-size: 17px;
  cursor: pointer;
}

.flyout-item:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

.flyout-item span {
  width: 28px;
  text-align: center;
  font-size: 24px;
}

.sidebar-bottom {
  margin-top: auto;
  display: grid;
  gap: 10px;
}

.primary,
.secondary,
.panel-action,
.pill {
  border: 0;
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
}

.primary {
  background: linear-gradient(#8ac457, var(--green-dark));
  box-shadow: inset 0 -2px rgba(0, 0, 0, 0.18), 0 3px 10px rgba(0, 0, 0, 0.2);
  padding: 13px 18px;
}

.primary:hover {
  background: linear-gradient(#96cd63, #78b54a);
}

.secondary,
.panel-action,
.pill {
  background: linear-gradient(#3c3a37, #292826);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 12px 16px;
}

.secondary:hover,
.panel-action:hover,
.pill:hover {
  background: linear-gradient(#474541, #302f2c);
}

.wide {
  width: 100%;
}

.big {
  font-size: 22px;
  min-height: 60px;
}

.page {
  min-height: 100vh;
  margin-left: 218px;
  padding: 20px 32px;
}

.landing {
  display: grid;
  grid-template-columns: minmax(360px, 680px) minmax(320px, 560px);
  align-items: center;
  justify-content: center;
  gap: 88px;
}

.hero-copy h1 {
  max-width: 560px;
  margin: 0 0 24px;
  font-size: clamp(48px, 5vw, 70px);
  line-height: 1.08;
  letter-spacing: 0;
}

.hero-copy p {
  max-width: 480px;
  color: var(--text);
  font-size: 24px;
  line-height: 1.45;
  margin: 0 0 34px;
}

.hero-button {
  width: min(500px, 100%);
  min-height: 80px;
  font-size: 30px;
}

.board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  overflow: hidden;
  border-radius: 8px;
  user-select: none;
  touch-action: none;
}

.preview-board {
  width: min(680px, 42vw);
  aspect-ratio: 1;
}

.square {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.square.light {
  background: var(--light-square);
}

.square.dark {
  background: var(--dark-square);
}

.amber-board .square.light {
  background: var(--amber-light);
}

.amber-board .square.dark {
  background: var(--amber-dark);
}

.piece {
  width: 86%;
  height: 86%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  cursor: grab;
  touch-action: none;
  filter: drop-shadow(0 2px 1px rgba(0, 0, 0, 0.3));
}

.piece:active {
  cursor: grabbing;
}

.piece-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.selected::before,
.last-move::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.selected::before {
  background: rgba(255, 236, 88, 0.46);
}

.last-move::before {
  background: rgba(255, 236, 88, 0.36);
}

.move-dot {
  width: 28%;
  height: 28%;
  border-radius: 50%;
  background: rgba(20, 20, 20, 0.28);
  pointer-events: none;
}

.capture-ring {
  position: absolute;
  inset: 7%;
  border-radius: 50%;
  border: 5px solid rgba(20, 20, 20, 0.28);
  pointer-events: none;
}

.in-check::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(201, 79, 61, 0.8), rgba(201, 79, 61, 0) 72%);
  pointer-events: none;
}

.drag-source {
  opacity: 0.18;
}

.drag-ghost {
  position: fixed;
  z-index: 1000;
  width: clamp(42px, 9vmin, 86px);
  height: clamp(42px, 9vmin, 86px);
  pointer-events: none;
  filter: drop-shadow(0 12px 16px rgba(0, 0, 0, 0.45));
}

.home {
  padding-top: 20px;
}

.home-header {
  max-width: 1320px;
  margin: 0 auto 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.user-chip,
.streak {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 26px;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  display: grid;
  place-items: center;
  background: #e8e6df;
  color: #77736c;
}

.dashboard {
  max-width: 1320px;
  margin: 0 auto;
  background: rgba(0, 0, 0, 0.14);
  border-radius: var(--radius);
  padding: 16px;
  display: grid;
  grid-template-columns: 310px repeat(3, 1fr);
  gap: 14px;
}

.play-panel,
.feature-card,
.history-panel,
.daily-panel,
.game-panel {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 16px;
}

.play-panel h2,
.history-panel h2,
.daily-panel h2,
.game-panel h2 {
  margin: 0 0 16px;
  font-size: 24px;
}

.time-pills {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.pill.active {
  outline: 2px solid var(--green);
  background: #252421;
}

.panel-action {
  width: 100%;
  min-height: 62px;
  margin-top: 10px;
  font-size: 22px;
}

.feature-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.feature-card h3 {
  margin: 18px 0 18px;
  font-size: 20px;
}

.mini-board {
  width: 100%;
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  overflow: hidden;
  border-radius: 6px;
}

.home-lower {
  max-width: 1320px;
  margin: 26px auto 0;
  display: grid;
  grid-template-columns: 1fr 376px;
  gap: 28px;
}

.empty-history {
  min-height: 260px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  color: var(--muted);
  text-align: center;
}

.empty-history span {
  font-size: 48px;
}

.empty-history strong {
  color: var(--text);
  font-size: 22px;
}

.empty-history p {
  margin: 0 0 14px;
  font-size: 18px;
}

.daily-board {
  width: 100%;
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  overflow: hidden;
}

.section-layout {
  max-width: 1460px;
  min-height: calc(100vh - 40px);
  display: grid;
  grid-template-columns: minmax(480px, 820px) minmax(360px, 520px);
  align-items: center;
  gap: 38px;
}

.section-board-wrap {
  display: grid;
  gap: 10px;
}

.section-board {
  width: min(70vh, 820px, calc(100vw - 800px));
  min-width: 480px;
  aspect-ratio: 1;
}

.player-label {
  width: min(70vh, 820px, calc(100vw - 800px));
  min-width: 480px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  font-size: 18px;
}

.avatar.small {
  width: 44px;
  height: 44px;
  font-size: 26px;
}

.section-panel {
  max-height: calc(100vh - 72px);
  overflow: auto;
  background: var(--panel-dark);
  border-radius: 6px;
}

.section-panel-header {
  position: sticky;
  top: 0;
  z-index: 1;
  min-height: 90px;
  background: #201f1c;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 16px;
}

.section-icon {
  font-size: 42px;
}

.section-panel h1 {
  margin: 0;
  font-size: 40px;
  letter-spacing: 0;
}

.section-cards {
  display: grid;
  gap: 10px;
  padding: 28px;
}

.section-card {
  min-height: 126px;
  display: grid;
  grid-template-columns: 78px 1fr;
  align-items: center;
  gap: 20px;
  padding: 18px 22px;
  border-radius: 8px;
  background: linear-gradient(#3a3835, #302f2c);
  border: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 -2px rgba(0, 0, 0, 0.18);
}

.section-card-art {
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  font-size: 42px;
}

.section-card h2 {
  margin: 0 0 6px;
  font-size: 27px;
  line-height: 1.12;
}

.section-card p {
  margin: 0 0 14px;
  color: #d8d5cf;
  font-size: 17px;
  line-height: 1.35;
}

.section-action {
  min-width: 132px;
  padding: 9px 14px;
}

.game-layout {
  max-width: 1180px;
  margin: 0 auto;
  min-height: calc(100vh - 40px);
  display: grid;
  grid-template-columns: minmax(420px, 690px) 360px;
  align-items: center;
  gap: 40px;
}

.board-column {
  display: grid;
  gap: 10px;
}

.game-board {
  width: min(72vh, 690px, calc(100vw - 680px));
  min-width: 420px;
  aspect-ratio: 1;
}

.player-row {
  width: min(72vh, 690px, calc(100vw - 680px));
  min-width: 420px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 18px;
  font-weight: 750;
}

.player-row strong {
  min-width: 90px;
  padding: 8px 12px;
  border-radius: var(--radius);
  background: #11100f;
  text-align: center;
  font-size: 24px;
}

.control-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.game-panel h3 {
  margin: 22px 0 10px;
}

.move-log {
  min-height: 220px;
  max-height: 320px;
  overflow: auto;
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 16px;
}

.overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.62);
  z-index: 40;
}

.modal {
  background: var(--panel-dark);
  padding: 24px;
  border-radius: 10px;
  text-align: center;
}

.promo-options {
  display: flex;
  gap: 10px;
}

.promo-cell {
  width: 72px;
  height: 72px;
  border: 0;
  border-radius: 8px;
  background: var(--light-square);
  cursor: pointer;
}

@media (max-width: 1100px) {
  .sidebar {
    width: 76px;
    align-items: center;
  }

  .brand span:last-child,
  .nav-item span,
  .plain-row span,
  .sidebar-bottom .primary,
  .sidebar-bottom .secondary {
    display: none;
  }

  .page {
    margin-left: 76px;
  }

  .landing,
  .dashboard,
  .home-lower,
  .section-layout,
  .game-layout {
    grid-template-columns: 1fr;
  }

  .preview-board,
  .section-board,
  .player-label,
  .game-board,
  .player-row {
    width: min(88vw, 660px);
    min-width: 0;
  }

  .nav-flyout {
    left: 76px;
    top: 96px;
  }
}

@media (max-width: 720px) {
  .sidebar {
    inset: auto 0 0 0;
    width: auto;
    height: 66px;
    flex-direction: row;
    padding: 8px 10px;
  }

  .brand,
  .sidebar-bottom,
  .nav-item:nth-child(n+5) {
    display: none;
  }

  .nav {
    width: 100%;
    display: flex;
    justify-content: space-around;
  }

  .nav-item {
    width: 52px;
    justify-content: center;
  }

  .page {
    margin-left: 0;
    padding: 18px 12px 84px;
  }

  .landing {
    gap: 28px;
  }

  .hero-copy h1 {
    font-size: 42px;
  }

  .hero-copy p {
    font-size: 18px;
  }

  .dashboard {
    padding: 0;
    background: transparent;
  }

  .nav-flyout {
    display: none !important;
  }

  .section-cards {
    padding: 14px;
  }

  .section-card {
    grid-template-columns: 54px 1fr;
    padding: 14px;
  }

  .section-card-art {
    width: 48px;
    height: 48px;
    font-size: 30px;
  }

  .section-card h2 {
    font-size: 22px;
  }
}
