body[data-page="playground"] {
  --playground-bg: var(--bg, #fff);
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: grid;
  grid-template-rows: 84px minmax(0, 1fr);
  background: var(--playground-bg);
}

@media (min-width: 1440px) {
  body[data-page="playground"] {
    width: calc(100dvw / var(--desktop-zoom));
    height: calc(100dvh / var(--desktop-zoom));
  }
}

body[data-page="playground"] > .nav {
  position: relative;
  inset: auto;
  z-index: 100;
  width: 100%;
  height: 84px;
  padding: 0 16px;
}

.playground-stage {
  width: 100%;
  min-width: 0;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  position: relative;
  background: var(--playground-bg);
  font-family: "Albert Sans", sans-serif;
}

.playground-frame {
  display: block;
  width: 100%;
  min-width: 0;
  height: 100%;
  border: 0;
  background: var(--playground-bg);
}

.canvas-container {
  width: 100%;
  height: 100%;
  overflow: hidden;
  cursor: grab;
  position: relative;
  touch-action: none;
}

.canvas-container:active { cursor: grabbing; }

.playground-canvas {
  position: absolute;
  top: 0;
  left: 0;
  max-width: none;
  will-change: transform;
}

.playground-tile {
  contain: layout style paint;
}

.archive-card {
  position: absolute;
  color: inherit;
  display: flex;
  flex-direction: column;
  cursor: zoom-in;
  transition: transform .3s cubic-bezier(.68, 0, .31, .91);
}

.archive-card:hover { transform: scale(1.03); z-index: 20; }
.archive-card:hover .card-image img { transform: scale(1.05); }
.archive-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 6px;
  border-radius: 6px;
}

.card-image {
  border-radius: 6px;
  overflow: hidden;
  width: 100%;
}

.card-image img {
  width: 100%;
  height: auto;
  max-width: none;
  display: block;
  object-fit: cover;
  border-radius: 6px;
  opacity: 0;
  transition: transform .5s cubic-bezier(.68, 0, .31, .91), opacity .25s ease;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.card-image img.is-loaded { opacity: 1; }

.drag-indicator {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink, #171717);
  pointer-events: none;
  user-select: none;
}

.drag-indicator-icon { width: 16px; height: 16px; flex: none; }
.drag-indicator span {
  font-family: "Inter", sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  line-height: 1;
  white-space: nowrap;
}

.image-viewer {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: clamp(28px, 6vw, 90px);
  background: rgba(251, 251, 251, .9);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  cursor: zoom-out;
}

.image-viewer[hidden] { display: none; }
.image-viewer img {
  display: block;
  width: auto;
  height: auto;
  max-width: min(86vw, 1500px);
  max-height: 82vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0, 20, 80, .16);
  cursor: default;
}

@media (min-width: 1440px) {
  .image-viewer img {
    max-width: min(calc(86dvw / var(--desktop-zoom)), 1500px, calc(100dvw / var(--desktop-zoom) - 2 * clamp(28px, 6vw, 90px)));
    max-height: min(calc(82dvh / var(--desktop-zoom)), calc(100dvh / var(--desktop-zoom) - 2 * clamp(28px, 6vw, 90px)));
  }
}

.image-viewer-close {
  position: fixed;
  top: 22px;
  right: 24px;
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  display: grid;
  place-items: center;
  cursor: pointer;
  outline: none;
  transition: background .3s var(--ease), color .3s var(--ease), transform .5s var(--spring);
}

.image-viewer-close svg { width: 20px; height: 20px; display: block; }

.image-viewer-prototype {
  position: fixed;
  right: 24px;
  bottom: 22px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  padding: 3px 3px 3px 16px;
  border-radius: 100px;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 12px 32px rgba(0, 20, 80, .2);
  font-family: "Manrope", sans-serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -.01em;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: transform .35s var(--ease2), background .25s var(--ease);
}

.image-viewer-prototype[hidden] { display: none; }
.image-viewer-prototype-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fff;
  color: var(--ink);
}
.image-viewer-prototype-icon svg { width: 14px; height: 14px; display: block; }
.image-viewer-prototype:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

@media (hover:hover) {
  .image-viewer-close:hover {
    background: var(--accent);
    color: #fff;
    transform: translate(3px, -3px);
  }
  .image-viewer-prototype:hover { transform: translateY(-2px); }
}

@media (max-width: 809.98px) {
  body[data-page="playground"] { grid-template-rows: 72px minmax(0, 1fr); }
  body[data-page="playground"] > .nav { top: auto; height: 72px; padding: 0 10px; }
}

@media (max-width: 600px) {
  body[data-page="playground"] > .nav {
    align-items: flex-start;
    padding-top: 8px;
  }
  .drag-indicator { bottom: 20px; gap: 6px; }
  .drag-indicator-icon { width: 14px; height: 14px; }
  .drag-indicator span { font-size: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  .archive-card, .card-image img { transition: none; }
}
