/* Phone mockups of the app screens, drawn in HTML. Static styles are the final state;
   loops run only while a phone is on screen (`.anim.running`, set by motion.js). */
.phone { flex: none; display: grid; justify-items: center; gap: 18px; margin: 0; }
/* The screen always shows the light app, whatever the page theme. */
.screen {
  --bg: #fbf8f1; --ink: #1c1a17; --sec: rgba(28, 26, 23, 0.74); --tile: #eee9df; --fill: rgba(28, 26, 23, 0.07);
  position: relative; display: flex; flex-direction: column; align-items: center;
  width: 280px; height: 606px; padding: 58px 18px 26px; overflow: hidden; border-radius: 46px;
  background: var(--bg); color: var(--ink); text-align: center;
  box-shadow: 0 0 0 9px #1c1a17, 0 0 0 10px rgba(255, 255, 255, 0.1), 0 40px 80px rgba(28, 26, 23, 0.22);
}
.phone figcaption { display: grid; gap: 4px; max-width: 280px; text-align: center; }
.phone figcaption b { font-size: 18px; font-weight: 650; }
.phone figcaption span { font-size: 15px; line-height: 1.4; color: var(--sec); }
.island { position: absolute; top: 12px; left: 50%; width: 92px; height: 27px; margin-left: -46px; border-radius: 14px; background: #000; }
.ph-nav { display: grid; grid-template-columns: 24px 1fr 24px; align-items: center; width: 100%; font-size: 14px; }
.ph-nav b { font-weight: 600; }
.ph-nav .x { font-size: 20px; line-height: 1; color: var(--sec); }
.ph-letter { margin-top: 42px; font-size: 96px; line-height: 1; font-weight: 300; font-feature-settings: "ss06" 1; }
.screen .cap { margin-top: 18px; padding: 10px 14px; }
.screen .cap .code { --u: 10px; }
.ph-say { margin: 16px 0 0; font-size: 16px; }
.ph-track { display: flex; align-items: center; gap: 8px; height: 24px; margin-top: auto; }
.ph-track i { display: block; height: 8px; width: 8px; border-radius: 4px; background: var(--ink); }
.ph-track i.h { width: 24px; }
.ph-key { position: relative; display: grid; place-items: center; width: 150px; height: 150px; margin-top: 14px; border-radius: 50%; background: #ffc629; color: #1c1a17; font-size: 16px; font-weight: 700; }
.ph-key::before { content: ""; width: 14px; height: 14px; margin-bottom: -26px; border-radius: 50%; background: rgba(28, 26, 23, 0.6); }
.ph-hint { display: grid; margin: 12px 0 0; font-size: 13px; color: var(--sec); }
.ph-hint span { grid-area: 1 / 1; }
.ph-hint .ok { opacity: 0; color: var(--ink); font-weight: 600; }

.ph-pill { margin-top: 10px; padding: 4px 10px; border-radius: 10px; background: var(--fill); font-size: 12px; font-weight: 600; }
.ph-lamp { display: block; width: 120px; height: 120px; margin-top: 34px; border-radius: 50%; background: #fff; box-shadow: inset 0 0 0 7px var(--ink), inset 0 0 0 14px #fff, inset 0 0 0 60px var(--tile); }
.ph-q { align-self: flex-start; margin: auto 0 12px; font-size: 20px; font-weight: 700; }
.ph-answers { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; margin: 0; padding: 0; list-style: none; }
.ph-answers li { display: grid; place-items: center; align-content: center; gap: 6px; height: 74px; border-radius: 14px; background: var(--tile); font-size: 32px; font-weight: 300; line-height: 1; }
.ph-answers .code { --u: 5px; }
.ph-answers li:not(.ok) .code { display: none; }
.ph-answers li.ok { background: #ffc629; color: #1c1a17; }

.ph-title { align-self: flex-start; font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.ph-status { display: flex; align-items: center; gap: 8px; align-self: flex-start; margin: 6px 0 0; font-size: 14px; color: var(--sec); }
.mic { width: 10px; height: 10px; border-radius: 50%; background: #ffc629; box-shadow: 0 0 0 4px rgba(255, 198, 41, 0.3); }
.ph-wave { width: calc(100% + 36px); height: 120px; margin-top: 38px; overflow: hidden; }
.bars { display: flex; align-items: center; gap: 3px; width: max-content; height: 100%; }
.bars span { display: block; width: 3px; height: 10%; border-radius: 2px; background: rgba(28, 26, 23, 0.2); }
.bars span.on { height: 64%; background: var(--ink); }
.bars span.on.hi { height: 86%; }
.ph-read { display: flex; gap: 8px; margin: 40px 0 0; padding: 0; list-style: none; }
.ph-read li { display: grid; place-items: center; gap: 8px; width: 66px; height: 84px; border-radius: 14px; background: var(--tile); font-size: 30px; font-weight: 300; line-height: 1; }
.ph-read .code { --u: 4px; }
.ph-stop { display: grid; place-items: center; width: 100%; height: 50px; margin-top: auto; border-radius: 25px; background: #1c1a17; color: #fff; font-size: 16px; font-weight: 600; }

/* Loops */
.anim.running .ph-key { animation: key-press 4.2s infinite; }
.anim.running .ph-track .d { animation: track-dot 4.2s infinite both; }
.anim.running .ph-track .h { animation: track-dash 4.2s infinite both; transform-origin: left center; }
.anim.running .ph-hint .ok { animation: hint-ok 4.2s infinite both; }
.anim.running .ph-hint .ask { animation: hint-ask 4.2s infinite both; }
@keyframes key-press {
  0%, 11%, 17%, 26%, 41%, 100% { transform: none; filter: none; }
  12%, 16%, 27%, 40% { transform: scale(0.93); filter: brightness(0.92); }
}
@keyframes track-dot { 0%, 11% { opacity: 0; transform: scale(0.3); } 13%, 88% { opacity: 1; transform: none; } 96%, 100% { opacity: 0; } }
@keyframes track-dash { 0%, 26% { opacity: 0; transform: scaleX(0.1); } 27% { opacity: 1; } 40%, 88% { opacity: 1; transform: none; } 96%, 100% { opacity: 0; } }
@keyframes hint-ok { 0%, 46% { opacity: 0; } 50%, 88% { opacity: 1; } 94%, 100% { opacity: 0; } }
@keyframes hint-ask { 0%, 46% { opacity: 1; } 50%, 88% { opacity: 0; } 94%, 100% { opacity: 1; } }

/* Lamp plays K (dash dot dash) with a 0.18 s unit inside a 4.6 s loop */
.anim.running .ph-lamp { animation: lamp-k 4.6s infinite step-end; }
.anim.running .ph-answers li.ok { animation: answer-ok 4.6s infinite both; }
.anim.running .ph-answers li.ok .code { animation: answer-code 4.6s infinite both; }
@keyframes lamp-k {
  0%, 20.4%, 28.3%, 43.9% { background: #fff; box-shadow: inset 0 0 0 7px var(--ink), inset 0 0 0 14px #fff, inset 0 0 0 60px var(--tile); }
  8.7%, 24.3%, 32.2% { background: #ffc629; box-shadow: inset 0 0 0 7px var(--ink), 0 0 0 10px rgba(255, 198, 41, 0.35), 0 0 46px 10px rgba(255, 198, 41, 0.6); }
}
@keyframes answer-ok { 0%, 51% { background: var(--tile); } 54%, 92% { background: #ffc629; } 98%, 100% { background: var(--tile); } }
@keyframes answer-code { 0%, 53% { opacity: 0; } 58%, 92% { opacity: 1; } 98%, 100% { opacity: 0; } }

.anim.running .bars { animation: bars-scroll 6s linear infinite; }
.anim.running .mic { animation: mic-pulse 1.2s ease-in-out infinite; }
.anim.running .ph-read li { animation: read-in-0 6s infinite both; }
.anim.running .ph-read li:nth-child(2) { animation-name: read-in-1; }
.anim.running .ph-read li:nth-child(3) { animation-name: read-in-2; }
@keyframes bars-scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@keyframes mic-pulse { 50% { box-shadow: 0 0 0 9px rgba(255, 198, 41, 0.12); } }
@keyframes read-in-0 { 0%, 18% { opacity: 0; transform: translateY(10px) scale(0.9); } 23%, 90% { opacity: 1; transform: none; } 97%, 100% { opacity: 0; } }
@keyframes read-in-1 { 0%, 36% { opacity: 0; transform: translateY(10px) scale(0.9); } 41%, 90% { opacity: 1; transform: none; } 97%, 100% { opacity: 0; } }
@keyframes read-in-2 { 0%, 54% { opacity: 0; transform: translateY(10px) scale(0.9); } 59%, 90% { opacity: 1; transform: none; } 97%, 100% { opacity: 0; } }

@media (max-width: 760px) {
  .screen { width: 250px; height: 541px; padding-top: 52px; border-radius: 42px; }
  .ph-letter { margin-top: 30px; font-size: 84px; }
  .ph-lamp { width: 104px; height: 104px; margin-top: 26px; }
  .ph-key { width: 132px; height: 132px; }
}
