/* The Word Lab. Its layout (the fixed overlay, the two-sided grid, the room layers
   and the creature slot) is shared with the other rooms in potions.css, and the
   plaques and the reset button come from kitchen.css; this file is only what is
   the room's own. */

#words { --words-warm: #6e5a3a; }

/* ---------------------------------------------------------------- the room */

.tablet-recess { fill: #1a1428; stroke: var(--rock-edge); stroke-width: 6; }
.book-spine { stroke: rgba(7, 4, 15, 0.35); stroke-width: 1.5; }
.shelf-board { fill: var(--rock-lit); }
.candle-wax { fill: #f2e6d2; }
.candle-flame { fill: #ffd27a; animation: flame 1.3s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: 50% 100%; }
.candle-glow { fill: #ffc46b; opacity: 0.16; filter: blur(14px); animation: flame-glow 1.3s ease-in-out infinite alternate; }
@keyframes flame { to { transform: scale(0.9, 1.08) translateX(1px); } }
@keyframes flame-glow { to { opacity: 0.24; } }
.rug-edge-warm { stroke: #5e3a2a; }

/* -------------------------------------------------------------- the benches */

/* Letters in lamp gold on the warm bench, numbers in violet on the violet bench,
   so a tile's colour says which kind it is before she can read it. */
.key {
  font-family: var(--display); font-weight: 800; font-size: 1.65rem; line-height: 1;
  color: var(--lamp);
}
.key-digit { color: #d9c8ff; border-color: rgba(201, 166, 255, 0.45); }
/* The five vowels in mint, the creature's green, on a greener plaque. */
.key-vowel { color: #8af0c4; border-color: rgba(111, 227, 174, 0.6); background: linear-gradient(180deg, #2d5a4e, #1f4038); }
@media (max-width: 1100px), (max-height: 560px) { .key { font-size: 1.4rem; } }
@media (max-height: 560px) and (min-aspect-ratio: 5/6) { .key { font-size: 1.15rem; } }

/* --------------------------------------------------------------- the tablet */

/* A slate with seven slots, lit by a lamp-coloured rim. The slots are buttons:
   a filled one, tapped, gives its tile back. */
.tablet {
  position: absolute; transform: translate(-50%, -50%); z-index: 2;
  display: flex; align-items: center; justify-content: center; gap: 1.6%;
  padding: 1.2% 2%; border-radius: 22px; box-sizing: border-box;
  background: radial-gradient(ellipse at 50% 40%, #2f2a45, #1b1830 75%);
  box-shadow: inset 0 0 0 3px rgba(255, 196, 107, 0.5), 0 10px 24px rgba(7, 4, 15, 0.45);
  pointer-events: auto; touch-action: none;
}
/* The bump animates `scale`, not `transform`: a transform keyframe would replace
   the translate that centres the tablet and jump it half its width sideways. */
.tablet.bump { animation: tablet-bump 0.35s cubic-bezier(.3, 1.5, .5, 1); }
@keyframes tablet-bump { 40% { scale: 1.05 0.95; } }
.tablet.over { box-shadow: inset 0 0 0 3px var(--lamp), 0 0 22px rgba(255, 196, 107, 0.6), 0 10px 24px rgba(7, 4, 15, 0.45); }
.tile-slot {
  flex: 1 1 0; min-width: 0; height: 84%; padding: 0;
  display: grid; place-items: center;
  border-radius: 14px; border: 2px dashed rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.05);
  font-family: var(--display); font-weight: 800; font-size: clamp(1.4rem, 3.4vw, 3rem); line-height: 1;
  transition: transform 0.14s ease, background 0.2s ease;
}
.tile-slot.filled { border-style: solid; animation: tile-in 0.35s cubic-bezier(.3, 1.6, .5, 1); }
.tile-slot.letter { color: var(--lamp); background: linear-gradient(180deg, #4a3a7c, #3b2a66); border-color: rgba(255, 196, 107, 0.7); }
.tile-slot.digit  { color: #d9c8ff; background: linear-gradient(180deg, #3a2a66, #2a1d4a); border-color: rgba(201, 166, 255, 0.7); }
.tile-slot.vowel  { color: #8af0c4; background: linear-gradient(180deg, #2d5a4e, #1f4038); border-color: rgba(111, 227, 174, 0.75); }
.tile-slot.filled:active { transform: translateY(-4px); }
@keyframes tile-in { from { scale: 0.4; } 60% { scale: 1.12; } }
.tablet-fx { position: absolute; inset: 0; pointer-events: none; z-index: 3; }

.result-reset-words { color: var(--lamp); border-color: rgba(255, 196, 107, 0.55); }
.speak-btn { display: grid; place-items: center; }
.speak-btn svg { width: 60%; height: 60%; display: block; }
.tile-slot.said { animation: tile-said 0.5s ease; }
@keyframes tile-said { 40% { scale: 1.1; } }

/* A phone on its side draws the scene so small that a slot would be 34 px; the
   tablet is widened and given a fixed height there so every slot is 44 px. */
@media (max-height: 560px) and (min-aspect-ratio: 5/6) {
  #words .tablet { width: 74% !important; height: 58px !important; top: 27% !important; padding: 5px 8px; gap: 4px; border-radius: 14px; }
  #words .tile-slot { height: 46px; font-size: 1.3rem; border-radius: 9px; }
}

#w-creature.cheer { animation: cheer 0.8s cubic-bezier(.3, 1.4, .5, 1); }

@media (prefers-reduced-motion: reduce) {
  .candle-flame, .candle-glow, .tile-slot.filled { animation: none; }
}
