/* ============================================================
   Online Mosaic — style.css (visualizer + enter shared vars)
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg1:      #0a0a0f;
  --bg2:      #111118;
  --btn1:     #4a90d9;
  --btn2:     #357abd;
  --btn-text: #ffffff;
  --accent:   #4a90d9;
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: linear-gradient(135deg, var(--bg1), var(--bg2));
  font-family: system-ui, -apple-system, sans-serif;
  color: #e4e4e8;
}

/* ── Layout ─────────────────────────────────────────────── */
#app {
  display: flex;
  width: 100%; height: 100%;
  overflow: hidden;
}

/* ── Wall viewport (main area) ──────────────────────────── */
#wall-viewport {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}
#wall-viewport:active { cursor: grabbing; }

/* ── Wall container (transform target) ──────────────────── */
#wall-container {
  position: relative;
  transform-origin: center center;
  will-change: transform;
  flex-shrink: 0;
}

/* ── Grid (all cells inside) ────────────────────────────── */
#wall-grid { display: block; }

.grid-cell { transition: none; }

.grid-cell.has-photo {
  cursor: pointer;
  transition: filter 0.2s ease;
}
.grid-cell.has-photo:hover {
  filter: brightness(1.1);
  outline: 2px solid rgba(150, 200, 255, 0.5);
  z-index: 2;
}
.grid-cell.wall-highlight {
  filter: brightness(1.15);
  outline: 2px solid rgba(150, 200, 255, 0.8);
  z-index: 3;
}

/* ── Master image overlay ───────────────────────────────── */
#master-overlay {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  pointer-events: none;
  display: none;
  z-index: 2;
}

/* ── Fly-in layer ───────────────────────────────────────── */
#fly-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 500;
}

/* ── Sidebar ────────────────────────────────────────────── */
#sidebar {
  width: 120px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 8px;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(8px);
  overflow-y: auto;
  z-index: 10;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}
#sidebar::-webkit-scrollbar { width: 4px; }
#sidebar::-webkit-scrollbar-track { background: transparent; }
#sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 2px; }

.sidebar-photo {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
  cursor: pointer;
  transition: filter 0.2s ease;
}
.sidebar-photo:hover {
  filter: brightness(1.2);
  outline: 2px solid rgba(150, 200, 255, 0.5);
}

.sidebar-photo.slide-in {
  animation: slideIn 0.5s cubic-bezier(0.34,1.56,0.64,1) both;
}

@keyframes slideIn {
  from { transform: translateY(-40px) scale(0.8); opacity: 0; }
  to   { transform: translateY(0)     scale(1);   opacity: 1; }
}

/* ── Counter ────────────────────────────────────────────── */
#counter-wrap {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(8px);
  border-radius: 20px;
  padding: 6px 16px;
  font-size: 14px;
  color: rgba(255,255,255,0.75);
  pointer-events: none;
}
#photo-counter {
  font-weight: 700;
  font-size: 16px;
  color: var(--accent, #4a90d9);
}

/* ── Zoom hint ──────────────────────────────────────────── */
#zoom-hint {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(6px);
  border-radius: 16px;
  padding: 5px 14px;
  font-size: 12px;
  color: rgba(255,255,255,0.6);
  pointer-events: none;
  transition: opacity 1.2s ease;
}

/* ── Fit button ─────────────────────────────────────────── */
#fitBtn {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 20;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 6px 12px;
  color: rgba(255,255,255,0.75);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s;
}
#fitBtn:hover { background: rgba(255,255,255,0.1); }

/* ── QR panel (bottom-left, links to enter page) ────────── */
#qr-panel {
  position: absolute;
  bottom: 14px;
  left: 14px;
  z-index: 20;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  border-radius: 12px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  pointer-events: none;
}
#qr-panel img,
#qr-panel canvas {
  border-radius: 6px;
  display: block;
  background: #ffffff;
}
.qr-label {
  font-size: 10px;
  color: rgba(255,255,255,0.65);
  text-align: center;
  letter-spacing: 0.3px;
}

/* ── Winner overlay ──────────────────────────────────────── */
#winner-overlay {
  position: fixed;
  inset: 0;
  z-index: 1500;
  background: rgba(255,255,255,0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: winnerFadeIn 0.35s ease forwards;
  cursor: pointer;
}
@keyframes winnerFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
#winner-overlay-card {
  background: #fff;
  border: 2px solid rgba(245,197,24,0.5);
  border-radius: 28px;
  padding: 40px 60px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  animation: winnerPop 0.5s cubic-bezier(0.34,1.56,0.64,1) forwards;
  max-width: 420px;
  width: 90vw;
}
@keyframes winnerPop {
  from { transform: scale(0.5) translateY(40px); opacity: 0; }
  to   { transform: scale(1)   translateY(0);    opacity: 1; }
}
.winner-ov-photo {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 50%;
  border: 4px solid #f5c518;
  display: block;
  margin: 0 auto 12px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.18);
  animation: winnerBounce 0.7s cubic-bezier(0.34,1.56,0.64,1) 0.25s both;
  will-change: transform;
}
@keyframes winnerBounce {
  0%   { transform: scale(0) rotate(-20deg); }
  60%  { transform: scale(1.15) rotate(8deg); }
  100% { transform: scale(1) rotate(0deg); }
}
.winner-ov-title  { font-size:28px; font-weight:800; color:#b8860b; margin-bottom:12px; }
.winner-ov-name   { font-size:22px; font-weight:700; color:#1a1a2e; margin-bottom:6px;  }
.winner-ov-prize  { font-size:16px; color:#555; margin-bottom:8px; }
.winner-ov-img    { width:80px; height:80px; object-fit:cover; border-radius:12px; margin:8px auto 0; display:block; box-shadow:0 4px 12px rgba(0,0,0,0.15); }
.winner-ov-dismiss{ margin-top:18px; font-size:12px; color:rgba(0,0,0,0.35); }

/* ── Lightbox ────────────────────────────────────────────── */
#lightbox-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: transparent;
  display: none;
  cursor: pointer;
}
#lightbox-backdrop.active {
  display: block;
  background: rgba(0, 0, 0, 0.85);
  animation: lbFadeIn 0.35s ease forwards;
}
@keyframes lbFadeIn {
  from { background: transparent; }
  to   { background: rgba(0, 0, 0, 0.85); }
}
#lightbox-photo {
  position: fixed;
  z-index: 2001;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.9);
  pointer-events: none;
  display: none;
}
#lightbox-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
