:root {
  --blue: #1F4FD8;
  --ink: #141413;
  --paper: #FFFFFF;
  --gray: #8A8680;
  --pale: #DCE4FF;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: Archivo, Arial, sans-serif;
  background: var(--blue);
  color: var(--paper);
  -webkit-font-smoothing: antialiased;
}

.app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: calc(16px + env(safe-area-inset-top)) 20px calc(20px + env(safe-area-inset-bottom));
  max-width: 480px;
  margin: 0 auto;
  position: relative;
  transition: background 600ms ease;
}
.app.light { background: var(--paper); color: var(--ink); }

.stage {
  position: relative;
  transition: height 500ms ease, min-height 500ms ease;
  height: 44vh;
  min-height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.app.small-stage .stage { height: 112px; min-height: 112px; }
.app.small-stage .blank { width: 96px; max-width: 96px; }
.app.small-stage .corner, .app.small-stage .corner-btn { display: none; }

.corner {
  position: absolute;
  top: 0;
  right: 0;
  width: 96px;
  height: 128px;
  border-radius: 14px;
  overflow: hidden;
  background: #4A73E3;
}
.corner-btn { position: absolute; top: 0; right: 0; min-height: 44px; font-size: 13px; padding: 0 14px; }
.cam { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); display: block; }
.corner-label {
  position: absolute; top: 8px; left: 10px;
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: #fff;
}

.blank { width: 56%; max-width: 260px; aspect-ratio: 1; transition: transform 400ms ease, width 500ms ease, max-width 500ms ease; }
.blank.talking { animation: bob 1.1s ease-in-out infinite; }
.blank.dancing { animation: dance 1.6s ease-in-out infinite; transform-origin: 50% 90%; }
@keyframes dance {
  0%   { transform: translateY(0) rotate(0deg) scaleX(1); }
  15%  { transform: translateY(-14px) rotate(-7deg) scaleX(0.97); }
  30%  { transform: translateY(0) rotate(0deg) scaleX(1.03); }
  45%  { transform: translateY(-14px) rotate(7deg) scaleX(0.97); }
  60%  { transform: translateY(0) rotate(0deg) scaleX(1.03); }
  75%  { transform: translateY(-22px) rotate(0deg) scaleX(0.95); }
  100% { transform: translateY(0) rotate(0deg) scaleX(1); }
}
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-6px) rotate(-1.5deg); } }
#eyes.blink circle { transform: scaleY(0.1); transform-origin: center; transform-box: fill-box; }
#eyes circle { transition: transform 90ms ease; }

.screen { display: flex; flex-direction: column; flex: 1 1 auto; gap: 14px; animation: rise 360ms ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes settle { from { opacity: 0; transform: translateY(16px) scale(0.96); } to { opacity: 1; transform: none; } }
.shirt-wrap, .video-wrap { animation: settle 520ms cubic-bezier(0.2, 0.8, 0.2, 1) both; }
@media (prefers-reduced-motion: reduce) { .screen, .shirt-wrap, .video-wrap, .blank { animation: none !important; transition: none !important; } }
.screen[hidden] { display: none; }

.kicker { margin: 0; font-size: 13px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--pale); }
.app.light .kicker { color: var(--gray); }
.line { margin: 0; }
.line.big { font-size: 30px; line-height: 1.1; font-weight: 800; letter-spacing: -0.01em; }
.line.small { font-size: 15px; line-height: 1.35; color: var(--pale); }
.app.light .line.small { color: var(--gray); }
.line.center { text-align: center; }
#pauseLine { align-self: center; color: var(--paper); background: var(--blue); padding: 10px 16px; border-radius: 22px; font-weight: 700; }
.line.title { font-size: 22px; font-weight: 800; letter-spacing: -0.01em; text-align: center; }
.checkout-head .line.title { font-size: 17px; text-align: left; }
.line.interim { font-size: 21px; line-height: 1.3; font-weight: 500; color: #FFFFFF; min-height: 1.4em; }
.line.interim:empty::before { content: attr(data-placeholder); color: var(--pale); }

.hearing { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.kicker.you { display: flex; align-items: center; gap: 12px; }
.hearing.hot .kicker.you { color: #FFFFFF; }
.meter { position: relative; width: 64px; height: 6px; border-radius: 3px; background: rgba(255,255,255,0.18); overflow: hidden; }
.meter i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: #FFFFFF; border-radius: 3px; transition: width 80ms linear; }

.typed textarea, .form input, .form textarea {
  width: 100%; font: inherit; font-size: 16px; padding: 12px 14px; border-radius: 12px;
  border: 2px solid rgba(255,255,255,0.5); background: rgba(255,255,255,0.08); color: inherit;
}
.app.light .typed textarea, .app.light .form input, .app.light .form textarea {
  border-color: #CFCBC4; background: #FAFAF8; color: var(--ink);
}

.controls { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.controls.one { justify-content: center; }
.btn.big { min-height: 56px; padding: 0 44px; font-size: 17px; border-radius: 28px; }
.controls.two > .btn { flex: 1 1 0; }
.controls.three > .btn { flex: 1 1 0; padding: 0 8px; font-size: 15px; white-space: nowrap; }
.status { text-align: center; font-size: 13px; color: var(--pale); letter-spacing: 0.04em; margin: 0; }
.app.light .status { color: var(--gray); }

.btn {
  min-height: 48px; padding: 0 20px; border-radius: 24px; font: inherit; font-size: 15px; font-weight: 700;
  border: 2px solid currentColor; background: transparent; color: inherit; cursor: pointer;
}
.btn.primary { background: var(--paper); color: var(--blue); border-color: var(--paper); }
.app.light .btn.primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn:disabled { opacity: 0.5; cursor: default; }

.shirt-wrap { display: flex; justify-content: center; align-items: center; height: 50vh; min-height: 260px; }
.shirt { width: auto; height: 100%; max-width: 100%; display: block; filter: drop-shadow(0 18px 28px rgba(20, 20, 19, 0.16)); isolation: isolate; }
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.shirt.mini { width: 84px; flex: 0 0 auto; filter: none; }
.checkout-head { display: flex; gap: 16px; align-items: center; }

.video-wrap { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 50vh; min-height: 260px; width: 100%; }
.video-wrap.waiting { background: #F3F2EF; border-radius: 14px; animation: settle 520ms cubic-bezier(0.2, 0.8, 0.2, 1) both, breathe 2.4s ease-in-out 600ms infinite; }
@keyframes breathe { 0%, 100% { background: #F3F2EF; } 50% { background: #E9E7E2; } }
.video-wrap img { display: block; height: 100%; width: auto; max-width: 100%; object-fit: contain; border-radius: 14px; }
.video-wrap img[hidden] { display: none; }

.form { display: flex; flex-direction: column; gap: 8px; }
.form label { font-size: 13px; letter-spacing: 0.04em; margin-top: 6px; }
.sizes { border: 0; padding: 0; margin: 0 0 8px; display: flex; flex-wrap: wrap; gap: 8px; }
.sizes legend { font-size: 13px; letter-spacing: 0.04em; margin-bottom: 6px; }
.sizes label { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px; border: 2px solid #CFCBC4; border-radius: 22px; font-weight: 700; }
.sizes label:has(input:checked) { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.sizes input { position: absolute; opacity: 0; width: 1px; height: 1px; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* The pause: the blue drains to white from the top while the tee fills in */
.app.draining { background: linear-gradient(to bottom, var(--paper) 0%, var(--paper) var(--drain, 0%), var(--blue) var(--drain, 0%), var(--blue) 100%); }

/* The trace: the artist's fields behind a tap, for reading the leap on test runs */
.trace { margin-top: 8px; font-size: 13px; color: var(--gray); }
.trace summary { cursor: pointer; letter-spacing: 0.04em; min-height: 44px; display: flex; align-items: center; }
.trace dl { margin: 0; display: grid; grid-template-columns: 1fr; gap: 2px 0; }
.trace dt { font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; font-size: 11px; margin-top: 10px; }
.trace dd { margin: 0; color: var(--ink); line-height: 1.4; overflow-wrap: anywhere; }
.trace .ideas { margin: 4px 0 0; padding-left: 18px; display: grid; gap: 8px; }
.trace .ideas li.picked { background: #F3F2EF; border-radius: 8px; padding: 6px 8px; margin-left: -8px; }
.trace .meta { color: var(--gray); }
.btn.tiny { min-height: 32px; padding: 0 12px; font-size: 12px; border-radius: 16px; margin-top: 6px; }
