/* The phone-scroll special mode (T4.6, js/screens/phone-scroll.js): night in bed, a close-up of her phone with its blue
   glow on her face, the tea on the nightstand. Upright: the phone fills the top, her face and the tea sit below it.
   Sideways: her face, the phone, the tea in a row. Reduced motion (.ps--still or the phone's setting): no sliding feed,
   no steam, no puffs, no progress line. Sits on top of app.css (.app-screen, .app-btn). */

.ps {
  --night: #10152c; --glow: #8fc4ff; --paper: #e9eef8;
  background: radial-gradient(ellipse at 50% 35%, #263463 0%, #151b38 55%, #0b1020 100%);
  color: var(--paper);
}
.ps-head {
  flex: none; display: flex; align-items: center; gap: 10px; width: 100%; max-width: 900px; margin: 0 auto;
  padding: max(8px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 4px max(14px, env(safe-area-inset-left));
}
.ps-title {
  flex: 1; min-width: 0; font-size: 1.1rem; line-height: 1.05; font-weight: 900; color: var(--cream);
  -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; text-shadow: 0 2px 0 var(--ink);
}
.ps-count {
  flex: none; padding: 4px 10px; border-radius: 999px; border: 2px solid var(--ink); background: #2b3768;
  font-size: 0.85rem; font-weight: 800; color: var(--paper); box-shadow: 0 2px 0 var(--ink);
}

.ps-room {
  flex: 1; min-height: 0; width: 100%; max-width: 900px; margin: 0 auto; display: grid; gap: 8px 12px;
  grid-template-columns: 1fr 1fr; grid-template-rows: minmax(0, 1fr) auto; grid-template-areas: "phone phone" "her side";
  padding: 4px max(14px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
}
@media (orientation: landscape) {
  .ps-room { grid-template-columns: 1fr auto 1fr; grid-template-rows: minmax(0, 1fr); grid-template-areas: "her phone side"; }
}

/* Her face in the glow */
.ps-her { grid-area: her; position: relative; min-height: 0; display: flex; align-items: flex-end; justify-content: center; }
.ps-her__art { width: 100%; max-width: 190px; height: 100%; max-height: 22vh; filter: brightness(0.72) saturate(0.75); }
@media (orientation: landscape) { .ps-her__art { max-height: 70%; max-width: 230px; } }
.ps-her__glow {
  position: absolute; inset: 0; pointer-events: none; mix-blend-mode: screen;
  background: radial-gradient(ellipse at 50% 45%, rgba(143, 196, 255, 0.4), transparent 62%);
}
.ps--idea .ps-her__glow { background: radial-gradient(ellipse at 50% 45%, rgba(255, 224, 138, 0.5), transparent 62%); }
.ps--idea .ps-her__art { filter: brightness(0.95); }

/* The phone */
.ps-phone {
  grid-area: phone; justify-self: center; position: relative; display: flex; flex-direction: column; min-height: 0;
  height: 100%; aspect-ratio: 10 / 17; max-width: 100%; padding: 8px 7px 12px; border-radius: 26px;
  border: 3px solid var(--ink); background: #2c2f3d; box-shadow: 0 0 34px rgba(143, 196, 255, 0.35), 4px 5px 0 rgba(0, 0, 0, 0.4);
}
.ps-status { flex: none; display: flex; justify-content: space-between; align-items: center; padding: 0 10px 4px; font-size: 0.75rem; font-weight: 800; }
.ps-battery { width: 22px; height: 12px; }
.ps-screen { position: relative; flex: 1; min-height: 0; overflow: hidden; border-radius: 16px; border: 2px solid var(--ink); background: var(--night); touch-action: none; }
.ps-track { position: absolute; inset: 0; transition: transform 0.8s cubic-bezier(0.3, 0.1, 0.25, 1); }
.ps-card { height: 100%; display: flex; flex-direction: column; overflow: hidden; }

/* A video card */
.ps-video { position: relative; flex: 1; min-height: 0; container-type: size; display: flex; align-items: center; justify-content: center; padding: 6px;
  background: linear-gradient(180deg, #3a4a86, #1d2549); }
.ps-face { position: relative; flex: none; width: min(100cqw, 100cqh); height: min(100cqw, 100cqh); } /* always square: the bumps sit in % of it */
.ps-face__art { display: block; width: 100%; height: 100%; }
.ps-progress { position: absolute; left: 8px; right: 8px; bottom: 5px; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, 0.2); overflow: hidden; }
.ps-progress::after { content: ""; position: absolute; inset: 0; background: var(--paper); transform-origin: left; transform: scaleX(0); }
.ps-card:not([inert]) .ps-progress::after { animation: ps-progress 7s linear forwards; }
@keyframes ps-progress { to { transform: scaleX(1); } }

.ps-bump {
  position: absolute; width: 17%; aspect-ratio: 1; transform: translate(-50%, -50%); padding: 0; border: 0; border-radius: 50%;
  background: transparent; cursor: pointer; display: grid; place-items: center; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.ps-bump__dot {
  width: var(--ps-r, 40%); aspect-ratio: 1; border-radius: 50%; border: 1.5px solid var(--ink);
  background: radial-gradient(circle at 38% 35%, #fff6d8 0 18%, #ffd9a0 30%, #f3a07c 100%);
  transition: transform 0.15s ease-out;
}
.ps-bump:hover .ps-bump__dot { transform: scale(1.12); }
.ps-bump--popped .ps-bump__dot { transform: scale(0.55); background: #f0b49a; border-color: rgba(42, 33, 29, 0.35); }
.ps-bump:focus-visible { outline: 3px solid var(--yellow); outline-offset: 0; }
.ps-bump__puff {
  position: absolute; inset: -10%; border-radius: 50%; pointer-events: none;
  border: 2px dashed #fff6c8; animation: ps-puff 0.5s ease-out forwards;
}
@keyframes ps-puff { from { transform: scale(0.4); opacity: 1; } to { transform: scale(1.3); opacity: 0; } }

.ps-meta { flex: none; display: flex; align-items: flex-end; gap: 6px; padding: 6px 9px 8px; background: #151b38; }
.ps-meta__words { flex: 1; min-width: 0; }
.ps-handle { font-size: 0.8rem; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ps-caption { font-size: 0.75rem; opacity: 0.85; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ps-like { flex: none; display: flex; flex-direction: column; align-items: center; font-size: 0.7rem; font-weight: 800; }
.ps-like .app-icon { width: 22px; height: 22px; }

/* The idea card */
.ps-card--idea {
  align-items: center; justify-content: center; gap: 8px; padding: 12px; text-align: center;
  background: radial-gradient(circle at 50% 30%, #fff3b0 0%, #ffd6e5 55%, #f48fb1 100%); color: var(--ink);
}
.ps-idea__slot { font-size: 0.75rem; font-weight: 800; padding: 3px 10px; border: 2px dashed var(--ink); border-radius: 999px; }
.ps-idea__bulb .app-icon { width: 54px; height: 54px; }
.ps-idea__title { font-size: 1.15rem; font-weight: 900; line-height: 1.15; }
.ps-idea__text { font-size: 0.85rem; }

/* The nightstand, the tea and the foot */
.ps-side { grid-area: side; display: flex; flex-direction: column; justify-content: flex-end; gap: 8px; min-height: 0; }
@media (orientation: landscape) { .ps-side { justify-content: center; } }
.ps-tea { position: relative; display: flex; flex-direction: column; align-items: center; }
.ps-tea__mug { width: 64px; height: 64px; margin-bottom: -6px; position: relative; z-index: 1; }
.ps-tea__stand { width: 110px; height: 14px; border-radius: 4px; border: 2px solid var(--ink); background: #6b4a3a; }
.ps-tea__bubble {
  position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); width: max-content; max-width: 170px; margin-bottom: 4px;
  padding: 5px 9px; border-radius: 12px; border: 2px solid var(--ink); background: var(--cream); color: var(--ink);
  font-size: 0.78rem; font-weight: 700; text-align: center; z-index: 2;
}
.ps-steam__wisp { animation: ps-steam 2.6s ease-in-out infinite; }
.ps-steam__wisp--1 { animation-delay: 0.6s; }
.ps-steam__wisp--2 { animation-delay: 1.2s; }
@keyframes ps-steam { 0% { transform: translateY(4px); opacity: 0.2; } 50% { opacity: 1; } 100% { transform: translateY(-6px); opacity: 0; } }

.ps-foot { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.ps-howto { font-size: 0.78rem; line-height: 1.25; opacity: 0.9; }
.ps-howto__keys { opacity: 0.8; }
.ps .app-btn { color: var(--ink); }

/* Reduced motion */
.ps--still .ps-track { transition: none; }
.ps--still .ps-steam__wisp, .ps--still .ps-progress::after { animation: none; }
.ps--still .ps-progress { display: none; }
.ps--still .ps-bump__dot { transition: none; }
@media (prefers-reduced-motion: reduce) {
  .ps-track, .ps-bump__dot { transition: none; }
  .ps-steam__wisp, .ps-progress::after, .ps-bump__puff { animation: none; }
  .ps-progress { display: none; }
}
