/* zone.css — Zone game styles */

/* ── Splash screen ────────────────────────────────────────────────────────── */

#zn-splash {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 24px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.zn-splash-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  max-width: 360px;
  width: 100%;
}

.zn-splash-logo {
  width: min(240px, 68vw);
  height: auto;
  filter: brightness(0) invert(1);
}

.zn-splash-dir {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.88rem;
  line-height: 1.65;
  color: rgba(241, 245, 249, 0.55);
  text-align: left;
}

#zn-splash-btns {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

#zn-splash-play {
  width: 100%;
  padding: 14px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: #FFD700;
  color: #0f172a;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 3px 0 #B8960A, 0 4px 8px rgba(0,0,0,0.5);
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.08s, box-shadow 0.08s;
}
#zn-splash-play:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #B8960A, 0 2px 4px rgba(0,0,0,0.5);
}

#zn-splash-continue {
  width: 100%;
  padding: 12px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 0.88rem;
  letter-spacing: 0.04em;
  background: transparent;
  color: rgba(241, 245, 249, 0.55);
  border: 1px solid rgba(241, 245, 249, 0.22);
  border-radius: 10px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.12s;
}
#zn-splash-continue:active { color: rgba(241,245,249,0.85); }

/* ── Game layout ── */
#zn-wrap {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 16px 32px;
  gap: 12px;
}

/* ── Directions overlay ───────────────────────────────────────────────────── */

#zn-directions-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  padding: 20px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.zn-dir-modal {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 32px 28px 28px;
  max-width: 380px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.zn-dir-logo {
  width: min(160px, 50vw);
  height: auto;
  filter: brightness(0) invert(1);
  align-self: center;
}

.zn-dir-heading {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #64748b;
  text-align: center;
}

.zn-dir-body {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.88rem;
  line-height: 1.65;
  color: rgba(241, 245, 249, 0.65);
}

.zn-dir-close {
  width: 100%;
  padding: 13px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  background: #FFD700;
  color: #0f172a;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.12s;
  margin-top: 4px;
}
.zn-dir-close:active { opacity: 0.8; }

/* ── Score bar ── */
#zn-score-bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  width: min(333px, calc(100vw - 32px));
}

#zn-score {
  font-family: 'DM Sans', sans-serif;
  font-size: 2.2rem;
  font-weight: 800;
  color: #f1f5f9;
  line-height: 1;
  letter-spacing: -0.02em;
}

#zn-best {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  color: #64748b;
}

/* ── Grid ── */
#zn-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 3px;                 /* zone-boundary gap — shows outer grid bg (#000) */
  background: #000;         /* zone boundary colour */
  border: 3px solid #000;  /* outer boundary */
  width: min(333px, calc(100vw - 32px));
  aspect-ratio: 1;
  box-sizing: border-box;
  touch-action: none;
  cursor: crosshair;
  flex-shrink: 0;
}

/* Each 3×3 zone */
.zn-zone {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 1px;           /* cell-line gap — shows zone bg (#CCC) */
  background: #CCCCCC; /* thin cell-line colour */
  min-width: 0;
  min-height: 0;
}

/* Individual cell */
.zn-cell {
  min-width: 0;
  min-height: 0;
  /* background set dynamically: zone tint (empty) or piece color (filled) */
}

/* ── Piece tray ── */
#zn-tray {
  display: flex;
  justify-content: space-around;
  align-items: center;
  width: min(333px, calc(100vw - 32px));
  padding: 10px 0;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  flex-shrink: 0;
}

.zn-slot {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 96px;
  height: 96px;
  border: 2px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  touch-action: none;
  transition: border-color 0.12s, background 0.12s, opacity 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.zn-slot:hover:not(.zn-placed) {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.18);
}

.zn-slot.zn-selected {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.6);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15);
}

.zn-slot.zn-placed {
  opacity: 0.22;
  cursor: default;
  pointer-events: none;
}

/* Mini piece grid inside a tray slot */
.zn-mini {
  display: grid;
  gap: 2px;
}

.zn-mini-cell {
  width: 16px;
  height: 16px;
  border-radius: 2px;
  background: transparent;
}

/* ── Ghost preview (applied via inline style + class) ── */
.zn-ghost-valid {
  /* colour set inline as rgba(r,g,b,0.5) */
}

.zn-ghost-invalid {
  /* colour set inline as rgba(220,50,50,0.4) */
}

/* ── Drag ghost (floating piece preview that follows the cursor) ── */
#zn-drag-ghost {
  position: fixed;
  pointer-events: none;
  z-index: 5000;
  display: none;
  transform: translate(-50%, -50%);
  opacity: 0.88;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.6));
}
#zn-drag-ghost.zn-drag-active { display: block; }
#zn-drag-ghost .zn-mini { gap: 3px; }
#zn-drag-ghost .zn-mini-cell {
  width: 22px;
  height: 22px;
  border-radius: 4px;
}

/* ── Zone clear animations ───────────────────────────────────────────────── */

/* Shockwave ring */
@keyframes shockwave {
  0%   { transform: scale(0.3); opacity: 1; border-width: 4px; }
  100% { transform: scale(3);   opacity: 0; border-width: 1px; }
}

.shockwave {
  position: fixed;
  border-radius: 50%;
  border: 4px solid #FFD700;
  pointer-events: none;
  z-index: 999;
  animation: shockwave 0.3s ease-out forwards;
}

/* Particle dots */
.explosion-particle {
  position: fixed;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 1000;
}

/* Combo indicator */
@keyframes combo-rise {
  0%   { transform: translate(-50%, 0);     opacity: 1; }
  70%  { transform: translate(-50%, -40px); opacity: 1; }
  100% { transform: translate(-50%, -60px); opacity: 0; }
}

.combo-indicator {
  font-family: 'DM Sans', sans-serif;
  font-size: 1.4rem;
  font-weight: 800;
  color: #FFD700;
  text-shadow: 0 0 15px rgba(255,215,0,0.7), 0 2px 4px rgba(0,0,0,0.9);
  white-space: nowrap;
  pointer-events: none;
  z-index: 1001;
  animation: combo-rise 0.8s ease-out forwards;
}

/* Mega bonus text */
@keyframes mega-rise {
  0%   { transform: translate(-50%, -50%);        opacity: 1; font-size: 1rem; }
  20%  { transform: translate(-50%, -50%) scale(1.3); opacity: 1; }
  100% { transform: translate(-50%, calc(-50% - 80px)); opacity: 0; }
}

.mega-bonus-text {
  font-family: 'DM Sans', sans-serif;
  font-size: 1.6rem;
  font-weight: 800;
  color: #FFD700;
  text-shadow: 0 0 24px rgba(255,215,0,0.9), 0 2px 8px rgba(0,0,0,0.9);
  white-space: nowrap;
  pointer-events: none;
  z-index: 1001;
  animation: mega-rise 1.1s ease-out forwards;
}

/* ── Overlays (start screen + game over) ──────────────────────────────────── */

.zn-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.zn-hidden { display: none !important; }

.zn-overlay-box {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 36px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  min-width: 260px;
  max-width: calc(100vw - 48px);
}

.zn-overlay-title {
  font-family: 'DM Sans', sans-serif;
  font-size: 2rem;
  font-weight: 800;
  color: #f1f5f9;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.zn-overlay-score {
  font-family: 'DM Sans', sans-serif;
  font-size: 3rem;
  font-weight: 800;
  color: #FFD700;
  line-height: 1;
}

.zn-overlay-best {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  color: #64748b;
  margin-bottom: 6px;
}

.zn-overlay-btn {
  font-family: 'DM Sans', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  border: none;
  border-radius: 12px;
  padding: 14px 24px;
  cursor: pointer;
  width: 100%;
  transition: opacity 0.12s;
  -webkit-tap-highlight-color: transparent;
}

.zn-overlay-btn:active { opacity: 0.75; }

.zn-btn-primary {
  background: #FFD700;
  color: #0f172a;
}

.zn-btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #f1f5f9;
}

/* Screen shake */
@keyframes screen-shake {
  0%,100% { transform: translate(0, 0); }
  20%     { transform: translate(-5px, 2px); }
  40%     { transform: translate(5px, -3px); }
  60%     { transform: translate(-4px, 3px); }
  80%     { transform: translate(4px, -1px); }
}

#zn-wrap.shaking {
  animation: screen-shake 0.22s ease-in-out;
}
