.workshop-page {
  min-height: 100vh;
  background: #1b1915;
}

.workshop-game {
  min-height: calc(100vh - 72px);
  overflow: visible;
  padding: 12px clamp(10px, 2vw, 24px);
  color: #171717;
  background:
    linear-gradient(120deg, rgba(23, 23, 23, 0.88), rgba(23, 23, 23, 0.38)),
    url("./assets/display-close-enhanced.jpg") center / cover fixed;
}

.workshop-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: min(1720px, calc(100vw - 32px));
  margin: 0 auto 12px;
  border: 1px solid rgba(255, 250, 240, 0.2);
  border-radius: 8px;
  padding: 10px 12px;
  color: #fffaf0;
  background: rgba(18, 17, 15, 0.72);
  backdrop-filter: blur(14px);
}

.workshop-hud div {
  display: grid;
  gap: 3px;
}

.workshop-hud span {
  color: rgba(255, 250, 240, 0.68);
  font-size: 12px;
}

.workshop-hud strong {
  font-size: clamp(15px, 2vw, 20px);
  line-height: 1.35;
}

.workshop-hud button,
.decision-panel button,
.sample-card,
.result-actions a {
  font: inherit;
}

.workshop-hud button {
  min-height: 38px;
  border: 1px solid rgba(255, 250, 240, 0.24);
  border-radius: 8px;
  padding: 0 14px;
  background: rgba(255, 250, 240, 0.1);
  color: #fffaf0;
  cursor: pointer;
}

.workshop-board {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 12px;
  max-width: min(1720px, calc(100vw - 32px));
  margin: 0 auto;
}

.sample-rail {
  display: grid;
  gap: 10px;
  align-content: start;
}

.sample-card {
  display: grid;
  gap: 8px;
  border: 1px solid rgba(255, 250, 240, 0.18);
  border-radius: 8px;
  padding: 7px;
  background: rgba(255, 252, 246, 0.9);
  color: #171717;
  text-align: left;
  cursor: pointer;
}

.sample-card.is-selected {
  border-color: #ffcf70;
  box-shadow: 0 0 0 2px rgba(255, 207, 112, 0.22);
}

.sample-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  object-fit: contain;
  object-position: center;
  background: #fffaf0;
  transition: transform 180ms ease, filter 180ms ease;
}

.sample-card:hover img,
.sample-card.is-selected img {
  filter: saturate(1.08) contrast(1.04);
  transform: scale(1.025);
}

.sample-card span {
  font-size: 12px;
  font-weight: 800;
}

.work-area {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.36fr);
  gap: 12px;
  min-height: calc(100vh - 132px);
}

.stage-frame,
.decision-panel {
  border: 1px solid rgba(255, 250, 240, 0.2);
  border-radius: 8px;
  background: rgba(246, 240, 230, 0.94);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
  overflow: hidden;
}

.stage-frame {
  display: grid;
  grid-template-columns: minmax(190px, 0.26fr) minmax(0, 0.74fr);
  min-height: min(780px, calc(100vh - 132px));
}

.source-panel {
  display: grid;
  align-content: center;
  gap: 12px;
  border-right: 1px solid rgba(23, 23, 23, 0.12);
  padding: clamp(14px, 1.6vw, 24px);
  background: #fffaf0;
}

.source-panel p {
  margin: 0;
  color: #70685d;
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.source-panel img {
  width: 100%;
  aspect-ratio: 1 / 1;
  max-height: min(360px, 42vh);
  border: 8px solid #171717;
  border-radius: 8px;
  object-fit: contain;
  background: #f8f0e3;
  box-shadow: 0 20px 42px rgba(0, 0, 0, 0.18);
}

.source-panel img.is-swapping {
  animation: sourcePop 360ms ease both;
}

.translation-preview {
  position: relative;
  min-height: min(780px, calc(100vh - 132px));
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(23, 23, 23, 0.05) 1px, transparent 1px),
    linear-gradient(0deg, rgba(23, 23, 23, 0.05) 1px, transparent 1px),
    #e4ddd0;
  background-size: 42px 42px;
}

.space-grid {
  position: absolute;
  inset: 4%;
  border: 1px solid rgba(23, 23, 23, 0.1);
  border-radius: 8px;
  transform: skewY(-8deg);
}

.assembled-layer,
.sample-object {
  position: absolute;
  left: 50%;
  top: 50%;
  display: grid;
  place-items: center;
  aspect-ratio: 2 / 3;
  border: 1px solid rgba(23, 23, 23, 0.16);
  border-radius: 8px;
  color: #171717;
  overflow: hidden;
  font-weight: 900;
  opacity: 0;
  transform: translate(-50%, -50%) translateY(22px) rotate(-4deg);
  transition: opacity 220ms ease, transform 260ms ease;
  box-shadow:
    0 18px 36px rgba(0, 0, 0, 0.22),
    inset 0 -10px 20px rgba(23, 23, 23, 0.12);
}

.assembled-layer::before,
.sample-object::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--workshop-sheet);
  background-size: 300% 200%;
  background-repeat: no-repeat;
  filter: saturate(1.05) contrast(1.02);
  transform: scale(1.02);
}

.translation-preview[data-sample="youth"] {
  --workshop-sheet: url("./assets/workshop-sheet-youth-v1-publish.webp");
}

.translation-preview[data-sample="artist"] {
  --workshop-sheet: url("./assets/workshop-sheet-artist-v1-publish.webp");
}

.translation-preview[data-sample="institution"] {
  --workshop-sheet: url("./assets/workshop-sheet-institution-v1-publish.webp");
}

.assembled-layer::after,
.sample-object::after {
  content: attr(data-label);
  position: absolute;
  left: 12px;
  bottom: 10px;
  border: 1px solid rgba(255, 250, 240, 0.34);
  border-radius: 999px;
  padding: 5px 9px;
  background: rgba(23, 23, 23, 0.58);
  color: #fffaf0;
  font-size: 12px;
  line-height: 1;
  backdrop-filter: blur(8px);
}

.assembled-layer.is-on {
  opacity: 1;
  transform: translate(-50%, -50%) translateY(0) rotate(-4deg);
  animation: layerLand 360ms cubic-bezier(0.2, 1.4, 0.38, 1) both;
}

.layer-bg {
  width: min(50%, 420px, 45vh);
  height: auto;
  background: #d8e3d6;
}

.layer-bg::before {
  background-position: 0 0;
}

.layer-body {
  width: min(44%, 360px, 39vh);
  height: auto;
  background: #f6ca6c;
  transform: translate(-50%, -50%) translate(18px, -8px) rotate(6deg);
}

.layer-body::before {
  background-position: 50% 0;
}

.layer-body.is-on {
  transform: translate(-50%, -50%) translate(18px, -8px) rotate(6deg);
}

.layer-detail {
  width: min(38%, 315px, 34vh);
  height: auto;
  background: #d7efe7;
  transform: translate(-50%, -50%) translate(-32px, -46px) rotate(-14deg);
}

.layer-detail::before {
  background-position: 100% 0;
}

.layer-detail.is-on {
  transform: translate(-50%, -50%) translate(-32px, -46px) rotate(-14deg);
}

.sample-object {
  top: 74%;
  width: min(38%, 330px, 28vh);
  height: auto;
  border-radius: 8px;
  background: #fffaf0;
  color: #fffaf0;
  z-index: 2;
}

.sample-object::before {
  background-size: 300% 200%;
  background-position: 0 100%;
}

.sample-object[data-output="keepsake"]::before {
  background-image: var(--workshop-sheet);
  background-position: 0 100%;
}

.sample-object[data-output="edition"]::before {
  background-image: var(--workshop-sheet);
  background-position: 50% 100%;
}

.sample-object[data-output="exhibition"]::before {
  background-image: var(--workshop-sheet);
  background-position: 100% 100%;
}

.sample-object.is-on {
  opacity: 1;
  transform: translate(-50%, -50%) translateY(0);
  animation: sampleReveal 520ms cubic-bezier(0.2, 1.1, 0.34, 1) both;
}


.celebration-layer {
  position: absolute;
  inset: 0;
  z-index: 4;
  overflow: hidden;
  pointer-events: none;
}

.confetti-piece {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--w);
  height: var(--h);
  border-radius: 2px;
  background: var(--c);
  opacity: 0;
  transform: translate(-50%, -50%) rotate(0deg);
  animation: confettiBurst 900ms cubic-bezier(0.16, 0.9, 0.34, 1) forwards;
}

.translation-preview::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle at 50% 48%, rgba(255, 207, 112, 0.34), transparent 34%);
}

.translation-preview.is-flashing::after {
  animation: previewFlash 520ms ease both;
}

.decision-panel {
  display: grid;
  align-content: start;
  gap: 14px;
  padding: clamp(16px, 2vw, 24px);
}

.decision-copy h1 {
  margin: 8px 0 10px;
  font-size: clamp(28px, 3vw, 46px);
  line-height: 1.04;
  letter-spacing: 0;
}

.decision-copy p:not(.eyebrow),
.result-card p {
  color: #625c53;
  line-height: 1.72;
}

.check-grid,
.output-grid {
  display: grid;
  gap: 10px;
}

.check-grid button,
.output-grid button,
.slot,
.piece {
  min-height: 64px;
  border: 1px solid rgba(23, 23, 23, 0.12);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  color: #171717;
  text-align: left;
  cursor: pointer;
}

.check-grid button.is-complete,
.output-grid button.is-selected,
.slot.is-filled {
  border-color: #8c3c24;
  background: #fbf0e2;
}

.check-grid strong,
.output-grid strong {
  display: block;
  margin-bottom: 4px;
}

.check-grid span,
.output-grid span {
  color: #726b60;
  font-size: 13px;
  line-height: 1.4;
}

.layer-game {
  display: grid;
  gap: 12px;
}

.pieces,
.slots {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.piece {
  min-height: 58px;
  text-align: center;
  font-weight: 900;
}

.piece-bg {
  background: #d8e3d6;
}

.piece-body {
  background: #f6ca6c;
}

.piece-detail {
  background: #d7efe7;
}

.slot {
  min-height: 78px;
  border-style: dashed;
  color: #766d61;
  text-align: center;
}

.slot.is-hover {
  border-color: #171717;
  background: #fffaf0;
}

.result-card {
  border: 1px solid rgba(23, 23, 23, 0.12);
  border-radius: 8px;
  padding: 18px;
  background: #fffaf0;
}

.result-card h2 {
  margin: 8px 0 10px;
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1.1;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.result-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid #171717;
  border-radius: 8px;
  padding: 0 14px;
  color: #171717;
  text-decoration: none;
  font-weight: 900;
}

.result-actions a:first-child {
  background: #171717;
  color: #fff;
}

.is-hidden {
  display: none;
}

@media (max-width: 1100px) {
  .work-area {
    grid-template-columns: 1fr;
  }

  .stage-frame {
    grid-template-columns: minmax(180px, 0.32fr) minmax(0, 0.68fr);
  }

  .workshop-board {
    grid-template-columns: 138px minmax(0, 1fr);
  }

  .sample-rail {
    grid-template-columns: 1fr;
  }

  .source-panel {
    border-right: 0;
    border-bottom: 1px solid rgba(23, 23, 23, 0.12);
  }

  .source-panel img {
    max-height: 360px;
  }
}

@media (max-width: 680px) {
  .workshop-page .site-header {
    position: static;
    gap: 10px;
    padding: 10px 14px;
  }

  .workshop-page .brand {
    gap: 10px;
  }

  .workshop-page .brand img {
    width: 36px;
    height: 36px;
  }

  .workshop-page .nav {
    padding-bottom: 0;
  }

  .workshop-game {
    padding: 6px;
  }

  .workshop-board {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .workshop-hud {
    position: static;
    align-items: center;
    flex-direction: row;
    margin-bottom: 6px;
    padding: 8px 10px;
  }

  .workshop-hud button {
    width: auto;
    min-width: 58px;
  }

  .pieces,
  .slots {
    grid-template-columns: 1fr;
  }

  .sample-rail {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 2px 2px 6px;
    scroll-snap-type: x mandatory;
  }

  .sample-card {
    flex: 0 0 34vw;
    min-width: 126px;
    grid-template-columns: 1fr;
    align-items: center;
    scroll-snap-align: start;
  }

  .sample-card img {
    aspect-ratio: 1 / 1;
  }

  .work-area {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
  }

  .translation-preview,
  .stage-frame {
    min-height: auto;
  }

  .stage-frame {
    position: sticky;
    top: 0;
    z-index: 6;
    display: grid;
    grid-template-columns: 1fr;
    border-color: rgba(23, 23, 23, 0.16);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.22);
  }

  .source-panel {
    display: none;
  }

  .decision-panel {
    padding: 14px;
  }

  .translation-preview {
    height: clamp(300px, 45svh, 420px);
    min-height: 300px;
  }

  .decision-panel {
    gap: 12px;
  }

  .check-grid button,
  .output-grid button,
  .slot,
  .piece {
    min-height: 54px;
    padding: 10px;
  }

  .layer-bg {
    width: min(54vw, 220px);
    height: auto;
  }

  .layer-body {
    width: min(47vw, 190px);
    height: auto;
  }

  .layer-detail {
    width: min(40vw, 165px);
    height: auto;
  }

  .sample-object {
    width: min(44vw, 185px);
    height: auto;
    top: 66%;
  }

  .decision-copy h1 {
    font-size: 30px;
  }
}

@keyframes sourcePop {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.96);
  }
  70% {
    opacity: 1;
    transform: translateY(-2px) scale(1.02);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes layerLand {
  0% {
    filter: saturate(0.7);
    opacity: 0;
  }
  70% {
    filter: saturate(1.2);
  }
  100% {
    filter: saturate(1.05);
  }
}

@keyframes sampleReveal {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) translateY(26px) scale(0.86);
  }
  72% {
    opacity: 1;
    transform: translate(-50%, -50%) translateY(-4px) scale(1.04);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) translateY(0) scale(1);
  }
}

@keyframes confettiBurst {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.4) rotate(0deg);
  }
  18% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform:
      translate(calc(-50% + var(--dx)), calc(-50% + var(--dy)))
      scale(1)
      rotate(var(--r));
  }
}

@keyframes previewFlash {
  0% {
    opacity: 0;
  }
  28% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}
