/* The frame is outside the coordinate plane. Home and editor MUST use this
   same borderless 16:10 canvas; do not add breakpoint-specific layer sizes. */
.tamami-stage-frame,
.dashboard-hero-shell .dashboard-hero {
  --tamami-stage-frame: url("/images/pixel_frame_decoration_quiet.svg?v=1");
  position: relative;
  isolation: isolate;
  box-sizing: border-box;
  width: 100%;
  height: auto;
  aspect-ratio: auto;
  padding: 0;
  border: 14px solid transparent;
  border-image-source: var(--tamami-stage-frame);
  border-image-slice: 14 fill;
  border-image-width: 1;
  border-image-repeat: stretch;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  clip-path: none;
  overflow: visible;
  image-rendering: pixelated;
}

.dashboard-hero-shell .pixel-sky { position: relative; inset: auto; overflow: visible; }
.dashboard-hero-shell .dashboard-cat-speech-wrap { z-index: 10; }

.tamami-stage-scene {
  position: relative;
  isolation: isolate;
}

/* Only the scenery bleeds into the frame's filled interior. Keep the canvas
   and every object exactly 14px inside the frame, as before. This polygon
   follows the INSIDE of pixel_frame_decoration_quiet.svg's 14px end caps;
   it clips the image, never the frame's outline/highlight/shadow pixels. */
.tamami-stage-backdrop {
  position: absolute;
  inset: -14px;
  z-index: 0;
  pointer-events: none;
  background-color: #f6f0fe;
  background-image: var(--decor-background-image, url("/images/dashboard_hero_bg.png"));
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  image-rendering: pixelated;
  clip-path: polygon(
    14px 4px, calc(100% - 10px) 4px,
    calc(100% - 10px) 6px, calc(100% - 6px) 6px,
    calc(100% - 6px) 10px, calc(100% - 4px) 10px,
    calc(100% - 4px) calc(100% - 12px), calc(100% - 6px) calc(100% - 12px),
    calc(100% - 6px) calc(100% - 8px), calc(100% - 10px) calc(100% - 8px),
    calc(100% - 10px) calc(100% - 6px), calc(100% - 14px) calc(100% - 6px),
    calc(100% - 14px) calc(100% - 4px), 10px calc(100% - 4px),
    10px calc(100% - 6px), 6px calc(100% - 6px),
    6px calc(100% - 10px), 4px calc(100% - 10px),
    4px 12px, 6px 12px,
    6px 8px, 10px 8px,
    10px 6px, 14px 6px
  );
}

.tamami-stage[data-tamami-canvas] {
  position: relative;
  z-index: 1;
  inset: auto;
  box-sizing: border-box;
  width: 100%;
  max-width: none;
  height: auto;
  aspect-ratio: 16 / 10;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  transform: none;
  overflow: hidden;
}

.tamami-stage[data-tamami-canvas] [data-placement-key] {
  top: var(--placement-y);
  left: var(--placement-x);
  width: var(--layer-width);
  height: var(--layer-height);
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  transform: translate(-50%, -50%);
  opacity: 1;
}

.tamami-stage[data-tamami-canvas] [hidden] { display: none; }
.tamami-stage[data-tamami-canvas] > .tamami-layer > img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  pointer-events: none;
  user-select: none;
}

.tamami-stage[data-tamami-canvas] .tamami-layer--effect {
  inset: 0;
  width: 100%;
  height: 100%;
  transform: none;
}
.tamami-stage[data-tamami-canvas] .tamami-layer--effect > img {
  animation: none;
  filter: none;
}
.tamami-stage[data-tamami-canvas].is-editing .is-placement-active {
  outline-color: #5a43bc;
}

/* The one-time keyring hint must not cover the speech button on small screens.
   Temporarily give speech its own row; the coordinate canvas stays unchanged. */
@media (max-width: 639px) {
  .dashboard-hero-shell:has([data-empty-keyring-prompt]:not([hidden])) .pixel-sky {
    display: flex;
    flex-direction: column;
  }
  .dashboard-hero-shell:has([data-empty-keyring-prompt]:not([hidden])) .dashboard-cat-speech-wrap {
    position: relative;
    inset: auto;
    order: 1;
    width: min(320px, 100%);
    margin: 8px auto 0;
    transform: none;
  }
}
