/* ── SNEK — path puzzle game styles ── */

#canvas-wrap {
  background: #0f172a;
  align-items: stretch;
  overflow-y: auto;
  padding: 0;
}

.sn-hide { display: none !important; }

/* ── Shared screen wrapper ── */
.sn-screen {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100%;
}

/* ── Start screen ── */
#sn-start {
  justify-content: center;
  padding: 40px 24px 48px;
}

.sn-start-inner {
  width: 100%;
  max-width: 320px;
  text-align: center;
}

.sn-logo {
  display: flex;
  justify-content: center;
  margin: 0 0 16px;
}

.sn-logo svg {
  height: 52px;
  width: auto;
}

.sn-logo svg path {
  fill: #c084fc;
}

.sn-logo-win {
  margin: 0 0 8px;
}

.sn-logo-win svg {
  height: 44px;
}

.sn-sub {
  font-family: 'DM Sans', sans-serif;
  font-size: 1rem;
  color: rgba(148, 163, 184, 0.9);
  line-height: 1.6;
  margin: 0 0 36px;
}

.sn-start-btns {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── Game screen ── */
#sn-game {
  justify-content: flex-start;
  padding: 0 0 24px;
  position: relative;
}

/* ── HUD ── */
.sn-hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 12px 18px 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  color: #64748b;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ── Board wrap ── */
.sn-board-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  position: relative;
  width: 100%;
}

/* ── Grid ── */
.sn-board {
  display: grid;
  /* columns + gap set by JS */
}

/* ── Cells ── */
.sn-cell {
  border-radius: 6px;
  /* width/height set by JS */
  position: relative;
}

/* Empty shape cell (unvisited) */
.sn-cell-empty {
  background: #1e293b;
  border: 1.5px solid #334155;
}

/* Start cell marker (before any move) */
.sn-cell-start {
  background: #1e293b;
  border: 2px solid #4ade80;
}

.sn-cell-start::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 38%;
  height: 38%;
  background: #4ade80;
  border-radius: 50%;
}

/* Visited trail */
.sn-cell-trail {
  background: #166534;
  border: 1.5px solid #22c55e;
}

/* Current head */
.sn-cell-head {
  background: #22c55e;
  border: 2px solid #86efac;
}

.sn-cell-head::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 42%;
  height: 42%;
  background: #dcfce7;
  border-radius: 50%;
}

/* Non-shape cell — invisible placeholder to maintain grid layout */
.sn-cell-void {
  background: transparent;
  border: none;
  pointer-events: none;
}

/* ── Complete flash ── */
@keyframes sn-complete-flash {
  0%   { background: #166534; border-color: #22c55e; }
  40%  { background: #15803d; border-color: #4ade80; box-shadow: 0 0 0 2px #4ade80, 0 0 10px rgba(74,222,128,0.5); }
  100% { background: #166534; border-color: #22c55e; }
}

.sn-cell-flash {
  animation: sn-complete-flash 0.5s ease-out forwards;
}

/* ── Reveal button (inline in HUD) ── */
.sn-reveal-btn {
  background: transparent;
  border: 1px solid #334155;
  border-radius: 6px;
  color: #475569;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 10px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.1s, color 0.1s;
}

.sn-reveal-btn:hover  { border-color: #c084fc; color: #c084fc; }
.sn-reveal-btn:active { background: rgba(192,132,252,0.08); }
.sn-reveal-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* ── D-pad ── */
.sn-dpad {
  display: grid;
  grid-template-areas:
    ".    up   ."
    "left down right";
  grid-template-columns: 56px 56px 56px;
  grid-template-rows: 56px 56px;
  gap: 6px;
  margin: 12px auto 4px;
}

.sn-dir {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1e293b;
  border: 1.5px solid #334155;
  border-radius: 10px;
  color: #94a3b8;
  font-size: 1.1rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  touch-action: manipulation;
  transition: background 0.08s, transform 0.06s;
}

.sn-dir:active {
  background: #2d4a6e;
  transform: scale(0.92);
}

.sn-up    { grid-area: up; }
.sn-left  { grid-area: left; }
.sn-down  { grid-area: down; }
.sn-right { grid-area: right; }

/* ── Overlays (stuck + level-complete) — inside board-wrap ── */
.sn-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 20;
  border-radius: 4px;
}

.sn-overlay-label {
  font-family: 'DM Serif Display', serif;
  font-size: 2.6rem;
  color: #ef4444;
  margin: 0;
  animation: sn-pop 0.3s cubic-bezier(0.34,1.56,0.64,1);
}

.sn-overlay-big {
  font-family: 'DM Serif Display', serif;
  font-size: 2.4rem;
  color: #4ade80;
  margin: 0;
  text-align: center;
  animation: sn-pop 0.3s cubic-bezier(0.34,1.56,0.64,1);
}

.sn-overlay-count {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  color: #64748b;
  margin: 0;
}

@keyframes sn-pop {
  0%   { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1);   opacity: 1; }
}

/* ── Win screen ── */
#sn-win {
  justify-content: center;
  padding: 40px 24px 48px;
}

.sn-win-inner {
  width: 100%;
  max-width: 320px;
  text-align: center;
}

.sn-win-headline {
  font-family: 'DM Serif Display', serif;
  font-size: 2.8rem;
  color: #4ade80;
  margin: 0 0 12px;
}

.sn-win-sub {
  font-family: 'DM Sans', sans-serif;
  font-size: 1rem;
  color: rgba(148,163,184,0.9);
  margin: 0 0 36px;
  line-height: 1.6;
}

.sn-end-btns {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 280px;
  margin: 0 auto;
}

/* ── Buttons ── */
.sn-btn-primary {
  display: block;
  width: 100%;
  background: #16a34a;
  color: #fff;
  font-family: 'DM Sans', sans-serif;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 15px 0;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 4px 0 #14532d, 0 6px 16px rgba(0,0,0,0.45);
  transition: transform 0.07s, box-shadow 0.07s, background 0.1s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.sn-btn-primary:hover  { background: #22c55e; }
.sn-btn-primary:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #14532d, 0 2px 8px rgba(0,0,0,0.4);
}

.sn-btn-ghost {
  display: block;
  width: 100%;
  background: transparent;
  border: 1px solid #334155;
  color: #64748b;
  padding: 14px 0;
  border-radius: 12px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.03em;
  transition: border-color 0.12s, color 0.12s;
  -webkit-tap-highlight-color: transparent;
}

.sn-btn-ghost:hover  { border-color: #64748b; color: #94a3b8; }
.sn-btn-ghost:active { background: rgba(255,255,255,0.04); }
