/* joinlings.com/try: one lesson, in Sprue's studio. The whole screen is the 3D world; the lesson is a die-cut
   sticker sheet stuck onto it (same vinyl, print shadows and fonts as the home page and the prototype's school strip).
   Phones: Sprue up top, the sheet at the bottom; while typing the sheet moves up under the header so the keyboard
   never covers it and nothing jumps when the keyboard opens or closes. Mac: the sheet sits left, Sprue right. */

html, body.try { height: 100%; overflow: hidden; overscroll-behavior: none; }
body.try { position: fixed; inset: 0; touch-action: manipulation; }
body.try #scene { pointer-events: none; }
body.try .bubble.static { left: 50%; top: 24%; transform: translateX(-50%) !important; }

/* header: logo goes home; sound and stop are stickers */
body.try .top { padding-top: max(12px, env(safe-area-inset-top)); }
.stop {
  display: inline-flex; align-items: center; gap: 7px; min-height: 44px; padding: 8px 14px 8px 11px; border: 0; cursor: pointer;
  border-radius: 13px; background: var(--char); color: var(--butter); box-shadow: var(--print-sm); font-weight: 700; font-size: .95rem;
  transform: rotate(-1.5deg);
}
.stop svg { width: 18px; height: 18px; fill: var(--tomato); stroke: var(--paper); stroke-width: 2; }
.stop[hidden] { display: none; }
.stop:active { box-shadow: 0 0 0 2.5px var(--paper), 1px 1px 0 2.5px var(--char); translate: 1px 2px; }
@media (max-width: 520px) { body.try .sound .label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } }

/* ------------------------------------------------------------------ the sheet */
.panel {
  position: fixed; z-index: 10; left: max(10px, env(safe-area-inset-left)); right: max(10px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom)); max-height: calc(100% - 96px - env(safe-area-inset-top));
  display: flex; flex-direction: column; align-items: stretch;
}
.panel .slip {
  position: relative; isolation: isolate; overflow: auto; overscroll-behavior: contain; scrollbar-width: none;
  background: var(--cream); border-radius: 20px; box-shadow: var(--print); padding: 16px 18px 18px; transform: rotate(-.4deg);
  margin: 4px;
}
.panel .slip::before { content: ''; position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: inherit; transform: translate(-3px, -2px); }
.panel .body > :first-child { margin-top: 0; }
.panel .eyebrow { margin-bottom: 8px !important; }
.panel .title { margin: 0 0 8px; font: 400 clamp(1.7rem, 7.4vw, 2.6rem)/1.05 var(--display); color: var(--tomato); text-shadow: 2.5px 2px 0 rgba(63,163,168,.55); text-wrap: balance; }
.panel p { margin: 0 0 .6em; }
.panel .lede { font-size: 1.04rem; line-height: 1.4; font-weight: 600; }
.facts { display: flex; flex-wrap: wrap; gap: 7px; margin: 10px 0 4px; padding: 0; list-style: none; }
.facts li { padding: 3px 10px 4px; border-radius: 9px; background: var(--butter); font-weight: 700; font-size: .88rem; box-shadow: var(--print-sm); white-space: nowrap; }
@media (max-width: 420px) { .facts { gap: 6px; } .facts li { padding: 2px 7px 3px; font-size: .8rem; } }
.facts li:nth-child(1) { rotate: -1.5deg; } .facts li:nth-child(2) { rotate: 1.2deg; } .facts li:nth-child(3) { rotate: -.8deg; }
.facts li.t { background: var(--teal); color: var(--paper); }
.facts li.b { background: var(--paper); }

/* the four beats, as little tabs on top of the sheet */
.beats { display: flex; gap: 6px; justify-content: center; margin: 0 0 6px; }
.beats[hidden] { display: none; }
.beats span { padding: 3px 10px 4px; border-radius: 8px; font-size: .8rem; font-weight: 700; background: var(--paper); color: #8c8577; box-shadow: var(--print-sm); }
.beats span.past { color: var(--teal-dk); }
.beats span.on { background: var(--tomato); color: var(--paper); rotate: -2deg; scale: 1.06; }

/* what Sprue says to you, and what it asks */
.lead { margin: 0; font-size: 1rem; font-weight: 600; line-height: 1.38; }
.lead b { display: block; margin-bottom: 4px; font: 400 1.32rem/1.12 var(--display); color: var(--tomato); }
.lead.reflect b { color: var(--char); font-size: 1.2rem; }
.lead.nudge { animation: nudge .4s; }
@keyframes nudge { 30% { translate: -5px 0; } 60% { translate: 4px 0; } }
.nextmove { margin: 10px 0 0 !important; padding: 7px 10px; border-radius: 10px; background: #f0e5cc; font-size: .95rem; font-weight: 600; line-height: 1.3; }
.promise { display: flex; gap: 8px; align-items: flex-start; margin: 12px 0 0 !important; font-size: .88rem; font-weight: 600; line-height: 1.3; color: #57534d; }
.promise::before { content: ''; flex: none; width: 10px; height: 10px; margin-top: 4px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 3px rgba(63,163,168,.25); }
.fine { margin: 10px 0 0 !important; font-size: .86rem; font-weight: 600; opacity: .8; }
.fine a { color: var(--teal-dk); font-weight: 700; }

/* buttons: die-cut stickers, the main one in tomato */
.row { display: flex; gap: 10px; margin-top: 14px; align-items: stretch; }
.row[hidden] { display: none; }
.row > button, .row > a {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 54px; padding: 8px 16px; border: 0; cursor: pointer;
  border-radius: 15px; background: var(--paper); color: var(--char); box-shadow: var(--print-sm); font-weight: 700; font-size: 1.02rem; text-decoration: none; text-align: center;
  transform: rotate(.8deg); transition: box-shadow .12s;
}
.row > .big { flex: 1 1 auto; background: var(--tomato); color: var(--paper); font: 400 1.12rem/1.1 var(--display); letter-spacing: .01em; transform: rotate(-.8deg); flex-direction: column; gap: 1px; }
.row > .big small { font: 600 .8rem/1.1 var(--ui); color: #ffe7c6; letter-spacing: 0; }
.row > button:active, .row > a:active { box-shadow: var(--print-press); translate: 1px 2px; }
.row > button:disabled { background: #ddd5c3; color: #6f695d; cursor: default; }
.row > button svg { width: 30px; height: 30px; flex: none; }
.row > .speak { flex-direction: row; gap: 10px; }
.row > .speak span { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; }
.row > .speak svg { width: 36px; height: 36px; }
.row > .teal { background: var(--teal); color: var(--paper); }
.row > .start { min-height: 58px; font-size: 1.25rem; }
.row > .start[aria-busy="true"] { opacity: .85; cursor: progress; }

/* chips: how was that? */
.answers { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 0; }
.chip { padding: 8px 14px; border: 0; cursor: pointer; font-weight: 700; font-size: 1rem; border-radius: 11px; background: var(--paper); box-shadow: var(--print-sm); }
.chip:nth-child(2n) { rotate: 1.2deg; } .chip:nth-child(2n+1) { rotate: -1.2deg; }
.chip.on { background: var(--teal); color: var(--paper); }
.chip:disabled { opacity: .45; cursor: default; }

/* typing */
.panel textarea {
  display: block; width: 100%; margin-top: 10px; font: 600 16px/1.35 var(--ui); color: var(--char); padding: 10px 12px; border: 0; border-radius: 12px;
  background: var(--paper); box-shadow: inset 0 2px 0 rgba(58,58,60,.18), 0 0 0 2.5px var(--char); outline: none; resize: none;
}
.panel textarea:focus { box-shadow: inset 0 2px 0 rgba(58,58,60,.18), 0 0 0 3px var(--teal-dk); }

/* the listening ring: glows only while the microphone is open */
.listen { display: flex; gap: 14px; align-items: center; }
.ring { position: relative; flex: none; width: 96px; height: 96px; display: grid; place-items: center; border-radius: 50%; background: var(--paper); box-shadow: var(--print-sm); }
.ring svg { position: absolute; inset: 6px; width: calc(100% - 12px); height: calc(100% - 12px); rotate: -90deg; }
.ring circle { fill: none; stroke-width: 8; }
.ring .track { stroke: #e9dfc8; }
.ring .arc { stroke: var(--teal); stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 0; transition: stroke-dashoffset .1s linear; }
.ring .lvl { position: absolute; width: 50px; height: 50px; border-radius: 50%; background: rgba(63,163,168,.22); scale: .35; transition: scale .1s; }
.ring b { position: relative; font: 400 1.5rem/1 var(--display); color: var(--char); }
.ring b.shh { font-size: 1.05rem; }
.ring.glow { box-shadow: 0 0 0 3px var(--paper), 0 0 0 7px rgba(63,163,168,.5), 2px 3px 0 7px var(--char); animation: ringGlow 1.6s ease-in-out infinite; }
@keyframes ringGlow { 50% { box-shadow: 0 0 0 3px var(--paper), 0 0 0 11px rgba(63,163,168,.32), 2px 3px 0 11px var(--char); } }
.listen .say { flex: 1; min-width: 0; }
.listen .say p { margin: 0; font-size: .98rem; font-weight: 600; line-height: 1.3; }
.listen .say p b { display: block; margin-bottom: 3px; font: 400 1.2rem/1.12 var(--display); color: var(--tomato); }
.listen .say .hi { font-size: 1.5rem; color: var(--teal-dk); text-shadow: 2px 2px 0 rgba(244,201,74,.9); }

/* the part you earned, as a sticker */
.earned { display: flex; gap: 12px; align-items: center; margin: 4px 0 0; }
.earned svg { flex: none; width: 58px; height: 58px; padding: 6px; border-radius: 14px; background: var(--paper); box-shadow: var(--print-sm); rotate: -6deg; }

/* the end: the waitlist ask */
.panel .end .title { font-size: clamp(1.6rem, 6.6vw, 2.3rem); }
.row.stack { flex-direction: column; }
.row.stack > * { width: 100%; }
.cta { min-height: 60px !important; }

/* ------------------------------------------------------------------ phones: while typing, the sheet sits under the header */
@media (max-width: 899px) {
  .panel.up { bottom: auto; top: calc(66px + env(safe-area-inset-top)); }
}
/* short phones (not while typing: a keyboard opening must never change the layout under your thumb) */
@media (max-width: 899px) and (max-height: 700px) {
  .panel:not(.up) .slip { padding: 12px 14px 14px; }
  .panel:not(.up) .lede { font-size: .96rem; }
  .panel:not(.up) .ring { width: 84px; height: 84px; }
  .panel:not(.up) .row > button, .panel:not(.up) .row > a { min-height: 50px; }
}

/* ------------------------------------------------------------------ big screens: the sheet on the left, Sprue on the right */
@media (min-width: 900px) {
  .panel { left: var(--left); right: auto; width: min(31rem, 44vw); top: 50%; bottom: auto; translate: 0 -50%; max-height: calc(100% - 140px); }
  .panel .slip { padding: 22px 24px 24px; }
  .panel .title { font-size: clamp(2.2rem, 3.6vw, 3rem); }
  .lead b { font-size: 1.55rem; }
  .lead.reflect b { font-size: 1.4rem; }
  .ring { width: 112px; height: 112px; }
  .beats { justify-content: flex-start; padding-left: 12px; }
}

/* ------------------------------------------------------------------ phones on their side: the sheet on the left, Sprue on the right */
@media (min-aspect-ratio: 13/9) and (max-height: 540px), (min-aspect-ratio: 13/9) and (max-width: 899px) {
  .panel, .panel.up {
    left: max(10px, env(safe-area-inset-left)); right: auto; width: min(26rem, 52vw);
    top: calc(52px + env(safe-area-inset-top)); bottom: max(8px, env(safe-area-inset-bottom)); max-height: none; translate: none;
    justify-content: center;
  }
  .panel .slip { padding: 12px 14px 14px; }
  .panel .title { font-size: 1.8rem; }
  .panel .lede { font-size: .96rem; }
  .ring { width: 80px; height: 80px; }
  .row { margin-top: 10px; }
  .row > button, .row > a { min-height: 46px; }
  .row > .start { min-height: 50px; font-size: 1.1rem; }
  body.try .bubble.static { left: 75%; top: 22%; }
}

/* ------------------------------------------------------------------ notes when something couldn't load */
.note3d { position: fixed; z-index: 30; left: 50%; top: calc(72px + env(safe-area-inset-top)); transform: translateX(-50%); width: min(26rem, 100% - 2rem); display: flex; gap: 12px; align-items: center; background: var(--paper); border-radius: 14px; box-shadow: var(--print-sm); padding: 10px 12px 10px 16px; font-weight: 600; font-size: .92rem; }
.note3d[hidden], .broken[hidden] { display: none; }
.note3d p { margin: 0; }
.note3d button { flex: none; min-height: 40px; border: 0; border-radius: 10px; background: var(--char); color: var(--butter); font-weight: 700; padding: 6px 14px; cursor: pointer; }
.broken { position: fixed; z-index: 40; inset: auto 12px max(16px, env(safe-area-inset-bottom)); margin: 0 auto; max-width: 28rem; background: var(--paper); border-radius: 16px; box-shadow: var(--print); padding: 16px 18px; font-weight: 600; }
.broken p { margin: 0 0 12px; }
.broken div { display: flex; gap: 10px; flex-wrap: wrap; }
.broken a { display: inline-flex; align-items: center; min-height: 46px; padding: 8px 16px; border-radius: 13px; background: var(--tomato); color: var(--paper); text-decoration: none; font-weight: 700; box-shadow: var(--print-sm); }
.broken a + a { background: var(--cream); color: var(--char); }

@media (prefers-reduced-motion: reduce) { .ring.glow { animation: none; } }
