:root {
  color-scheme: dark;
  --night: #252a4a;
  --dust: #665a7a;
  --rose: #c9879a;
  --peach: #e9ae89;
  --cream: #f4e4c1;
  --sage: #8daa91;
  --mist: #8eb8c7;
  --cocoa: #604b4b;
  --ink: #171a30;
  --panel: rgba(37, 42, 74, 0.94);
  --line: rgba(244, 228, 193, 0.2);
  --shadow: 0 16px 42px rgba(14, 15, 32, 0.45);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Monaco, Consolas, monospace;
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  background: #171a30;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--cream);
  background:
    radial-gradient(circle at 50% 0%, rgba(142, 184, 199, 0.14), transparent 45%),
    linear-gradient(180deg, #1c203b, #121425);
  image-rendering: pixelated;
}

button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, canvas:focus-visible {
  outline: 3px solid var(--peach);
  outline-offset: 3px;
}

.app-shell {
  width: min(1100px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) 14px max(18px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-rows: auto auto auto minmax(150px, auto);
  gap: 10px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.pixel-button, .icon-button, .dock-button, .action-card, .primary-button, .secondary-button, .danger-button,
.room-tab, .journal-tab, .shop-card, .close-button, .observe-button {
  border: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.portrait-button {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 5px 11px 5px 5px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(23, 26, 48, 0.78);
  box-shadow: inset 0 0 0 2px rgba(0,0,0,.18);
}

.portrait-button canvas {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--dust);
}

.portrait-copy { display: grid; text-align: left; min-width: 0; }
.portrait-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.portrait-copy small { color: rgba(244, 228, 193, .68); font-size: 10px; }

.topbar-actions { display: flex; align-items: center; gap: 7px; }
.audio-cluster { display: flex; align-items: center; gap: 5px; }
.volume-control {
  height: 34px;
  display: grid;
  grid-template-columns: auto 72px auto;
  align-items: center;
  gap: 5px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(23, 26, 48, .78);
  font-size: 8px;
}
.volume-control span { color: var(--peach); font-weight: 800; }
.volume-control output { min-width: 29px; color: rgba(244,228,193,.72); }
.volume-control input { width: 72px; accent-color: var(--peach); cursor: pointer; }
.currency-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 34px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(23, 26, 48, 0.78);
  font-size: 12px;
}
.currency-chip span { color: var(--peach); }
.currency-chip.dream span { color: #cbbcff; }
.icon-button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(23, 26, 48, .78);
}
.icon-button[aria-pressed="true"] { background: var(--dust); }

.game-frame {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 240px;
  border: 3px solid #111329;
  border-radius: 15px;
  background: #111329;
  box-shadow: var(--shadow), inset 0 0 0 2px rgba(244,228,193,.18);
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--night);
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  cursor: pointer;
}

.scene-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 5px 8px;
  border: 1px solid rgba(244,228,193,.2);
  border-radius: 999px;
  color: rgba(244,228,193,.86);
  background: rgba(23,26,48,.62);
  backdrop-filter: blur(4px);
  font-size: clamp(9px, 2vw, 12px);
  pointer-events: none;
}

.observe-button {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 8px 12px;
  border: 1px solid rgba(244,228,193,.2);
  border-radius: 9px;
  background: rgba(23,26,48,.72);
  font-size: 11px;
}

.speech-bubble {
  position: absolute;
  left: 50%;
  bottom: 28%;
  max-width: min(72%, 390px);
  transform: translateX(-50%);
  padding: 10px 13px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  color: var(--ink);
  background: var(--cream);
  box-shadow: 4px 4px 0 rgba(23,26,48,.55);
  font-size: clamp(10px, 2vw, 13px);
  text-align: center;
}
.speech-bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -8px;
  width: 12px;
  height: 12px;
  transform: translateX(-50%) rotate(45deg);
  background: var(--cream);
  border-right: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
}

.toast {
  position: absolute;
  top: 14px;
  left: 50%;
  z-index: 5;
  transform: translate(-50%, -10px);
  padding: 8px 12px;
  border-radius: 10px;
  color: var(--ink);
  background: var(--cream);
  box-shadow: 3px 3px 0 rgba(23,26,48,.45);
  font-size: 11px;
  animation: toast-in .24s steps(3) forwards;
}
@keyframes toast-in { to { transform: translate(-50%, 0); } }

.dock {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(23,26,48,.76);
}

.dock-button {
  min-height: 55px;
  display: grid;
  place-items: center;
  gap: 2px;
  padding: 7px 4px;
  border-radius: 10px;
  background: transparent;
}
.dock-button span { font-size: 21px; line-height: 1; }
.dock-button small { font-size: 9px; color: rgba(244,228,193,.68); }
.dock-button.active { background: var(--dust); box-shadow: inset 0 0 0 1px rgba(244,228,193,.16); }
.dock-button.active small { color: var(--cream); }

.action-panel {
  min-height: 170px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: 0 10px 30px rgba(9,10,25,.2);
}
.panel-content { display: none; padding: 12px; }
.panel-content.active { display: block; }

.action-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
}
.action-card {
  min-height: 108px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 5px;
  padding: 10px 6px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(102,90,122,.28);
  transition: transform .1s ease, background .1s ease;
}
.action-card:hover, .shop-card:hover { transform: translateY(-2px); background: rgba(102,90,122,.5); }
.action-card:active, .shop-card:active { transform: translateY(1px); }
.action-card span { font-size: 29px; }
.action-card strong { font-size: 12px; }
.action-card small { color: rgba(244,228,193,.62); font-size: 9px; text-align: center; }

.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(122px, 1fr));
  gap: 8px;
  max-height: 260px;
  overflow: auto;
  padding: 2px;
  scrollbar-color: var(--dust) transparent;
}
.shop-card {
  min-height: 98px;
  display: grid;
  grid-template-columns: 38px 1fr;
  grid-template-rows: auto auto auto;
  gap: 2px 7px;
  align-items: center;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  text-align: left;
  background: rgba(102,90,122,.22);
}
.shop-card .shop-icon { grid-row: 1 / 4; font-size: 28px; text-align: center; }
.shop-card strong { font-size: 11px; }
.shop-card small { color: rgba(244,228,193,.62); font-size: 8px; }
.shop-card .price { color: var(--peach); font-size: 9px; }
.shop-card.owned .price { color: var(--sage); }
.shop-card.active { box-shadow: inset 0 0 0 2px var(--peach); }
.shop-card.locked { opacity: .55; }

.room-tabs, .journal-tabs {
  display: flex;
  gap: 5px;
  margin-bottom: 10px;
  overflow-x: auto;
}
.room-tab, .journal-tab {
  flex: 0 0 auto;
  padding: 7px 10px;
  border-radius: 8px;
  background: rgba(23,26,48,.62);
  font-size: 10px;
}
.room-tab.active, .journal-tab.active { background: var(--dust); }

.journal-content { min-height: 120px; }
.stat-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 8px;
}
.summary-card, .memory-card, .timeline-entry {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(23,26,48,.38);
}
.summary-card small, .memory-card small, .timeline-entry small { color: rgba(244,228,193,.58); }
.summary-card strong { display: block; margin-top: 4px; }
.memory-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); gap: 8px; }
.memory-card { min-height: 92px; display: grid; align-content: center; gap: 4px; }
.memory-card.locked { filter: grayscale(1); opacity: .45; }
.timeline { display: grid; gap: 7px; max-height: 205px; overflow: auto; }
.timeline-entry { display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: start; }

.modal {
  width: min(620px, calc(100% - 24px));
  max-height: calc(100vh - 24px);
  overflow: auto;
  padding: 0;
  border: 2px solid rgba(244,228,193,.24);
  border-radius: 16px;
  color: var(--cream);
  background: #292e50;
  box-shadow: 0 26px 80px rgba(5,6,20,.72);
}
.modal::backdrop { background: rgba(10,11,27,.78); backdrop-filter: blur(5px); }
.modal form { position: relative; padding: clamp(18px, 5vw, 30px); }
.modal h1, .modal h2 { margin: 7px 0 9px; letter-spacing: -0.04em; }
.modal p { color: rgba(244,228,193,.72); line-height: 1.6; font-size: 12px; }
.modal-kicker { color: var(--peach); font-size: 9px; letter-spacing: .16em; }
.close-button {
  position: absolute;
  top: 11px;
  right: 11px;
  z-index: 3;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(23,26,48,.68);
  font-size: 21px;
}
.primary-button, .secondary-button, .danger-button, .file-button {
  width: 100%;
  display: block;
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  text-align: center;
}
.primary-button { color: var(--ink); background: var(--peach); font-weight: 800; }
.secondary-button { border: 1px solid var(--line); background: rgba(23,26,48,.5); }
.danger-button { color: #ffd7da; border: 1px solid rgba(255,150,160,.35); background: rgba(110,42,60,.46); }
.file-button input { display: none; }
.version-label { display: block; margin-top: 16px; color: rgba(244,228,193,.38); text-align: center; font-size: 8px; }

.monster-choices {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  max-height: 52vh;
  overflow: auto;
  padding: 2px;
  margin: 16px 0;
}
.monster-choice {
  position: relative;
  min-height: 142px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 4px;
  padding: 11px 7px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(23,26,48,.38);
  cursor: pointer;
}
.monster-choice input { position: absolute; opacity: 0; pointer-events: none; }
.monster-choice canvas { width: 64px; height: 64px; image-rendering: pixelated; }
.monster-choice small { min-height: 29px; color: rgba(244,228,193,.62); text-align: center; font-size: 8px; }
.monster-choice:has(input:checked) { background: rgba(201,135,154,.24); box-shadow: inset 0 0 0 2px var(--peach); }
.name-field { display: grid; gap: 7px; margin-top: 12px; font-size: 11px; }
.name-field input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 12px;
  color: var(--cream);
  background: rgba(23,26,48,.54);
}


.pet-box-button { font-size: 16px; }
.pet-box-modal { width: min(760px, calc(100% - 24px)); }
.pet-box-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  max-height: 52vh;
  overflow: auto;
  margin: 16px 0;
  padding: 2px;
}
.pet-box-card {
  min-width: 0;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  gap: 7px 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(23,26,48,.38);
}
.pet-box-card.active {
  border-color: rgba(233,174,137,.72);
  background: rgba(201,135,154,.18);
  box-shadow: inset 0 0 0 1px rgba(233,174,137,.28);
}
.pet-box-card canvas {
  grid-row: 1 / 3;
  width: 64px;
  height: 64px;
  border-radius: 9px;
  background: #3a405f;
  image-rendering: pixelated;
}
.pet-box-copy { min-width: 0; display: grid; gap: 4px; }
.pet-box-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pet-box-copy small { color: rgba(244,228,193,.6); font-size: 8px; line-height: 1.4; }
.pet-select-button { align-self: end; margin: 0; padding: 8px 10px; font-size: 9px; }
.active-pet-pill {
  align-self: end;
  width: fit-content;
  padding: 5px 7px;
  border-radius: 999px;
  color: #d9eedb;
  background: rgba(141,170,145,.2);
  font-size: 8px;
}
.pet-box-empty {
  grid-column: 1 / -1;
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: rgba(244,228,193,.62);
  text-align: center;
  font-size: 10px;
}

.status-heading { display: flex; align-items: center; gap: 14px; }
.status-heading canvas { width: 82px; height: 82px; border-radius: 13px; background: var(--dust); image-rendering: pixelated; }
.status-heading p { margin: 0; }
.stats-list { display: grid; gap: 10px; margin-top: 18px; }
.stat-row { display: grid; grid-template-columns: 28px 86px 1fr auto; gap: 7px; align-items: center; font-size: 10px; }
.stat-track, .progress-track { height: 9px; overflow: hidden; border-radius: 999px; background: rgba(23,26,48,.74); }
.stat-track span, .progress-track span { display: block; width: 50%; height: 100%; border-radius: inherit; background: var(--sage); transition: width .3s steps(6); }
.stat-row small { color: rgba(244,228,193,.55); }
.bond-card { display: grid; gap: 8px; margin-top: 18px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: rgba(23,26,48,.34); }
.bond-card > div:first-child { display: flex; justify-content: space-between; gap: 10px; font-size: 10px; }
.bond-card small { color: rgba(244,228,193,.56); font-size: 9px; }

.event-modal { max-width: 430px; text-align: center; }
.event-symbol { font-size: 48px; animation: floaty 2s ease-in-out infinite; }
@keyframes floaty { 50% { transform: translateY(-6px); } }
.reward-pill { display: inline-block; margin: 7px 0 4px; padding: 7px 10px; border-radius: 999px; background: rgba(141,170,145,.18); color: #c7e0ca; font-size: 10px; }

.minigame-modal { width: min(720px, calc(100% - 18px)); }
.minigame-header { display: flex; justify-content: space-between; align-items: start; }
.minigame-header .close-button { position: static; }
.minigame-body {
  min-height: 330px;
  display: grid;
  place-items: center;
  margin-top: 12px;
  border: 2px solid rgba(23,26,48,.72);
  border-radius: 12px;
  overflow: hidden;
  background: #1b1f39;
}
.minigame-screen { width: 100%; min-height: 330px; padding: 18px; display: grid; align-content: center; gap: 14px; text-align: center; }
.game-score { display: flex; justify-content: center; gap: 18px; font-size: 11px; }
.rhythm-lane { height: 148px; display: grid; grid-template-columns: repeat(4,1fr); gap: 6px; align-items: end; padding: 10px; border-radius: 10px; background: rgba(23,26,48,.64); }
.rhythm-key { height: 52px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 9px; background: var(--dust); font-size: 22px; }
.rhythm-key.hit { background: var(--peach); color: var(--ink); transform: translateY(3px); }
.rhythm-prompt { min-height: 44px; font-size: 38px; }
.stack-stage { position: relative; width: min(100%, 360px); height: 230px; margin: auto; border-bottom: 12px solid var(--cocoa); background: linear-gradient(#4d547a, #303653); overflow: hidden; }
.stack-block { position: absolute; height: 24px; border: 3px solid var(--ink); border-radius: 4px; background: var(--peach); }
.stack-controls { display: flex; justify-content: center; gap: 8px; }
.stack-controls button, .hide-object { border: 1px solid var(--line); border-radius: 9px; color: inherit; background: var(--dust); cursor: pointer; }
.stack-controls button { min-width: 60px; padding: 11px; }
.hide-room { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; width: min(100%, 460px); }
.hide-object { min-height: 82px; display: grid; place-items: center; font-size: 34px; }
.hide-object.found { background: var(--sage); }

.confetti-pixel {
  position: fixed;
  z-index: 1000;
  width: 7px;
  height: 7px;
  pointer-events: none;
  animation: confetti-fall .8s steps(8) forwards;
}
@keyframes confetti-fall { to { transform: translate(var(--dx), var(--dy)) rotate(180deg); opacity: 0; } }

@media (max-width: 680px) {
  .app-shell { padding-left: 8px; padding-right: 8px; }
  .game-frame { min-height: 0; }
  .currency-chip { padding: 0 7px; }
  .action-grid { grid-template-columns: repeat(2, 1fr); }
  .minigames-grid { grid-template-columns: repeat(3, 1fr); }
  .minigames-grid .action-card { min-height: 104px; }
  .monster-choices { grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: 50vh; }
  .pet-box-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .monster-choice { min-height: 132px; padding: 8px 5px; }
  .monster-choice canvas { width: 58px; height: 58px; }
  .monster-choice small { min-height: 28px; text-align: center; }
  .stat-row { grid-template-columns: 24px 72px 1fr; }
  .stat-row small { display: none; }
}

@media (max-width: 430px) {
  .portrait-copy small { display: none; }
  .portrait-button { padding-right: 7px; }
  .pet-box-grid { grid-template-columns: 1fr; }
  .pet-box-card { grid-template-columns: 58px minmax(0, 1fr); }
  .pet-box-card canvas { width: 58px; height: 58px; }
  .currency-chip { font-size: 10px; height: 31px; }
  .icon-button { width: 31px; height: 31px; }
  .volume-control { grid-template-columns: 52px; width: 64px; padding: 0 5px; }
  .volume-control span, .volume-control output { display: none; }
  .volume-control input { width: 52px; }
  .dock-button { min-height: 49px; }
  .dock-button span { font-size: 18px; }
  .minigames-grid { grid-template-columns: 1fr; }
  .minigames-grid .action-card { min-height: 76px; grid-template-columns: 36px 1fr; grid-template-rows: auto auto; justify-items: start; text-align: left; }
  .minigames-grid .action-card span { grid-row: 1 / 3; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition: none !important; }
}

/* DreamPet v4 — Living Collection */
.mini-icon-button {
  width: 23px; height: 23px; margin-left: -10px; align-self: flex-end; z-index: 2;
  border: 1px solid var(--line); border-radius: 50%; color: var(--cream); background: var(--cocoa); cursor: pointer; font-size: 10px;
}
.visitor-badge { position:absolute; z-index:35; left:12px; bottom:12px; max-width:55%; padding:7px 10px; border:2px solid var(--ink); border-radius:10px; color:var(--ink); background:var(--cream); box-shadow:3px 3px 0 rgba(23,26,48,.5); font-size:10px; }
.visitor-badge span { display:inline-grid; place-items:center; width:22px; height:22px; margin-right:5px; border-radius:5px; color:var(--cream); background:var(--dust); }
.inline-warning { margin:10px 0; padding:9px 11px; border:1px solid rgba(233,174,137,.65); border-radius:9px; color:var(--cream); background:rgba(201,135,154,.19); font-size:11px; }
.monster-choice em { display:block; min-height:24px; color:var(--mist); font-size:8px; font-style:normal; }
.evolution-pair { color:var(--peach); font-size:8px; }
.monster-preview { width:58px; height:52px; display:grid; place-items:center; margin:auto; border:3px solid var(--ink); border-radius:45% 45% 38% 38%; color:var(--ink); background:var(--body); box-shadow:inset -8px -7px 0 var(--shade), 3px 3px 0 rgba(0,0,0,.2); }
.monster-preview i { display:grid; place-items:center; width:28px; height:24px; border-radius:40%; color:var(--ink); background:var(--accent); font-style:normal; font-size:18px; }
.growth-card, .journal-note { margin-top:12px; padding:12px; border:1px solid var(--line); border-radius:10px; background:rgba(23,26,48,.46); }
.growth-card p, .journal-note p { margin:6px 0 0; color:rgba(244,228,193,.75); font-size:11px; line-height:1.55; }

.audio-modal form { width:min(480px,92vw); }
.mixer-row { display:grid; grid-template-columns:80px 1fr 42px; align-items:center; gap:10px; padding:11px 0; border-bottom:1px solid var(--line); }
.mixer-row input { width:100%; accent-color:var(--peach); }
.mixer-row output { color:var(--mist); font-size:10px; text-align:right; }
.help-copy { color:rgba(244,228,193,.64); font-size:10px; line-height:1.55; }

.room-toolbar-main { display:flex; justify-content:space-between; align-items:center; gap:10px; padding:0 0 9px; }
.primary-button.compact, .secondary-button.compact { width:auto; min-height:32px; padding:7px 11px; margin:0; }
.layout-chips { display:flex; gap:5px; overflow-x:auto; scrollbar-width:thin; }
.layout-chip { flex:none; padding:6px 9px; border:1px solid var(--line); border-radius:999px; color:rgba(244,228,193,.7); background:rgba(23,26,48,.55); cursor:pointer; font-size:8px; }
.layout-chip.active { color:var(--ink); background:var(--peach); }
.room-editor-overlay { position:absolute; inset:0; z-index:18; pointer-events:none; }
.room-editor-overlay .room-object { position:absolute; display:block; padding:0; border:0; color:transparent; background:transparent; pointer-events:auto; cursor:pointer; -webkit-tap-highlight-color:transparent; }
.room-editor-overlay .room-object span { display:none; }
.room-editor-overlay.editing { background:rgba(23,26,48,.08); pointer-events:auto; }
.room-editor-overlay.editing::before { content:""; position:absolute; inset:0; background-image:linear-gradient(rgba(244,228,193,.12) 1px,transparent 1px),linear-gradient(90deg,rgba(244,228,193,.12) 1px,transparent 1px); background-size:2.5% 4.444%; pointer-events:none; }
.room-editor-overlay.editing .room-object { min-width:28px; min-height:28px; border:2px dashed rgba(244,228,193,.55); border-radius:6px; color:var(--cream); background:rgba(37,42,74,.55); touch-action:none; }
.room-editor-overlay.editing .room-object span { display:grid; place-items:center; width:100%; height:100%; font-size:14px; }
.room-editor-overlay.editing .room-object.selected { border-color:var(--peach); background:rgba(201,135,154,.55); box-shadow:0 0 0 3px rgba(233,174,137,.2); }
.room-editor-toolbar { position:absolute; z-index:50; left:8px; right:8px; top:8px; display:flex; justify-content:space-between; align-items:center; gap:8px; padding:7px 8px; border:2px solid var(--ink); border-radius:10px; color:var(--ink); background:var(--cream); box-shadow:4px 4px 0 rgba(23,26,48,.45); }
.editor-title { display:grid; min-width:110px; }
.editor-title strong { font-size:10px; }.editor-title small { font-size:7px; color:var(--cocoa); }
.editor-actions { display:flex; gap:4px; overflow-x:auto; }
.editor-actions button { flex:none; min-height:28px; padding:4px 7px; border:1px solid var(--cocoa); border-radius:6px; color:var(--ink); background:#ead7b4; cursor:pointer; font-size:9px; }
.editor-actions button.primary { color:var(--cream); background:var(--night); }
.editing-room ~ .dock, .game-frame.editing-room + .dock { opacity:.22; pointer-events:none; }
.game-frame.editing-room .observe-button, .game-frame.editing-room .scene-badge, .game-frame.editing-room .speech-bubble { display:none; }

.collection-controls { display:grid; grid-template-columns:minmax(140px,1fr) repeat(2,minmax(105px,.45fr)); gap:8px; margin:10px 0 14px; }
.collection-controls label { display:grid; gap:4px; color:rgba(244,228,193,.7); font-size:8px; }
.collection-controls input, .collection-controls select { width:100%; min-height:34px; padding:7px 9px; border:1px solid var(--line); border-radius:7px; color:var(--cream); background:var(--ink); }
.pet-box-heading { display:flex; justify-content:space-between; align-items:flex-start; gap:12px; }
.pet-box-card { position:relative; display:grid; grid-template-columns:72px minmax(0,1fr); gap:9px; padding:10px; border:1px solid var(--line); border-radius:11px; background:rgba(23,26,48,.55); }
.pet-box-card.active { border-color:var(--peach); box-shadow:inset 0 0 0 2px rgba(233,174,137,.18); }
.pet-box-card canvas { width:72px; height:72px; border-radius:9px; image-rendering:pixelated; }
.pet-box-copy { min-width:0; }.pet-box-copy > strong { display:block; font-size:13px; }.pet-box-copy small,.pet-box-copy time { color:rgba(244,228,193,.6); font-size:8px; }.pet-box-copy p { min-height:28px; margin:5px 0; color:rgba(244,228,193,.78); font-size:9px; line-height:1.35; }
.favorite-star { position:absolute; z-index:2; top:5px; right:6px; border:0; color:rgba(244,228,193,.45); background:transparent; cursor:pointer; font-size:18px; }.favorite-star.on { color:var(--peach); }
.mini-stat { height:4px; margin-top:5px; border-radius:9px; overflow:hidden; background:rgba(244,228,193,.1); }.mini-stat span { display:block; height:100%; background:var(--rose); }
.pet-card-actions { grid-column:1/-1; display:grid; grid-template-columns:repeat(3,1fr); gap:5px; }.pet-card-actions button,.detail-actions button,.box-back { min-height:30px; border:1px solid var(--line); border-radius:6px; color:var(--cream); background:var(--dust); cursor:pointer; font-size:8px; }.pet-card-actions .primary { color:var(--ink); background:var(--peach); }.pet-card-actions button:disabled { opacity:.45; cursor:default; }
.empty-collection { grid-column:1/-1; display:grid; gap:5px; padding:30px; text-align:center; border:1px dashed var(--line); border-radius:10px; }
.pet-detail-header { display:flex; align-items:center; gap:16px; margin:15px 0; }.pet-detail-header canvas { width:96px; height:96px; border-radius:12px; image-rendering:pixelated; }.pet-detail-header h2 { margin:4px 0; }
.box-back { width:auto; padding:5px 9px; background:transparent; }.pet-detail-grid { display:grid; grid-template-columns:repeat(2,1fr); gap:8px; }.detail-stat { display:grid; grid-template-columns:80px 1fr 28px; align-items:center; gap:6px; padding:7px; border:1px solid var(--line); border-radius:7px; }.detail-stat div { height:5px; overflow:hidden; background:rgba(244,228,193,.1); }.detail-stat div span { display:block; height:100%; background:var(--sage); }.detail-stat small,.detail-stat strong { font-size:8px; }
.detail-section { margin-top:12px; padding:11px; border:1px solid var(--line); border-radius:9px; background:rgba(23,26,48,.42); }.detail-section h3 { margin:0 0 5px; font-size:11px; }.detail-section p { margin:0; color:rgba(244,228,193,.75); font-size:10px; line-height:1.5; }.detail-section small { color:rgba(244,228,193,.5); font-size:8px; }.collection-counts { display:flex; flex-wrap:wrap; gap:7px; }.collection-counts span { padding:5px 7px; border-radius:999px; background:rgba(142,184,199,.14); font-size:8px; }.detail-actions { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-top:13px; }

.difficulty-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:8px; width:100%; }.record-strip,.species-bonus { padding:8px 10px; border-radius:8px; color:var(--mist); background:rgba(142,184,199,.1); font-size:9px; }
.rhythm-pad { display:grid; grid-template-columns:repeat(4,1fr); gap:7px; width:min(100%,480px); }.rhythm-pad button { min-height:72px; border:2px solid var(--ink); border-radius:10px; color:var(--ink); background:var(--peach); box-shadow:0 5px 0 var(--cocoa); cursor:pointer; font-size:26px; }.rhythm-pad button:active { transform:translateY(4px); box-shadow:0 1px 0 var(--cocoa); }
.score-line { display:flex; justify-content:center; gap:20px; padding:8px; color:rgba(244,228,193,.8); font-size:10px; }
.stack-stage { position:relative; width:min(100%,420px); height:230px; margin:auto; overflow:hidden; border-bottom:12px solid var(--cocoa); background:linear-gradient(#4d547a,#303653); }.stack-base { position:absolute; left:23%; bottom:0; width:54%; height:13px; background:var(--cocoa); }.stack-piece { position:absolute; height:22px; display:grid; place-items:center; border:2px solid var(--ink); border-radius:4px; color:var(--ink); background:var(--peach); }.stack-piece.moving { bottom:198px; }.stack-piece.placed { background:var(--rose); }
.hide-room { display:grid; grid-template-columns:repeat(4,1fr); gap:8px; width:min(100%,500px); }.hide-room button { min-height:64px; border:1px solid var(--line); border-radius:9px; color:var(--cream); background:var(--dust); cursor:pointer; font-size:25px; }.hide-room button.soft-hint { animation:soft-hint 1.8s ease-in-out infinite; }.hide-room button.found { color:var(--ink); background:var(--sage); }@keyframes soft-hint { 50% { transform:translateY(-2px); box-shadow:0 0 0 2px rgba(244,228,193,.16); } }
.result-symbol { font-size:45px; color:var(--peach); }.result-screen h3 { margin:3px; }

.mission-list { display:grid; gap:8px; }.mission-card { display:grid; grid-template-columns:1fr auto; align-items:center; gap:12px; padding:11px; border:1px solid var(--line); border-radius:9px; background:rgba(23,26,48,.4); }.mission-card small { display:block; margin:4px 0; color:rgba(244,228,193,.62); font-size:8px; }.mission-card button { min-width:65px; min-height:34px; border:0; border-radius:7px; color:var(--ink); background:var(--peach); cursor:pointer; }.mission-card button:disabled { opacity:.4; }.mission-card.claimed { opacity:.62; }
.recipe-grid,.photo-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:8px; }.recipe-card,.photo-grid article { display:grid; gap:4px; min-height:92px; padding:11px; border:1px solid var(--line); border-radius:9px; background:rgba(23,26,48,.42); }.recipe-card span,.photo-grid article span { color:var(--peach); font-size:20px; }.recipe-card small,.photo-grid article small { color:rgba(244,228,193,.6); font-size:8px; line-height:1.4; }.recipe-card.locked { filter:saturate(.35); opacity:.55; }.journal-subtitle { margin:17px 0 8px; font-size:12px; }.collectible-row { display:flex; flex-wrap:wrap; gap:7px; margin-bottom:15px; }.collectible { padding:7px 9px; border:1px solid var(--line); border-radius:999px; color:rgba(244,228,193,.38); font-size:8px; }.collectible.unlocked { color:var(--cream); border-color:rgba(233,174,137,.55); background:rgba(233,174,137,.1); }
.dom-confetti { position:absolute; z-index:80; pointer-events:none; color:var(--peach); font-style:normal; animation:dom-confetti 1s ease-out forwards; }@keyframes dom-confetti { to { transform:translate(var(--dx),var(--dy)) rotate(280deg); opacity:0; } }
.reduce-motion *, .reduce-motion *::before, .reduce-motion *::after { animation-duration:.01ms!important; animation-iteration-count:1!important; transition:none!important; }

@media (max-width:680px) {
  .collection-controls { grid-template-columns:1fr 1fr; }.collection-controls label:first-child { grid-column:1/-1; }
  .room-toolbar-main { align-items:flex-start; flex-direction:column; }.layout-chips { width:100%; }
  .room-editor-toolbar { align-items:flex-start; flex-direction:column; }.editor-actions { width:100%; }
  .difficulty-grid { grid-template-columns:1fr; }.hide-room { grid-template-columns:repeat(3,1fr); }.pet-detail-grid { grid-template-columns:1fr; }
}
@media (max-width:430px) {
  .pet-box-heading { display:block; }.pet-box-heading .primary-button { margin-top:8px; }
  .pet-box-card { grid-template-columns:62px minmax(0,1fr); }.pet-box-card canvas { width:62px;height:62px; }.pet-card-actions { grid-template-columns:1fr; }
  .pet-detail-header { align-items:flex-start; }.pet-detail-header canvas { width:72px;height:72px; }.detail-actions { grid-template-columns:1fr; }
  .mixer-row { grid-template-columns:62px 1fr 34px; }.journal-tabs { overflow-x:auto; flex-wrap:nowrap; justify-content:flex-start; }.journal-tab { flex:none; }
  .rhythm-pad button { min-height:58px; }.hide-room { grid-template-columns:repeat(3,1fr); }
}
body.room-editing .topbar, body.room-editing .dock, body.room-editing .action-panel { display:none; }
body.room-editing .app-shell { width:min(1250px,100%); min-height:100vh; grid-template-rows:minmax(0,1fr); }
body.room-editing .game-frame { align-self:center; max-height:calc(100vh - 24px); }
[hidden] { display: none !important; }

/* DreamPet v4.1 — readability and room editor redesign */
body { font-size: 15px; line-height: 1.45; }

.portrait-copy small { font-size: 12px; }
.currency-chip { font-size: 13px; }
.scene-badge, .observe-button, .toast { font-size: 12px; }
.dock-button small { font-size: 11px; }
.action-card strong { font-size: 14px; }
.action-card small { font-size: 11px; line-height: 1.35; }
.shop-card strong { font-size: 13px; }
.shop-card small { font-size: 11px; line-height: 1.35; }
.shop-card .price { font-size: 12px; font-weight: 700; }
.room-tab, .journal-tab { min-height: 38px; padding: 9px 13px; font-size: 12px; }
.layout-chip { min-height: 34px; padding: 7px 11px; font-size: 11px; }
.modal-kicker { font-size: 11px; }
.modal p, .help-copy { font-size: 13px; }
.monster-choice small, .monster-choice em, .evolution-pair { font-size: 10px; line-height: 1.35; }
.name-field { font-size: 13px; }
.inline-warning { font-size: 13px; }
.stat-row, .bond-card > div:first-child { font-size: 12px; }
.bond-card small, .growth-card p, .journal-note p { font-size: 12px; }
.summary-card small, .memory-card small, .timeline-entry small { font-size: 11px; line-height: 1.4; }
.mission-card small, .recipe-card small, .photo-grid article small, .collectible { font-size: 11px; }

.room-toolbar-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.room-editor-help {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid rgba(142,184,199,.32);
  border-radius: 10px;
  color: rgba(244,228,193,.84);
  background: rgba(142,184,199,.09);
  font-size: 12px;
  line-height: 1.5;
}
.inventory-card .price { color: var(--peach) !important; }

.room-editor-overlay {
  position: absolute;
  inset: 0;
  z-index: 18;
  pointer-events: none;
}
.room-editor-overlay .room-object {
  --hit-size: 48px;
  position: absolute;
  display: block;
  min-width: var(--hit-size);
  min-height: var(--hit-size);
  padding: 0;
  border: 0;
  color: transparent;
  background: transparent;
  pointer-events: auto;
  cursor: pointer;
  transform: translate(-50%, -100%);
  -webkit-tap-highlight-color: transparent;
}
.room-editor-overlay .room-object-handle,
.room-editor-overlay .room-object-label { display: none; }
.room-editor-overlay.editing {
  background: rgba(23,26,48,.08);
  pointer-events: auto;
}
.room-editor-overlay.editing::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(244,228,193,.10) 1px, transparent 1px),
    linear-gradient(90deg,rgba(244,228,193,.10) 1px,transparent 1px);
  background-size: 2.5% 4.444%;
  pointer-events: none;
}
.room-editor-overlay.editing .room-object {
  display: grid;
  place-items: center;
  min-width: 54px;
  min-height: 54px;
  border: 2px dashed rgba(244,228,193,.72);
  border-radius: 12px;
  color: var(--cream);
  background: rgba(37,42,74,.48);
  box-shadow: 0 4px 14px rgba(10,11,27,.28);
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.room-editor-overlay.editing .room-object:hover {
  border-color: var(--mist);
  background: rgba(37,42,74,.68);
}
.room-editor-overlay.editing .room-object.dragging {
  cursor: grabbing;
  border-style: solid;
  border-color: var(--peach);
  background: rgba(201,135,154,.54);
  box-shadow: 0 0 0 5px rgba(233,174,137,.18), 0 10px 22px rgba(10,11,27,.42);
}
.room-editor-overlay.editing .room-object.selected {
  border-style: solid;
  border-color: var(--peach);
  background: rgba(201,135,154,.45);
  box-shadow: 0 0 0 4px rgba(233,174,137,.18);
}
.room-editor-overlay.editing .room-object-handle {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  color: var(--ink);
  background: var(--cream);
  box-shadow: 2px 2px 0 rgba(23,26,48,.48);
  font-size: 17px;
  line-height: 1;
}
.room-editor-overlay.editing .room-object-label {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);
  display: none;
  width: max-content;
  max-width: 150px;
  transform: translateX(-50%);
  padding: 5px 8px;
  border: 2px solid var(--ink);
  border-radius: 7px;
  color: var(--ink);
  background: var(--cream);
  box-shadow: 2px 2px 0 rgba(23,26,48,.45);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
}
.room-editor-overlay.editing .room-object.selected .room-object-label,
.room-editor-overlay.editing .room-object:focus-visible .room-object-label { display: block; }

.room-editor-toolbar {
  position: absolute;
  z-index: 50;
  left: 12px;
  right: 12px;
  top: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  color: var(--ink);
  background: rgba(244,228,193,.96);
  box-shadow: 5px 5px 0 rgba(23,26,48,.46);
}
.editor-title { display: grid; gap: 2px; }
.editor-title strong { font-size: 13px; }
.editor-title small { color: var(--cocoa); font-size: 11px; }
.editor-toolbar-actions { display: flex; gap: 8px; }
.editor-toolbar-actions button {
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--cocoa);
  border-radius: 8px;
  color: var(--ink);
  background: #ead7b4;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}
.editor-toolbar-actions .primary {
  border-color: var(--ink);
  background: var(--peach);
}

.room-editor-panel {
  min-height: 250px;
  max-height: 39vh;
  overflow: hidden;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(37,42,74,.98);
  box-shadow: var(--shadow);
}
.editor-panel-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}
.editor-panel-top > div:first-child { display: grid; gap: 3px; }
.editor-panel-top strong { font-size: 15px; }
.editor-panel-top small { color: rgba(244,228,193,.68); font-size: 11px; }
.editor-layout-switcher {
  display: flex;
  max-width: 52%;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 3px;
}
.editor-layout-switcher button {
  flex: none;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--cream);
  background: rgba(23,26,48,.58);
  cursor: pointer;
  font-size: 11px;
}
.editor-layout-switcher button.active {
  color: var(--ink);
  border-color: var(--peach);
  background: var(--peach);
}
.editor-panel-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 32%);
  gap: 12px;
  min-height: 0;
  height: calc(100% - 50px);
}
.editor-catalog,
.editor-selection-panel {
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(23,26,48,.38);
}
.editor-catalog { display: grid; grid-template-rows: auto minmax(0,1fr); padding: 11px; }
.editor-section-heading { display: grid; gap: 2px; margin-bottom: 9px; }
.editor-section-heading strong { font-size: 13px; }
.editor-section-heading small { color: rgba(244,228,193,.62); font-size: 11px; }
.editor-object-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
  gap: 8px;
  overflow: auto;
  padding: 1px 4px 6px 1px;
  scrollbar-color: var(--dust) transparent;
}
.editor-object-card {
  min-height: 76px;
  display: grid;
  grid-template-columns: 42px minmax(0,1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 9px;
  border: 1px solid rgba(244,228,193,.22);
  border-radius: 10px;
  color: var(--cream);
  background: rgba(102,90,122,.28);
  text-align: left;
  cursor: pointer;
}
.editor-object-card:hover:not(:disabled) {
  border-color: var(--mist);
  background: rgba(102,90,122,.48);
}
.editor-object-card:disabled {
  opacity: .52;
  cursor: default;
}
.editor-object-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 9px;
  color: var(--ink);
  background: var(--cream);
  font-size: 25px;
}
.editor-object-copy { min-width: 0; display: grid; gap: 3px; }
.editor-object-copy strong { overflow: hidden; text-overflow: ellipsis; font-size: 12px; white-space: nowrap; }
.editor-object-copy small { color: rgba(244,228,193,.62); font-size: 10px; }
.editor-add-label {
  padding: 7px 8px;
  border-radius: 7px;
  color: var(--ink);
  background: var(--peach);
  font-size: 10px;
  font-weight: 900;
  white-space: nowrap;
}
.editor-object-card.placed .editor-add-label { background: var(--sage); }
.editor-selection-panel { padding: 12px; overflow: auto; }
.editor-empty-selection {
  min-height: 100%;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 7px;
  padding: 18px;
  text-align: center;
}
.editor-empty-selection > span { font-size: 34px; }
.editor-empty-selection strong { font-size: 13px; }
.editor-empty-selection small { max-width: 260px; color: rgba(244,228,193,.62); font-size: 11px; }
.editor-selected-card { display: grid; gap: 11px; }
.editor-selected-heading { display: flex; align-items: center; gap: 10px; }
.editor-selected-heading > span {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 10px;
  color: var(--ink);
  background: var(--cream);
  font-size: 27px;
}
.editor-selected-heading div { display: grid; gap: 2px; }
.editor-selected-heading small { color: var(--peach); font-size: 9px; letter-spacing: .08em; }
.editor-selected-heading strong { font-size: 14px; }
.editor-nudge {
  display: grid;
  grid-template-columns: repeat(4,1fr);
  gap: 6px;
}
.editor-nudge button,
.editor-selection-actions button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--cream);
  background: var(--dust);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}
.editor-nudge button { font-size: 19px; }
.editor-selection-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}
.editor-selection-actions .danger {
  color: #fff0e7;
  border-color: rgba(201,105,105,.55);
  background: #854f62;
}

body.room-editing {
  overflow: hidden;
}
body.room-editing .topbar,
body.room-editing .dock,
body.room-editing .action-panel { display: none; }
body.room-editing .app-shell {
  width: min(1250px,100%);
  height: 100dvh;
  min-height: 100dvh;
  grid-template-rows: minmax(0,1fr) auto;
  gap: 10px;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
}
body.room-editing .game-frame {
  align-self: center;
  width: min(100%, calc((100dvh - 300px) * 16 / 9));
  min-height: 220px;
  max-height: calc(100dvh - 300px);
  margin-inline: auto;
}

@media (max-width: 760px) {
  body { font-size: 14px; }
  .action-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .shop-grid { grid-template-columns: repeat(auto-fill,minmax(150px,1fr)); max-height: 330px; }
  .shop-card { min-height: 104px; }
  .room-toolbar-main { align-items: stretch; flex-direction: column; }
  .room-toolbar-main .primary-button { margin-top: 0; }

  body.room-editing .app-shell {
    grid-template-rows: auto minmax(0,1fr);
    overflow: hidden;
  }
  body.room-editing .game-frame {
    width: 100%;
    min-height: 190px;
    max-height: none;
  }
  .room-editor-toolbar {
    left: 7px;
    right: 7px;
    top: 7px;
    align-items: stretch;
    padding: 8px;
  }
  .editor-title small { display: none; }
  .editor-toolbar-actions { margin-left: auto; }
  .editor-toolbar-actions button { min-height: 38px; padding: 7px 9px; }
  .editor-toolbar-actions button:first-child { display: none; }
  .room-editor-panel {
    min-height: 0;
    max-height: none;
    height: 46dvh;
    padding: 10px;
  }
  .editor-panel-top { display: block; margin-bottom: 8px; }
  .editor-panel-top > div:first-child small { display: none; }
  .editor-layout-switcher { max-width: 100%; margin-top: 7px; }
  .editor-panel-grid {
    grid-template-columns: minmax(0,1fr);
    grid-template-rows: minmax(0,1fr) auto;
    height: calc(100% - 67px);
  }
  .editor-selection-panel { padding: 8px; }
  .editor-empty-selection { min-height: 66px; grid-template-columns: auto 1fr; justify-items: start; align-items: center; text-align: left; padding: 8px; }
  .editor-empty-selection > span { grid-row: 1/3; font-size: 25px; }
  .editor-empty-selection small { font-size: 10px; }
  .editor-selected-card { grid-template-columns: minmax(125px,1fr) auto; align-items: center; gap: 8px; }
  .editor-selected-heading > span { width: 40px; height: 40px; font-size: 22px; }
  .editor-selected-heading strong { font-size: 12px; }
  .editor-nudge { grid-template-columns: repeat(4,36px); }
  .editor-nudge button { min-height: 36px; }
  .editor-selection-actions { grid-column: 1/-1; grid-template-columns: repeat(4,1fr); }
  .editor-selection-actions button { min-height: 36px; padding: 5px; font-size: 10px; }
  .editor-object-list { grid-template-columns: 1fr; }
  .editor-object-card { min-height: 67px; }
  .room-editor-overlay.editing .room-object { min-width: 58px; min-height: 58px; }
}

@media (max-width: 430px) {
  .portrait-copy small { font-size: 10px; }
  .currency-chip { font-size: 11px; }
  .dock-button small { font-size: 10px; }
  .action-card strong { font-size: 13px; }
  .action-card small { font-size: 10px; }
  .shop-card strong { font-size: 12px; }
  .shop-card small { font-size: 10px; }
  .room-tab, .journal-tab { font-size: 11px; }
  .editor-title strong { font-size: 11px; }
  .editor-toolbar-actions .primary { font-size: 11px; }
  .room-editor-panel { height: 49dvh; }
  .editor-panel-top strong { font-size: 13px; }
  .editor-layout-switcher button { min-height: 31px; font-size: 10px; }
  .editor-object-card { grid-template-columns: 38px minmax(0,1fr) auto; padding: 7px; }
  .editor-object-icon { width: 38px; height: 38px; font-size: 22px; }
  .editor-add-label { font-size: 9px; padding: 6px; }
}

/* Minimum readable text sizes across collection, journal and minigames */
.version-label { font-size: 10px; }
.collection-controls label { font-size: 11px; }
.pet-box-copy small,
.pet-box-copy time { font-size: 11px; }
.pet-box-copy p { font-size: 12px; line-height: 1.45; }
.pet-select-button,
.pet-card-actions button,
.detail-actions button,
.box-back { font-size: 11px; }
.detail-stat small,
.detail-stat strong { font-size: 11px; }
.detail-section h3 { font-size: 13px; }
.detail-section p { font-size: 12px; }
.detail-section small { font-size: 11px; }
.collection-counts span { font-size: 11px; }
.mixer-row output { font-size: 12px; }
.record-strip,
.species-bonus { font-size: 11px; line-height: 1.4; }
.score-line,
.game-score { font-size: 12px; }
.editor-object-copy small,
.editor-add-label,
.editor-selected-heading small { font-size: 11px; }

@media (orientation: landscape) and (max-height: 620px) {
  body.room-editing .app-shell {
    grid-template-columns: minmax(0,1fr) minmax(360px,42vw);
    grid-template-rows: minmax(0,1fr);
  }
  body.room-editing .game-frame {
    grid-column: 1;
    width: 100%;
    min-height: 0;
    max-height: calc(100dvh - 24px);
  }
  .room-editor-panel {
    grid-column: 2;
    height: calc(100dvh - 24px);
    max-height: none;
  }
  .editor-panel-grid {
    grid-template-columns: minmax(0,1fr);
    grid-template-rows: minmax(0,1fr) auto;
  }
  .editor-selection-actions { grid-template-columns: repeat(4,1fr); }
  .editor-selection-actions button { min-height: 38px; padding: 5px; font-size: 10px; }
}

/* DreamPet v4.2 — editor che non deforma la stanza e non copre gli oggetti */
.room-editor-toolbar { display: none !important; }

body.room-editing {
  --editor-side-width: 390px;
  overflow: hidden;
}
body.room-editing .topbar,
body.room-editing .dock,
body.room-editing .action-panel { display: none !important; }
body.room-editing .app-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: none;
  height: 100dvh;
  min-height: 100dvh;
  padding: 16px calc(var(--editor-side-width) + 28px) 16px 16px;
}
body.room-editing .game-frame {
  flex: 0 1 auto;
  width: min(100%, calc((100dvh - 32px) * 16 / 9));
  max-width: 1100px;
  min-height: 0;
  max-height: none;
  margin: 0 auto;
  aspect-ratio: 16 / 9;
}
body.room-editing .scene-badge,
body.room-editing .observe-button,
body.room-editing .visitor-badge,
body.room-editing .speech-bubble,
body.room-editing .toast { display: none !important; }

.room-editor-panel {
  position: fixed;
  z-index: 100;
  top: 12px;
  right: 12px;
  bottom: 12px;
  width: var(--editor-side-width);
  height: auto;
  min-height: 0;
  max-height: none;
  overflow: hidden;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(37,42,74,.985);
  box-shadow: 0 20px 48px rgba(8,9,24,.58);
}
.editor-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.editor-drawer-title { display: grid; gap: 2px; min-width: 0; }
.editor-drawer-title strong { font-size: 16px; }
.editor-drawer-title small { color: rgba(244,228,193,.68); font-size: 11px; }
.editor-drawer-actions { display: flex; gap: 7px; flex: none; }
.editor-drawer-actions button {
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--cream);
  background: var(--dust);
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
}
.editor-drawer-actions .primary {
  color: var(--ink);
  border-color: var(--peach);
  background: var(--peach);
}
.room-editor-panel .editor-panel-top {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}
.room-editor-panel .editor-layout-switcher {
  max-width: 100%;
}
.room-editor-panel .editor-panel-grid {
  grid-template-columns: minmax(0,1fr);
  grid-template-rows: minmax(0,1fr) auto;
  height: calc(100% - 132px);
}
.room-editor-panel .editor-selection-panel {
  max-height: 205px;
}
.room-editor-panel .editor-object-list {
  grid-template-columns: 1fr;
}

/* Le hit-area restano comode ma non nascondono ciò che viene disegnato sul canvas. */
.room-editor-overlay.editing {
  background: transparent !important;
}
.room-editor-overlay.editing::before {
  opacity: .42;
}
.room-editor-overlay.editing .room-object,
.room-editor-overlay.editing .room-object:hover,
.room-editor-overlay.editing .room-object.selected,
.room-editor-overlay.editing .room-object.dragging {
  min-width: 50px;
  min-height: 50px;
  border: 1px dashed rgba(244,228,193,.52);
  border-radius: 9px;
  color: transparent;
  background: transparent !important;
  box-shadow: none;
}
.room-editor-overlay.editing .room-object.selected {
  border: 2px solid var(--peach);
  outline: 3px solid rgba(233,174,137,.18);
  outline-offset: 2px;
}
.room-editor-overlay.editing .room-object.dragging {
  z-index: 999 !important;
  border: 2px solid var(--mist);
  outline: 4px solid rgba(142,184,199,.2);
  outline-offset: 2px;
}
.room-editor-overlay.editing .room-object-handle {
  position: absolute;
  top: -12px;
  right: -12px;
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  color: var(--ink);
  background: var(--cream);
  box-shadow: 2px 2px 0 rgba(23,26,48,.42);
  font-size: 13px;
  pointer-events: none;
}
.room-editor-overlay.editing .room-object-label,
.room-editor-overlay.editing .room-object.selected .room-object-label,
.room-editor-overlay.editing .room-object:focus-visible .room-object-label {
  display: none !important;
}
body.room-object-dragging .room-editor-overlay.editing::before { opacity: .18; }

@media (max-width: 900px) {
  body.room-editing {
    --editor-drawer-height: min(42dvh, 350px);
  }
  body.room-editing .app-shell {
    padding: 10px 10px calc(var(--editor-drawer-height) + 20px);
  }
  body.room-editing .game-frame {
    width: min(100%, calc((100dvh - var(--editor-drawer-height) - 30px) * 16 / 9));
  }
  .room-editor-panel {
    top: auto;
    left: 8px;
    right: 8px;
    bottom: 8px;
    width: auto;
    height: var(--editor-drawer-height);
  }
  .room-editor-panel .editor-panel-grid {
    grid-template-columns: minmax(0,1fr) minmax(235px,36%);
    grid-template-rows: minmax(0,1fr);
    height: calc(100% - 126px);
  }
  .room-editor-panel .editor-selection-panel { max-height: none; }
}

@media (max-width: 620px) {
  body.room-editing {
    --editor-drawer-height: min(46dvh, 380px);
  }
  .editor-drawer-title small { display: none; }
  .editor-drawer-title strong { font-size: 14px; }
  .editor-drawer-actions button { min-height: 36px; padding: 6px 8px; }
  .room-editor-panel { padding: 9px; }
  .room-editor-panel .editor-panel-top {
    grid-template-columns: 1fr;
    margin-bottom: 7px;
  }
  .room-editor-panel .editor-panel-top > div:first-child small { display: none; }
  .room-editor-panel .editor-panel-grid {
    grid-template-columns: minmax(0,1fr);
    grid-template-rows: minmax(0,1fr) auto;
    height: calc(100% - 116px);
  }
  .room-editor-panel .editor-selection-panel {
    max-height: 118px;
    padding: 7px;
  }
  .room-editor-panel .editor-selected-card {
    grid-template-columns: minmax(120px,1fr) auto;
    align-items: center;
    gap: 7px;
  }
  .room-editor-panel .editor-selected-heading > span {
    width: 38px;
    height: 38px;
    font-size: 21px;
  }
  .room-editor-panel .editor-nudge {
    grid-template-columns: repeat(4,34px);
  }
  .room-editor-panel .editor-nudge button { min-height: 34px; }
  .room-editor-panel .editor-selection-actions {
    grid-column: 1 / -1;
    grid-template-columns: repeat(4,1fr);
  }
  .room-editor-panel .editor-selection-actions button {
    min-height: 34px;
    padding: 4px;
    font-size: 10px;
  }
  .room-editor-overlay.editing .room-object,
  .room-editor-overlay.editing .room-object:hover,
  .room-editor-overlay.editing .room-object.selected,
  .room-editor-overlay.editing .room-object.dragging {
    min-width: 46px;
    min-height: 46px;
  }
}

@media (orientation: landscape) and (max-height: 620px) {
  body.room-editing {
    --editor-side-width: min(390px, 42vw);
  }
  body.room-editing .app-shell {
    padding: 10px calc(var(--editor-side-width) + 20px) 10px 10px;
  }
  body.room-editing .game-frame {
    width: min(100%, calc((100dvh - 20px) * 16 / 9));
  }
  .room-editor-panel {
    top: 8px;
    left: auto;
    right: 8px;
    bottom: 8px;
    width: var(--editor-side-width);
    height: auto;
  }
  .room-editor-panel .editor-panel-grid {
    grid-template-columns: minmax(0,1fr);
    grid-template-rows: minmax(0,1fr) auto;
    height: calc(100% - 122px);
  }
}

/* v4.2.1 — nessuna maniglia o riquadro può coprire la decorazione */
.room-editor-overlay.editing .room-object,
.room-editor-overlay.editing .room-object.selected,
.room-editor-overlay.editing .room-object.dragging {
  border-color: transparent;
}
.room-editor-overlay.editing .room-object:hover {
  border: 1px dashed rgba(244,228,193,.55);
}
.room-editor-overlay.editing .room-object.selected {
  border: 2px solid var(--peach);
}
.room-editor-overlay.editing .room-object.dragging {
  border: 2px solid var(--mist);
}
.room-editor-overlay.editing .room-object .room-object-handle {
  display: none !important;
  width: 24px !important;
  height: 24px !important;
  min-width: 24px !important;
  min-height: 24px !important;
  font-size: 12px !important;
  line-height: 1 !important;
}
.room-editor-overlay.editing .room-object.selected .room-object-handle,
.room-editor-overlay.editing .room-object.dragging .room-object-handle {
  display: grid !important;
}

@media (max-width: 620px) and (orientation: portrait) {
  body.room-editing .app-shell {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 8px;
    padding: 8px;
    overflow: hidden;
  }
  body.room-editing .game-frame {
    flex: 0 0 auto;
    width: 100%;
    max-width: none;
    margin: 0;
  }
  .room-editor-panel {
    position: static;
    flex: 1 1 auto;
    width: 100%;
    height: auto;
    min-height: 0;
    max-height: none;
  }
  .room-editor-panel .editor-panel-grid {
    height: calc(100% - 116px);
  }
}

/* DreamPet v4.3 — pixel art restyle inspired by attached reference */
:root {
  --bg:#141028;
  --bg2:#1d1740;
  --panel:#251d4e;
  --panel2:#2f2663;
  --edge:#0c0920;
  --hi:#4a3f8f;
  --txt:#e8e4ff;
  --dim:#9a90cf;
  --gold:#ffd166;
  --cyan:#43e8d8;
  --red:#ff5d6c;
  --green:#5dff9b;
  --cream:#f6f0ff;
  --ink:#090714;
  --shadow: 0 6px 0 rgba(12,9,32,.95), 0 14px 28px rgba(0,0,0,.32);
  font-family: 'VT323', ui-monospace, monospace;
}

html {
  background: var(--bg);
}
body {
  color: var(--txt);
  font-family: 'VT323', ui-monospace, monospace;
  font-size: 22px;
  background:
    radial-gradient(circle at top center, rgba(74,63,143,.34), transparent 38%),
    linear-gradient(180deg, #1b1640 0%, #141028 55%, #100c24 100%);
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,.13) 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply;
}
button, input, select, textarea {
  font-family: 'VT323', ui-monospace, monospace;
}
body.room-editing {
  overflow-x: hidden;
}

h1, h2, h3,
.modal-kicker,
.primary-button, .secondary-button, .danger-button,
.observe-button, .dock-button small, .dock-button strong,
.room-tab, .journal-tab, .close-button,
.editor-drawer-title strong, .editor-section-heading strong,
.room-toolbar-main .primary-button, .layout-chip, .editor-drawer-actions button,
.editor-layout-switcher button, .shop-card strong,
.action-card strong, .pixel-heading, .version-label {
  font-family: 'Press Start 2P', monospace;
  letter-spacing: .02em;
}

.app-shell {
  width: min(1180px, 100%);
  gap: 12px;
}
.topbar {
  padding: 8px 10px;
  border: 3px solid var(--edge);
  border-radius: 6px;
  background: var(--bg2);
  box-shadow: inset 0 0 0 2px var(--hi), 0 4px 0 var(--edge);
}
.portrait-button,
.currency-chip,
.icon-button,
.mini-icon-button,
.volume-control,
.dock,
.action-panel,
.game-frame,
.modal form,
.shop-card,
.summary-card,
.room-tab,
.journal-tab,
.layout-chip,
.editor-object-card,
.editor-selected-card,
.editor-empty-selection,
.editor-selection-panel,
.editor-catalog,
.bond-card,
.growth-card,
.status-heading,
.inline-warning,
.reward-pill,
.help-copy,
.mixer-row,
.minigame-body,
.pet-card,
.pet-box-toolbar,
.pet-box-filters,
.pet-memory-card {
  border: 3px solid var(--edge) !important;
  border-radius: 4px !important;
  box-shadow: inset 0 0 0 2px var(--hi), 0 4px 0 var(--edge) !important;
}
.game-frame {
  border-radius: 6px !important;
  background: #120f28;
  overflow: hidden;
}
#gameCanvas {
  background: #171337;
}
.portrait-button,
.currency-chip,
.icon-button,
.mini-icon-button,
.volume-control {
  background: var(--panel) !important;
  color: var(--txt);
}
.icon-button,
.mini-icon-button,
.close-button {
  display: grid;
  place-items: center;
  min-width: 40px;
  min-height: 40px;
  background: var(--panel2) !important;
}
.primary-button, .secondary-button, .danger-button,
.room-tab, .journal-tab, .layout-chip, .editor-drawer-actions button,
.editor-layout-switcher button, .editor-selection-actions button,
.editor-object-card, .action-card, .dock-button {
  border: 3px solid var(--edge);
  border-radius: 4px;
  box-shadow: inset 0 0 0 2px var(--hi), 0 4px 0 var(--edge);
}
.primary-button, .secondary-button, .danger-button,
.editor-drawer-actions button,
.editor-layout-switcher button,
.editor-selection-actions button,
.layout-chip,
.room-tab,
.journal-tab {
  min-height: 42px;
  padding: 10px 12px;
  font-size: 10px;
  line-height: 1.5;
  color: var(--txt);
  background: var(--panel2);
}
.primary-button,
.editor-drawer-actions .primary,
.room-toolbar-main .primary-button { background: #5b4a10; box-shadow: inset 0 0 0 2px var(--gold), 0 4px 0 var(--edge); color: #fff1bd; }
.secondary-button { background: #0e5b54; box-shadow: inset 0 0 0 2px var(--cyan), 0 4px 0 var(--edge); color: #d3fffb; }
.danger-button, .editor-selection-actions .danger { background: #6b1a24; box-shadow: inset 0 0 0 2px var(--red), 0 4px 0 var(--edge); color: #ffdbe0; }
.primary-button:active, .secondary-button:active, .danger-button:active,
.room-tab:active, .journal-tab:active, .layout-chip:active, .editor-drawer-actions button:active,
.editor-layout-switcher button:active, .editor-selection-actions button:active,
.action-card:active, .dock-button:active, .editor-object-card:active {
  transform: translateY(2px);
  box-shadow: inset 0 0 0 2px var(--hi), 0 2px 0 var(--edge);
}
.portrait-copy strong, .currency-chip strong, .topbar strong, .topbar small {
  font-size: 18px;
}
.portrait-copy small { color: var(--dim); }
.currency-chip { font-size: 18px; }
.currency-chip span { color: var(--gold) !important; }
.currency-chip.dream span { color: var(--cyan) !important; }
.observe-button {
  background: var(--panel2) !important;
  color: var(--txt);
  font-size: 10px;
  padding: 10px 12px;
}
.scene-badge, .visitor-badge {
  border: 3px solid var(--edge);
  border-radius: 4px;
  color: var(--gold);
  background: rgba(10,8,25,.82);
  box-shadow: inset 0 0 0 2px var(--hi), 0 3px 0 var(--edge);
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
}
.speech-bubble, .toast {
  border: 3px solid var(--edge);
  border-radius: 4px;
  color: var(--txt);
  background: var(--panel);
  box-shadow: inset 0 0 0 2px var(--hi), 0 4px 0 var(--edge);
  font-size: 18px;
}
.speech-bubble::after {
  background: var(--panel);
  border-right: 3px solid var(--edge);
  border-bottom: 3px solid var(--edge);
}
.dock {
  background: var(--bg2);
  padding: 6px;
}
.dock-button {
  min-height: 68px;
  background: transparent;
}
.dock-button span {
  font-size: 24px;
}
.dock-button small {
  font-size: 9px;
  color: var(--dim);
}
.dock-button.active {
  background: #372d72;
}
.dock-button.active small { color: var(--gold); }
.action-panel {
  background: var(--panel);
}
.panel-content {
  padding: 14px;
}
.action-grid {
  gap: 10px;
}
.action-card {
  min-height: 118px;
  padding: 12px 10px;
  background: rgba(20,16,40,.45);
  color: var(--txt);
}
.action-card span {
  font-size: 24px;
}
.action-card strong {
  font-size: 10px;
  line-height: 1.5;
}
.action-card small, .help-copy, .room-editor-help, .editor-drag-note {
  font-size: 18px;
  line-height: 1.2;
  color: var(--dim);
}
.shop-card {
  background: rgba(20,16,40,.55) !important;
}
.shop-card strong { font-size: 9px; line-height: 1.45; color: var(--txt); }
.shop-card small, .shop-card .price { font-size: 17px; color: var(--dim); }
.room-tab.active, .journal-tab.active, .layout-chip.active {
  background: #372d72;
  color: var(--gold);
  box-shadow: inset 0 0 0 2px var(--gold), 0 4px 0 var(--edge);
}
.room-toolbar-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.layout-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.modal {
  border: 0;
  padding: 0;
  background: rgba(8,7,18,.75);
}
.modal::backdrop {
  background: rgba(8,7,18,.78);
}
.modal form, .pet-box-body {
  background: var(--panel) !important;
  color: var(--txt);
}
.modal-kicker {
  color: var(--gold);
  font-size: 9px;
}
.modal h1, .modal h2 {
  font-size: clamp(18px, 3vw, 28px);
  color: var(--cream);
  line-height: 1.5;
}
.name-field span, .mixer-row span, .bond-card span, .growth-card strong, .stats-list strong,
.editor-selected-heading small, .editor-section-heading small, .editor-panel-top small {
  font-size: 17px;
}
.stats-list, .journal-content, .pet-box-list, .pet-grid {
  font-size: 18px;
}

/* Pixel room editor layout */
.room-editor-panel {
  margin-top: 10px;
  padding: 12px;
  background: var(--bg2) !important;
  border: 3px solid var(--edge) !important;
  border-radius: 6px !important;
  box-shadow: inset 0 0 0 2px var(--hi), 0 4px 0 var(--edge) !important;
}
.editor-drawer-header,
.editor-panel-top,
.editor-selection-panel,
.editor-catalog {
  background: rgba(17,14,34,.52);
  border-radius: 4px;
}
.editor-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
  border: 3px solid var(--edge);
  box-shadow: inset 0 0 0 2px var(--hi);
}
.editor-drawer-title strong {
  display: block;
  font-size: 11px;
  color: var(--gold);
}
.editor-drawer-title small {
  display: block;
  margin-top: 6px;
  font-size: 18px;
  color: var(--dim);
}
.editor-drawer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.editor-panel-top {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
  border: 3px solid var(--edge);
  box-shadow: inset 0 0 0 2px var(--hi);
}
.editor-panel-top strong {
  font-size: 20px;
  color: var(--cream);
}
.editor-layout-switcher {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: start;
  justify-content: flex-end;
}
.editor-panel-grid {
  display: grid !important;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, .95fr) !important;
  gap: 12px;
  align-items: start;
}
.editor-catalog, .editor-selection-panel {
  padding: 10px;
  min-height: 100%;
}
.editor-section-heading {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 10px;
}
.editor-section-heading strong {
  font-size: 10px;
  color: var(--gold);
}
.editor-object-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
  max-height: 48vh;
  overflow: auto;
  padding-right: 2px;
}
.editor-object-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 10px;
  text-align: left;
  background: rgba(16,12,36,.68);
}
.editor-object-card .editor-add-label {
  grid-column: 1 / -1;
  margin-top: 4px;
  color: var(--gold);
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
}
.editor-object-card.placed {
  opacity: .55;
}
.editor-object-icon {
  font-size: 28px;
}
.editor-object-copy strong {
  font-size: 9px;
  color: var(--cream);
  line-height: 1.45;
}
.editor-object-copy small {
  display: block;
  margin-top: 4px;
  font-size: 17px;
  color: var(--dim);
}
.editor-selected-card,
.editor-empty-selection {
  min-height: 170px;
  padding: 12px;
  background: rgba(16,12,36,.78);
}
.editor-selected-heading {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}
.editor-selected-heading > span {
  font-size: 28px;
}
.editor-selected-heading strong {
  font-size: 10px;
  line-height: 1.5;
}
.editor-selection-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.editor-selection-actions button {
  width: 100%;
}
.editor-empty-selection {
  display: grid;
  gap: 8px;
  align-content: start;
}
.editor-empty-selection span {
  font-size: 30px;
  color: var(--gold);
}
.editor-empty-selection strong {
  font-size: 10px;
  line-height: 1.45;
}

/* Room editing overlay: drag directly, no blocking blocks */
.room-editor-overlay.editing {
  background: rgba(0,0,0,.02);
}
.room-editor-overlay.editing::before {
  opacity: .12;
  background-size: 5% 8.888%;
}
.room-editor-overlay.editing .room-object,
.room-editor-overlay.editing .room-object:hover,
.room-editor-overlay.editing .room-object.selected,
.room-editor-overlay.editing .room-object.dragging {
  background: transparent !important;
  color: transparent !important;
  border: 2px dashed rgba(255, 209, 102, .8) !important;
  border-radius: 4px !important;
  box-shadow: none !important;
  min-width: 24px;
  min-height: 24px;
}
.room-editor-overlay.editing .room-object:hover {
  border-color: rgba(67,232,216,.95) !important;
}
.room-editor-overlay.editing .room-object.selected {
  border-style: solid !important;
  border-color: var(--cyan) !important;
  outline: 2px solid rgba(255,255,255,.7);
  outline-offset: 1px;
}
.room-editor-overlay.editing .room-object.dragging {
  border-color: var(--gold) !important;
  outline: 2px solid rgba(255,209,102,.65);
}
.room-editor-overlay.editing .room-object .room-object-handle {
  display: grid !important;
  position: absolute;
  right: -8px;
  bottom: -8px;
  width: 20px;
  height: 20px;
  place-items: center;
  border: 2px solid var(--edge);
  border-radius: 4px;
  background: var(--gold);
  color: var(--ink);
  font-size: 11px;
  box-shadow: 0 2px 0 var(--edge);
  pointer-events: none;
}
.room-editor-overlay.editing .room-object.selected .room-object-handle,
.room-editor-overlay.editing .room-object.dragging .room-object-handle {
  display: grid !important;
}
.room-editor-overlay.editing .room-object-label,
.room-editor-overlay.editing .room-object.selected .room-object-label,
.room-editor-overlay.editing .room-object:focus-visible .room-object-label {
  display: block !important;
  position: absolute;
  left: 0;
  bottom: calc(100% + 6px);
  padding: 2px 6px;
  white-space: nowrap;
  border: 2px solid var(--edge);
  border-radius: 4px;
  background: rgba(37,29,78,.95);
  color: var(--gold);
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  line-height: 1.45;
  box-shadow: 0 2px 0 var(--edge);
}
body.room-object-dragging .scene-badge,
body.room-object-dragging .speech-bubble,
body.room-object-dragging .visitor-badge,
body.room-object-dragging .toast,
body.room-editing .scene-badge,
body.room-editing .visitor-badge {
  opacity: 0;
}

.pet-box-modal .pet-box-body,
.onboarding-modal form,
.status-modal form,
.audio-modal form,
.pause-modal form,
.event-modal form,
.minigame-modal form {
  max-width: min(980px, 96vw);
}

@media (max-width: 980px) {
  .app-shell {
    padding-inline: 10px;
  }
  .topbar {
    flex-wrap: wrap;
    justify-content: center;
  }
  .topbar-actions {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }
  .action-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .editor-panel-grid {
    grid-template-columns: 1fr !important;
  }
  .editor-object-list {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    max-height: none;
  }
  .editor-selection-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 720px) {
  body { font-size: 20px; }
  .app-shell {
    grid-template-rows: auto auto auto minmax(220px, auto);
  }
  .dock-button {
    min-height: 60px;
  }
  .dock-button span {
    font-size: 20px;
  }
  .panel-content {
    padding: 10px;
  }
  .room-editor-panel {
    padding: 10px;
  }
  .editor-drawer-header,
  .editor-panel-top {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: flex-start;
  }
  .editor-drawer-actions,
  .editor-layout-switcher {
    width: 100%;
    justify-content: flex-start;
  }
  .editor-selection-actions {
    grid-template-columns: 1fr;
  }
  .primary-button, .secondary-button, .danger-button,
  .editor-drawer-actions button,
  .editor-layout-switcher button,
  .editor-selection-actions button,
  .room-tab, .journal-tab, .layout-chip {
    font-size: 9px;
  }
}

/* DreamPet v4.4 — palette pastello lo-fi e minigiochi guidati */
:root {
  --bg:#303149;
  --bg2:#3d3c58;
  --panel:#4b4867;
  --panel2:#5a5575;
  --edge:#15131f;
  --hi:#817a9d;
  --txt:#fff5e8;
  --dim:#d4cad8;
  --gold:#f0d6a1;
  --cyan:#b4ded7;
  --red:#e1a0a7;
  --green:#b9d6b0;
  --night:#444663;
  --dust:#7d7292;
  --rose:#d9a6b2;
  --peach:#efc3a4;
  --cream:#fff4df;
  --sage:#a9c3a1;
  --mist:#add0d6;
  --cocoa:#80696c;
  --ink:#11101a;
}
html { background:#303149; }
body {
  background:
    radial-gradient(circle at 50% -12%, rgba(180,222,215,.24), transparent 38%),
    radial-gradient(circle at 10% 35%, rgba(217,166,178,.14), transparent 32%),
    linear-gradient(180deg,#4a4865 0%,#35354f 52%,#2d2d45 100%);
}
body::after { opacity:.4; }
.topbar,.dock,.action-panel,.room-editor-panel { background:rgba(75,72,103,.95) !important; }
.portrait-button,.currency-chip,.icon-button,.mini-icon-button,.volume-control { background:#575270 !important; }
.primary-button,.editor-drawer-actions .primary,.room-toolbar-main .primary-button {
  color:#2b2430;
  background:#f0d6a1;
  box-shadow:inset 0 0 0 2px #fff0ca,0 4px 0 var(--edge);
}
.secondary-button { color:#263638; background:#b4ded7; box-shadow:inset 0 0 0 2px #d8f0ec,0 4px 0 var(--edge); }
.danger-button,.editor-selection-actions .danger { color:#402126; background:#e1a0a7; box-shadow:inset 0 0 0 2px #f3c3c8,0 4px 0 var(--edge); }
.room-tab.active,.journal-tab.active,.layout-chip.active,.dock-button.active {
  color:#fff7e7;
  background:#756d91;
  box-shadow:inset 0 0 0 2px #b4ded7,0 4px 0 var(--edge);
}
.action-card,.shop-card,.editor-object-card,.editor-selected-card,.editor-empty-selection {
  background:rgba(56,54,79,.72) !important;
}
.scene-badge,.visitor-badge { color:#fff0ce; background:rgba(61,60,88,.9); }
.speech-bubble,.toast { color:#2d2935; background:#fff1dc; box-shadow:inset 0 0 0 2px #f0d6a1,0 4px 0 var(--edge); }
.speech-bubble::after { background:#fff1dc; }
.modal form,.pet-box-body { background:#4b4867 !important; }
.minigame-body {
  background:
    linear-gradient(rgba(75,72,103,.88),rgba(58,57,82,.94)),
    repeating-linear-gradient(90deg,rgba(255,255,255,.02) 0 8px,transparent 8px 16px);
}
.monster-choice {
  background:rgba(55,53,78,.72);
  border:3px solid var(--edge);
  border-radius:4px;
  box-shadow:inset 0 0 0 2px var(--hi),0 4px 0 var(--edge);
}
.monster-choice canvas {
  width:72px;
  height:72px;
  border:3px solid var(--edge);
  border-radius:4px;
  background:#817a9d;
  box-shadow:inset 0 0 0 2px rgba(255,244,223,.25);
}
.monster-choice:has(input:checked) {
  background:rgba(180,222,215,.16);
  box-shadow:inset 0 0 0 3px var(--cyan),0 4px 0 var(--edge);
}

/* Catalogo sei minigiochi */
.minigames-grid { grid-template-columns:repeat(3,minmax(0,1fr)); }
.minigames-grid .action-card { min-height:132px; }
.minigames-grid .action-card small { max-width:26ch; }

.minigame-screen { min-height:380px; padding:20px; }
.minigame-intro { align-content:start; max-width:760px; margin:auto; }
.minigame-intro-icon {
  width:62px;height:62px;margin:0 auto;display:grid;place-items:center;
  border:3px solid var(--edge);border-radius:4px;background:#756d91;
  box-shadow:inset 0 0 0 2px var(--cyan),0 4px 0 var(--edge);font-size:34px;
}
.minigame-goal { display:grid;gap:6px;padding:12px;border:3px solid var(--edge);background:rgba(255,244,223,.1);box-shadow:inset 0 0 0 2px var(--hi); }
.minigame-goal small { font-family:'Press Start 2P',monospace;font-size:9px;color:var(--gold); }
.minigame-goal strong { font-size:24px; }
.how-to-play { list-style:none;padding:0;margin:0;display:grid;grid-template-columns:repeat(3,1fr);gap:10px;counter-reset:none; }
.how-to-play li { display:grid;grid-template-columns:38px 1fr;align-items:center;gap:8px;padding:10px;text-align:left;border:3px solid var(--edge);background:rgba(48,49,73,.7);box-shadow:inset 0 0 0 2px var(--hi); }
.how-to-play li span { width:34px;height:34px;display:grid;place-items:center;background:var(--peach);color:var(--ink);border:2px solid var(--edge);font-family:'Press Start 2P',monospace;font-size:10px; }
.how-to-play li p { margin:0;font-size:19px;line-height:1.15; }
.control-hint { padding:9px 12px;border:2px dashed rgba(255,244,223,.5);color:var(--dim);font-size:18px;line-height:1.2; }
.difficulty-grid { display:grid;grid-template-columns:repeat(3,1fr);gap:9px; }
.difficulty-card { min-height:82px;padding:10px;border:3px solid var(--edge);border-radius:4px;color:var(--txt);background:#575270;box-shadow:inset 0 0 0 2px var(--hi),0 4px 0 var(--edge);cursor:pointer; }
.difficulty-card strong { display:block;font-family:'Press Start 2P',monospace;font-size:9px;line-height:1.5; }
.difficulty-card small { display:block;margin-top:6px;font-size:17px;color:var(--dim); }
.difficulty-card.selected { background:#766f91;box-shadow:inset 0 0 0 2px var(--gold),0 4px 0 var(--edge); }
.record-strip,.species-bonus { border:2px solid rgba(180,222,215,.45);border-radius:4px;background:rgba(180,222,215,.1);font-size:17px;line-height:1.2; }
.minigame-start { justify-self:center;min-width:min(100%,330px); }
.game-active-screen { align-content:start; }
.live-instruction { display:grid;gap:5px;padding:10px;border:3px solid var(--edge);background:rgba(255,244,223,.1);box-shadow:inset 0 0 0 2px var(--hi); }
.live-instruction strong { font-family:'Press Start 2P',monospace;font-size:10px;line-height:1.5;color:var(--gold); }
.live-instruction small { font-size:18px;color:var(--dim); }
.score-line { display:flex;justify-content:center;flex-wrap:wrap;gap:16px;font-size:20px; }
.score-line strong { color:var(--gold); }
.big-game-button { min-width:min(100%,320px);justify-self:center;font-size:11px; }
.game-timer { height:16px;padding:3px;border:3px solid var(--edge);background:#302f47;box-shadow:inset 0 0 0 1px var(--hi); }
.game-timer span { display:block;height:100%;width:100%;background:linear-gradient(90deg,var(--cyan),var(--gold)); }
.beat-cue { min-height:100px;display:grid;place-items:center;align-content:center;gap:4px; }
.beat-cue span { font-family:'Press Start 2P',monospace;font-size:54px;color:#fff4df;text-shadow:4px 4px 0 var(--edge); }
.beat-cue small { font-family:'Press Start 2P',monospace;font-size:9px;color:var(--gold); }
.rhythm-pad button { background:#a9cad3;border:3px solid var(--edge);border-radius:4px;color:#242333;box-shadow:inset 0 0 0 2px #d5eaec,0 5px 0 var(--edge); }
.rhythm-pad button.cue { box-shadow:inset 0 0 0 3px var(--gold),0 5px 0 var(--edge); }
.rhythm-pad button.good { background:#b9d6b0; }
.rhythm-pad button.bad { background:#e1a0a7; }
.clear-stack { border:3px solid var(--edge);border-bottom-width:12px;background:linear-gradient(#8d8aaa,#676681);box-shadow:inset 0 0 0 2px rgba(255,244,223,.25); }
.stack-guide { position:absolute;height:22px;border:3px dashed #fff1c9;background:rgba(240,214,161,.12);pointer-events:none; }
.stack-piece { height:22px;border:3px solid var(--edge);border-radius:3px;background:#efc3a4;color:#2a2330;box-shadow:inset 0 0 0 1px #fff0d6; }
.stack-piece.placed:nth-of-type(even) { background:#d9a6b2; }
.stack-piece.miss { background:#e1a0a7; }
.hide-thermometer { position:relative;height:34px;overflow:hidden;border:3px solid var(--edge);background:#44425f;box-shadow:inset 0 0 0 2px var(--hi); }
.hide-thermometer span { position:absolute;inset:0 auto 0 0;width:0;background:linear-gradient(90deg,#add0d6,#f0d6a1,#e1a0a7);transition:width .25s steps(6); }
.hide-thermometer strong { position:relative;z-index:1;display:grid;place-items:center;height:100%;font-family:'Press Start 2P',monospace;font-size:8px;text-shadow:2px 2px 0 var(--edge); }
.hide-room button { min-height:78px;display:grid;place-items:center;gap:2px;border:3px solid var(--edge);border-radius:4px;background:#756d91;color:var(--txt);box-shadow:inset 0 0 0 2px var(--hi),0 4px 0 var(--edge); }
.hide-room button span { font-size:28px; }
.hide-room button small { font-size:16px; }
.hide-room button.checked { opacity:.45; }
.hide-room button.found { opacity:1;background:#b9d6b0;color:#242333;box-shadow:inset 0 0 0 2px #e2efdf,0 4px 0 var(--edge); }

.bubble-board { width:min(100%,430px);margin:auto;display:grid;grid-template-columns:repeat(var(--bubble-cols),1fr);gap:7px; }
.bubble { aspect-ratio:1;border:3px solid var(--edge);border-radius:50%;font-size:24px;color:#242333;box-shadow:inset -5px -5px 0 rgba(50,45,65,.16),inset 4px 4px 0 rgba(255,255,255,.38),0 3px 0 var(--edge);cursor:pointer; }
.bubble-0{background:#d9a6b2}.bubble-1{background:#add0d6}.bubble-2{background:#f0d6a1}.bubble-3{background:#b9d6b0}.bubble-4{background:#b7a9c9}.bubble-5{background:#efc3a4}
.bubble.lonely { animation:bubble-no .35s steps(3); }
@keyframes bubble-no { 50%{transform:translateX(5px)} }

.cloud-board { position:relative;width:min(100%,560px);height:320px;margin:auto;border:3px solid var(--edge);background:linear-gradient(#8794b2,#b7d9df);box-shadow:inset 0 0 0 3px rgba(255,244,223,.28);overflow:hidden; }
.cloud-board::after { content:"";position:absolute;inset:auto 0 0;height:35%;background:radial-gradient(ellipse at 20% 100%,#fff0dc 0 25%,transparent 26%),radial-gradient(ellipse at 55% 115%,#fff0dc 0 32%,transparent 33%),radial-gradient(ellipse at 90% 105%,#fff0dc 0 26%,transparent 27%);opacity:.7;pointer-events:none; }
.cloud-board svg { position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:1; }
.cloud-line { stroke:#fff0c9;stroke-width:1.8;stroke-linecap:square;filter:drop-shadow(1px 1px 0 #39364d); }
.cloud-star { position:absolute;z-index:2;transform:translate(-50%,-50%);width:40px;height:40px;border:3px solid var(--edge);border-radius:4px;background:#fff0d6;color:#302d40;font-family:'Press Start 2P',monospace;font-size:9px;box-shadow:inset 0 0 0 2px #f0d6a1,0 3px 0 var(--edge);cursor:pointer; }
.cloud-star.decoy { background:#a9cad3;color:#fff; }
.cloud-star.next { animation:cloud-next 1.1s steps(2) infinite; }
.cloud-star.connected { background:#b9d6b0; }
.cloud-star.wrong { background:#e1a0a7; }
@keyframes cloud-next { 50%{box-shadow:inset 0 0 0 3px #fff,0 0 0 5px rgba(240,214,161,.55),0 3px 0 var(--edge)} }

.fishing-scene { width:min(100%,560px);margin:auto;padding:18px;border:3px solid var(--edge);background:linear-gradient(#8b91b0 0 42%,#78aab4 43% 100%);box-shadow:inset 0 0 0 2px rgba(255,244,223,.25); }
.fishing-water { margin-bottom:16px;color:#e3f0eb;font-size:28px;letter-spacing:8px;text-shadow:2px 2px 0 #506a75; }
.fishing-meter { position:relative;height:42px;border:3px solid var(--edge);background:#4d4b68;box-shadow:inset 0 0 0 2px var(--hi); }
.calm-zone { position:absolute;top:3px;bottom:3px;background:repeating-linear-gradient(45deg,#f0d6a1 0 7px,#efc3a4 7px 14px);border:2px solid #fff0c9; }
.float-marker { position:absolute;top:-7px;width:10px;height:50px;transform:translateX(-50%);background:#d9a6b2;border:3px solid var(--edge);box-shadow:inset 0 0 0 1px #fff0dc; }
.result-score { font-size:32px; }

@media (max-width:780px) {
  .minigames-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .how-to-play { grid-template-columns:1fr; }
  .how-to-play li { grid-template-columns:34px 1fr; }
  .minigame-screen { padding:12px; }
  .cloud-board { height:270px; }
}
@media (max-width:520px) {
  .minigames-grid { grid-template-columns:1fr; }
  .minigames-grid .action-card { min-height:86px;grid-template-columns:38px 1fr;grid-template-rows:auto auto;text-align:left;justify-items:start; }
  .minigames-grid .action-card span { grid-row:1 / 3; }
  .difficulty-grid { grid-template-columns:1fr; }
  .rhythm-pad { grid-template-columns:repeat(2,1fr); }
  .hide-room { grid-template-columns:repeat(2,1fr); }
  .bubble-board { gap:4px; }
  .bubble { font-size:19px; }
  .cloud-board { height:240px; }
  .cloud-star { width:34px;height:34px;font-size:8px; }
}

/* =========================================================
   DreamPet v4.5 — UI clarity, overflow safety, Room Builder
   ========================================================= */
:root {
  --v45-ink:#171321;
  --v45-bg:#dcd1e7;
  --v45-bg2:#c9bdd8;
  --v45-panel:#f4edf3;
  --v45-panel2:#e8ddeb;
  --v45-lav:#cdb7e9;
  --v45-rose:#f0b9c8;
  --v45-peach:#f5c6a5;
  --v45-mist:#9fd6d3;
  --v45-sage:#a9c9b1;
  --v45-cream:#fff4dc;
  --v45-dim:#635b70;
  --v45-edge:#292235;
}

/* Text can never escape cards or buttons. */
button, a, label, p, small, strong, span, em, h1, h2, h3, output,
.action-card, .shop-card, .summary-card, .monster-choice, .pet-card,
.room-tab, .journal-tab, .layout-chip, .modal form, .panel-content {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: normal;
}
button { white-space: normal; }
.modal form, .action-panel, .panel-content, .pet-box-body { overflow-x: hidden; }
.action-card strong, .shop-card strong, .dock-button small, .room-tab, .journal-tab,
.primary-button, .secondary-button, .danger-button, .layout-chip {
  line-height: 1.45;
}
.action-card small, .shop-card small, .summary-card small, .help-copy,
.room-editor-help, .pet-card small { line-height: 1.2; }
.shop-grid { grid-template-columns: repeat(auto-fit,minmax(min(100%,180px),1fr)) !important; }
.room-tabs, .journal-tabs { display:flex !important; flex-wrap:wrap; gap:7px; }
.room-tab, .journal-tab { flex:1 1 118px; }

/* New top navigation */
.topbar {
  display:grid !important;
  grid-template-columns:auto minmax(190px,1fr) auto minmax(360px,1.25fr);
  align-items:stretch !important;
  gap:10px !important;
  padding:10px !important;
  color:var(--v45-ink) !important;
  background:rgba(244,237,243,.96) !important;
  border:3px solid var(--v45-edge) !important;
  box-shadow:inset 0 0 0 2px #fff,0 5px 0 rgba(41,34,53,.85) !important;
}
.brand-block,
.pet-summary-button,
.resource-strip,
.topbar-menu {
  border:2px solid var(--v45-edge);
  border-radius:6px;
  background:var(--v45-panel2);
  box-shadow:inset 0 0 0 2px rgba(255,255,255,.65);
}
.brand-block {
  display:flex; align-items:center; gap:8px; padding:7px 10px;
  color:var(--v45-ink); text-decoration:none;
}
.brand-icon { width:44px;height:44px;flex:0 0 auto; }
.brand-block span { display:grid;gap:2px; }
.brand-block strong { font-family:'Press Start 2P',monospace;font-size:12px;color:#5b416d; }
.brand-block small { font-size:18px;color:var(--v45-dim); }
.pet-summary-button {
  display:grid !important; grid-template-columns:50px minmax(0,1fr); align-items:center;
  gap:9px; padding:6px 10px !important; color:var(--v45-ink) !important;
  cursor:pointer; text-align:left;
}
.pet-summary-button canvas { width:46px;height:46px;border:2px solid var(--v45-edge);border-radius:4px;background:var(--v45-lav);image-rendering:pixelated; }
.pet-summary-button .portrait-copy { display:grid;gap:1px; }
.pet-summary-button .portrait-copy small { font-family:'Press Start 2P',monospace;font-size:7px;color:#80688f; }
.pet-summary-button .portrait-copy strong { font-size:22px;line-height:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis; }
.pet-summary-button .portrait-copy em { font-style:normal;font-size:17px;color:var(--v45-dim);white-space:nowrap;overflow:hidden;text-overflow:ellipsis; }
.resource-strip { display:flex;align-items:stretch;gap:5px;padding:5px; }
.resource-chip { display:grid;grid-template-columns:34px auto;align-items:center;gap:5px;min-width:90px;padding:4px 7px;border:2px solid var(--v45-edge);border-radius:4px;background:var(--v45-cream); }
.resource-chip svg { width:32px;height:32px; }
.resource-chip span { display:grid; }
.resource-chip small { font-family:'Press Start 2P',monospace;font-size:6px;color:var(--v45-dim); }
.resource-chip strong { font-size:22px;line-height:1;color:var(--v45-ink); }
.resource-chip.bytes { background:#fae3c8; }
.resource-chip.dreams { background:#e5d5f3; }
.topbar-menu { display:grid;grid-template-columns:repeat(4,minmax(76px,1fr));gap:5px;padding:5px; }
.top-menu-button {
  display:grid;grid-template-columns:32px minmax(0,1fr);align-items:center;gap:6px;
  min-height:48px;padding:5px 7px;border:2px solid var(--v45-edge);border-radius:4px;
  color:var(--v45-ink);background:var(--v45-panel);cursor:pointer;text-align:left;
  box-shadow:0 3px 0 rgba(41,34,53,.75);
}
.top-menu-button svg { width:31px;height:31px; }
.top-menu-button span { display:grid;gap:1px; }
.top-menu-button strong { font-family:'Press Start 2P',monospace;font-size:7px;line-height:1.35; }
.top-menu-button small { font-size:16px;line-height:1;color:var(--v45-dim); }
.top-menu-button.audio { background:#d7eeee; }
.top-menu-button.audio.enabled { background:#bde4d6; }
.top-menu-button.mixer { background:#e4d7f1; }
.top-menu-button.petbox { background:#f5d5df; }
.top-menu-button.menu { background:#dbe8dd; }
.top-menu-button:active { transform:translateY(2px);box-shadow:0 1px 0 rgba(41,34,53,.75); }

/* New colorful dock icons */
.dock { padding:7px !important;background:rgba(244,237,243,.96) !important;border-color:var(--v45-edge) !important; }
.dock-button { display:grid !important;grid-template-columns:42px auto;justify-content:center;align-items:center;gap:7px;min-height:64px !important;color:var(--v45-ink) !important; }
.dock-button svg { width:40px;height:40px; }
.dock-button small { font-family:'Press Start 2P',monospace;font-size:9px !important;color:var(--v45-ink) !important; }
.dock-button.care { background:#f7d7df; }
.dock-button.food { background:#f7dfc6; }
.dock-button.play { background:#e2d6f2; }
.dock-button.room { background:#d6ece9; }
.dock-button.journal { background:#f3e7c9; }
.dock-button.active { outline:3px solid #725785;outline-offset:-4px;filter:saturate(1.08); }
.observe-button { display:flex !important;align-items:center;gap:5px;padding:6px 9px !important;color:var(--v45-ink) !important;background:var(--v45-cream) !important; }
.observe-button svg { width:26px;height:26px; }
.observe-button span { font-family:'Press Start 2P',monospace;font-size:8px; }

/* Cleaner action and shop cards */
.action-card, .shop-card, .summary-card { color:var(--v45-ink) !important;background:rgba(255,248,244,.9) !important;border-color:var(--v45-edge) !important; }
.action-card strong, .shop-card strong, .summary-card strong { color:#43354e !important; }
.action-card small, .shop-card small, .summary-card small { color:var(--v45-dim) !important; }
.action-card { grid-template-rows:auto auto 1fr; }
.action-card > span { align-self:center; }

/* Simple Room Builder: canvas stays 16:9 and never gets covered by duplicated nodes. */
.room-hit-layer,
.room-drag-surface { position:absolute;inset:0;z-index:24; }
.room-hit-layer { pointer-events:none; }
.room-hit-target { position:absolute;display:block;padding:0;border:0;background:transparent;box-shadow:none;pointer-events:auto;cursor:pointer; }
.room-hit-target:hover { outline:2px dotted rgba(255,244,220,.65);outline-offset:2px; }
.room-drag-surface { touch-action:none;cursor:grab;background:transparent; }
.room-drag-surface.dragging { cursor:grabbing; }
.room-selection-frame {
  position:absolute;pointer-events:none;border:2px solid #fff4dc;outline:2px solid #5b4667;outline-offset:1px;
  background:transparent !important;box-shadow:none !important;border-radius:2px;
}
.room-selection-frame span {
  position:absolute;left:0;bottom:calc(100% + 5px);max-width:180px;padding:3px 6px;
  border:2px solid var(--v45-edge);border-radius:3px;background:var(--v45-cream);color:var(--v45-ink);
  font-family:'Press Start 2P',monospace;font-size:7px;line-height:1.35;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
.room-selection-frame i {
  position:absolute;right:-2px;top:calc(100% + 4px);padding:2px 5px;border:2px solid var(--v45-edge);border-radius:3px;
  background:var(--v45-mist);color:var(--v45-ink);font-family:'Press Start 2P',monospace;font-size:6px;font-style:normal;
}
body.room-editing .dock, body.room-editing .action-panel { display:none !important; }
body.room-editing .app-shell {
  width:min(1450px,100%);grid-template-columns:minmax(0,1.65fr) minmax(350px,.85fr) !important;
  grid-template-rows:auto auto !important;grid-template-areas:'top top' 'game editor';align-items:start;
}
body.room-editing .topbar { grid-area:top; }
body.room-editing .game-frame { grid-area:game;aspect-ratio:16/9 !important;width:100%;min-height:0 !important; }
.room-builder-panel {
  grid-area:editor;max-height:calc(100dvh - 125px);overflow:auto;padding:10px;
  color:var(--v45-ink);background:var(--v45-panel);border:3px solid var(--v45-edge);border-radius:6px;
  box-shadow:inset 0 0 0 2px #fff,0 5px 0 rgba(41,34,53,.8);
}
.room-builder-header { display:flex;justify-content:space-between;gap:10px;align-items:flex-start;padding:10px;border:2px solid var(--v45-edge);border-radius:4px;background:#e8ddeb; }
.room-builder-header span { font-family:'Press Start 2P',monospace;font-size:7px;color:#745a82; }
.room-builder-header h2 { margin:4px 0;font-family:'Press Start 2P',monospace;font-size:13px;line-height:1.45;color:#3f3449; }
.room-builder-header p { margin:0;font-size:18px;line-height:1.15;color:var(--v45-dim); }
.room-builder-header-actions { display:flex;gap:6px;flex-wrap:wrap;justify-content:flex-end; }
.room-builder-header-actions button,
.room-layout-row button,
.room-object-actions button {
  min-height:38px;padding:8px 9px;border:2px solid var(--v45-edge);border-radius:4px;background:#fff8f2;color:var(--v45-ink);
  font-family:'Press Start 2P',monospace;font-size:7px;line-height:1.4;cursor:pointer;box-shadow:0 3px 0 rgba(41,34,53,.7);
}
.room-builder-header-actions .primary { background:#cbe5dc; }
.room-layout-row { display:grid;gap:7px;padding:9px 0; }
.room-layout-row > strong { font-family:'Press Start 2P',monospace;font-size:9px;color:#4b3b58; }
.room-layout-row > div { display:flex;flex-wrap:wrap;gap:5px; }
.room-layout-row button.active { background:#d5c2ea;outline:2px solid #715986; }
.room-builder-grid { display:grid;grid-template-columns:minmax(0,1fr);gap:10px; }
.room-catalog,.room-inspector { padding:9px;border:2px solid var(--v45-edge);border-radius:4px;background:#ece3ee; }
.room-catalog > header,.room-inspector > header { display:grid;gap:2px;margin-bottom:8px; }
.room-catalog > header strong,.room-inspector > header strong { font-family:'Press Start 2P',monospace;font-size:9px;color:#4b3b58; }
.room-catalog > header small,.room-inspector > header small { font-size:17px;color:var(--v45-dim); }
.room-catalog-list { display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px;max-height:38vh;overflow:auto;padding:1px; }
.room-catalog-card {
  display:grid;grid-template-columns:74px minmax(0,1fr);gap:7px;align-items:center;padding:6px;
  border:2px solid var(--v45-edge);border-radius:4px;background:#fff9f4;color:var(--v45-ink);text-align:left;cursor:pointer;
}
.room-catalog-card canvas { width:72px;height:52px;border:2px solid var(--v45-edge);border-radius:3px;image-rendering:pixelated;background:#f4edf3; }
.room-catalog-card > span { display:grid;gap:2px; }
.room-catalog-card strong { font-family:'Press Start 2P',monospace;font-size:7px;line-height:1.4;color:#43354e; }
.room-catalog-card small { font-size:16px;color:var(--v45-dim); }
.room-catalog-card b { grid-column:1/-1;padding:4px 6px;border-top:1px dashed #a797ae;font-family:'Press Start 2P',monospace;font-size:7px;color:#715986; }
.room-catalog-card.placed { opacity:.55;cursor:not-allowed; }
.room-builder-empty { display:grid;gap:7px;padding:10px;border:2px dashed #917f9c;border-radius:4px;background:#fff9f4; }
.room-builder-empty > span { display:grid;place-items:center;width:32px;height:32px;border-radius:50%;background:var(--v45-peach);font-family:'Press Start 2P',monospace;font-size:10px; }
.room-builder-empty strong,.room-builder-selected strong { font-family:'Press Start 2P',monospace;font-size:9px;line-height:1.45;color:#43354e; }
.room-builder-empty p,.room-builder-selected p { margin:0;font-size:18px;line-height:1.18;color:var(--v45-dim); }
.room-builder-selected { display:grid;grid-template-columns:98px minmax(0,1fr);gap:8px;padding:8px;border:2px solid var(--v45-edge);border-radius:4px;background:#fff9f4; }
.room-builder-selected canvas { width:96px;height:68px;border:2px solid var(--v45-edge);border-radius:3px;image-rendering:pixelated; }
.room-builder-selected > div:not(.room-object-actions) { display:grid;align-content:center;gap:3px; }
.room-builder-selected small { font-family:'Press Start 2P',monospace;font-size:6px;color:#80688f; }
.room-object-actions { grid-column:1/-1;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px; }
.room-object-actions .danger { background:#f4c7cf; }
body.room-object-dragging .scene-badge,
body.room-object-dragging .visitor-badge,
body.room-object-dragging .speech-bubble,
body.room-object-dragging .toast { visibility:hidden; }

@media (max-width:1180px) {
  .topbar { grid-template-columns:auto minmax(180px,1fr) auto; }
  .topbar-menu { grid-column:1/-1; }
  body.room-editing .app-shell { grid-template-columns:1fr !important;grid-template-areas:'top' 'game' 'editor'; }
  .room-builder-panel { max-height:none; }
}
@media (max-width:760px) {
  .topbar { grid-template-columns:1fr 1fr !important;padding:7px !important; }
  .brand-block { grid-column:1/-1;justify-content:center; }
  .pet-summary-button { grid-column:1/2; }
  .resource-strip { grid-column:2/3; }
  .topbar-menu { grid-column:1/-1;grid-template-columns:repeat(2,minmax(0,1fr)); }
  .top-menu-button { min-height:52px; }
  .dock-button { grid-template-columns:1fr;gap:2px; }
  .dock-button svg { width:35px;height:35px;justify-self:center; }
  .dock-button small { font-size:7px !important; }
  .room-catalog-list { grid-template-columns:1fr;max-height:none; }
  .room-builder-header { flex-direction:column; }
  .room-builder-header-actions { width:100%;justify-content:stretch; }
  .room-builder-header-actions button { flex:1; }
  .room-builder-selected { grid-template-columns:80px minmax(0,1fr); }
  .room-builder-selected canvas { width:78px;height:58px; }
}
@media (max-width:480px) {
  .pet-summary-button { grid-column:1/-1; }
  .resource-strip { grid-column:1/-1; }
  .resource-chip { flex:1; }
  .topbar-menu { grid-template-columns:1fr 1fr; }
  .top-menu-button strong { font-size:6px; }
  .top-menu-button small { font-size:15px; }
  .action-grid { grid-template-columns:1fr !important; }
  .room-object-actions { grid-template-columns:1fr; }
}

/* DreamPet v5.0 — living room, accessible interactions and advanced builder */
.room-hit-target {
  overflow:visible;
  border-radius:5px;
}
.room-hit-target > i,
.room-hit-target > span {
  position:absolute;
  left:50%;
  pointer-events:none;
  opacity:0;
  transform:translate(-50%,6px);
  transition:opacity .16s steps(2),transform .16s steps(2);
}
.room-hit-target > i {
  top:-18px;
  display:grid;
  place-items:center;
  width:18px;
  height:18px;
  border:2px solid #493b55;
  border-radius:4px;
  background:#fff2c9;
  color:#80638f;
  font-style:normal;
  font-size:10px;
  box-shadow:0 2px 0 rgba(51,40,63,.72);
  animation:room-interact-bob 1.25s steps(3) infinite;
}
.room-hit-target > span {
  top:calc(100% + 5px);
  width:max-content;
  max-width:130px;
  padding:3px 6px;
  border:2px solid #493b55;
  border-radius:4px;
  background:#fff9f1;
  color:#493b55;
  font-family:'Press Start 2P',monospace;
  font-size:6px;
  line-height:1.45;
  overflow-wrap:anywhere;
  box-shadow:0 2px 0 rgba(51,40,63,.7);
}
.room-hit-target:hover,
.room-hit-target:focus-visible,
.room-hit-target.armed {
  outline:2px solid rgba(255,244,220,.88);
  outline-offset:3px;
  background:rgba(255,244,220,.06);
}
.room-hit-target:hover > i,
.room-hit-target:hover > span,
.room-hit-target:focus-visible > i,
.room-hit-target:focus-visible > span,
.room-hit-target.armed > i,
.room-hit-target.armed > span {
  opacity:1;
  transform:translate(-50%,0);
}
@keyframes room-interact-bob { 50% { transform:translate(-50%,-3px); } }


.room-builder-tools {
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  align-items:end;
  gap:8px;
  margin:0 0 9px;
}
.room-search,
.room-snap-toggle {
  display:grid;
  gap:4px;
  min-width:0;
}
.room-search span,
.room-snap-toggle span {
  color:#65536f;
  font-family:'Press Start 2P',monospace;
  font-size:7px;
  line-height:1.4;
}
.room-search input {
  width:100%;
  min-width:0;
  min-height:42px;
  padding:8px 10px;
  border:2px solid #53445f;
  border-radius:4px;
  background:#fffaf5;
  color:#493b55;
  font-size:18px;
  outline:none;
}
.room-search input:focus { box-shadow:0 0 0 3px #d8c3e4; }
.room-snap-toggle {
  grid-template-columns:auto 1fr;
  align-items:center;
  min-height:42px;
  padding:7px 9px;
  border:2px solid #53445f;
  border-radius:4px;
  background:#f6ecf5;
}
.room-snap-toggle input { width:20px;height:20px;accent-color:#8d72a2; }
.room-category-tabs,
.room-filter-tabs {
  display:flex;
  flex-wrap:wrap;
  gap:5px;
  margin-bottom:8px;
}
.room-category-tabs button,
.room-filter-tabs button {
  min-height:34px;
  max-width:100%;
  padding:6px 8px;
  border:2px solid #665371;
  border-radius:4px;
  background:#fff9f3;
  color:#665371;
  font-family:'Press Start 2P',monospace;
  font-size:6px;
  line-height:1.45;
  cursor:pointer;
  overflow-wrap:anywhere;
}
.room-category-tabs button.active,
.room-filter-tabs button.active {
  background:#d9cae8;
  color:#4e3b5a;
  box-shadow:inset 0 0 0 2px #fff;
}
.room-filter-tabs button { background:#edf2e8; }
.room-catalog-list { grid-template-columns:repeat(2,minmax(0,1fr)); }
.room-catalog-card {
  grid-template-columns:106px minmax(0,1fr);
  align-content:start;
  min-width:0;
  padding:7px;
}
.room-catalog-card canvas { width:104px;height:72px; }
.room-catalog-card > span { min-width:0; }
.room-catalog-card strong,
.room-catalog-card small,
.room-catalog-card em,
.room-catalog-card b {
  min-width:0;
  max-width:100%;
  overflow-wrap:anywhere;
  word-break:normal;
}
.room-catalog-card strong { font-size:7px; }
.room-catalog-card small { font-size:17px;line-height:1.05; }
.room-catalog-card em { font-size:15px;line-height:1.05;color:#8c788f;font-style:normal; }
.room-catalog-card b { font-size:6px; }
.room-catalog-card.buyable { background:#fff6e8; }
.room-catalog-card.placed { opacity:.84; }
.room-catalog-card:disabled { opacity:.48; }
.room-catalog-empty {
  grid-column:1/-1;
  padding:20px;
  border:2px dashed #8d7896;
  border-radius:4px;
  background:#fff9f4;
  color:#716078;
  font-size:18px;
  text-align:center;
}
.room-builder-header-actions button:disabled { opacity:.42;cursor:not-allowed; }
.room-builder-selected canvas { width:112px;height:78px; }
.room-builder-selected { grid-template-columns:114px minmax(0,1fr); }

@media (max-width:760px) {
  .room-builder-tools { grid-template-columns:1fr; }
  .room-category-tabs { display:grid;grid-template-columns:repeat(2,minmax(0,1fr)); }
  .room-filter-tabs { display:grid;grid-template-columns:repeat(2,minmax(0,1fr)); }
  .room-catalog-card { grid-template-columns:88px minmax(0,1fr); }
  .room-catalog-card canvas { width:86px;height:64px; }
}
@media (max-width:430px) {
  .room-category-tabs { grid-template-columns:1fr 1fr; }
  .room-catalog-card { grid-template-columns:76px minmax(0,1fr); }
  .room-catalog-card canvas { width:74px;height:58px; }
  .room-builder-selected { grid-template-columns:1fr; }
  .room-builder-selected canvas { width:100%;height:auto;max-height:105px; }
}

/* Uniform minigame presentation */
.minigame-demo {
  position:relative;
  min-height:92px;
  display:grid;
  place-items:center;
  overflow:hidden;
  border:3px solid #5e5069;
  border-radius:5px;
  background:linear-gradient(180deg,#f6e8f1,#e0e8df);
  box-shadow:inset 0 0 0 2px #fff,0 4px 0 rgba(65,50,75,.55);
}
.minigame-demo::before { content:attr(data-example);font-size:44px;animation:minigame-example 1.4s steps(4) infinite; }
.minigame-demo::after { content:'ESEMPIO';position:absolute;left:7px;top:7px;font-family:'Press Start 2P';font-size:6px;color:#7c6788; }
@keyframes minigame-example { 50% { transform:translateX(12px) translateY(-4px) scale(1.08); } }
.game-toolbar {
  display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:8px;padding:6px;border:2px solid #675672;border-radius:4px;background:#f8f0ef;
}
.game-toolbar strong { min-width:0;font-family:'Press Start 2P';font-size:7px;color:#55455f;overflow-wrap:anywhere; }
.game-toolbar div { display:flex;gap:5px; }
.game-toolbar button { min-height:34px;padding:5px 8px;border:2px solid #675672;border-radius:4px;background:#fffaf4;color:#55455f;font-family:'Press Start 2P';font-size:6px; }
.minigame-help-overlay,
.minigame-pause-overlay {
  position:absolute;inset:0;z-index:20;display:grid;place-items:center;padding:14px;background:rgba(65,52,74,.82);
}
.minigame-overlay-card { max-width:520px;padding:14px;border:3px solid #4c4057;border-radius:5px;background:#fff9f3;color:#55455f;box-shadow:inset 0 0 0 2px #fff,0 5px 0 #3b3045; }
.minigame-overlay-card h3 { font-family:'Press Start 2P';font-size:10px;line-height:1.5; }
.minigame-overlay-card p,.minigame-overlay-card li { font-size:19px;line-height:1.15; }
.minigame-overlay-card button { width:100%;min-height:42px;border:2px solid #594865;border-radius:4px;background:#d8eadf;color:#4d3c57;font-family:'Press Start 2P';font-size:7px; }
.minigame-body { position:relative; }
.minigame-start-row { display:grid;grid-template-columns:1fr 1fr;gap:8px; }
.minigame-start-row button { min-width:0;overflow-wrap:anywhere; }
.game-active-screen.paused > *:not(.game-toolbar) { animation-play-state:paused !important; }
@media(max-width:520px){.minigame-start-row{grid-template-columns:1fr;}}

/* DreamPet v5.1 — official logo + better room catalog */
.brand-logo {
  width: 96px;
  height: auto;
  display: block;
  image-rendering: pixelated;
  filter: drop-shadow(0 3px 0 rgba(73,59,85,.28));
}
.brand-block {
  align-items: center;
  gap: 10px;
}
.brand-block span {
  align-content: center;
}
.onboarding-logo {
  display: block;
  width: min(360px, 72vw);
  margin: 0 auto 10px;
  image-rendering: pixelated;
}

.room-builder-grid {
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr);
  align-items: start;
}
.room-catalog-list {
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
}
.room-catalog-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 8px;
  padding: 9px;
}
.room-catalog-card canvas {
  width: 100%;
  height: auto;
  aspect-ratio: 126 / 88;
  background: linear-gradient(180deg, #fbf7fd 0%, #efe3f0 100%);
}
.room-catalog-copy {
  display: grid;
  gap: 5px;
  text-align: left;
}
.room-catalog-card strong {
  font-size: 7px;
  line-height: 1.55;
}
.room-catalog-card small {
  font-size: 16px;
  line-height: 1.15;
}
.room-catalog-card em {
  min-height: 32px;
  font-size: 15px;
  line-height: 1.12;
}
.room-catalog-card b {
  width: 100%;
  text-align: center;
  margin-top: auto;
  border-top: 1px dashed #a797ae;
}
@media (max-width: 980px) {
  .room-builder-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 760px) {
  .brand-logo {
    width: 82px;
  }
  .room-catalog-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 520px) {
  .room-catalog-list {
    grid-template-columns: 1fr;
  }
}

/* DreamPet v5.2 — simpler header and clearer top buttons */
.topbar {
  grid-template-columns: 188px minmax(220px, 1fr) 198px minmax(340px, 1.2fr) !important;
  gap: 10px;
  align-items: stretch;
}
.brand-icon-hidden { display:none; }
.brand-block {
  justify-content: center;
  padding: 10px 12px;
}
.brand-logo {
  width: min(154px, 100%);
}
.pet-summary-button {
  min-height: 92px;
  grid-template-columns: 56px minmax(0,1fr);
  gap: 10px;
  padding: 10px 12px;
}
.pet-summary-button canvas {
  width: 54px;
  height: 54px;
}
.pet-summary-button .portrait-copy small {
  font-size: 6px;
  line-height: 1.5;
}
.pet-summary-button .portrait-copy strong {
  font-size: 20px;
  line-height: 1.05;
}
.pet-summary-button .portrait-copy em {
  font-size: 18px;
  line-height: 1.05;
}
.resource-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 8px;
}
.resource-chip {
  min-height: 92px;
  padding: 10px 12px;
  align-items: center;
}
.resource-chip svg {
  width: 32px;
  height: 32px;
}
.resource-chip small {
  font-size: 6px;
  line-height: 1.4;
}
.resource-chip strong {
  font-size: 26px;
  line-height: 1;
}
.topbar-menu {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 8px;
}
.top-menu-button {
  min-height: 92px;
  grid-template-columns: 1fr;
  justify-items: center;
  align-content: center;
  gap: 6px;
  padding: 8px 6px;
  text-align: center;
}
.top-menu-button svg {
  width: 26px;
  height: 26px;
}
.top-menu-button span {
  justify-items: center;
  gap: 3px;
}
.top-menu-button strong {
  font-size: 7px;
  line-height: 1.45;
  color: #43354e;
}
.top-menu-button small {
  font-size: 14px;
  line-height: 1.1;
  color: #5f5068;
}
@media (max-width: 1180px) {
  .topbar {
    grid-template-columns: 180px minmax(180px,1fr) 180px minmax(260px,1fr) !important;
  }
  .top-menu-button small { font-size: 13px; }
}
@media (max-width: 900px) {
  .topbar {
    grid-template-columns: 1fr 1fr !important;
  }
  .brand-block {
    grid-column: 1 / -1;
  }
  .pet-summary-button,
  .resource-strip,
  .topbar-menu {
    grid-column: auto;
  }
  .topbar-menu {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 560px) {
  .topbar {
    grid-template-columns: 1fr !important;
  }
  .pet-summary-button,
  .resource-strip,
  .topbar-menu {
    grid-column: 1 / -1;
  }
  .resource-strip,
  .topbar-menu {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.brand-tagline-hidden{display:none;}

.compat-hidden-copy{display:none !important;}


/* DreamPet v5.2.2 — more compact top header */
.topbar{grid-template-columns:160px minmax(210px,1fr) 178px minmax(300px,1.05fr)!important;gap:8px;padding:8px!important;}
.brand-block,.pet-summary-button,.resource-strip,.topbar-menu{padding:6px!important;}
.brand-logo{width:min(126px,100%);}
.pet-summary-button{min-height:76px;grid-template-columns:46px minmax(0,1fr);gap:8px;padding:8px 10px!important;}
.pet-summary-button canvas{width:42px;height:42px;}
.pet-summary-button .portrait-copy{gap:0;}
.pet-summary-button .portrait-copy small{font-size:6px;line-height:1.35;}
.pet-summary-button .portrait-copy strong{font-size:18px;line-height:1;}
.pet-summary-button .portrait-copy em{font-size:15px;line-height:1.05;}
.resource-strip{grid-template-columns:1fr 1fr;gap:6px;padding:6px!important;}
.resource-chip{min-height:76px;padding:6px 8px;grid-template-columns:28px auto;gap:6px;}
.resource-chip svg{width:26px;height:26px;}
.resource-chip span{display:grid;gap:2px;align-content:center;}
.resource-chip small{font-size:8px;line-height:1.1;white-space:nowrap;letter-spacing:0;color:#5b4a64;}
.resource-chip strong{font-size:22px;line-height:1;color:#2d2336;}
.topbar-menu{grid-template-columns:repeat(4,minmax(64px,1fr));gap:6px;padding:6px!important;}
.top-menu-button{min-height:76px;gap:4px;padding:6px 4px;}
.top-menu-button svg{width:22px;height:22px;}
.top-menu-button span{gap:1px;}
.top-menu-button strong{font-size:7px;line-height:1.25;}
.top-menu-button small{font-size:12px;line-height:1.05;white-space:nowrap;}
@media (max-width:1180px){.topbar{grid-template-columns:150px minmax(180px,1fr) 170px minmax(260px,1fr)!important;}.top-menu-button small{font-size:11px;}}
@media (max-width:900px){.topbar{grid-template-columns:1fr 1fr!important;}.topbar-menu{grid-template-columns:repeat(2,minmax(0,1fr));}.top-menu-button,.resource-chip,.pet-summary-button{min-height:70px;}}
@media (max-width:560px){.topbar{grid-template-columns:1fr!important;}.resource-strip,.topbar-menu{grid-template-columns:repeat(2,minmax(0,1fr));}.top-menu-button small{white-space:normal;}}

/* DreamPet v5.3 — single-screen dashboard and landscape mobile */
.landscape-lock { display:none; }

@media (min-width: 901px) {
  html, body { height:100%; overflow:hidden; }
  body:not(.room-editing) .app-shell {
    width:min(1440px,100%);
    height:100dvh;
    min-height:0;
    padding:10px 12px;
    grid-template-columns:minmax(0,1.58fr) minmax(360px,.72fr);
    grid-template-rows:auto auto minmax(0,1fr);
    grid-template-areas:
      "top top"
      "game dock"
      "game panel";
    gap:10px;
    overflow:hidden;
  }
  body:not(.room-editing) .topbar { grid-area:top; }
  body:not(.room-editing) .game-frame {
    grid-area:game;
    width:100%;
    max-width:none;
    aspect-ratio:16 / 9;
    align-self:start;
    min-height:0;
  }
  body:not(.room-editing) .dock {
    grid-area:dock;
    display:grid;
    grid-template-columns:repeat(5,minmax(0,1fr));
    gap:6px;
    padding:6px !important;
  }
  body:not(.room-editing) .dock-button {
    min-height:54px !important;
    grid-template-columns:1fr !important;
    gap:2px !important;
    padding:5px 3px !important;
  }
  body:not(.room-editing) .dock-button svg { width:29px;height:29px;justify-self:center; }
  body:not(.room-editing) .dock-button small { font-size:7px !important; }
  body:not(.room-editing) .action-panel {
    grid-area:panel;
    min-height:0;
    height:100%;
    overflow:hidden;
  }
  body:not(.room-editing) .panel-content {
    height:100%;
    min-height:0;
    overflow:auto;
    overscroll-behavior:contain;
    scrollbar-width:thin;
  }
  body:not(.room-editing) .action-grid { gap:8px; }
  body:not(.room-editing) .action-card { min-height:100px;padding:9px 7px; }
}

/* Header: resources can never overflow their containers. */
.topbar {
  width:100%;
  grid-template-columns:140px minmax(230px,1fr) minmax(240px,.75fr) minmax(360px,1.15fr) !important;
  gap:7px !important;
  padding:7px !important;
}
.brand-block,.pet-summary-button,.resource-strip,.topbar-menu {
  min-width:0;
  overflow:hidden;
  padding:5px !important;
}
.brand-logo { width:min(112px,100%);max-height:62px;object-fit:contain; }
.pet-summary-button { min-height:66px;padding:6px 9px !important;grid-template-columns:42px minmax(0,1fr);gap:7px; }
.pet-summary-button canvas { width:38px;height:38px; }
.pet-summary-button .portrait-copy small { font-size:6px;line-height:1.2; }
.pet-summary-button .portrait-copy strong { font-size:18px; }
.pet-summary-button .portrait-copy em { font-size:14px; }
.resource-strip { grid-template-columns:repeat(2,minmax(0,1fr));gap:5px; }
.resource-chip {
  min-width:0;
  min-height:66px;
  padding:5px 7px;
  grid-template-columns:25px minmax(0,1fr);
  gap:5px;
  overflow:hidden;
}
.resource-chip svg { width:24px;height:24px; }
.resource-chip span {
  min-width:0;
  display:flex;
  flex-direction:column;
  justify-content:center;
  align-items:flex-start;
  gap:1px;
  overflow:hidden;
}
.resource-chip small {
  width:100%;
  font-family:'Press Start 2P',monospace;
  font-size:7px;
  line-height:1.25;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  color:#594761;
}
.resource-chip strong {
  width:100%;
  font-size:22px;
  line-height:1;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.topbar-menu { grid-template-columns:repeat(4,minmax(0,1fr));gap:5px; }
.top-menu-button { min-width:0;min-height:66px;gap:3px;padding:4px 3px;overflow:hidden; }
.top-menu-button svg { width:21px;height:21px; }
.top-menu-button strong { font-size:7px;line-height:1.2;white-space:nowrap; }
.top-menu-button small { max-width:100%;font-size:11px;line-height:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis; }

@media (max-width: 1100px) and (min-width: 901px) {
  body:not(.room-editing) .app-shell { grid-template-columns:minmax(0,1.45fr) minmax(330px,.75fr); }
  .topbar { grid-template-columns:120px minmax(190px,1fr) minmax(200px,.78fr) minmax(320px,1.18fr) !important; }
  .brand-logo { width:100px; }
  .top-menu-button small { font-size:10px; }
}

/* Smartphone: gameplay is intentionally landscape-only. */
@media (max-width: 900px) and (orientation: portrait) {
  body { overflow:hidden !important; }
  body > .app-shell,
  body > dialog { visibility:hidden !important;pointer-events:none !important; }
  .landscape-lock {
    position:fixed;
    inset:0;
    z-index:100000;
    display:grid;
    place-items:center;
    align-content:center;
    gap:12px;
    padding:24px;
    text-align:center;
    color:#493b55;
    background:linear-gradient(180deg,#eee3f2,#d9cee7);
  }
  .landscape-lock img { width:min(260px,72vw);height:auto;image-rendering:pixelated; }
  .landscape-phone {
    display:grid;
    place-items:center;
    width:72px;height:48px;
    border:4px solid #493b55;
    border-radius:8px;
    background:#fff7f2;
    font-family:'Press Start 2P',monospace;
    font-size:22px;
    animation:landscape-rotate 1.5s steps(4) infinite;
  }
  .landscape-lock strong { font-family:'Press Start 2P',monospace;font-size:12px;line-height:1.6; }
  .landscape-lock p { max-width:320px;margin:0;font-size:20px;line-height:1.15; }
  @keyframes landscape-rotate { 50% { transform:rotate(90deg); } }
}

@media (max-width: 900px) and (orientation: landscape) {
  html, body { width:100%;height:100%;overflow:hidden; }
  .landscape-lock { display:none; }
  body:not(.room-editing) .app-shell {
    width:100%;
    height:100dvh;
    min-height:0;
    padding:5px;
    grid-template-columns:minmax(0,1.5fr) minmax(280px,.82fr);
    grid-template-rows:auto auto minmax(0,1fr);
    grid-template-areas:"top top" "game dock" "game panel";
    gap:5px;
    overflow:hidden;
  }
  body:not(.room-editing) .topbar { grid-area:top; }
  body:not(.room-editing) .game-frame { grid-area:game;aspect-ratio:16/9;align-self:start;width:100%;min-height:0; }
  body:not(.room-editing) .dock { grid-area:dock;display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:3px;padding:3px !important; }
  body:not(.room-editing) .dock-button { min-height:42px !important;grid-template-columns:1fr !important;gap:0 !important;padding:2px !important; }
  body:not(.room-editing) .dock-button svg { width:23px;height:23px;justify-self:center; }
  body:not(.room-editing) .dock-button small { font-size:5px !important; }
  body:not(.room-editing) .action-panel { grid-area:panel;min-height:0;height:100%;overflow:hidden; }
  body:not(.room-editing) .panel-content { height:100%;overflow:auto;padding:6px; }
  body:not(.room-editing) .action-grid { grid-template-columns:repeat(2,minmax(0,1fr));gap:5px; }
  body:not(.room-editing) .action-card { min-height:74px;padding:5px; }
  body:not(.room-editing) .action-card span { font-size:19px; }
  body:not(.room-editing) .action-card strong { font-size:6px; }
  body:not(.room-editing) .action-card small { font-size:13px; }
  .topbar {
    grid-template-columns:78px minmax(145px,1fr) 136px minmax(245px,1.4fr) !important;
    min-height:54px;
    gap:4px !important;
    padding:4px !important;
  }
  .brand-block,.pet-summary-button,.resource-strip,.topbar-menu { padding:3px !important; }
  .brand-logo { width:70px;max-height:46px; }
  .pet-summary-button { min-height:46px;grid-template-columns:32px minmax(0,1fr);gap:4px;padding:3px 5px !important; }
  .pet-summary-button canvas { width:29px;height:29px; }
  .pet-summary-button .portrait-copy small { display:none; }
  .pet-summary-button .portrait-copy strong { font-size:15px; }
  .pet-summary-button .portrait-copy em { font-size:11px; }
  .resource-strip { gap:3px; }
  .resource-chip { min-height:46px;grid-template-columns:18px minmax(0,1fr);gap:3px;padding:3px 4px; }
  .resource-chip svg { width:18px;height:18px; }
  .resource-chip small { font-size:5px; }
  .resource-chip strong { font-size:17px; }
  .topbar-menu { gap:3px; }
  .top-menu-button { min-height:46px;grid-template-columns:1fr;gap:0;padding:2px; }
  .top-menu-button svg { width:18px;height:18px; }
  .top-menu-button strong { font-size:5px; }
  .top-menu-button small { display:none; }
}

/* Keep the Room Builder usable inside the same fixed viewport. */
@media (min-width: 901px) {
  body.room-editing .app-shell {
    width:min(1440px,100%);
    height:100dvh;
    min-height:0;
    padding:10px 12px;
    grid-template-columns:minmax(0,1.45fr) minmax(380px,.82fr) !important;
    grid-template-rows:auto minmax(0,1fr) !important;
    grid-template-areas:"top top" "game editor" !important;
    gap:10px;
    overflow:hidden;
  }
  body.room-editing .game-frame { grid-area:game;align-self:start;width:100%;aspect-ratio:16/9 !important; }
  body.room-editing .room-builder-panel { grid-area:editor;max-height:100%;height:100%;min-height:0;overflow:auto; }
}
@media (max-width: 900px) and (orientation: landscape) {
  body.room-editing .app-shell {
    width:100%;
    height:100dvh;
    min-height:0;
    padding:5px;
    grid-template-columns:minmax(0,1.35fr) minmax(310px,.9fr) !important;
    grid-template-rows:auto minmax(0,1fr) !important;
    grid-template-areas:"top top" "game editor" !important;
    gap:5px;
    overflow:hidden;
  }
  body.room-editing .game-frame { grid-area:game;align-self:start;width:100%;aspect-ratio:16/9 !important; }
  body.room-editing .room-builder-panel { grid-area:editor;max-height:100%;height:100%;min-height:0;overflow:auto;padding:6px; }
}

/* Final compactness pass for v5.3. */
@media (min-width:901px) {
  .topbar { padding:5px !important; }
  .brand-block,.pet-summary-button,.resource-strip,.topbar-menu { padding:4px !important; }
  .brand-logo { width:min(96px,100%);max-height:48px; }
  .pet-summary-button { min-height:58px;padding:5px 8px !important;grid-template-columns:38px minmax(0,1fr); }
  .pet-summary-button canvas { width:34px;height:34px; }
  .resource-chip { min-height:58px;padding:4px 6px; }
  .top-menu-button { min-height:58px;padding:3px; }
  .top-menu-button svg { width:19px;height:19px; }
}
@media (max-width:900px) and (orientation:landscape) {
  .topbar { grid-auto-flow:column;grid-template-rows:1fr !important; }
  .topbar > .brand-block,
  .topbar > .pet-summary-button,
  .topbar > .resource-strip,
  .topbar > .topbar-menu { grid-column:auto !important;grid-row:1 !important;align-self:stretch; }
  .brand-block { justify-content:center; }
  .brand-logo { width:62px;max-height:40px; }
  .pet-summary-button,.resource-chip,.top-menu-button { min-height:42px; }
}

@media (min-width:901px) {
  body:not(.room-editing) .action-panel .action-grid,
  body:not(.room-editing) .action-panel .minigames-grid {
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
  }
  body:not(.room-editing) .action-panel .shop-grid {
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
  }
}

/* DreamPet v5.3.1 — mobile fullscreen shell and true touch responsiveness */
.mobile-launch-gate,
.mobile-reenter-fullscreen { display:none; }

@media (hover:none) and (pointer:coarse), (max-width:1024px) and (max-height:700px) {
  html,
  body {
    width:100%;
    height:var(--mobile-safe-height, 100dvh);
    min-height:0;
    overflow:hidden !important;
    overscroll-behavior:none;
  }
  body {
    position:fixed;
    inset:0;
    touch-action:manipulation;
  }
  html:fullscreen,
  html:fullscreen body {
    width:100%;
    height:100%;
  }
  body.mobile-device .mobile-launch-gate {
    position:fixed;
    inset:0;
    z-index:120000;
    display:grid;
    place-items:center;
    align-content:center;
    gap:10px;
    padding:calc(18px + env(safe-area-inset-top)) calc(18px + env(safe-area-inset-right)) calc(18px + env(safe-area-inset-bottom)) calc(18px + env(safe-area-inset-left));
    text-align:center;
    color:#493b55;
    background:linear-gradient(180deg,#eee3f2,#d7cbe4);
  }
  body.mobile-device .mobile-launch-gate[hidden] { display:none !important; }
  .mobile-launch-gate img {
    width:min(260px,58vw);
    max-height:30vh;
    object-fit:contain;
    image-rendering:pixelated;
  }
  .mobile-launch-gate .landscape-phone {
    width:64px;
    height:42px;
  }
  .mobile-launch-gate strong {
    font-family:'Press Start 2P',monospace;
    font-size:11px;
    line-height:1.55;
  }
  .mobile-launch-gate p {
    max-width:430px;
    margin:0;
    font-size:19px;
    line-height:1.1;
  }
  .mobile-launch-gate small {
    max-width:430px;
    font-size:14px;
    line-height:1.1;
    color:#76647e;
  }
  .mobile-fullscreen-button {
    min-height:48px;
    max-width:100%;
    padding:10px 14px;
    border:3px solid #493b55;
    border-radius:5px;
    background:#f7d5df;
    color:#493b55;
    box-shadow:inset 0 0 0 2px #fff7f2,0 4px 0 #493b55;
    font-family:'Press Start 2P',monospace;
    font-size:8px;
    line-height:1.55;
  }
  .mobile-fullscreen-button:active { transform:translateY(2px);box-shadow:inset 0 0 0 2px #fff7f2,0 2px 0 #493b55; }
  .mobile-reenter-fullscreen {
    position:fixed;
    right:calc(7px + env(safe-area-inset-right));
    bottom:calc(7px + env(safe-area-inset-bottom));
    z-index:110000;
    display:grid;
    place-items:center;
    width:38px;
    height:38px;
    padding:0;
    border:2px solid #493b55;
    border-radius:5px;
    background:rgba(255,249,244,.94);
    color:#493b55;
    box-shadow:0 3px 0 #493b55;
    font-size:18px;
  }
  .mobile-reenter-fullscreen[hidden] { display:none !important; }
  body.mobile-device:not(.mobile-session-started) > .app-shell,
  body.mobile-device:not(.mobile-session-started) > dialog { visibility:hidden !important;pointer-events:none !important; }
}

/* Portrait remains blocked after fullscreen has been requested when orientation lock is unavailable. */
@media (max-width:1024px) and (orientation:portrait) and (hover:none) and (pointer:coarse),
       (max-width:700px) and (orientation:portrait) {
  .landscape-lock { display:none; }
  body.mobile-session-started .landscape-lock {
    position:fixed;
    inset:0;
    z-index:115000;
    display:grid;
    place-items:center;
    align-content:center;
    gap:10px;
    padding:20px;
    text-align:center;
    color:#493b55;
    background:linear-gradient(180deg,#eee3f2,#d9cee7);
  }
  body.mobile-session-started .landscape-lock img { width:min(250px,68vw);height:auto;image-rendering:pixelated; }
  body.mobile-session-started .landscape-lock strong { font-family:'Press Start 2P',monospace;font-size:11px;line-height:1.55; }
  body.mobile-session-started .landscape-lock p { max-width:340px;margin:0;font-size:19px;line-height:1.12; }
}

/* Final mobile landscape layout. This also catches wide phones above 900px. */
@media (max-width:1024px) and (orientation:landscape) and (hover:none) and (pointer:coarse),
       (max-width:1024px) and (max-height:700px) and (orientation:landscape) {
  .landscape-lock { display:none !important; }
  body.mobile-device.mobile-session-started > .app-shell { visibility:visible !important;pointer-events:auto !important; }
  body:not(.room-editing) .app-shell {
    box-sizing:border-box;
    width:var(--mobile-vw, 100vw);
    max-width:none;
    height:var(--mobile-safe-height, 100dvh);
    min-height:0;
    padding:
      calc(4px + env(safe-area-inset-top))
      calc(4px + env(safe-area-inset-right))
      calc(4px + env(safe-area-inset-bottom))
      calc(4px + env(safe-area-inset-left));
    grid-template-columns:minmax(0,1fr) clamp(220px,34vw,320px) !important;
    grid-template-rows:44px 36px minmax(0,1fr) !important;
    grid-template-areas:
      "top top"
      "game dock"
      "game panel" !important;
    gap:4px !important;
    overflow:hidden !important;
  }
  body:not(.room-editing) .topbar {
    grid-area:top;
    width:100%;
    height:44px;
    min-height:44px;
    grid-template-columns:54px minmax(105px,1fr) 108px minmax(220px,1.25fr) !important;
    grid-template-rows:1fr !important;
    grid-auto-flow:column;
    gap:3px !important;
    padding:3px !important;
    overflow:hidden;
  }
  .topbar > .brand-block,
  .topbar > .pet-summary-button,
  .topbar > .resource-strip,
  .topbar > .topbar-menu {
    grid-column:auto !important;
    grid-row:1 !important;
    align-self:stretch;
    min-width:0;
    min-height:0;
    height:100%;
    padding:2px !important;
    overflow:hidden;
  }
  .brand-logo { width:49px;max-width:49px;max-height:36px;object-fit:contain; }
  .pet-summary-button { grid-template-columns:27px minmax(0,1fr);gap:3px;padding:2px 4px !important; }
  .pet-summary-button canvas { width:25px;height:25px; }
  .pet-summary-button .portrait-copy { min-width:0;gap:0; }
  .pet-summary-button .portrait-copy small { display:none; }
  .pet-summary-button .portrait-copy strong { font-size:13px;line-height:1; }
  .pet-summary-button .portrait-copy em { font-size:10px;line-height:1; }
  .resource-strip { display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:2px; }
  .resource-chip {
    min-width:0;
    min-height:0;
    height:100%;
    padding:2px 3px;
    grid-template-columns:14px minmax(0,1fr);
    gap:2px;
    overflow:hidden;
  }
  .resource-chip svg { width:14px;height:14px; }
  .resource-chip span { min-width:0;display:grid;gap:0;align-content:center;overflow:hidden; }
  .resource-chip small {
    width:100%;
    font-size:5px;
    line-height:1.05;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:clip;
    letter-spacing:0;
  }
  .resource-chip strong {
    width:100%;
    font-size:15px;
    line-height:1;
    white-space:nowrap;
    overflow:hidden;
  }
  .topbar-menu { display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:2px; }
  .top-menu-button {
    min-width:0;
    min-height:0;
    height:100%;
    display:grid;
    grid-template-columns:16px minmax(0,1fr);
    align-items:center;
    justify-items:start;
    gap:2px;
    padding:2px 3px;
    overflow:hidden;
  }
  .top-menu-button svg { width:15px;height:15px; }
  .top-menu-button span { min-width:0;display:block;overflow:hidden; }
  .top-menu-button strong { display:block;font-size:5px;line-height:1.2;white-space:nowrap;overflow:hidden;text-overflow:clip; }
  .top-menu-button small { display:none !important; }
  body:not(.room-editing) .game-frame {
    grid-area:game;
    justify-self:center;
    align-self:start;
    width:min(100%, calc((var(--mobile-safe-height, 100dvh) - 56px) * 1.7777778));
    max-width:100%;
    height:auto;
    max-height:calc(var(--mobile-safe-height, 100dvh) - 56px);
    aspect-ratio:16 / 9 !important;
    min-height:0;
    overflow:hidden;
  }
  body:not(.room-editing) .dock {
    grid-area:dock;
    display:grid;
    grid-template-columns:repeat(5,minmax(0,1fr));
    gap:2px;
    height:36px;
    min-height:0;
    padding:2px !important;
    overflow:hidden;
  }
  body:not(.room-editing) .dock-button {
    min-width:0;
    min-height:0 !important;
    height:30px;
    display:grid;
    grid-template-columns:16px minmax(0,1fr) !important;
    align-items:center;
    gap:1px !important;
    padding:1px 2px !important;
    overflow:hidden;
  }
  body:not(.room-editing) .dock-button svg { width:15px;height:15px;justify-self:center; }
  body:not(.room-editing) .dock-button small { font-size:5px !important;line-height:1;white-space:nowrap;overflow:hidden; }
  body:not(.room-editing) .action-panel {
    grid-area:panel;
    width:100%;
    height:100%;
    min-width:0;
    min-height:0;
    overflow:hidden;
  }
  body:not(.room-editing) .panel-content {
    box-sizing:border-box;
    width:100%;
    height:100%;
    min-width:0;
    min-height:0;
    padding:5px;
    overflow:auto;
    overscroll-behavior:contain;
    scrollbar-width:thin;
  }
  body:not(.room-editing) .action-grid,
  body:not(.room-editing) .minigames-grid,
  body:not(.room-editing) .shop-grid { grid-template-columns:repeat(2,minmax(0,1fr)) !important;gap:4px; }
  body:not(.room-editing) .action-card { min-width:0;min-height:60px;padding:4px; }
  body:not(.room-editing) .action-card span { font-size:17px; }
  body:not(.room-editing) .action-card strong { font-size:5px;line-height:1.35; }
  body:not(.room-editing) .action-card small { font-size:11px;line-height:1; }
  dialog {
    max-width:calc(var(--mobile-vw, 100vw) - 10px) !important;
    max-height:calc(var(--mobile-safe-height, 100dvh) - 10px) !important;
  }
  dialog > form,
  .pet-box-body {
    box-sizing:border-box;
    max-width:100% !important;
    max-height:calc(var(--mobile-safe-height, 100dvh) - 14px) !important;
    overflow:auto !important;
  }

  body.room-editing .app-shell {
    box-sizing:border-box;
    width:var(--mobile-vw, 100vw);
    max-width:none;
    height:var(--mobile-safe-height, 100dvh);
    min-height:0;
    padding:
      calc(4px + env(safe-area-inset-top))
      calc(4px + env(safe-area-inset-right))
      calc(4px + env(safe-area-inset-bottom))
      calc(4px + env(safe-area-inset-left));
    grid-template-columns:minmax(0,1fr) clamp(265px,40vw,360px) !important;
    grid-template-rows:44px minmax(0,1fr) !important;
    grid-template-areas:"top top" "game editor" !important;
    gap:4px !important;
    overflow:hidden !important;
  }
  body.room-editing .topbar { grid-area:top; }
  body.room-editing .game-frame {
    grid-area:game;
    justify-self:center;
    align-self:start;
    width:min(100%, calc((var(--mobile-safe-height, 100dvh) - 52px) * 1.7777778));
    max-width:100%;
    height:auto;
    aspect-ratio:16 / 9 !important;
  }
  body.room-editing .room-builder-panel {
    grid-area:editor;
    box-sizing:border-box;
    width:100%;
    height:100%;
    min-width:0;
    min-height:0;
    max-height:none;
    padding:5px;
    overflow:auto;
    overscroll-behavior:contain;
  }
}

/* DreamPet v5.3.2 — compact Room Builder catalog on mobile landscape */
@media (max-width:1024px) and (orientation:landscape) and (hover:none) and (pointer:coarse),
       (max-width:1024px) and (max-height:700px) and (orientation:landscape) {
  body.room-editing .room-builder-panel {
    padding:4px;
  }
  body.room-editing .room-builder-header {
    gap:4px;
    padding:4px 5px;
    margin-bottom:4px;
  }
  body.room-editing .room-builder-header > div:first-child p,
  body.room-editing .room-builder-header > div:first-child h2 {
    display:none;
  }
  body.room-editing .room-builder-header > div:first-child span {
    font-size:6px;
  }
  body.room-editing .room-builder-header-actions {
    gap:3px;
  }
  body.room-editing .room-builder-header-actions button {
    min-height:27px;
    padding:3px 5px;
    font-size:5px;
  }
  body.room-editing .room-layout-row {
    display:none;
  }
  body.room-editing .room-builder-tools {
    grid-template-columns:minmax(0,1fr) auto;
    gap:4px;
    margin-bottom:4px;
  }
  body.room-editing .room-search span,
  body.room-editing .room-snap-toggle span {
    font-size:5px;
  }
  body.room-editing .room-search input {
    min-height:28px;
    padding:3px 6px;
    font-size:13px;
  }
  body.room-editing .room-snap-toggle {
    min-height:28px;
    padding:3px 5px;
  }
  body.room-editing .room-snap-toggle input {
    width:15px;
    height:15px;
  }
  body.room-editing .room-category-tabs,
  body.room-editing .room-filter-tabs {
    display:flex;
    flex-wrap:nowrap;
    gap:3px;
    margin-bottom:4px;
    overflow-x:auto;
    overscroll-behavior-inline:contain;
    scrollbar-width:none;
  }
  body.room-editing .room-category-tabs::-webkit-scrollbar,
  body.room-editing .room-filter-tabs::-webkit-scrollbar {
    display:none;
  }
  body.room-editing .room-category-tabs button,
  body.room-editing .room-filter-tabs button {
    flex:0 0 auto;
    min-height:25px;
    padding:3px 5px;
    font-size:5px;
    white-space:nowrap;
  }
  body.room-editing .room-builder-grid {
    display:block !important;
  }
  body.room-editing .room-catalog,
  body.room-editing .room-inspector {
    padding:4px;
  }
  body.room-editing .room-catalog > header {
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:4px;
    margin-bottom:4px;
  }
  body.room-editing .room-catalog > header strong {
    font-size:6px;
  }
  body.room-editing .room-catalog > header small {
    font-size:10px;
    white-space:nowrap;
  }
  body.room-editing .room-catalog-list {
    display:grid;
    grid-template-columns:repeat(auto-fill,minmax(78px,1fr)) !important;
    gap:4px;
    max-height:none;
    overflow:visible;
  }
  body.room-editing .room-catalog-card {
    display:flex;
    flex-direction:column;
    min-width:0;
    min-height:0;
    gap:3px;
    padding:4px;
  }
  body.room-editing .room-catalog-card canvas {
    width:100%;
    height:34px;
    aspect-ratio:auto;
    object-fit:contain;
    flex:0 0 34px;
  }
  body.room-editing .room-catalog-copy {
    display:grid;
    gap:1px;
    min-width:0;
  }
  body.room-editing .room-catalog-card strong {
    min-height:0;
    font-size:5px;
    line-height:1.35;
    text-align:center;
  }
  body.room-editing .room-catalog-card small {
    font-size:9px;
    line-height:1;
    text-align:center;
  }
  body.room-editing .room-catalog-card em {
    display:none;
  }
  body.room-editing .room-catalog-card b {
    margin-top:auto;
    padding:3px 2px 1px;
    font-size:5px;
    line-height:1.25;
    text-align:center;
  }
  body.room-editing .room-inspector {
    margin-top:4px;
  }
  body.room-editing .room-inspector > header {
    display:none;
  }
  body.room-editing .room-builder-empty {
    padding:5px;
  }
  body.room-editing .room-builder-empty p {
    display:none;
  }
  body.room-editing .room-builder-selected {
    grid-template-columns:56px minmax(0,1fr);
    gap:4px;
    padding:4px;
  }
  body.room-editing .room-builder-selected canvas {
    width:54px;
    height:42px;
  }
  body.room-editing .room-builder-selected p {
    display:none;
  }
  body.room-editing .room-object-actions {
    grid-template-columns:repeat(4,minmax(0,1fr));
    gap:3px;
  }
  body.room-editing .room-object-actions button {
    min-height:25px;
    padding:3px 2px;
    font-size:5px;
  }
}

/* DreamPet v5.3.3 — desktop scene and right panel share the same baseline */
@media (min-width: 1025px),
       (min-width: 901px) and (hover:hover) and (pointer:fine) {
  body:not(.room-editing) .app-shell {
    width: 100%;
    max-width: none;
    padding-inline: clamp(8px, 1.1vw, 18px);
    grid-template-columns: minmax(0, 1fr) clamp(290px, 19vw, 330px) !important;
    grid-template-rows: auto auto auto !important;
    grid-template-areas:
      "top top"
      "game dock"
      "game panel" !important;
    align-content: start;
    justify-content: stretch;
  }
  body:not(.room-editing) .game-frame {
    grid-area: game;
    width: 100%;
    max-width: none;
    height: auto;
    min-height: 0;
    align-self: stretch;
    justify-self: stretch;
    aspect-ratio: 16 / 9 !important;
  }
  body:not(.room-editing) .dock {
    grid-area: dock;
    align-self: stretch;
  }
  body:not(.room-editing) .action-panel {
    grid-area: panel;
    height: auto;
    min-height: 0;
    align-self: stretch;
  }
  body:not(.room-editing) .panel-content {
    height: 100%;
    min-height: 0;
  }
}

/* Keep the navigation strip compact while the lower panel grows to scene height. */
@media (min-width: 1025px),
       (min-width: 901px) and (hover:hover) and (pointer:fine) {
  body:not(.room-editing) .app-shell {
    grid-template-rows: auto 72px auto !important;
  }
  body:not(.room-editing) .dock {
    height: 72px;
    min-height: 72px;
  }
  body:not(.room-editing) .dock-button {
    min-height: 60px !important;
  }
}

/* DreamPet v5.3.5 — compact catalog, large canvas, no delete drop zone */
.room-editor-focus-toggle {
  position:absolute;
  top:8px;
  right:8px;
  z-index:120;
  min-height:34px;
  padding:6px 9px;
  border:2px solid #493b55;
  border-radius:5px;
  background:rgba(255,249,244,.96);
  color:#493b55;
  box-shadow:0 3px 0 #493b55;
  font-family:'Press Start 2P',monospace;
  font-size:6px;
  line-height:1.45;
  cursor:pointer;
}
.room-editor-focus-toggle:active { transform:translateY(2px);box-shadow:0 1px 0 #493b55; }
.room-editor-focus-toggle[hidden] { display:none !important; }

@media (min-width:1025px),
       (min-width:901px) and (hover:hover) and (pointer:fine) {
  body.room-editing { overflow:hidden !important; }
  body.room-editing .topbar { display:none !important; }
  body.room-editing .app-shell {
    box-sizing:border-box;
    width:100vw;
    max-width:none;
    height:100dvh;
    min-height:0;
    padding:8px;
    grid-template-columns:minmax(0,1fr) clamp(260px,20vw,310px) !important;
    grid-template-rows:minmax(0,1fr) !important;
    grid-template-areas:"game editor" !important;
    gap:8px;
    overflow:hidden !important;
  }
  body.room-editing .game-frame {
    grid-area:game;
    justify-self:center;
    align-self:center;
    width:min(100%, calc((100dvh - 16px) * 1.7777778));
    max-width:100%;
    height:auto;
    max-height:calc(100dvh - 16px);
    aspect-ratio:16 / 9 !important;
  }
  body.room-editing .room-builder-panel {
    grid-area:editor;
    box-sizing:border-box;
    width:100%;
    height:100%;
    min-width:0;
    min-height:0;
    max-height:none;
    padding:5px;
    overflow:auto;
    overscroll-behavior:contain;
  }
  body.room-editing .room-builder-header {
    gap:5px;
    padding:5px;
    margin-bottom:4px;
    align-items:center;
  }
  body.room-editing .room-builder-header h2,
  body.room-editing .room-builder-header p { display:none; }
  body.room-editing .room-builder-header span { font-size:6px; }
  body.room-editing .room-builder-header-actions { gap:3px;flex-wrap:nowrap; }
  body.room-editing .room-builder-header-actions button {
    min-height:28px;
    padding:4px 5px;
    font-size:5px;
    white-space:nowrap;
  }
  body.room-editing .room-layout-row { display:none; }
  body.room-editing .room-builder-tools {
    grid-template-columns:minmax(0,1fr) auto;
    gap:4px;
    margin-bottom:4px;
  }
  body.room-editing .room-search span,
  body.room-editing .room-snap-toggle span { font-size:5px; }
  body.room-editing .room-search input {
    min-height:30px;
    padding:4px 6px;
    font-size:14px;
  }
  body.room-editing .room-snap-toggle {
    min-height:30px;
    padding:3px 5px;
  }
  body.room-editing .room-category-tabs,
  body.room-editing .room-filter-tabs {
    display:flex;
    flex-wrap:nowrap;
    gap:3px;
    margin-bottom:4px;
    overflow-x:auto;
    scrollbar-width:none;
  }
  body.room-editing .room-category-tabs::-webkit-scrollbar,
  body.room-editing .room-filter-tabs::-webkit-scrollbar { display:none; }
  body.room-editing .room-category-tabs button,
  body.room-editing .room-filter-tabs button {
    flex:0 0 auto;
    min-height:27px;
    padding:3px 5px;
    font-size:5px;
    white-space:nowrap;
  }
  body.room-editing .room-builder-grid { display:block !important; }
  body.room-editing .room-catalog,
  body.room-editing .room-inspector { padding:4px; }
  body.room-editing .room-catalog > header {
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:4px;
    margin-bottom:4px;
  }
  body.room-editing .room-catalog > header strong { font-size:6px; }
  body.room-editing .room-catalog > header small {
    font-size:11px;
    white-space:nowrap;
  }
  body.room-editing .room-catalog-list {
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr)) !important;
    gap:4px;
    max-height:none;
    overflow:visible;
  }
  body.room-editing .room-catalog-card {
    display:flex;
    flex-direction:column;
    min-width:0;
    min-height:68px;
    gap:2px;
    padding:4px;
  }
  body.room-editing .room-catalog-card canvas {
    width:100%;
    height:35px;
    aspect-ratio:auto;
    object-fit:contain;
    flex:0 0 35px;
  }
  body.room-editing .room-catalog-copy { gap:1px;min-width:0; }
  body.room-editing .room-catalog-card strong {
    min-height:0;
    font-size:5px;
    line-height:1.3;
    text-align:center;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
  }
  body.room-editing .room-catalog-card small {
    font-size:9px;
    line-height:1;
    text-align:center;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
  }
  body.room-editing .room-catalog-card em { display:none; }
  body.room-editing .room-catalog-card b {
    margin-top:auto;
    padding:3px 1px 1px;
    font-size:4px;
    line-height:1.3;
    text-align:center;
    white-space:nowrap;
    overflow:hidden;
  }
  body.room-editing .room-inspector { margin-top:4px; }
  body.room-editing .room-inspector > header { display:none; }
  body.room-editing .room-builder-empty { padding:5px; }
  body.room-editing .room-builder-empty p { display:none; }
  body.room-editing .room-builder-selected {
    grid-template-columns:54px minmax(0,1fr);
    gap:4px;
    padding:4px;
  }
  body.room-editing .room-builder-selected canvas { width:52px;height:40px; }
  body.room-editing .room-builder-selected p { display:none; }
  body.room-editing .room-object-actions {
    grid-template-columns:repeat(4,minmax(0,1fr));
    gap:3px;
  }
  body.room-editing .room-object-actions button {
    min-height:25px;
    padding:3px 2px;
    font-size:5px;
  }
  body.room-editor-focus .app-shell {
    grid-template-columns:minmax(0,1fr) !important;
    grid-template-areas:"game" !important;
  }
  body.room-editor-focus .room-builder-panel { display:none !important; }
  body.room-editor-focus .game-frame {
    width:min(calc(100dvh * 1.7777778), calc(100vw - 16px));
    max-height:calc(100dvh - 16px);
  }
}

@media (max-width:1024px) and (orientation:landscape) and (hover:none) and (pointer:coarse),
       (max-width:1024px) and (max-height:700px) and (orientation:landscape) {
  body.room-editing .topbar { display:none !important; }
  body.room-editing .app-shell {
    width:var(--mobile-vw,100vw);
    max-width:none;
    height:var(--mobile-safe-height,100dvh);
    min-height:0;
    padding:
      calc(3px + env(safe-area-inset-top))
      calc(3px + env(safe-area-inset-right))
      calc(3px + env(safe-area-inset-bottom))
      calc(3px + env(safe-area-inset-left));
    grid-template-columns:minmax(0,1fr) clamp(198px,31vw,250px) !important;
    grid-template-rows:minmax(0,1fr) !important;
    grid-template-areas:"game editor" !important;
    gap:3px !important;
    overflow:hidden !important;
  }
  body.room-editing .game-frame {
    grid-area:game;
    justify-self:center;
    align-self:center;
    width:min(100%, calc((var(--mobile-safe-height,100dvh) - 6px) * 1.7777778));
    max-width:100%;
    height:auto;
    max-height:calc(var(--mobile-safe-height,100dvh) - 6px);
    aspect-ratio:16 / 9 !important;
  }
  body.room-editing .room-builder-panel {
    grid-area:editor;
    height:100%;
    max-height:none;
    padding:3px;
    overflow:auto;
  }
  body.room-editing .room-catalog-list {
    grid-template-columns:repeat(3,minmax(0,1fr)) !important;
    gap:3px;
  }
  body.room-editing .room-catalog-card {
    min-height:58px;
    padding:3px;
    gap:1px;
  }
  body.room-editing .room-catalog-card canvas {
    height:27px;
    flex-basis:27px;
  }
  body.room-editing .room-catalog-card strong { font-size:4px; }
  body.room-editing .room-catalog-card small { font-size:8px; }
  body.room-editing .room-catalog-card b { font-size:4px;padding-top:2px; }
  .room-editor-focus-toggle {
    top:5px;
    right:5px;
    min-height:29px;
    padding:4px 6px;
    font-size:5px;
  }
  body.room-editor-focus .app-shell {
    grid-template-columns:minmax(0,1fr) !important;
    grid-template-areas:"game" !important;
  }
  body.room-editor-focus .room-builder-panel { display:none !important; }
  body.room-editor-focus .game-frame {
    width:min(calc(var(--mobile-safe-height,100dvh) * 1.7777778), calc(var(--mobile-vw,100vw) - 6px));
    max-height:calc(var(--mobile-safe-height,100dvh) - 6px);
  }
}

/* Explicit editor columns: avoid inherited named-area sizing from older layouts. */
@media (min-width:1025px),
       (min-width:901px) and (hover:hover) and (pointer:fine) {
  body.room-editing .app-shell {
    grid-template-areas:none !important;
    grid-template-columns:minmax(0,1fr) clamp(260px,20vw,310px) !important;
    grid-template-rows:minmax(0,1fr) !important;
  }
  body.room-editing .game-frame { grid-column:1 !important;grid-row:1 !important; }
  body.room-editing .room-builder-panel { grid-column:2 !important;grid-row:1 !important; }
  body.room-editor-focus .app-shell { grid-template-columns:minmax(0,1fr) !important; }
  body.room-editor-focus .game-frame { grid-column:1 !important;grid-row:1 !important; }
}
@media (max-width:1024px) and (orientation:landscape) and (hover:none) and (pointer:coarse),
       (max-width:1024px) and (max-height:700px) and (orientation:landscape) {
  body.room-editing .app-shell {
    grid-template-areas:none !important;
    grid-template-columns:minmax(0,1fr) clamp(198px,31vw,250px) !important;
    grid-template-rows:minmax(0,1fr) !important;
  }
  body.room-editing .game-frame { grid-column:1 !important;grid-row:1 !important; }
  body.room-editing .room-builder-panel { grid-column:2 !important;grid-row:1 !important; }
  body.room-editor-focus .app-shell { grid-template-columns:minmax(0,1fr) !important; }
  body.room-editor-focus .game-frame { grid-column:1 !important;grid-row:1 !important; }
}

/* Room Builder must remain a grid; older editor rules switched the shell to flex. */
body.room-editing .app-shell { display:grid !important; }

/* DreamPet v5.3.6 — balanced Room Builder and readable controls */
@media (min-width:1025px),
       (min-width:901px) and (hover:hover) and (pointer:fine) {
  body.room-editing .app-shell {
    grid-template-columns:minmax(0,1fr) clamp(340px,28vw,440px) !important;
  }
  body.room-editing .game-frame {
    width:min(100%, calc((100dvh - 28px) * 1.7777778));
    max-height:calc(100dvh - 28px);
  }
  body.room-editing .room-builder-panel {
    padding:7px;
  }
  body.room-editing .room-builder-header {
    align-items:flex-start;
    gap:7px;
    padding:7px;
  }
  body.room-editing .room-builder-header-actions {
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    width:min(210px,100%);
    gap:5px;
    flex:0 0 auto;
  }
  body.room-editing .room-builder-header-actions button {
    width:100%;
    min-width:0;
    min-height:32px;
    padding:5px 6px;
    font-size:6px;
    line-height:1.35;
    white-space:normal;
    overflow-wrap:anywhere;
  }
  body.room-editing .room-builder-tools {
    gap:6px;
    margin-bottom:6px;
  }
  body.room-editing .room-search input {
    min-height:34px;
    font-size:16px;
  }
  body.room-editing .room-category-tabs,
  body.room-editing .room-filter-tabs {
    gap:4px;
    margin-bottom:6px;
  }
  body.room-editing .room-category-tabs button,
  body.room-editing .room-filter-tabs button {
    min-height:30px;
    padding:4px 7px;
    font-size:6px;
    line-height:1.3;
  }
  body.room-editing .room-catalog-list {
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    gap:7px;
  }
  body.room-editing .room-catalog-card {
    min-height:108px;
    padding:6px;
    gap:4px;
    overflow:visible;
  }
  body.room-editing .room-catalog-card canvas {
    height:54px;
    flex:0 0 54px;
  }
  body.room-editing .room-catalog-card strong {
    min-height:16px;
    font-size:6px;
    line-height:1.4;
    white-space:normal;
    overflow:visible;
    text-overflow:clip;
    overflow-wrap:anywhere;
  }
  body.room-editing .room-catalog-card small {
    font-size:12px;
    line-height:1.05;
    white-space:normal;
    overflow:visible;
    text-overflow:clip;
    overflow-wrap:anywhere;
  }
  body.room-editing .room-catalog-card b {
    min-height:22px;
    display:grid;
    place-items:center;
    padding:4px 3px 2px;
    font-size:5px;
    line-height:1.35;
    white-space:normal;
    overflow:visible;
    overflow-wrap:anywhere;
  }
  body.room-editing .room-catalog > header {
    align-items:flex-start;
  }
  body.room-editing .room-catalog > header small {
    max-width:62%;
    font-size:12px;
    line-height:1.1;
    white-space:normal;
    text-align:right;
    overflow-wrap:anywhere;
  }
  body.room-editing .room-builder-selected {
    grid-template-columns:70px minmax(0,1fr);
    gap:6px;
    padding:6px;
  }
  body.room-editing .room-builder-selected canvas {
    width:68px;
    height:50px;
  }
  body.room-editing .room-builder-selected strong,
  body.room-editing .room-builder-selected small {
    overflow-wrap:anywhere;
  }
  body.room-editing .room-object-actions button {
    min-height:30px;
    padding:4px 3px;
    font-size:6px;
    line-height:1.3;
    white-space:normal;
    overflow-wrap:anywhere;
  }
}

@media (max-width:1024px) and (orientation:landscape) and (hover:none) and (pointer:coarse),
       (max-width:1024px) and (max-height:700px) and (orientation:landscape) {
  body.room-editing .app-shell {
    grid-template-columns:minmax(0,1fr) clamp(240px,39vw,330px) !important;
  }
  body.room-editing .game-frame {
    width:min(100%, calc((var(--mobile-safe-height,100dvh) - 14px) * 1.7777778));
    max-height:calc(var(--mobile-safe-height,100dvh) - 14px);
  }
  body.room-editing .room-builder-panel {
    padding:5px;
  }
  body.room-editing .room-builder-header-actions {
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:3px;
  }
  body.room-editing .room-builder-header-actions button {
    min-width:0;
    min-height:27px;
    padding:3px 4px;
    font-size:5px;
    line-height:1.3;
    white-space:normal;
    overflow-wrap:anywhere;
  }
  body.room-editing .room-catalog-list {
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    gap:5px;
  }
  body.room-editing .room-catalog-card {
    min-height:83px;
    padding:4px;
    gap:2px;
    overflow:visible;
  }
  body.room-editing .room-catalog-card canvas {
    height:40px;
    flex-basis:40px;
  }
  body.room-editing .room-catalog-card strong {
    min-height:13px;
    font-size:5px;
    line-height:1.3;
    white-space:normal;
    overflow:visible;
    text-overflow:clip;
    overflow-wrap:anywhere;
  }
  body.room-editing .room-catalog-card small {
    font-size:10px;
    line-height:1;
    white-space:normal;
    overflow:visible;
    text-overflow:clip;
    overflow-wrap:anywhere;
  }
  body.room-editing .room-catalog-card b {
    min-height:17px;
    display:grid;
    place-items:center;
    padding:3px 2px 1px;
    font-size:5px;
    line-height:1.2;
    white-space:normal;
    overflow:visible;
    overflow-wrap:anywhere;
  }
  body.room-editing .room-catalog > header small {
    max-width:60%;
    font-size:10px;
    line-height:1.05;
    white-space:normal;
    text-align:right;
  }
  body.room-editing .room-object-actions button {
    min-height:27px;
    font-size:5px;
    line-height:1.25;
    white-space:normal;
    overflow-wrap:anywhere;
  }
}

/* DreamPet v5.3.7 — desktop Room Builder categories always visible */
@media (min-width:1025px),
       (min-width:901px) and (hover:hover) and (pointer:fine) {
  body.room-editing .room-category-tabs {
    display:grid !important;
    grid-template-columns:repeat(3,minmax(0,1fr)) !important;
    gap:5px !important;
    width:100%;
    max-width:100%;
    overflow:visible !important;
    padding:0;
    margin:0 0 7px;
  }
  body.room-editing .room-filter-tabs {
    display:grid !important;
    grid-template-columns:repeat(4,minmax(0,1fr)) !important;
    gap:5px !important;
    width:100%;
    max-width:100%;
    overflow:visible !important;
    padding:0;
    margin:0 0 7px;
  }
  body.room-editing .room-category-tabs button,
  body.room-editing .room-filter-tabs button {
    width:100%;
    min-width:0;
    max-width:none;
    min-height:31px;
    padding:4px 5px;
    font-size:5.5px;
    line-height:1.35;
    white-space:normal !important;
    overflow:visible !important;
    overflow-wrap:anywhere;
    text-align:center;
  }
  body.room-editing .room-builder-panel {
    overflow-x:hidden !important;
    overflow-y:auto !important;
  }
  body.room-editing .room-catalog,
  body.room-editing .room-builder-grid,
  body.room-editing .room-catalog-list {
    min-width:0;
    max-width:100%;
  }
}

/* DreamPet v5.3.8 — readable Room Builder typography, no clipped controls */
body.room-editing .room-builder-panel,
body.room-editing .room-builder-panel * {
  box-sizing: border-box;
}
body.room-editing .room-builder-panel button,
body.room-editing .room-builder-panel input,
body.room-editing .room-builder-panel strong,
body.room-editing .room-builder-panel small,
body.room-editing .room-builder-panel em,
body.room-editing .room-builder-panel p,
body.room-editing .room-builder-panel span,
body.room-editing .room-builder-panel b {
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: normal;
}
body.room-editing .room-builder-panel button {
  height: auto !important;
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
}
body.room-editing .room-builder-header > div:first-child span {
  font-size: 8px;
  line-height: 1.45;
}
body.room-editing .room-builder-header h2 {
  font-size: 13px;
  line-height: 1.5;
}
body.room-editing .room-builder-header p {
  font-size: 17px;
  line-height: 1.2;
}
body.room-editing .room-layout-row > strong,
body.room-editing .room-catalog > header strong,
body.room-editing .room-inspector > header strong {
  font-size: 8px;
  line-height: 1.5;
}
body.room-editing .room-layout-row button,
body.room-editing .room-builder-header-actions button,
body.room-editing .room-object-actions button {
  min-height: 36px;
  padding: 7px 8px;
  font-size: 7px;
  line-height: 1.4;
}
body.room-editing .room-search span,
body.room-editing .room-snap-toggle span {
  font-size: 7px;
  line-height: 1.45;
}
body.room-editing .room-search input {
  min-height: 40px;
  padding: 7px 9px;
  font-size: 18px;
  line-height: 1.15;
}
body.room-editing .room-snap-toggle {
  min-height: 40px;
}
body.room-editing .room-category-tabs button,
body.room-editing .room-filter-tabs button {
  min-height: 38px;
  padding: 7px 6px;
  font-size: 7px;
  line-height: 1.45;
}
body.room-editing .room-catalog > header small,
body.room-editing .room-inspector > header small {
  font-size: 15px;
  line-height: 1.18;
}
body.room-editing .room-catalog-card {
  min-height: 126px;
  padding: 8px;
  gap: 6px;
}
body.room-editing .room-catalog-card canvas {
  height: 62px;
  flex-basis: 62px;
}
body.room-editing .room-catalog-card strong {
  min-height: 20px;
  font-size: 7px;
  line-height: 1.5;
}
body.room-editing .room-catalog-card small {
  min-height: 16px;
  font-size: 15px;
  line-height: 1.12;
}
body.room-editing .room-catalog-card b {
  min-height: 28px;
  padding: 6px 4px 4px;
  font-size: 6.5px;
  line-height: 1.4;
}
body.room-editing .room-builder-empty strong,
body.room-editing .room-builder-selected strong {
  font-size: 8px;
  line-height: 1.5;
}
body.room-editing .room-builder-empty p,
body.room-editing .room-builder-selected p {
  font-size: 16px;
  line-height: 1.2;
}
body.room-editing .room-builder-selected small {
  font-size: 7px;
  line-height: 1.45;
}

@media (min-width:1025px),
       (min-width:901px) and (hover:hover) and (pointer:fine) {
  body.room-editing .app-shell {
    grid-template-columns:minmax(0,1fr) clamp(380px,30vw,500px) !important;
  }
  body.room-editing .room-category-tabs {
    grid-template-columns:repeat(3,minmax(0,1fr)) !important;
  }
  body.room-editing .room-filter-tabs {
    grid-template-columns:repeat(4,minmax(0,1fr)) !important;
  }
  body.room-editing .room-catalog-list {
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    gap:8px;
  }
}

@media (max-width:1024px) and (orientation:landscape) and (hover:none) and (pointer:coarse),
       (max-width:1024px) and (max-height:700px) and (orientation:landscape) {
  body.room-editing .app-shell {
    grid-template-columns:minmax(0,1fr) clamp(270px,41vw,360px) !important;
  }
  body.room-editing .room-builder-panel {
    padding:6px;
  }
  body.room-editing .room-builder-header > div:first-child span {
    font-size:6px;
  }
  body.room-editing .room-builder-header-actions button,
  body.room-editing .room-layout-row button,
  body.room-editing .room-object-actions button {
    min-height:31px;
    padding:5px 5px;
    font-size:6px;
    line-height:1.35;
  }
  body.room-editing .room-search span,
  body.room-editing .room-snap-toggle span {
    font-size:6px;
  }
  body.room-editing .room-search input {
    min-height:34px;
    font-size:16px;
  }
  body.room-editing .room-snap-toggle {
    min-height:34px;
  }
  body.room-editing .room-category-tabs button,
  body.room-editing .room-filter-tabs button {
    min-height:32px;
    padding:5px 4px;
    font-size:6px;
    line-height:1.35;
  }
  body.room-editing .room-catalog > header strong,
  body.room-editing .room-inspector > header strong {
    font-size:7px;
  }
  body.room-editing .room-catalog > header small,
  body.room-editing .room-inspector > header small {
    font-size:12px;
  }
  body.room-editing .room-catalog-card {
    min-height:103px;
    padding:5px;
    gap:3px;
  }
  body.room-editing .room-catalog-card canvas {
    height:48px;
    flex-basis:48px;
  }
  body.room-editing .room-catalog-card strong {
    min-height:17px;
    font-size:6px;
    line-height:1.4;
  }
  body.room-editing .room-catalog-card small {
    min-height:13px;
    font-size:12px;
    line-height:1.08;
  }
  body.room-editing .room-catalog-card b {
    min-height:23px;
    padding:4px 3px 3px;
    font-size:5.5px;
    line-height:1.3;
  }
  body.room-editing .room-builder-selected strong {
    font-size:7px;
  }
  body.room-editing .room-builder-selected small {
    font-size:6px;
  }
}


/* DreamPet v5.3.9 — Decorazioni opens the full visual catalog */
.room-tab.room-catalog-launch{
  background:#eadcf5;
  border-color:#7d668d;
  font-weight:800;
  box-shadow:inset 0 -2px 0 rgba(83,62,96,.18);
}
.room-tab.room-catalog-launch:hover,
.room-tab.room-catalog-launch:focus-visible{
  background:#dcc7ed;
  transform:translateY(-1px);
}
.room-tab.room-catalog-launch::after{
  content:'APRI CATALOGO';
  display:block;
  margin-top:3px;
  font-family:'Press Start 2P',monospace;
  font-size:5px;
  line-height:1.35;
  opacity:.72;
}

/* DreamPet v5.4.1 — full Room Builder, modal store and permanent tools */
.room-stage{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  transform-origin:center center;
  will-change:transform;
}
.room-stage > #gameCanvas{position:absolute;inset:0;width:100%;height:100%;}
body:not(.room-editing) .room-stage{transform:none!important;}
body.room-editing .room-stage{
  transform:translate(var(--room-editor-pan-x,0px),var(--room-editor-pan-y,0px)) scale(var(--room-editor-zoom,1));
  transition:transform .12s ease-out;
}
body.room-object-dragging .room-stage,
body.room-scene-panning .room-stage{transition:none;}
body.room-editing .scene-badge,
body.room-editing .observe-button,
body.room-editing .visitor-badge,
body.room-editing .speech-bubble{display:none!important;}

.room-editor-toolbar,
.room-selection-hud,
.room-catalog-modal,
.room-catalog-modal *{box-sizing:border-box;}
.room-editor-toolbar[hidden],
.room-selection-hud[hidden],
.room-catalog-modal[hidden]{display:none!important;}

.room-editor-toolbar{
  position:fixed;
  top:max(8px,env(safe-area-inset-top));
  left:50%;
  z-index:7000;
  display:flex;
  align-items:stretch;
  justify-content:center;
  gap:6px;
  width:min(calc(100vw - 20px),1180px);
  min-height:48px;
  padding:6px;
  transform:translateX(-50%);
  border:3px solid #493b55;
  border-radius:7px;
  background:rgba(239,229,242,.97);
  box-shadow:inset 0 0 0 2px #fff8f2,0 4px 0 #493b55;
  backdrop-filter:blur(8px);
}
.room-editor-toolbar button,
.room-zoom-control output{
  min-width:0;
  min-height:34px;
  padding:7px 9px;
  border:2px solid #604e6d;
  border-radius:5px;
  background:#fff8f0;
  color:#382d43;
  box-shadow:inset 0 -2px 0 rgba(64,45,72,.13);
  font-family:'Press Start 2P',monospace;
  font-size:8px;
  line-height:1.35;
  text-align:center;
  white-space:normal;
  overflow-wrap:anywhere;
}
.room-editor-toolbar button:hover,
.room-editor-toolbar button:focus-visible{background:#eadcf5;transform:translateY(-1px);}
.room-editor-toolbar button:active{transform:translateY(1px);}
.room-editor-toolbar button.active{background:#d8c3e8;box-shadow:inset 0 0 0 2px #b99fce;}
.room-editor-toolbar button.primary{background:#d9ead8;}
.room-editor-toolbar button.danger{background:#f3d3d7;}
.room-editor-toolbar button:disabled{opacity:.42;transform:none;cursor:not-allowed;}
.room-editor-toolbar .room-editor-focus-toggle{
  position:static;
  inset:auto;
  z-index:auto;
  min-height:34px;
  margin:0;
  padding:7px 9px;
  box-shadow:inset 0 -2px 0 rgba(64,45,72,.13);
}
.room-zoom-control{display:grid;grid-template-columns:36px 62px 36px;gap:3px;}
.room-zoom-control button{padding:5px;font-size:13px;}
.room-zoom-control output{display:grid;place-items:center;padding:5px;background:#e7dded;}

body.room-editing{overflow:hidden!important;}
body.room-editing .topbar,
body.room-editing .dock,
body.room-editing .action-panel{display:none!important;}
body.room-editing .app-shell{
  display:grid!important;
  box-sizing:border-box;
  width:100vw!important;
  max-width:none!important;
  height:100dvh!important;
  min-height:0!important;
  padding:66px 10px 10px!important;
  grid-template-columns:minmax(0,1fr) clamp(330px,25vw,420px)!important;
  grid-template-rows:minmax(0,1fr)!important;
  grid-template-areas:none!important;
  gap:10px!important;
  overflow:hidden!important;
}
body.room-editing .game-frame{
  grid-column:1!important;
  grid-row:1!important;
  align-self:center!important;
  justify-self:center!important;
  width:min(100%,calc((100dvh - 84px) * 1.7777778))!important;
  max-width:100%!important;
  max-height:calc(100dvh - 84px)!important;
  min-height:0!important;
  height:auto!important;
  aspect-ratio:16/9!important;
  overflow:hidden!important;
}
body.room-editing .room-builder-panel{
  grid-column:2!important;
  grid-row:1!important;
  width:100%!important;
  height:100%!important;
  min-width:0!important;
  min-height:0!important;
  padding:10px!important;
  overflow-x:hidden!important;
  overflow-y:auto!important;
  overscroll-behavior:contain;
  border:3px solid #493b55!important;
  border-radius:7px!important;
  background:rgba(239,229,242,.97)!important;
  box-shadow:inset 0 0 0 2px #fff8f2,0 4px 0 #493b55!important;
}
body.room-editor-focus .app-shell{grid-template-columns:minmax(0,1fr)!important;}
body.room-editor-focus .game-frame{
  grid-column:1!important;
  width:min(calc((100dvh - 84px) * 1.7777778),calc(100vw - 20px))!important;
  max-height:calc(100dvh - 84px)!important;
}
body.room-editor-focus .room-builder-panel{display:none!important;}

.room-builder-header{
  display:flex!important;
  align-items:flex-start!important;
  justify-content:space-between!important;
  gap:10px!important;
  margin:0 0 10px!important;
  padding:10px!important;
  border:2px solid #786483!important;
  border-radius:5px!important;
  background:#e7dced!important;
}
.room-builder-header > div{min-width:0;}
.room-builder-header span,
.room-builder-header small{font-family:'Press Start 2P',monospace;font-size:8px!important;line-height:1.45!important;color:#6e5779;}
.room-builder-header h2{display:block!important;margin:5px 0!important;font-size:18px!important;line-height:1.18!important;color:#362b40;}
.room-builder-header p{display:block!important;margin:0!important;font-size:15px!important;line-height:1.25!important;color:#695a70;}
.room-builder-header > button{
  flex:0 0 auto;
  min-height:38px;
  padding:7px 9px;
  border:2px solid #604e6d;
  border-radius:5px;
  background:#fff8f0;
  font-family:'Press Start 2P',monospace;
  font-size:8px;
  line-height:1.35;
}
.room-layout-row{
  display:grid!important;
  gap:7px!important;
  margin-bottom:10px!important;
  padding:9px!important;
  border:2px solid #8a758f!important;
  border-radius:5px!important;
  background:#f7eef3!important;
}
.room-layout-row > strong{font-family:'Press Start 2P',monospace;font-size:9px!important;line-height:1.45!important;}
.room-layout-row > div{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:6px!important;}
.room-layout-row button,
.room-layer-list button,
.room-object-actions button,
.room-nudge-pad button{
  min-width:0;
  min-height:38px!important;
  padding:7px 8px!important;
  border:2px solid #75617f!important;
  border-radius:5px!important;
  background:#fff9f2!important;
  color:#3d3048!important;
  font-family:'Press Start 2P',monospace!important;
  font-size:8px!important;
  line-height:1.4!important;
  white-space:normal!important;
  overflow:visible!important;
  overflow-wrap:anywhere!important;
  text-overflow:clip!important;
}
.room-layout-row button.active,
.room-layer-list button.active{background:#dac5e8!important;box-shadow:inset 0 0 0 2px #b497c9!important;}
.room-inspector-v54,
.room-layers-v54{
  min-width:0;
  margin-top:10px;
  padding:9px;
  border:2px solid #806b89;
  border-radius:5px;
  background:#f5ecf2;
}
.room-inspector-v54 > header,
.room-layers-v54 > header{display:grid;gap:3px;margin-bottom:8px;}
.room-inspector-v54 > header strong,
.room-layers-v54 > header strong{font-family:'Press Start 2P',monospace;font-size:9px;line-height:1.45;color:#463650;}
.room-inspector-v54 > header small,
.room-layers-v54 > header small{font-size:14px;line-height:1.2;color:#77657c;}
.room-builder-empty{display:grid;place-items:center;gap:6px;padding:14px;text-align:center;}
.room-builder-empty span{font-size:28px;}
.room-builder-empty strong{font-family:'Press Start 2P',monospace;font-size:9px!important;line-height:1.5!important;}
.room-builder-empty p{margin:0;font-size:15px!important;line-height:1.25!important;}
.room-builder-selected{
  display:grid!important;
  grid-template-columns:86px minmax(0,1fr)!important;
  gap:9px!important;
  min-width:0!important;
  padding:9px!important;
  border:2px solid #8c768f!important;
  border-radius:5px!important;
  background:#fff8f3!important;
}
.room-builder-selected.locked{background:#ece8ef!important;}
.room-builder-selected canvas{width:84px!important;height:62px!important;border:2px solid #75617f;border-radius:4px;background:#eee5f0;image-rendering:pixelated;}
.room-selected-copy{display:grid;align-content:start;gap:4px;min-width:0;}
.room-selected-copy small{font-family:'Press Start 2P',monospace;font-size:8px!important;line-height:1.45!important;color:#7b627f;}
.room-selected-copy strong{font-family:'Press Start 2P',monospace;font-size:9px!important;line-height:1.5!important;color:#382d43;}
.room-selected-copy p{margin:0;font-size:15px!important;line-height:1.2!important;color:#695a70;}
.room-nudge-pad{grid-column:1/-1;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:5px;}
.room-nudge-pad button{font-size:15px!important;min-height:34px!important;padding:4px!important;}
.room-object-actions{grid-column:1/-1;display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:6px!important;}
.room-object-actions .danger{background:#f2ced3!important;}
.room-layer-list{display:grid;gap:5px;max-height:30vh;overflow:auto;padding-right:2px;}
.room-layer-list button{display:grid;grid-template-columns:24px minmax(0,1fr) auto;align-items:center;gap:6px;text-align:left;}
.room-layer-list button span{font-size:16px;}
.room-layer-list button strong{font-size:8px;line-height:1.4;}
.room-layer-list button small{font-size:13px;white-space:nowrap;}

.room-selection-hud{
  position:fixed;
  left:50%;
  bottom:max(10px,env(safe-area-inset-bottom));
  z-index:6800;
  width:min(calc(100vw - 24px),860px);
  max-height:42vh;
  padding:7px;
  transform:translateX(-50%);
  overflow:auto;
  border:3px solid #493b55;
  border-radius:7px;
  background:rgba(242,233,244,.96);
  box-shadow:inset 0 0 0 2px #fff8f2,0 4px 0 #493b55;
  backdrop-filter:blur(8px);
}
.room-selection-hud .room-builder-selected{
  grid-template-columns:minmax(150px,1fr) auto auto!important;
  align-items:center;
  padding:6px!important;
  border:0!important;
  background:transparent!important;
}
.room-selection-hud .room-selected-copy p{font-size:14px!important;}
.room-selection-hud .room-nudge-pad{grid-column:auto;grid-template-columns:repeat(2,36px);width:78px;}
.room-selection-hud .room-object-actions{grid-column:auto;grid-template-columns:repeat(4,minmax(75px,1fr))!important;max-width:520px;}
.room-selection-hud .room-object-actions button{min-height:34px!important;padding:5px!important;font-size:7px!important;}
.room-selection-hud .room-object-actions button:nth-last-child(n+5){display:none;}
body.room-catalog-open .room-editor-toolbar,
body.room-catalog-open .room-selection-hud{visibility:hidden;pointer-events:none;}

.room-drag-surface{touch-action:none;cursor:grab;}
.room-drag-surface.dragging{cursor:grabbing;}
.game-frame.room-grid-visible .room-drag-surface::before{
  content:'';
  position:absolute;
  inset:0;
  z-index:1;
  pointer-events:none;
  background-image:
    linear-gradient(rgba(244,229,255,.18) 1px,transparent 1px),
    linear-gradient(90deg,rgba(244,229,255,.18) 1px,transparent 1px),
    linear-gradient(rgba(255,224,181,.2) 1px,transparent 1px),
    linear-gradient(90deg,rgba(255,224,181,.2) 1px,transparent 1px);
  background-size:2.5% 4.444%,2.5% 4.444%,10% 17.777%,10% 17.777%;
}
.room-placement-zone{
  position:absolute;
  z-index:2;
  display:none;
  pointer-events:none;
  border:2px dashed rgba(255,242,200,.75);
  background:rgba(159,118,194,.14);
}
.room-placement-zone span{
  position:absolute;
  top:4px;
  left:4px;
  padding:3px 5px;
  border-radius:3px;
  background:rgba(54,37,67,.78);
  color:#fff4df;
  font-family:'Press Start 2P',monospace;
  font-size:6px;
  line-height:1.4;
}
.room-drag-surface[data-placement-zone] .room-placement-zone{display:block;}
.room-drag-surface[data-placement-zone="wall"] .room-placement-zone{left:2%;right:2%;top:13%;height:40%;}
.room-drag-surface[data-placement-zone="floor"] .room-placement-zone{left:2%;right:2%;top:76%;bottom:2%;}
.room-drag-surface[data-placement-zone="table"] .room-placement-zone{left:5%;right:5%;top:38%;height:40%;}
.room-drag-surface[data-placement-zone="room"] .room-placement-zone{left:2%;right:2%;top:42%;bottom:2%;}
.room-guide{position:absolute;z-index:9;pointer-events:none;background:#ffe098;box-shadow:0 0 0 1px rgba(59,39,70,.45);}
.room-guide-x{top:0;bottom:0;width:1px;}
.room-guide-y{left:0;right:0;height:1px;}
.room-selection-frame{
  z-index:10!important;
  background:transparent!important;
  border:2px solid #ffe19a!important;
  box-shadow:0 0 0 2px rgba(69,48,82,.75),0 5px 12px rgba(20,12,28,.35)!important;
  pointer-events:none!important;
}
.room-selection-frame.locked{border-style:dashed!important;border-color:#d7cbe0!important;}
.room-selection-name,
.room-selection-coords{
  position:absolute;
  left:50%;
  width:max-content;
  max-width:220px;
  padding:3px 5px;
  transform:translateX(-50%);
  border:1px solid #4b3856;
  border-radius:3px;
  background:rgba(255,247,230,.95);
  color:#3d2f47;
  text-align:center;
  pointer-events:none;
}
.room-selection-name{bottom:calc(100% + 5px);font-family:'Press Start 2P',monospace;font-size:6px;line-height:1.4;}
.room-selection-coords{top:calc(100% + 5px);font-style:normal;font-size:11px;line-height:1.1;}
.room-selection-quick{
  position:absolute;
  top:50%;
  left:calc(100% + 6px);
  display:grid;
  gap:3px;
  transform:translateY(-50%);
  pointer-events:auto;
}
.room-selection-quick button{
  display:grid;
  place-items:center;
  width:28px;
  height:28px;
  padding:0;
  border:2px solid #4e3b59;
  border-radius:4px;
  background:#fff4df;
  color:#3d2f47;
  font-size:13px;
  box-shadow:0 2px 0 #4e3b59;
}
.room-selection-quick button:active{transform:translateY(1px);box-shadow:0 1px 0 #4e3b59;}
.room-object-dragging .room-selection-frame{filter:drop-shadow(8px 10px 5px rgba(18,10,28,.42));}

.room-catalog-modal{
  position:fixed;
  inset:0;
  z-index:12000;
  display:grid;
  place-items:center;
  padding:max(12px,env(safe-area-inset-top)) max(12px,env(safe-area-inset-right)) max(12px,env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left));
  background:rgba(30,22,42,.82);
  backdrop-filter:blur(8px);
}
.room-catalog-window{
  display:grid;
  grid-template-rows:auto auto auto auto minmax(0,1fr);
  width:min(1440px,100%);
  height:min(920px,100%);
  min-width:0;
  min-height:0;
  padding:12px;
  overflow:hidden;
  border:4px solid #493b55;
  border-radius:8px;
  background:#eee4f0;
  box-shadow:inset 0 0 0 3px #fff8f2,0 12px 0 rgba(28,18,35,.72);
}
.room-catalog-window-header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
  padding:10px 12px;
  border:2px solid #806a8a;
  border-radius:5px;
  background:#dfd0e7;
}
.room-catalog-window-header > div{min-width:0;}
.room-catalog-window-header small{font-family:'Press Start 2P',monospace;font-size:9px;line-height:1.5;color:#705879;}
.room-catalog-window-header h2{margin:5px 0;font-size:25px;line-height:1.1;color:#352a3e;}
.room-catalog-window-header p{margin:0;font-size:16px;line-height:1.25;color:#625269;}
.room-catalog-close{
  flex:0 0 auto;
  min-height:42px;
  padding:8px 12px;
  border:2px solid #604d6a;
  border-radius:5px;
  background:#f2d2d7;
  font-family:'Press Start 2P',monospace;
  font-size:9px;
  line-height:1.4;
}
.room-catalog-controls{
  display:grid;
  grid-template-columns:minmax(240px,1fr) 210px auto;
  gap:9px;
  margin-top:10px;
}
.room-catalog-controls label{display:grid;gap:4px;min-width:0;}
.room-catalog-controls label > span{font-family:'Press Start 2P',monospace;font-size:8px;line-height:1.4;color:#65506f;}
.room-catalog-controls input[type="text"],
.room-catalog-controls input:not([type]),
.room-catalog-controls select,
.room-catalog-search input{
  width:100%;
  min-width:0;
  min-height:43px;
  padding:8px 10px;
  border:2px solid #776180;
  border-radius:5px;
  background:#fffaf4;
  color:#3b2f44;
  font-size:17px;
  line-height:1.2;
}
.room-catalog-snap{
  display:flex!important;
  align-items:center;
  align-self:end;
  min-height:43px;
  padding:7px 10px;
  border:2px solid #776180;
  border-radius:5px;
  background:#fffaf4;
}
.room-catalog-snap input{width:20px;height:20px;}
.room-catalog-categories,
.room-catalog-filters{
  display:flex;
  gap:6px;
  min-width:0;
  margin-top:9px;
  overflow-x:auto;
  overscroll-behavior-inline:contain;
  scrollbar-width:thin;
  padding-bottom:2px;
}
.room-catalog-categories button,
.room-catalog-filters button{
  flex:0 0 auto;
  min-height:38px;
  padding:7px 10px;
  border:2px solid #75617f;
  border-radius:5px;
  background:#fff8f1;
  color:#3d3047;
  font-family:'Press Start 2P',monospace;
  font-size:8px;
  line-height:1.4;
  white-space:nowrap;
}
.room-catalog-categories button.active,
.room-catalog-filters button.active{background:#d4bee4;box-shadow:inset 0 0 0 2px #b095c2;}
.room-catalog-filters span{margin-left:auto;align-self:center;padding:0 8px;font-size:15px;white-space:nowrap;color:#6b596f;}
.room-catalog-body{
  display:grid;
  grid-template-columns:minmax(0,1fr) clamp(290px,25vw,380px);
  gap:10px;
  min-width:0;
  min-height:0;
  margin-top:9px;
  overflow:hidden;
}
.room-store-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  align-content:start;
  gap:10px;
  min-width:0;
  min-height:0;
  padding:2px 5px 10px 2px;
  overflow:auto;
  overscroll-behavior:contain;
}
.room-store-card{
  position:relative;
  display:grid;
  grid-template-rows:128px auto auto auto;
  min-width:0;
  min-height:310px;
  padding:9px;
  border:3px solid #796480;
  border-radius:6px;
  background:#fff8f2;
  box-shadow:inset 0 0 0 2px #eee0e8,0 4px 0 #594661;
  overflow:visible;
}
.room-store-card:hover,
.room-store-card.selected{border-color:#9e79b2;background:#f7effb;transform:translateY(-1px);}
.room-store-preview{
  display:grid;
  place-items:center;
  width:100%;
  min-width:0;
  height:128px;
  padding:4px;
  border:2px solid #89718f;
  border-radius:5px;
  background:linear-gradient(180deg,#efe5f2,#d9cbe2);
}
.room-store-preview canvas{display:block;width:100%;height:100%;image-rendering:pixelated;object-fit:contain;}
.room-store-favorite{
  position:absolute;
  top:15px;
  right:15px;
  z-index:2;
  display:grid;
  place-items:center;
  width:36px;
  height:36px;
  padding:0;
  border:2px solid #5b4864;
  border-radius:50%;
  background:rgba(255,249,239,.94);
  color:#7b6683;
  font-size:20px;
}
.room-store-favorite.active{color:#9b6722;background:#ffe6a9;}
.room-store-copy{display:grid;align-content:start;gap:5px;min-width:0;padding:8px 1px 5px;}
.room-store-copy small{font-family:'Press Start 2P',monospace;font-size:8px;line-height:1.45;color:#806b85;}
.room-store-copy strong{font-family:'Press Start 2P',monospace;font-size:10px;line-height:1.5;color:#392d42;}
.room-store-copy p{display:-webkit-box;min-height:38px;margin:0;overflow:hidden;font-size:15px;line-height:1.25;color:#65566b;-webkit-line-clamp:2;-webkit-box-orient:vertical;}
.room-store-stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:4px;margin-top:auto;}
.room-store-stats span{display:grid;gap:2px;min-width:0;padding:5px 3px;border:1px solid #b3a1b6;border-radius:4px;background:#eee5ee;text-align:center;font-size:11px;line-height:1.1;}
.room-store-stats b{font-size:14px;color:#43354b;}
.room-store-add{
  width:100%;
  min-height:42px;
  margin-top:8px;
  padding:8px;
  border:2px solid #5f4d68;
  border-radius:5px;
  background:#d9ead8;
  color:#382d42;
  font-family:'Press Start 2P',monospace;
  font-size:8px;
  line-height:1.45;
  white-space:normal;
  overflow-wrap:anywhere;
}
.room-store-add:disabled{opacity:.48;cursor:not-allowed;}
.room-store-preview-panel{min-width:0;min-height:0;overflow:auto;}
.room-store-detail{
  display:grid;
  grid-template-rows:220px auto auto;
  min-height:100%;
  padding:10px;
  border:3px solid #796480;
  border-radius:6px;
  background:#fff8f2;
  box-shadow:inset 0 0 0 2px #eee0e8;
}
.room-store-detail-stage{display:grid;place-items:center;min-width:0;border:2px solid #89718f;border-radius:5px;background:linear-gradient(180deg,#efe5f2,#d9cbe2);}
.room-store-detail-stage canvas{display:block;width:100%;height:100%;image-rendering:pixelated;object-fit:contain;}
.room-store-detail-copy{min-width:0;padding:10px 2px;}
.room-store-detail-copy > small{font-family:'Press Start 2P',monospace;font-size:8px;line-height:1.45;color:#806b85;}
.room-store-detail-copy h3{margin:6px 0;font-family:'Press Start 2P',monospace;font-size:12px;line-height:1.5;color:#392d42;}
.room-store-detail-copy p{margin:0 0 9px;font-size:16px;line-height:1.25;color:#65566b;}
.room-store-detail-copy dl{display:grid;grid-template-columns:1fr 1fr;gap:5px;margin:0;}
.room-store-detail-copy dl div{min-width:0;padding:6px;border:1px solid #b3a1b6;border-radius:4px;background:#eee5ee;}
.room-store-detail-copy dt{font-family:'Press Start 2P',monospace;font-size:7px;line-height:1.4;color:#725c79;}
.room-store-detail-copy dd{margin:3px 0 0;font-size:14px;line-height:1.15;color:#3e3247;}
.room-store-detail-actions{display:grid;grid-template-columns:1fr 1.4fr;gap:7px;align-self:end;}
.room-store-detail-actions button{
  min-height:46px;
  padding:8px;
  border:2px solid #5f4d68;
  border-radius:5px;
  background:#fff8f1;
  color:#382d42;
  font-family:'Press Start 2P',monospace;
  font-size:8px;
  line-height:1.45;
  white-space:normal;
  overflow-wrap:anywhere;
}
.room-store-detail-actions button.primary{background:#d9ead8;}
.room-store-detail-actions button:disabled{opacity:.48;}
.room-catalog-empty{grid-column:1/-1;display:grid;place-items:center;min-height:180px;padding:20px;border:2px dashed #937d98;border-radius:6px;font-size:17px;text-align:center;color:#6c5a70;}

@media (max-width:1180px) and (min-width:761px){
  .room-editor-toolbar{gap:4px;}
  .room-editor-toolbar button{padding:6px;font-size:7px;}
  .room-zoom-control{grid-template-columns:32px 54px 32px;}
  .room-store-grid{grid-template-columns:repeat(2,minmax(0,1fr));}
  .room-catalog-body{grid-template-columns:minmax(0,1fr) 320px;}
}

@media (max-width:1024px) and (orientation:landscape) and (hover:none) and (pointer:coarse),
       (max-width:1024px) and (max-height:700px) and (orientation:landscape){
  body.room-editing .app-shell{
    width:var(--mobile-vw,100vw)!important;
    height:var(--mobile-safe-height,100dvh)!important;
    padding:
      calc(4px + env(safe-area-inset-top))
      calc(4px + env(safe-area-inset-right))
      calc(62px + env(safe-area-inset-bottom))
      calc(4px + env(safe-area-inset-left))!important;
    grid-template-columns:minmax(0,1fr)!important;
    grid-template-rows:minmax(0,1fr)!important;
    gap:0!important;
  }
  body.room-editing .game-frame,
  body.room-editor-focus .game-frame{
    grid-column:1!important;
    width:min(100%,calc((var(--mobile-safe-height,100dvh) - 72px) * 1.7777778))!important;
    max-height:calc(var(--mobile-safe-height,100dvh) - 72px)!important;
  }
  body.room-editing .room-builder-panel{display:none!important;}
  .room-editor-toolbar{
    top:auto;
    bottom:max(4px,env(safe-area-inset-bottom));
    width:calc(var(--mobile-vw,100vw) - 8px - env(safe-area-inset-left) - env(safe-area-inset-right));
    min-height:52px;
    gap:3px;
    padding:4px;
    overflow-x:auto;
    justify-content:flex-start;
    scrollbar-width:none;
  }
  .room-editor-toolbar::-webkit-scrollbar{display:none;}
  .room-editor-toolbar button{flex:0 0 auto;min-height:42px;padding:6px 8px;font-size:7px;}
  .room-editor-toolbar button[data-editor-action="layers"],
  .room-editor-toolbar button[data-editor-action="fit"]{display:none;}
  .room-zoom-control{flex:0 0 auto;grid-template-columns:38px 58px 38px;}
  .room-zoom-control button,.room-zoom-control output{min-height:42px;}
  .room-selection-hud{
    top:max(4px,env(safe-area-inset-top));
    bottom:auto;
    width:min(94vw,760px);
    max-height:40vh;
    padding:4px;
  }
  .room-selection-hud .room-builder-selected{grid-template-columns:minmax(120px,1fr) auto!important;gap:4px!important;padding:3px!important;}
  .room-selection-hud .room-selected-copy small{font-size:6px!important;}
  .room-selection-hud .room-selected-copy strong{font-size:7px!important;}
  .room-selection-hud .room-selected-copy p{font-size:12px!important;}
  .room-selection-hud .room-nudge-pad{grid-column:auto;width:74px;grid-template-columns:repeat(2,34px);}
  .room-selection-hud .room-object-actions{grid-column:1/-1;grid-template-columns:repeat(4,minmax(0,1fr))!important;width:100%;max-width:none;}
  .room-selection-hud .room-object-actions button{min-height:30px!important;padding:4px!important;font-size:6px!important;}
  .room-selection-hud .room-object-actions button:nth-last-child(n+5){display:block;}
  .room-catalog-modal{padding:max(4px,env(safe-area-inset-top)) max(4px,env(safe-area-inset-right)) max(4px,env(safe-area-inset-bottom)) max(4px,env(safe-area-inset-left));}
  .room-catalog-window{width:100%;height:100%;padding:6px;border-width:3px;grid-template-rows:auto auto auto auto minmax(0,1fr);}
  .room-catalog-window-header{padding:6px 7px;gap:8px;}
  .room-catalog-window-header small{font-size:6px;}
  .room-catalog-window-header h2{margin:2px 0;font-size:18px;}
  .room-catalog-window-header p{display:none;}
  .room-catalog-close{min-height:36px;padding:6px 8px;font-size:7px;}
  .room-catalog-controls{grid-template-columns:minmax(150px,1fr) 145px auto;gap:5px;margin-top:5px;}
  .room-catalog-controls label > span{font-size:6px;}
  .room-catalog-controls input[type="text"],
  .room-catalog-controls input:not([type]),
  .room-catalog-controls select,
  .room-catalog-search input{min-height:34px;padding:5px 7px;font-size:14px;}
  .room-catalog-snap{min-height:34px;padding:4px 6px;}
  .room-catalog-snap input{width:17px;height:17px;}
  .room-catalog-categories,.room-catalog-filters{gap:4px;margin-top:5px;}
  .room-catalog-categories button,.room-catalog-filters button{min-height:31px;padding:5px 7px;font-size:6px;}
  .room-catalog-filters span{font-size:12px;}
  .room-catalog-body{grid-template-columns:minmax(0,1fr) 240px;gap:5px;margin-top:5px;}
  .room-store-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;padding-right:3px;}
  .room-store-card{grid-template-rows:80px auto auto auto;min-height:232px;padding:6px;border-width:2px;}
  .room-store-preview{height:80px;}
  .room-store-favorite{top:9px;right:9px;width:30px;height:30px;font-size:17px;}
  .room-store-copy{gap:2px;padding:5px 0 3px;}
  .room-store-copy small{font-size:6px;}
  .room-store-copy strong{font-size:7px;}
  .room-store-copy p{min-height:28px;font-size:12px;line-height:1.15;}
  .room-store-stats span{padding:3px 2px;font-size:9px;}
  .room-store-stats b{font-size:11px;}
  .room-store-add{min-height:34px;margin-top:5px;padding:5px;font-size:6px;}
  .room-store-detail{grid-template-rows:115px auto auto;padding:6px;border-width:2px;}
  .room-store-detail-copy{padding:6px 1px;}
  .room-store-detail-copy > small{font-size:6px;}
  .room-store-detail-copy h3{margin:3px 0;font-size:8px;}
  .room-store-detail-copy p{margin-bottom:5px;font-size:12px;line-height:1.15;}
  .room-store-detail-copy dl{gap:3px;}
  .room-store-detail-copy dl div{padding:3px;}
  .room-store-detail-copy dt{font-size:5px;}
  .room-store-detail-copy dd{font-size:10px;}
  .room-store-detail-actions{grid-template-columns:1fr;gap:4px;}
  .room-store-detail-actions button{min-height:34px;padding:5px;font-size:6px;}
  .room-selection-name{font-size:5px;}
  .room-selection-coords{font-size:9px;}
  .room-selection-quick button{width:25px;height:25px;font-size:11px;}
}

@media (max-width:760px){
  .room-catalog-body{grid-template-columns:minmax(0,1fr);}
  .room-store-preview-panel{display:none;}
  .room-store-grid{grid-template-columns:repeat(2,minmax(0,1fr));}
}

/* Stable readability rules: pixel labels never below 8px on desktop, body text never below 14px. */
@media (min-width:1025px), (min-width:901px) and (hover:hover) and (pointer:fine){
  body.room-editing .room-builder-panel button,
  .room-editor-toolbar button,
  .room-catalog-modal button,
  .room-catalog-modal small,
  .room-catalog-modal dt{font-size:max(8px,var(--room-editor-font,8px));}
  body.room-editing .room-builder-panel p,
  body.room-editing .room-builder-panel dd,
  .room-catalog-modal p,
  .room-catalog-modal dd,
  .room-catalog-modal input,
  .room-catalog-modal select{font-size:max(14px,var(--room-editor-body-font,14px));}
}

/* v5.4 catalog refinements: full descriptions and touch preview overlay */
.room-store-preview{overflow:hidden;}
.room-store-preview canvas{height:calc(100% - 8px);max-width:100%;max-height:100%;}
.room-store-copy p{
  display:block;
  min-height:0;
  overflow:visible;
  -webkit-line-clamp:unset;
  -webkit-box-orient:initial;
}
.room-store-detail{position:relative;}
.room-store-detail-back{
  display:none;
  min-height:36px;
  padding:6px 8px;
  border:2px solid #5f4d68;
  border-radius:5px;
  background:#fff8f1;
  color:#382d42;
  font-family:'Press Start 2P',monospace;
  font-size:7px;
  line-height:1.4;
}
@media (max-width:1024px) and (orientation:landscape) and (hover:none) and (pointer:coarse),
       (max-width:1024px) and (max-height:700px) and (orientation:landscape){
  .room-catalog-body{position:relative;grid-template-columns:minmax(0,1fr)!important;}
  .room-store-preview-panel{display:none;}
  body.room-catalog-preview-open .room-store-preview-panel{
    position:absolute;
    inset:0;
    z-index:30;
    display:block;
    padding:4px;
    overflow:auto;
    background:#eee4f0;
  }
  body.room-catalog-preview-open .room-store-detail{min-height:100%;grid-template-rows:auto 135px auto auto;}
  body.room-catalog-preview-open .room-store-detail-back{display:block;}
  .room-store-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important;}
  .room-store-copy p{font-size:12px;line-height:1.18;}
}
/* Override the retired v4.2 toolbar suppression. */
.room-editor-toolbar{display:flex!important;}
.room-editor-toolbar[hidden]{display:none!important;}
/* v5.4 selection HUD keeps every command visible without covering the room. */
.room-selection-hud .room-selected-copy p{display:block!important;}
.room-selection-hud .room-object-actions{grid-template-columns:repeat(7,minmax(68px,1fr))!important;}
.room-selection-hud .room-object-actions button:nth-last-child(n+5){display:block;}
@media (max-width:1024px) and (orientation:landscape) and (hover:none) and (pointer:coarse),
       (max-width:1024px) and (max-height:700px) and (orientation:landscape){
  .room-selection-hud{width:calc(var(--mobile-vw,100vw) - 8px);max-height:70px;overflow:hidden;}
  .room-selection-hud .room-builder-selected{
    display:grid!important;
    grid-template-columns:minmax(135px,1fr) 132px minmax(260px,2fr)!important;
    align-items:center;
    gap:5px!important;
  }
  .room-selection-hud .room-selected-copy p{display:block!important;white-space:nowrap;overflow:hidden!important;text-overflow:clip;font-size:10px!important;}
  .room-selection-hud .room-nudge-pad{grid-column:auto!important;display:grid;grid-template-columns:repeat(4,30px)!important;width:132px;gap:3px;}
  .room-selection-hud .room-nudge-pad button{min-height:32px!important;width:30px;padding:2px!important;}
  .room-selection-hud .room-object-actions{
    grid-column:auto!important;
    display:flex!important;
    gap:3px!important;
    min-width:0;
    max-width:none;
    overflow-x:auto;
    scrollbar-width:none;
  }
  .room-selection-hud .room-object-actions::-webkit-scrollbar{display:none;}
  .room-selection-hud .room-object-actions button{display:block!important;flex:0 0 88px;min-height:32px!important;}
}
@media (max-width:1024px) and (orientation:landscape) and (hover:none) and (pointer:coarse),
       (max-width:1024px) and (max-height:700px) and (orientation:landscape){
  .room-selection-hud{max-height:78px;}
  .room-selection-hud .room-selected-copy p{white-space:normal;overflow:visible!important;line-height:1.1!important;}
}


/* DreamPet v5.4.2 — compact, usable mobile catalog */
.room-catalog-mobile-nav{display:none;}
@media (max-width:1024px) and (orientation:landscape) and (hover:none) and (pointer:coarse),
       (max-width:1024px) and (max-height:700px) and (orientation:landscape){
  .room-catalog-modal{
    padding:max(2px,env(safe-area-inset-top)) max(2px,env(safe-area-inset-right)) max(2px,env(safe-area-inset-bottom)) max(2px,env(safe-area-inset-left));
    backdrop-filter:none;
  }
  .room-catalog-window{
    grid-template-rows:38px 38px 38px minmax(0,1fr);
    gap:3px;
    padding:3px;
    border-width:2px;
    border-radius:4px;
    box-shadow:none;
  }
  .room-catalog-window-header{
    min-height:0;
    padding:3px 5px;
    align-items:center;
    border-width:1px;
  }
  .room-catalog-window-header > div{display:flex;align-items:center;gap:7px;overflow:hidden;}
  .room-catalog-window-header small,
  .room-catalog-window-header p{display:none;}
  .room-catalog-window-header h2{
    margin:0;
    font-family:'Press Start 2P',monospace;
    font-size:9px;
    line-height:1.2;
    white-space:nowrap;
  }
  .room-catalog-close{
    min-height:30px;
    padding:4px 7px;
    border-width:1px;
    font-size:7px;
  }
  .room-catalog-controls{
    grid-template-columns:minmax(0,1fr) minmax(120px,30%);
    gap:4px;
    margin:0;
  }
  .room-catalog-controls label{display:block;}
  .room-catalog-controls label > span{display:none;}
  .room-catalog-controls input[type="text"],
  .room-catalog-controls input:not([type]),
  .room-catalog-controls select,
  .room-catalog-search input{
    min-height:36px;
    height:36px;
    padding:4px 7px;
    border-width:1px;
    font-size:14px;
  }
  .room-catalog-snap{display:none!important;}
  .room-catalog-categories,
  .room-catalog-filters{display:none!important;}
  .room-catalog-mobile-nav{
    display:grid;
    grid-template-columns:minmax(0,1fr) minmax(0,1fr) auto;
    align-items:end;
    gap:4px;
    min-width:0;
    margin:0;
  }
  .room-catalog-mobile-nav label{display:grid;grid-template-columns:auto minmax(0,1fr);align-items:center;gap:4px;min-width:0;}
  .room-catalog-mobile-nav label > span{
    font-family:'Press Start 2P',monospace;
    font-size:6px;
    line-height:1.2;
    color:#584660;
  }
  .room-catalog-mobile-nav select{
    width:100%;
    min-width:0;
    height:34px;
    padding:3px 5px;
    border:1px solid #776180;
    border-radius:4px;
    background:#fffaf4;
    color:#3b2f44;
    font-size:13px;
  }
  .room-catalog-mobile-nav output{
    align-self:center;
    padding:0 4px;
    font-size:11px;
    white-space:nowrap;
    color:#5f4e65;
  }
  .room-catalog-body{
    min-height:0;
    margin:0;
    gap:0;
    overflow:hidden;
  }
  .room-store-grid{
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
    grid-auto-rows:minmax(108px,auto);
    gap:4px;
    padding:1px 2px 4px 1px;
    overflow-y:auto;
    overflow-x:hidden;
    scrollbar-width:thin;
  }
  .room-store-card{
    display:grid;
    grid-template-columns:68px minmax(0,1fr);
    grid-template-rows:minmax(68px,auto) 31px;
    min-height:108px;
    padding:4px;
    gap:3px 4px;
    border-width:1px;
    border-radius:4px;
    box-shadow:0 2px 0 #594661;
    overflow:hidden;
  }
  .room-store-preview{
    grid-column:1;
    grid-row:1;
    width:68px;
    height:68px;
    min-height:68px;
    padding:1px;
    border-width:1px;
  }
  .room-store-preview canvas{width:100%;height:100%;max-height:none;}
  .room-store-favorite{
    top:6px;
    left:50px;
    right:auto;
    width:21px;
    height:21px;
    border-width:1px;
    font-size:13px;
  }
  .room-store-copy{
    grid-column:2;
    grid-row:1;
    align-content:center;
    gap:3px;
    padding:1px 0;
    overflow:hidden;
  }
  .room-store-copy small{
    font-size:6px;
    line-height:1.25;
    white-space:normal;
  }
  .room-store-copy strong{
    display:-webkit-box;
    overflow:hidden;
    font-size:7px;
    line-height:1.35;
    -webkit-line-clamp:2;
    -webkit-box-orient:vertical;
  }
  .room-store-copy p{display:none;}
  .room-store-stats{
    grid-column:1;
    grid-row:2;
    grid-template-columns:1fr 1fr;
    gap:2px;
    min-width:0;
    margin:0;
  }
  .room-store-stats span{
    min-width:0;
    padding:2px 1px;
    border-width:1px;
    font-size:0;
    line-height:1;
  }
  .room-store-stats span:nth-child(2){display:none;}
  .room-store-stats span:first-child::before{content:'Hai ';font-size:8px;}
  .room-store-stats span:nth-child(3)::before{content:'₿ ';font-size:8px;}
  .room-store-stats b{display:inline;font-size:9px;}
  .room-store-add{
    grid-column:2;
    grid-row:2;
    min-height:31px;
    height:auto;
    margin:0;
    padding:3px 4px;
    border-width:1px;
    font-size:6px;
    line-height:1.25;
  }
  .room-store-preview-panel{display:none!important;}
  body.room-catalog-preview-open .room-store-preview-panel{
    display:block!important;
    inset:0;
    padding:3px;
  }
  body.room-catalog-preview-open .room-store-detail{
    width:min(560px,100%);
    min-height:100%;
    margin:auto;
    grid-template-columns:150px minmax(0,1fr);
    grid-template-rows:32px minmax(112px,1fr) auto;
    gap:4px;
    padding:4px;
  }
  body.room-catalog-preview-open .room-store-detail-back{
    grid-column:1/-1;
    min-height:30px;
    padding:3px 6px;
    font-size:6px;
  }
  body.room-catalog-preview-open .room-store-detail-stage{
    grid-column:1;
    grid-row:2;
    min-height:112px;
  }
  body.room-catalog-preview-open .room-store-detail-copy{
    grid-column:2;
    grid-row:2;
    padding:2px;
    overflow:auto;
  }
  body.room-catalog-preview-open .room-store-detail-copy > small{font-size:6px;}
  body.room-catalog-preview-open .room-store-detail-copy h3{font-size:8px;margin:2px 0;}
  body.room-catalog-preview-open .room-store-detail-copy p{font-size:12px;margin:0 0 4px;}
  body.room-catalog-preview-open .room-store-detail-copy dl{grid-template-columns:repeat(3,minmax(0,1fr));gap:2px;}
  body.room-catalog-preview-open .room-store-detail-copy dl div{padding:2px;}
  body.room-catalog-preview-open .room-store-detail-copy dt{font-size:5px;}
  body.room-catalog-preview-open .room-store-detail-copy dd{font-size:9px;}
  body.room-catalog-preview-open .room-store-detail-actions{
    grid-column:1/-1;
    grid-row:3;
    grid-template-columns:1fr 1.4fr;
    gap:4px;
  }
  body.room-catalog-preview-open .room-store-detail-actions button{min-height:32px;padding:4px;font-size:6px;}
}
@media (max-width:799px) and (orientation:landscape){
  .room-store-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important;}
  .room-catalog-mobile-nav label > span{display:none;}
}
@media (max-height:430px) and (orientation:landscape){
  .room-catalog-window{grid-template-rows:34px 34px 34px minmax(0,1fr);}
  .room-catalog-close{min-height:28px;}
  .room-catalog-controls input[type="text"],
  .room-catalog-controls input:not([type]),
  .room-catalog-controls select,
  .room-catalog-search input{height:32px;min-height:32px;}
  .room-catalog-mobile-nav select{height:31px;}
  .room-store-grid{grid-auto-rows:minmax(98px,auto);}
  .room-store-card{grid-template-columns:60px minmax(0,1fr);grid-template-rows:minmax(60px,auto) 29px;min-height:98px;}
  .room-store-preview{width:60px;height:60px;min-height:60px;}
  .room-store-favorite{left:44px;}
  .room-store-add{min-height:29px;}
}
