/* ── PLAY PAGE ── */
body { overflow-x: hidden; }

/* ── NO IMAGE STATE ── */
.no-image {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: 16px;
  padding: 40px 24px;
  text-align: center;
}
.no-image h2 { font-family: 'Caveat', cursive; font-size: 2.4rem; color: var(--ink); }
.no-image p { color: var(--soft-ink); max-width: 400px; }

/* ── GAME LAYOUT ── */
.game-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: calc(100vh - 60px);
  max-width: 1100px;
  margin: 0 auto;
  gap: 0;
}

/* ── SIDEBAR ── */
.sidebar {
  border-right: 1px solid rgba(22,33,62,0.08);
  padding: 24px 16px;
  overflow-y: auto;
}
.sidebar-header {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--soft-ink);
  margin-bottom: 10px;
}

/* ── Category Buttons ── */
.category-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.category-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1.5px solid rgba(22,33,62,0.1);
  border-radius: 10px;
  background: white;
  cursor: pointer;
  font-family: 'Nunito', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--soft-ink);
  transition: all 0.15s;
  text-align: left;
}
.category-btn:hover { border-color: var(--coral); color: var(--coral); }
.category-btn.active { border-color: var(--coral); background: rgba(255,107,107,0.06); color: var(--coral); }
.cat-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.cat-dot-animals { background: #A8D5BA; }
.cat-dot-food   { background: #FFD166; }
.cat-dot-nature { background: #6EC6A0; }
.cat-dot-holidays { background: #FF8FA3; }

/* ── Image List ── */
.image-list { display: flex; flex-direction: column; gap: 4px; max-height: 60vh; overflow-y: auto; }
.image-list-loading { font-size: 0.8rem; color: var(--soft-ink); padding: 8px; }
.image-thumb {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
  text-decoration: none;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 600;
}
.image-thumb:hover { background: var(--cream); }
.image-thumb.active { background: rgba(255,107,107,0.08); }
.thumb-preview {
  width: 36px; height: 36px;
  border-radius: 6px;
  flex-shrink: 0;
  overflow: hidden;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(6, 1fr);
  background: white;
  border: 1px solid rgba(22,33,62,0.1);
}
.thumb-cell { width: 100%; height: 100%; }

/* ── CANVAS AREA ── */
.canvas-area {
  padding: 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.canvas-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.canvas-meta {}
.canvas-category {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--coral);
}
.canvas-title {
  font-family: 'Caveat', cursive;
  font-size: 2rem;
  color: var(--ink);
  line-height: 1.1;
}
.canvas-stats { display: flex; gap: 12px; }
.stat-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--soft-ink);
  background: white;
  border: 1px solid rgba(22,33,62,0.1);
  border-radius: 8px;
  padding: 6px 12px;
}

/* ── PIXEL GRID ── */
.pixel-canvas-wrap {
  display: flex;
  justify-content: center;
}
.pixel-canvas {
  display: grid;
  grid-template-columns: repeat(32, 1fr);
  grid-template-rows: repeat(32, 1fr);
  gap: 1px;
  background: rgba(22,33,62,0.12);
  border-radius: 8px;
  padding: 1px;
  width: min(560px, 100%);
  aspect-ratio: 1;
  box-shadow: 0 4px 24px rgba(22,33,62,0.12);
}
.pixel-canvas .cell {
  width: 100%;
  aspect-ratio: 1;
  background: white;
  cursor: crosshair;
  border-radius: 1px;
  transition: background 0.1s;
}
.pixel-canvas .cell:hover { filter: brightness(0.9); }
.pixel-canvas .cell.filled { }

/* ── PALETTE ── */
.palette-section { display: flex; flex-direction: column; gap: 10px; }
.palette-label { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--soft-ink); }
.palette {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.palette-color {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 2.5px solid transparent;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}
.palette-color:hover { transform: scale(1.12); }
.palette-color.selected {
  border-color: var(--ink);
  transform: scale(1.15);
  box-shadow: 0 0 0 2px white, 0 0 0 4px var(--ink);
}
.palette-color.eraser {
  background: white;
  border: 1.5px dashed rgba(22,33,62,0.3);
  color: var(--soft-ink);
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.palette-divider { width: 1px; height: 30px; background: rgba(22,33,62,0.1); margin: 0 4px; }

/* ── REFERENCE ── */
.reference-section { display: flex; flex-direction: column; gap: 8px; }
.reference-toggle {
  background: none;
  border: 1.5px solid rgba(22,33,62,0.15);
  border-radius: 8px;
  padding: 7px 16px;
  font-family: 'Nunito', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--soft-ink);
  cursor: pointer;
  width: fit-content;
  transition: all 0.15s;
}
.reference-toggle:hover { border-color: var(--coral); color: var(--coral); }
.reference-wrap {}
.reference-img {
  max-width: 200px;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(22,33,62,0.12);
  border: 1px solid rgba(22,33,62,0.08);
}

/* ── RESPONSIVE ── */
@media (max-width: 700px) {
  .game-layout { grid-template-columns: 1fr; }
  .sidebar { border-right: none; border-bottom: 1px solid rgba(22,33,62,0.08); padding: 16px; }
  .category-list { flex-direction: row; overflow-x: auto; }
  .category-btn { flex-shrink: 0; }
  .image-list { flex-direction: row; overflow-x: auto; max-height: none; }
  .canvas-area { padding: 16px; }
  .pixel-canvas { width: 100%; }
}

/* ── UPGRADE PILL ── */
.upgrade-pill {
  margin-left: 12px;
  padding: 6px 14px;
  border: none;
  border-radius: 999px;
  background: var(--coral);
  color: #fff;
  font-family: 'Nunito', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: transform 0.12s, box-shadow 0.12s;
}
.upgrade-pill:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(255,107,107,0.32); }

/* ── PAYWALL MODAL ── */
.paywall-modal {
  position: fixed;
  inset: 0;
  background: rgba(22, 33, 62, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}
.paywall-modal[hidden] { display: none; }
.paywall-modal-card {
  background: #fff;
  border-radius: 16px;
  padding: 32px 28px;
  max-width: 360px;
  width: 100%;
  box-shadow: 0 24px 64px rgba(22, 33, 62, 0.32);
  text-align: center;
  position: relative;
}
.paywall-modal-close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--soft-ink);
  cursor: pointer;
  line-height: 1;
}
.paywall-modal-title {
  font-family: 'Caveat', cursive;
  font-size: 2.2rem;
  color: var(--ink);
  margin-bottom: 8px;
}
.paywall-modal-body {
  font-size: 0.95rem;
  color: var(--soft-ink);
  margin-bottom: 24px;
  line-height: 1.5;
}
.paywall-cta {
  display: inline-block;
  padding: 14px 32px;
  background: var(--coral);
  color: #fff;
  border-radius: 8px;
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  transition: transform 0.12s;
}
.paywall-cta:hover { transform: translateY(-1px); }