/* Slow-wave sleep. Everything scoped under .sws-*. */

.sws-sc { position: relative; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.sws-hero img { display: block; width: 220px; max-width: 100%; max-height: 32vh; object-fit: contain; margin: 0 auto; filter: drop-shadow(0 16px 26px rgba(123, 92, 253, .3)); }

/* the room */
.sws-room { position: relative; width: 100%; max-width: 330px; height: 120px; display: flex; align-items: center; justify-content: center; border-radius: 18px; background: rgba(252, 192, 80, .10); transition: background 1s; }
.sws-room img { height: 104px; width: auto; transition: filter 1s; }
.sws-lamp { position: absolute; right: 18px; top: 16px; width: 18px; height: 18px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 18px 6px rgba(252, 192, 80, .55); transition: background .4s, box-shadow .4s; }
.sws-room.off { background: rgba(10, 12, 30, .6); }
.sws-room.off img { filter: brightness(.7); }
.sws-room.off .sws-lamp { background: #3A3550; box-shadow: none; }
.sws-room.bang { animation: sws-shake .5s linear; }
.sws-room.bang::after { content: 'BANG'; position: absolute; left: 14px; top: 12px; font: 800 18px var(--sans); color: var(--gold); letter-spacing: 1px; }
@keyframes sws-shake { 0%, 100% { transform: none; } 20% { transform: translateX(-4px); } 40% { transform: translateX(4px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }

/* the signal */
.sws-sig { position: relative; width: 100%; max-width: 340px; height: 150px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); overflow: hidden; }
.sws-sig.short { height: 120px; }
.sws-sig.game { height: 190px; }
.sws-sig canvas { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }
.sws-st { position: absolute; left: 10px; top: 8px; padding: 3px 9px; border-radius: 99px; background: rgba(123, 92, 253, .22); color: var(--violet-bright); font: 700 12px var(--sans); }
.sws-now { display: none; position: absolute; top: 0; bottom: 0; left: 72%; width: 3px; margin-left: -1.5px; background: var(--gold); box-shadow: 0 0 10px rgba(252, 192, 80, .8); }
.sws-sig.aim .sws-now { display: block; }
.sws-sig.hit .sws-now { animation: sws-hit .5s ease-out; }
@keyframes sws-hit { 0% { box-shadow: 0 0 30px 10px rgba(252, 192, 80, .95); width: 8px; margin-left: -4px; } 100% { box-shadow: 0 0 10px rgba(252, 192, 80, .8); } }
.sws-sig.off .sws-now { animation: sws-off .4s ease-out; }
@keyframes sws-off { 0% { background: var(--dim); box-shadow: none; } 100% { background: var(--gold); } }
.sws-hits { display: flex; gap: 8px; }
.sws-hits i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-strong); transition: background .25s, border-color .25s; }
.sws-hits i.on { background: var(--gold); border-color: var(--gold); box-shadow: 0 0 8px rgba(252, 192, 80, .7); }
.sws-click { min-width: 180px; }

/* the cells */
.sws-cells { display: grid; grid-template-columns: repeat(5, 48px); gap: 6px; justify-content: center; padding: 6px; border-radius: 16px; }
.sws-cell { width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; border: 0; padding: 0; border-radius: 50%; background: transparent; cursor: pointer; }
.sws-cell i { display: block; width: 26px; height: 26px; border-radius: 50%; background: #2A2F4A; border: 2px solid rgba(169, 155, 255, .45); transition: border-color .3s; }
.sws-cell.in i { border-color: var(--gold); }
.sws-cell.fire i { animation: sws-fire .45s ease-out; }
@keyframes sws-fire { 0% { background: var(--violet-bright); box-shadow: 0 0 14px 4px rgba(169, 155, 255, .8); } 100% { background: #2A2F4A; box-shadow: none; } }
.sws-cell.in.fire i { animation-name: sws-fire-in; }
@keyframes sws-fire-in { 0% { background: var(--gold); box-shadow: 0 0 16px 5px rgba(252, 192, 80, .85); } 100% { background: #2A2F4A; box-shadow: none; } }

/* the rat's replay */
.sws-rp { width: 100%; max-width: 340px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.sws-rcs { display: flex; align-items: center; gap: 10px; }
.sws-rcs span { font: 700 13px var(--sans); color: var(--dim); margin-right: 4px; }
.sws-rcs i { width: 30px; height: 30px; border-radius: 50%; background: #2A2F4A; border: 3px solid var(--c); }
.sws-rcs i.fire { animation: sws-rfire 700ms ease-out; }
@keyframes sws-rfire { 0% { background: var(--c); box-shadow: 0 0 18px 6px var(--c); transform: scale(1.18); } 100% { background: #2A2F4A; box-shadow: none; transform: none; } }
.sws-trk { position: relative; width: 100%; height: 96px; display: flex; align-items: flex-end; padding: 0 4px 6px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); transition: background .8s; }
.sws-trk b { flex: 1; height: 14px; background: var(--c); opacity: .55; }
.sws-trk b.fire { animation: sws-seg 420ms ease-out; }
@keyframes sws-seg { 0% { opacity: 1; box-shadow: 0 0 22px 8px var(--c); transform: scaleY(2.2); } 100% { opacity: .55; box-shadow: none; transform: none; } }
.sws-trk b:first-child { border-radius: 7px 0 0 7px; } .sws-trk b:last-of-type { border-radius: 0 7px 7px 0; }
.sws-rat { position: absolute; left: 0; bottom: 18px; height: 70px; width: auto; transition: filter .8s; }
.sws-zz { position: absolute; left: 58%; top: 8px; font: 800 16px var(--serif); color: var(--violet-bright); opacity: 0; transition: opacity .8s; }
.sws-rp.asleep .sws-trk { background: #0B0E20; }
.sws-rp.asleep .sws-rat { filter: brightness(.55); }
.sws-rp.asleep .sws-zz { opacity: 1; }
.sws-rst { font: 700 13px var(--sans); color: var(--violet-bright); }

@media (max-height: 700px) {
  .sws-trk { height: 82px; }
  .sws-rat { height: 58px; }
  .sws-room { height: 96px; }
  .sws-room img { height: 84px; }
  .sws-sig { height: 120px; }
  .sws-sig.short { height: 96px; }
  .sws-sig.game { height: 150px; }
  .sws-cells { grid-template-columns: repeat(5, 44px); gap: 4px; }
  .sws-cell { width: 44px; height: 44px; }
  .sws-hero img { max-height: 26vh; }
}
