/* Mobile-only home scene overrides.  Desktop rules remain in asset-home.css. */
@media (max-width: 600px) {
  /* Prevent iOS/Edge from flashing a rectangular tap highlight over illustration buttons. */
  .home-view,
  .home-view button,
  .home-view a {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
  }

  .home-view .paper-note,
  .home-view .jar-zone,
  .home-view .stats-trigger {
    -webkit-user-select: none;
    user-select: none;
  }

  .home-view button:focus:not(:focus-visible),
  .home-view a:focus:not(:focus-visible) {
    outline: none;
  }

  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
    background: #f8f1e8;
  }

  .app-shell {
    width: 100%;
    max-width: none;
    min-height: 100dvh;
    overflow-x: clip;
    background: #f8f1e8;
  }

  .home-view {
    min-height: 100dvh;
    height: 100dvh;
    padding-bottom: 0;
    overflow: hidden;
    background-image: url("assets/background-mobile.png?v=20260721-user-2");
    background-position: center top;
    background-size: 100% auto;
    /* The supplied background already contains the complete wall-and-desk
       illustration.  This colour only covers any viewport space below it. */
    background-color: #e9c093;
  }

  .home-canvas {
    height: 100%;
    overflow: hidden;
  }

  .home-view::after {
    display: none;
  }

  .home-view .topbar {
    height: 70px;
    padding: 0 10.1%;
  }

  .scene-copy {
    top: calc(100vw + 7px);
    left: 12.1%;
    right: 8%;
    z-index: 3;
  }

  .scene-copy p {
    margin-bottom: 3px;
    font-size: clamp(17px, 4.6vw, 20px);
    line-height: 1.35;
  }

  .scene-copy span {
    font-size: clamp(11px, 3.1vw, 13px);
  }

  .desk-scene {
    position: absolute;
    top: calc(100vw + 88px);
    right: 0;
    bottom: 0;
    left: 0;
    isolation: isolate;
    width: 100%;
    height: auto;
    margin: 0;
    overflow: visible;
    /* Transparent here: the supplied scene image already carries the wall.
       A solid fill was creating the visible white rectangular splice. */
    background: transparent;
  }

  /* Do not layer a second desk over the supplied background image.
     It was the source of the white/wood splice on mobile. */
  .scene-desk-surface {
    display: none;
  }

  .desk-scene .jar-zone {
    top: -55px;
    right: auto;
    bottom: auto;
    left: -4%;
    z-index: 3;
    width: 270px;
    height: 310px;
    transform: scale(0.96);
    transform-origin: left top;
  }

  .desk-scene .paper-note {
    top: calc(1% + 15px);
    bottom: auto;
    left: auto;
    right: 3%;
    z-index: 3;
    width: 265px;
    height: 265px;
    transform: scale(0.68);
    transform-origin: right top;
  }

  .desk-scene .paper-note:hover {
    transform: scale(0.68);
  }

  .desk-scene .pencil {
    /* Keep the pen tucked beneath the note, rather than on the desk edge. */
    top: calc(34% + 45px);
    bottom: auto;
    left: auto;
    right: -2%;
    z-index: 4;
    width: 278px;
    height: 94px;
    transform: scale(0.7);
    transform-origin: right top;
  }

  /* A memory is its own full-viewport layer on phones.  This avoids the
     card inheriting a narrow width from a previously scaled app container. */
  .modal-view.active {
    position: fixed;
    inset: 0;
    width: 100vw;
    min-height: 100dvh;
    height: 100dvh;
  }

  .memory-canvas {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .memory-card {
    width: min(82vw, 426px);
    min-height: 390px;
    max-height: calc(100dvh - 42px);
  }
}

@media (max-width: 360px) {
  .desk-scene {
    top: calc(100vw + 40px);
    bottom: 0;
    height: auto;
    margin: 0;
  }

  .desk-scene .jar-zone {
    transform: scale(0.81);
  }

  .desk-scene .paper-note,
  .desk-scene .paper-note:hover {
    transform: scale(0.57);
  }

  .desk-scene .pencil {
    transform: scale(0.46);
  }
}
