/* The room (CARE §8.3–8.4, PLAN §4.2): the care bar (five 60 px buttons, labels only for ages 9–10), one tray at a time
   above it (56 px tiles in a strip that scrolls sideways, the tricks in two rows of five), the wants bubble (72 × 64,
   placed over the toy's top every frame by room.js), the Sun of a night opening (76 px) and the rest card. The frame
   (#room, .stage, the back button, the sheet base) is css/version.css. Nothing active in the bottom 24 px (--edge).
   Reduce Motion and the grown-up's calm switch (#room.calm): no pop, no slide. */

/* ---- the care bar ---- */
.care-bar {
  flex: none; width: 100%; display: flex; justify-content: center; align-items: flex-start; gap: 9px;
  padding: 10px 12px var(--edge); background: var(--card); border-top: 2px solid var(--hair);
}
.care {
  display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: var(--tap);
  padding: 0; border: 0; background: none; color: var(--ink);
}
.care-ico {
  width: var(--tap); height: var(--tap); border-radius: 50%; display: grid; place-items: center;
  border: 2px solid var(--line); background: var(--paper);
  transition: transform var(--t-micro) var(--spring), background var(--t-micro);
}
.care-ico .ico { width: 30px; height: 30px; }
.care:active .care-ico { transform: scale(.92); }
.care[aria-pressed="true"] .care-ico {
  background: var(--coral); border-color: var(--coral-deep);
  box-shadow: var(--press), 0 0 0 4px color-mix(in srgb, var(--coral) 28%, transparent);
}
.care-name, .tile-name { display: none; font-size: .8125rem; font-weight: 800; line-height: 1.1; text-align: center; }
#room.labels .care-name, #room.labels .tile-name { display: block; }
#room.labels .care-name:empty, #room.labels .tile-name:empty { display: none; }

/* ---- the tray: a strip of 56 px tiles that scrolls sideways (the next tile shows at the edge, CARE §2.1) ---- */
.tray {
  flex: none; width: 100%; display: flex; gap: 10px; padding: 10px 16px; overflow-x: auto; overflow-y: hidden;
  overscroll-behavior-x: contain; scroll-snap-type: x proximity; scrollbar-width: none;
  background: var(--paper); border-top: 2px solid var(--hair); touch-action: pan-x;
  animation: tray-in var(--t-card) var(--spring);
}
.tray::-webkit-scrollbar { display: none; }
.tray > .tile:first-child { margin-left: auto; }
.tray > .tile:last-child { margin-right: auto; }
@keyframes tray-in { from { transform: translateY(14px); opacity: 0; } }
.tile {
  flex: none; width: 56px; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 0; border: 0; background: none; color: var(--ink); scroll-snap-align: start; touch-action: pan-x;
}
.tile-ico {
  width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center;
  border: 2px solid var(--line); background: var(--card); box-shadow: var(--shadow);
  transition: transform var(--t-micro) var(--spring);
}
.tile-ico .ico { width: 32px; height: 32px; }
.tile:active .tile-ico { transform: scale(.92); }
.tile[aria-pressed="true"] .tile-ico {
  background: var(--coral); border-color: var(--coral-deep);
  box-shadow: var(--press), 0 0 0 4px color-mix(in srgb, var(--coral) 28%, transparent);
}
.tile-name { max-width: 70px; font-size: .75rem; }
/* The blankets carry their own colour (CARE §2.4); the lamp tile is lit. */
.tile[data-colour="coral"] .tile-ico { background: color-mix(in srgb, var(--coral) 42%, var(--card)); }
.tile[data-colour="cobalt"] .tile-ico { background: color-mix(in srgb, var(--cobalt) 38%, var(--card)); }
.tile[data-colour="butter"] .tile-ico { background: color-mix(in srgb, var(--butter) 70%, var(--card)); }
.tile[data-item="lamp"] .tile-ico { background: color-mix(in srgb, var(--butter) 35%, var(--card)); }
/* The tricks: two rows of five, as Simple's moves (CARE §8.3). */
.tray.tray-tricks { display: grid; grid-template-columns: repeat(5, 56px); justify-content: center; gap: 10px 12px; overflow: visible; }
.tray.tray-tricks > .tile { margin: 0; }

/* ---- the wants bubble (CARE §3.2): a cloud with three little circles under it, a 40 px picture inside ---- */
.bubble {
  position: absolute; left: 0; top: 0; z-index: var(--z-view); width: 72px; height: 64px; display: grid; place-items: center;
  cursor: pointer; touch-action: manipulation; will-change: translate;
}
.bubble::before {
  content: ""; position: absolute; inset: 0; border-radius: 36px 36px 30px 34px;
  background: var(--card); border: 2px solid var(--line); box-shadow: var(--shadow-lift);
}
.bubble::after {
  content: ""; position: absolute; left: -14px; bottom: -20px; width: 26px; height: 26px; pointer-events: none;
  background:
    radial-gradient(circle at 70% 18%, var(--card) 0 5px, var(--line) 5px 6.5px, transparent 7px),
    radial-gradient(circle at 38% 56%, var(--card) 0 3.5px, var(--line) 3.5px 5px, transparent 5.5px),
    radial-gradient(circle at 12% 88%, var(--card) 0 2px, var(--line) 2px 3.2px, transparent 3.6px);
}
.bubble-ico { position: relative; width: 40px; height: 40px; display: grid; place-items: center; color: var(--ink); }
.bubble-ico .ico { width: 40px; height: 40px; stroke-width: 1.8; }
.bubble.pop { animation: bubble-pop .34s var(--spring); }
@keyframes bubble-pop { from { transform: scale(.4); opacity: 0; } }

/* ---- the Sun of a night opening (CARE §2.4): where the bar was, 76 px ---- */
.round.sun {
  top: auto; bottom: calc(22px + var(--edge)); left: calc(50% - 38px); width: 76px; height: 76px;
  color: var(--coral-deep); background: color-mix(in srgb, var(--butter) 70%, var(--card)); border-color: var(--coral-deep);
}
.round.sun .ico { width: 40px; height: 40px; }
.round.back, .round.sun { z-index: var(--z-top); }

/* ---- the rest card (CARE §6.2, R15): the sleeping toy and the grown-ups' key ---- */
#rest .rest-toy { filter: saturate(.75) brightness(.92); }
#rest .round.key { top: 0; right: 0; }

/* ---- calm ---- */
#room.calm .tray, #room.calm .bubble.pop { animation: none; }
#room.calm .care-ico, #room.calm .tile-ico { transition: none; }
@media (prefers-reduced-motion: reduce) {
  .tray, .bubble.pop { animation: none; }
  .care-ico, .tile-ico { transition: none; }
}

/* ---- tablets and landscape: one centred row, wider trays (CARE §8.3) ---- */
@media (min-width: 760px) {
  .care-bar { gap: 18px; }
  .tray.tray-tricks { grid-template-columns: repeat(10, 56px); }
}
