/* ─── Reset & base ─────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: #f8e2dc;
  font-family: 'Nunito', Arial, sans-serif;
  color: #fff;
}

img {
  display: block;
  max-width: 100%;
}

button {
  background: none;
  border: none;
  cursor: url('images/hand-pointing-fill.svg') 10 0, pointer;
  padding: 0;
}

/* ─── Intro screen ──────────────────────────────────────────────── */
.intro {
  position: fixed;
  inset: 0;
  background-color: #f8e2dc;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  overflow: hidden;
  padding: 40px 48px;
  text-align: center;
}

.intro.is-hidden {
  display: none;
}

.intro__logo {
  height: 84px;
  width: auto;
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 0.4s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.intro__logo.is-visible {
  opacity: 1;
  transform: scale(1);
}

.intro__headline {
  font-size: clamp(1.5rem, 3vw, 2.5rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #c25211;
  opacity: 0;
  transform: translateY(-18px);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.intro__description {
  font-size: clamp(0.95rem, 1.5vw, 1.1rem);
  line-height: 1.65;
  color: #c25211;
  max-width: 640px;
  opacity: 0;
  transform: translateY(-14px);
  transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.intro__headline.is-visible,
.intro__description.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Scene: all images stacked, same size */
.intro__scene {
  position: relative;
  width: 60%;
  flex-shrink: 1;
  min-height: 0;
}

.intro__bg {
  display: block;
  width: 100%;
  height: auto;
  position: relative;
  pointer-events: none;
  user-select: none;
  opacity: 0;
  transform: translateY(-14px);
  will-change: opacity, transform;
}

.intro__char {
  display: block;
  width: 100%;
  height: auto;
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
  pointer-events: none;
  will-change: opacity, transform;
}

.btn-start {
  opacity: 0;
  transform: translateY(-14px);
  transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.btn-start.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.btn-start img {
  height: 56px;
  width: auto;
  transition: transform 0.15s ease, opacity 0.15s;
}

.btn-start:hover img {
  transform: scale(1.05) translateY(-2px);
}

.btn-start:active img {
  transform: scale(0.95) translateY(2px);
  opacity: 0.85;
}

/* ─── Builder ───────────────────────────────────────────────────── */
.builder {
  display: none;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background-color: #f8e2dc;
}

.builder.is-visible {
  display: flex;
}

/* ─── Builder logo ──────────────────────────────────────────────── */
.builder__logo {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 12px 16px 0;
}

.builder__logo img {
  height: 36px;
  width: auto;
  flex-shrink: 0;
}

.builder__tagline {
  flex-shrink: 0;
  font-size: clamp(0.8rem, 1.1vw, 1.05rem);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #c25211;
  white-space: nowrap;
  text-align: center;
  padding: 8px 16px 0;
}

/* ─── Hero ──────────────────────────────────────────────────────── */
.hero {
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  padding: 16px 16px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.hero__canvas {
  position: relative;
  display: inline-block;
  max-height: calc(100dvh - 160px - 72px - 80px);
  border-radius: 24px;
  overflow: hidden;
  user-select: none;
}

.hero__bg {
  display: block;
  max-height: calc(100dvh - 160px - 72px - 80px);
  width: auto;
  max-width: calc(100vw - 32px);
  pointer-events: none;
}

.hero__items {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* ─── Hero items ────────────────────────────────────────────────── */
.hero-item {
  position: absolute;
  cursor: url('images/hand-fill.svg') 16 4, grab;
  touch-action: none;
  pointer-events: all;
  transform-origin: center center;
  user-select: none;
}

.hero-item img {
  width: 100%;
  height: auto;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.hero-item.is-selected {
  outline: 2px dashed rgba(255,255,255,0.85);
  outline-offset: 2px;
  z-index: 100 !important;
}

.hero-item.is-dragging {
  cursor: url('images/hand-grabbing-fill.svg') 16 4, grabbing;
}

.resize-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  background: #fff;
  border: 2px solid rgba(0,0,0,0.4);
  border-radius: 50%;
  pointer-events: none;
  z-index: 101;
  display: none;
}
.hero-item.is-selected .resize-handle {
  display: block;
  pointer-events: all;
}
.resize-handle.tl { top: -6px;  left: -6px;  cursor: nwse-resize; }
.resize-handle.tr { top: -6px;  right: -6px; cursor: nesw-resize; }
.resize-handle.bl { bottom: -6px; left: -6px;  cursor: nesw-resize; }
.resize-handle.br { bottom: -6px; right: -6px; cursor: nwse-resize; }

/* ─── Toolbar ───────────────────────────────────────────────────── */
.toolbar {
  flex-shrink: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  background-color: #f8e2dc;
}

.toolbar__scroll {
  overflow: hidden;
  width: calc(5 * 80px + 4 * 8px);
  flex-shrink: 0;
}

.toolbar__items {
  display: flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.25s ease;
}

.toolbar__item {
  flex-shrink: 0;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: background 0.15s;
}

.toolbar__item img {
  width: 64px;
  height: 64px;
  object-fit: contain;
}

.toolbar__item img {
  transition: transform 0.15s ease, opacity 0.15s;
}
.toolbar__item:hover img { transform: scale(1.1) translateY(-2px); }
.toolbar__item:active img { transform: scale(0.95) translateY(2px); opacity: 0.85; }

.toolbar__nav {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toolbar__nav img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.toolbar__nav:disabled { opacity: 0.3; cursor: default; }

.toolbar__divider {
  flex-shrink: 0;
  width: 1px;
  height: 48px;
  background: rgba(0,0,0,0.15);
  margin: 0 4px;
}

.toolbar__controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar__control {
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: background 0.15s, opacity 0.15s;
}

.toolbar__control img {
  width: 64px;
  height: 64px;
  object-fit: contain;
}

.toolbar__control:disabled { opacity: 0.3; cursor: default; }

.toolbar__control img {
  transition: transform 0.15s ease, opacity 0.15s;
}
.toolbar__control:not(:disabled):hover img { transform: scale(1.1) translateY(-2px); }
.toolbar__control:not(:disabled):active img { transform: scale(0.95) translateY(2px); opacity: 0.85; }

.actions {
  flex-shrink: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px 16px 56px;
}

.actions__logo {
  height: 56px;
  width: auto;
  margin-left: 24px;
}

.btn-action img {
  height: 48px;
  width: auto;
  transition: transform 0.15s ease, opacity 0.15s;
}

.btn-action:hover img { transform: scale(1.05) translateY(-2px); }
.btn-action:active img { transform: scale(0.95) translateY(2px); opacity: 0.85; }

.footer-frosting {
  width: 100%;
  line-height: 0;
}

.footer-frosting img {
  width: 100%;
  height: auto;
  display: block;
}

.footer {
  width: 100%;
  padding: 24px 32px;
  background-image: url('images/footer.avif');
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  gap: 16px;
}

.footer__logo {
  height: 40px;
  width: auto;
  flex-shrink: 0;
}

.footer__copy {
  font-size: 0.75rem;
  color: #fff;
}

/* ─── Responsive ────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .intro__scene { width: 100%; margin: 0 -16px; }
  .intro { padding: 24px 16px; }
  .builder__tagline { white-space: normal; }
  .btn-start img { height: 48px; }
  .toolbar { flex-wrap: wrap; justify-content: center; }
  .toolbar__scroll { width: calc(5 * 80px + 4 * 8px); }
  .toolbar__controls { width: 100%; justify-content: center; }
  .toolbar__divider { display: none; }
  .toolbar__item, .toolbar__control { width: 80px; height: 80px; }
  .toolbar__item img, .toolbar__control img { width: 66px; height: 66px; }
  .toolbar__nav img { width: 36px; height: 36px; }
  .btn-action img { height: 40px; }
}

@media (max-width: 480px) {
  .toolbar__scroll { width: calc(3 * 80px + 2 * 8px); }
  .toolbar__item, .toolbar__control { width: 80px; height: 80px; }
  .toolbar__item img, .toolbar__control img { width: 66px; height: 66px; }
  .toolbar__nav img { width: 36px; height: 36px; }
  .toolbar__divider { display: none; }
  .btn-action img { height: 36px; }
}
