/* ═══════════════════════════════════════════════════════
   where nothing happens  —  Presentation Layer Styles
   Interface 1 (Puzzle Grid) + Interface 2 (Full Viewer)
   ═══════════════════════════════════════════════════════ */

/* ---- base ---- */
html, body {
  height: 100%;
  overflow: hidden;
}

/* ---- interface containers ---- */
.interface {
  position: fixed;
  inset: 0;
  display: flex;
  transition: opacity 0.4s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.interface.hidden {
  opacity: 0;
  transform: scale(0.97);
  pointer-events: none;
}

.interface.visible {
  opacity: 1;
  transform: scale(1);
  pointer-events: all;
}

/* ---- panels ---- */
.left-panel {
  width: 33.333%;
  height: 100%;
  position: relative;
  overflow: hidden;
  background: var(--bg-deep);
  flex-shrink: 0;
}

.left-panel::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 1px;
  height: 100%;
  background: linear-gradient(to bottom, transparent, rgba(255,255,255,0.08), transparent);
}

.right-panel {
  width: 66.667%;
  height: 100%;
  position: relative;
  overflow: hidden;
  background: var(--bg-deep);
}

/* noise texture overlay on right panel */
.right-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  opacity: 0.5;
  pointer-events: none;
  z-index: 0;
}

/* ---- poster image ---- */
.poster-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1.2s ease-in-out;
}

.poster-img.poster-active {
  opacity: 1;
}

.poster-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(6,6,15,0.4), transparent 40%);
  pointer-events: none;
  z-index: 2;
}

/* poster crossfade */
.poster-img.fade-enter {
  animation: posterFadeIn 0.6s ease forwards;
}

@keyframes posterFadeIn {
  from { opacity: 0; transform: scale(1.03); }
  to   { opacity: 1; transform: scale(1); }
}

/* poster gradient fallback */
.poster-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a1a3e, #0a0a1a);
  font-family: 'Syne', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: rgba(255,255,255,0.15);
  text-transform: uppercase;
  letter-spacing: 4px;
}

/* ═══════════════════════════════════════════════════════
   INTERFACE 1 — PUZZLE GRID
   ═══════════════════════════════════════════════════════ */

.puzzle-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(6, 1fr);
  gap: 10px;
  padding: 16px;
  width: 100%;
  height: 100%;
  position: relative;
  z-index: 1;
}

/* ---- empty slot ---- */
.grid-empty {
  /* invisible space */
}

/* ---- puzzle tile ---- */
.puzzle-tile {
  border-radius: 18px;
  overflow: hidden;
  position: relative;
  cursor: grab;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  transition: box-shadow 0.35s ease, border-color 0.35s ease, transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
  animation: slideUp 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: var(--entry-delay, 0ms);
  user-select: none;
}

.puzzle-tile:active {
  cursor: grabbing;
  transform: scale(1.04);
  box-shadow: 0 8px 40px rgba(0,0,0,0.5), 0 0 20px rgba(120,160,255,0.15);
  z-index: 20;
}

.puzzle-tile::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 18px;
  background: radial-gradient(circle at 50% 50%, rgba(79,140,255,0.06), transparent 70%);
  opacity: 0;
  transition: opacity 0.35s;
  pointer-events: none;
}

.puzzle-tile:hover::before {
  opacity: 1;
}

.puzzle-tile:hover {
  box-shadow: 0 0 30px rgba(120,160,255,0.2),
              0 8px 32px rgba(0,0,0,0.4);
  border-color: rgba(255,255,255,0.2);
  z-index: 10;
}

/* ---- tile thumbnail ---- */
.tile-thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.88;
  transition: opacity 0.3s;
  pointer-events: none;
}

.puzzle-tile:hover .tile-thumb {
  opacity: 1;
}

/* ---- tile initials placeholder ---- */
.tile-initials {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  inset: 0;
  font-family: 'Syne', sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: rgba(255,255,255,0.12);
  letter-spacing: 2px;
  pointer-events: none;
}

/* ---- tile label ---- */
.tile-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 24px 10px 10px;
  background: linear-gradient(to top, rgba(0,0,0,0.85), transparent);
  font-family: 'ChangaOne', sans-serif;
  font-size: 10px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: rgba(255,255,255,0.9);
  z-index: 3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

/* ---- rating badge ---- */
.rating-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 3px 7px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
  pointer-events: none;
  z-index: 5;
  transition: all 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.rating-badge.new-badge {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.25);
  font-size: 9px;
  letter-spacing: 1px;
}

.rating-badge.rated-badge {
  background: rgba(245,158,11,0.12);
  border: 1px solid rgba(245,158,11,0.2);
  color: #f59e0b;
}

.badge-star {
  font-size: 9px;
}

.badge-count {
  color: rgba(255,255,255,0.35);
  font-weight: 400;
  font-size: 9px;
}

/* badge update animation */
.rating-badge.badge-pop {
  animation: badgePop 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes badgePop {
  0%   { opacity: 0; transform: scale(0.6) translateY(-4px); }
  60%  { transform: scale(1.15) translateY(0); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

/* ---- rocks ---- */
.puzzle-rock {
  border-radius: 16px;
  background:
    radial-gradient(ellipse at 30% 30%, #3a3535, #1a1818);
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.6);
  position: relative;
  overflow: hidden;
}

.rock-texture {
  position: absolute;
  inset: 0;
  background: repeating-conic-gradient(rgba(255,255,255,0.015) 0%, transparent 0.5%);
  border-radius: inherit;
}

/* ---- snake overlay ---- */
.snake-overlay {
  position: relative;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  animation: snakeAppear 0.8s ease-out forwards;
}

.snake-svg {
  width: 60%;
  height: 60%;
  filter: drop-shadow(0 0 8px rgba(255,140,0,0.3));
  animation: snakeWiggle 0.6s ease-in-out 2;
}

@keyframes snakeAppear {
  0%   { opacity: 0; transform: scale(0.3) rotate(-15deg); }
  60%  { opacity: 1; transform: scale(1.1) rotate(5deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

@keyframes snakeWiggle {
  0%, 100% { transform: rotate(0deg); }
  25%      { transform: rotate(8deg); }
  75%      { transform: rotate(-8deg); }
}

/* ---- snake sleeping dot ---- */
.snake-dot {
  position: absolute;
  bottom: 8px;
  left: 8px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #f59e0b;
  z-index: 4;
  animation: snakePulse 2.5s ease-in-out infinite;
  pointer-events: none;
}

@keyframes snakePulse {
  0%, 100% { opacity: 0.2; transform: scale(0.8); }
  50%      { opacity: 0.7; transform: scale(1.1); }
}

/* ---- stubborn tile hint ---- */
.stubborn-hint {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 10px;
  color: rgba(255,255,255,0.08);
  pointer-events: none;
  z-index: 4;
  transition: color 0.2s, opacity 0.2s;
  opacity: 0;
}

.puzzle-tile:hover .stubborn-hint {
  opacity: 1;
  color: rgba(255,255,255,0.25);
}

/* ---- tile blocked (shake) ---- */
@keyframes tileShake {
  0%   { transform: translateX(0); }
  20%  { transform: translateX(-6px); }
  40%  { transform: translateX(6px); }
  60%  { transform: translateX(-4px); }
  80%  { transform: translateX(4px); }
  100% { transform: translateX(0); }
}

.tile-blocked {
  animation: tileShake 0.3s ease !important;
}

/* ---- entry animation ---- */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(24px) scale(0.94); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---- heatmap glow ---- */
.puzzle-tile.glow-cool    { box-shadow: 0 0 18px rgba(100,130,200,0.12); }
.puzzle-tile.glow-neutral { box-shadow: 0 0 18px rgba(255,255,255,0.1); }
.puzzle-tile.glow-warm    { box-shadow: 0 0 22px rgba(245,158,11,0.15); }
.puzzle-tile.glow-hot     { box-shadow: 0 0 30px rgba(245,158,11,0.3); border-color: rgba(245,158,11,0.2); }


/* ═══════════════════════════════════════════════════════
   INTERFACE 2 — FULL-WIDTH VIEWER
   ═══════════════════════════════════════════════════════ */

.full-iframe-panel {
  width: 100%;
  height: 100%;
  position: relative;
}

.site-frame-full {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  background: #fff;
}

/* ---- iframe fallback ---- */
.iframe-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  background: var(--bg-deep);
}

.fallback-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius-xl);
  padding: 50px;
  text-align: center;
  max-width: 400px;
  animation: fadeScaleIn 0.4s ease forwards;
}

.fallback-icon {
  font-size: 48px;
  margin-bottom: 20px;
}

.fallback-card h3 {
  font-family: 'Syne', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
}

.fallback-card p {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 24px;
  line-height: 1.6;
}

.fallback-open-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: var(--radius-full);
  padding: 12px 28px;
  color: white;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  border: none;
  transition: all 0.25s;
}

.fallback-open-btn:hover {
  transform: scale(1.04);
  box-shadow: 0 0 30px rgba(79,140,255,0.25);
}

/* ---- shimmer loader ---- */
.iframe-shimmer {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: var(--surface);
  overflow: hidden;
}

.iframe-shimmer::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.03), transparent);
  animation: shimmer 1.8s ease-in-out infinite;
}

@keyframes shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ---- open in new tab link ---- */
.new-tab-link {
  position: absolute;
  bottom: 16px;
  right: 20px;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-full);
  padding: 8px 16px;
  color: rgba(255,255,255,0.6);
  font-size: 11px;
  letter-spacing: 0.5px;
  transition: all 0.2s;
  text-decoration: none;
}

.new-tab-link:hover {
  color: white;
  background: rgba(0,0,0,0.7);
  border-color: rgba(255,255,255,0.2);
}

/* ---- floating info card ---- */
.info-card {
  position: absolute;
  bottom: 28px;
  left: 28px;
  width: 280px;
  background: rgba(8, 8, 18, 0.82);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow:
    0 8px 40px rgba(0,0,0,0.6),
    inset 0 1px 0 rgba(255,255,255,0.07);
  z-index: 100;
  animation: fadeScaleIn 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.info-designer {
  font-family: 'ChangaOne', sans-serif;
  font-size: 15px;
  font-weight: 400;
  color: rgba(255,255,255,0.9);
  letter-spacing: 0.5px;
}

.info-divider {
  height: 1px;
  background: rgba(255,255,255,0.08);
  margin: 2px 0;
}

.info-instructions {
  font-size: 12px;
  line-height: 1.65;
  color: rgba(255,255,255,0.45);
}

/* back button inside info card */
.info-back-btn {
  position: static !important;
  transform: none !important;
  width: 100%;
  justify-content: center;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-full);
  padding: 10px 20px;
  color: white;
  font-size: 13px;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.25s ease;
}

.info-back-btn:hover {
  background: rgba(255,255,255,0.14);
  transform: none !important;
  box-shadow: 0 0 20px rgba(255,255,255,0.08);
}

.info-back-btn:active {
  transform: none !important;
  opacity: 0.8;
}

.info-back-btn svg {
  width: 14px;
  height: 14px;
}


/* ═══════════════════════════════════════════════════════
   RATING MODAL
   ═══════════════════════════════════════════════════════ */

.rating-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 6, 15, 0.55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 150;
  animation: fadeIn 0.3s ease;
}

.rating-modal {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border-radius: var(--radius-xl);
  padding: 36px 40px;
  width: min(420px, 88%);
  box-shadow:
    0 0 60px rgba(0,0,0,0.5),
    0 0 120px rgba(245,158,11,0.04),
    inset 0 1px 0 rgba(255,255,255,0.08);
  animation: modalIn 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.rating-modal.modal-out {
  animation: modalOut 0.3s ease forwards;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(24px) scale(0.94); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes modalOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to   { opacity: 0; transform: translateY(16px) scale(0.96); }
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.modal-thumb {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
}

.modal-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: rgba(255,255,255,0.3);
  margin-bottom: 3px;
}

.modal-title {
  font-family: 'ChangaOne', sans-serif;
  font-size: 18px;
  font-weight: 400;
  color: #fff;
}

/* ---- stars ---- */
.star-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}

.star-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  transition: transform 0.18s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.star-btn:hover {
  transform: scale(1.3);
}

.star-btn:active {
  transform: scale(0.9);
}

.star-btn svg {
  width: 34px;
  height: 34px;
  transition: all 0.15s ease;
}

.star-hint {
  text-align: center;
  font-size: 13px;
  color: rgba(255,255,255,0.35);
  min-height: 20px;
  margin-bottom: 16px;
  transition: all 0.2s ease;
}

/* ---- skip button (MOD 01 — visible secondary button) ---- */
.skip-btn-visible {
  display: block;
  margin: 0 auto;
  margin-top: 8px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 999px;
  padding: 10px 24px;
  color: rgba(255,255,255,0.55);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
  max-width: 220px;
  font-family: 'DM Sans', sans-serif;
}

.skip-btn-visible:hover {
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.85);
  border-color: rgba(255,255,255,0.22);
}

/* ---- thank you state ---- */
.thank-you-state {
  text-align: center;
  padding: 16px 0;
  animation: fadeScaleIn 0.35s ease;
}

.thank-you-check {
  font-size: 48px;
  color: var(--amber);
  margin-bottom: 16px;
  display: block;
  animation: checkPop 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes checkPop {
  0%   { transform: scale(0) rotate(-30deg); opacity: 0; }
  70%  { transform: scale(1.2) rotate(5deg); }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.thank-you-text {
  font-family: 'Syne', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: white;
  margin-bottom: 16px;
}

.thank-you-stars {
  display: flex;
  justify-content: center;
  gap: 6px;
}

.thank-you-stars svg {
  width: 22px;
  height: 22px;
}

/* ---- general keyframes ---- */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes fadeScaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}

/* ---- responsive ---- */
@media (max-width: 768px) {
  .interface {
    flex-direction: column;
  }
  .left-panel {
    width: 100%;
    height: 35%;
  }
  .left-panel::after {
    width: 100%;
    height: 1px;
    top: auto;
    bottom: 0;
    right: auto;
    background: linear-gradient(to right, transparent, rgba(255,255,255,0.08), transparent);
  }
  .right-panel {
    width: 100%;
    height: 65%;
  }
  .puzzle-grid {
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: auto;
    gap: 8px;
    padding: 12px;
    overflow-y: auto;
  }
  .info-card {
    bottom: 12px;
    left: 12px;
    right: 12px;
    width: auto;
  }
}
