/* Layout of the demo on top of demo/ui/src/ui.css. Only --fd-* tokens: new components belong in ui.css. */
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: #101814; color: var(--fd-chalk); font: 16px/1.35 var(--fd-font-body); }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }

.stage { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start; gap: 28px; padding: 24px 12px 40px; }
.phone { position: relative; width: 390px; height: 844px; max-width: 100%; border-radius: 44px; overflow: hidden; background: var(--fd-pitch);
  box-shadow: 0 0 0 10px #1A1F1C, 0 0 0 12px #2A322D, 0 30px 60px -20px rgba(0, 0, 0, .8); }
#screens { position: absolute; inset: 0; }
@media (max-width: 760px) {
  .stage { padding: 0; gap: 0; }
  .phone { width: 100%; height: 100svh; min-height: 640px; border-radius: 0; box-shadow: none; }
  .host { width: 100%; border-radius: 0; }
}

/* screen frame */
.scr { position: absolute; inset: 0; min-height: 0; overflow: hidden; }
.scr.calm { background: var(--fd-paper); color: var(--fd-ink); padding: 20px 18px 24px; display: flex; flex-direction: column; gap: var(--fd-gap); }
.scr > .deco { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; fill: none; stroke: var(--fd-chalk); stroke-opacity: .8; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.fd-header { min-height: var(--fd-tap); }
.fd-header > :last-child:not(.fd-dots):not(.fd-icon-button) { margin-left: auto; }
.body { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: var(--fd-gap); padding: 14px 10px 16px 2px; margin: -14px -10px 0 -2px; scrollbar-width: none; }
.body::-webkit-scrollbar { display: none; }
.fd-actions { margin-top: 0; }
.fd-actions .fd-button--cta { flex: 1; }

/* calm (adult) overrides on paper */
.calm .fd-title__text { color: var(--fd-ink); -webkit-text-stroke: 0; text-shadow: none; font-size: 22px; }
.calm .fd-title__sub { color: var(--fd-ink-soft); font-size: 17px; }
.calm .fd-field__label { color: var(--fd-ink); }
.calm .fd-field__input { background: var(--fd-white); font: 20px var(--fd-font-body); }
.calm .fd-dots__dot { background: var(--fd-white); }
.calm .fd-dots__dot--done { background: var(--fd-ink-soft); }
.calm .fd-button--ghost { color: var(--fd-ink); }
.otp { letter-spacing: .4em; }

/* home */
.hello .fd-title__sub { font-size: 18px; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tile { height: 150px; padding: 14px; text-align: left; display: flex; flex-direction: column; justify-content: space-between;
  font: 15px/1.15 var(--fd-font-display); border: var(--fd-line) solid var(--fd-ink); }
.tile svg { width: 48px; height: 48px; }
.tile--paper { background: var(--fd-paper); color: var(--fd-ink); box-shadow: var(--fd-shadow); }
.tile--ink { background: var(--fd-ink); color: var(--fd-chalk); box-shadow: 5px 5px 0 var(--fd-sticker); }
.tile:active { transform: translate(3px, 3px); box-shadow: 2px 2px 0 var(--fd-ink); }
.lastrow { display: flex; justify-content: space-between; align-items: center; font-size: 18px; }
.link { border: 0; background: none; min-height: var(--fd-tap); padding: 0; font: 700 24px var(--fd-font-hand); color: var(--fd-sticker); }
.mission-sticker { max-width: 310px; }
.mission-sticker .col { display: flex; flex-direction: column; text-align: left; }
.mission-sticker .lbl { font-size: 15px; }
.lockbtn { position: relative; width: var(--fd-tap); height: var(--fd-tap); border: 0; border-radius: 50%; padding: 0; background: rgba(28, 42, 34, .45); color: var(--fd-chalk);
  display: grid; place-items: center; touch-action: none; -webkit-user-select: none; user-select: none; }
.lockbtn .ring { position: absolute; inset: 0; transform: rotate(-90deg); }
.lockbtn .ring circle { fill: none; stroke: var(--fd-sticker); stroke-width: 4; stroke-dasharray: 120; stroke-dashoffset: 120; }
.lockbtn.holding .ring circle { transition: stroke-dashoffset 2s linear; stroke-dashoffset: 0; }

/* card extras */
.card-btn { display: block; width: 100%; border: 0; background: none; padding: 0; text-align: left; }
.card-btn:active .fd-card { transform: translate(2px, 2px); }
.fd-card__nums.word { font-size: 24px; }
.fd-card--small .fd-card__nums.word { font-size: 20px; }
.fd-card .thumb { width: 100%; background: var(--fd-white); border: 2px solid var(--fd-ink); display: block; }
.fd-card .txt { font-size: 17px; white-space: pre-wrap; }
.st-txt { display: flex; flex-direction: column; gap: 4px; flex-grow: 1; }
.did { font-size: 15px; color: var(--fd-ink-soft); }
.list { display: flex; flex-direction: column; gap: 26px; padding-top: 8px; }
.card-wrap { padding: 10px 8px 12px 0; }

/* match steps */
.rate { display: flex; flex-direction: column; gap: 10px; }
.rate .fd-chips { flex-direction: column; flex-wrap: nowrap; }
.rate .fd-chip { min-height: 60px; font-size: 20px; }
.quote { font: 700 32px/1.05 var(--fd-font-hand); color: var(--fd-sticker); }
.draw { background: var(--fd-paper); border: var(--fd-line) solid var(--fd-ink); box-shadow: var(--fd-shadow-sm); position: relative; }
.draw canvas { display: block; width: 100%; height: 170px; touch-action: none; cursor: crosshair; }
.tools { position: absolute; right: 8px; top: 8px; display: flex; gap: 6px; align-items: center; }
.tools button { width: 32px; height: 32px; border-radius: 50%; border: 3px solid transparent; padding: 0; }
.tools button.on { border-color: var(--fd-ink); box-shadow: 0 0 0 2px var(--fd-paper); }
.tools .clr { background: var(--fd-paper); color: var(--fd-ink); border: 2px solid var(--fd-ink); border-radius: 0; width: auto; padding: 0 10px; font-size: 15px; }
.btn-line { min-height: 52px; padding: 0 14px; border: var(--fd-line) solid var(--fd-ink); background: var(--fd-paper); color: var(--fd-ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-size: 18px; }
.media-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.thumb-wrap { position: relative; }
.thumb-wrap img { width: 100%; display: block; border: var(--fd-line) solid var(--fd-ink); }
.thumb-wrap .btn-line { position: absolute; right: 8px; top: 8px; min-height: 40px; }

/* training */
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; }
.check { display: flex; align-items: center; gap: 10px; min-height: var(--fd-tap); border: 0; background: none; padding: 0; font-size: 18px; text-align: left; color: var(--fd-ink); }
.check i, .consent i { width: 28px; height: 28px; flex: none; border: var(--fd-line) solid var(--fd-ink); background: var(--fd-white); display: grid; place-items: center; }
.check.on i::after, .consent.on i::after { content: ""; width: 14px; height: 8px; border-left: 3.5px solid var(--fd-pitch); border-bottom: 3.5px solid var(--fd-pitch); transform: rotate(-45deg) translate(1px, -2px); }
.line-inp { width: 100%; min-height: 36px; border: 0; border-bottom: 2px dashed var(--fd-ink); border-radius: 0; background: transparent; color: var(--fd-ink); padding: 0; font: 700 26px/34px var(--fd-font-hand); }
.line-inp::placeholder { color: #9AA79F; font-weight: 600; }
.paper-title { margin: 0; font: 28px/1 var(--fd-font-display); color: var(--fd-chalk); -webkit-text-stroke: 1.5px var(--fd-ink); text-shadow: 3px 3px 0 var(--fd-ink); }
.hl { background: linear-gradient(transparent 55%, var(--fd-sticker) 55%); padding: 0 3px; }
.compact .fd-mood__face { width: 54px; height: 54px; }
.compact .fd-mood__face svg { width: 40px; height: 40px; }
.compact .fd-mood__name { display: none; }

/* onboarding */
.logo { font: 38px/1 var(--fd-font-display); color: var(--fd-sticker); -webkit-text-stroke: 2px var(--fd-ink); text-shadow: 4px 4px 0 var(--fd-ink); transform: rotate(-2deg); margin: 8px 0 4px; }
.steps-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.steps-list li { background: var(--fd-paper); color: var(--fd-ink); border: var(--fd-line) solid var(--fd-ink); padding: 10px 14px; font-size: 18px; }
.avs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.av { aspect-ratio: 1; border: var(--fd-line) solid var(--fd-ink); background: var(--fd-paper); box-shadow: var(--fd-shadow-sm); display: grid; place-items: center; padding: 0; }
.av svg { width: 60%; height: 60%; fill: none; stroke: var(--fd-ink); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.av.on { background: var(--fd-sticker); transform: rotate(-4deg); }
.kid-p { margin: 0; font-size: 19px; }
.pin { display: flex; flex-direction: column; align-items: center; gap: 18px; padding-top: 6px; }
.pin-dots { display: flex; gap: 16px; }
.pin-dots i { width: 22px; height: 22px; border: var(--fd-line) solid var(--fd-ink); border-radius: 50%; background: var(--fd-paper); }
.pin-dots i.on { background: var(--fd-sticker); }
.pad { display: grid; grid-template-columns: repeat(3, 76px); gap: 12px; }
.pad button { height: 64px; border: var(--fd-line) solid var(--fd-ink); background: var(--fd-paper); color: var(--fd-ink); box-shadow: var(--fd-shadow-sm); font: 26px var(--fd-font-display); padding: 0; }
.pad button:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--fd-ink); }
.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.consent { display: flex; gap: 12px; align-items: flex-start; width: 100%; padding: 12px; border: var(--fd-line) solid var(--fd-ink); background: var(--fd-white); color: var(--fd-ink); font-size: 17px; text-align: left; }
.consent.on i { background: var(--fd-sticker); }
.consent.on i::after { border-color: var(--fd-ink); }
.consent small, .set-row small { display: block; margin-top: 2px; font-size: 14px; color: var(--fd-ink-soft); }
.code-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.code-grid span { border: var(--fd-line) solid var(--fd-ink); background: var(--fd-white); padding: 8px 10px; font: 17px var(--fd-font-display); display: flex; gap: 8px; align-items: baseline; }
.code-grid small { font: 13px var(--fd-font-body); color: var(--fd-ink-soft); }
.code-inline { display: block; font: 15px/1.5 var(--fd-font-display); word-break: break-all; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hint { margin: 0; font-size: 15px; color: var(--fd-ink-soft); }
.fd-pitch .hint { color: var(--fd-chalk); }
.err { margin: 0; font-size: 16px; color: #B3261E; }

/* adult settings */
.set { display: flex; flex-direction: column; border: var(--fd-line) solid var(--fd-ink); background: var(--fd-white); }
.set h3 { margin: 0; padding: 10px 14px 6px; font: 13px var(--fd-font-display); color: var(--fd-ink-soft); }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 12px 14px; border: 0; border-top: 2px dashed #D6D1BE; background: none; color: var(--fd-ink); font-size: 17px; text-align: left; }
.set-row[disabled] { opacity: .5; }
.act { flex: none; border: 0; background: none; padding: 0; color: var(--fd-ink); font-size: 16px; text-decoration: underline; min-height: var(--fd-tap); }
.danger .act, .act.danger { color: #B3261E; }
.sw { position: relative; width: 52px; height: 30px; flex: none; padding: 0; border: var(--fd-line) solid var(--fd-ink); border-radius: 15px; background: var(--fd-white); }
.sw i { position: absolute; top: 2px; left: 2px; width: 21px; height: 21px; border-radius: 50%; background: var(--fd-ink); transition: left .15s; }
.sw[aria-checked="true"] { background: var(--fd-ok); }
.sw[aria-checked="true"] i { left: 23px; }
.sw[disabled] { opacity: .4; }
.banner { border: var(--fd-line) solid var(--fd-ink); background: var(--fd-sun); color: var(--fd-ink); padding: 10px 14px; font-size: 16px; display: flex; justify-content: space-between; gap: 10px; align-items: center; }

/* feed */
.mrow { gap: 4px; }
.res { align-self: flex-start; border: 2px solid var(--fd-ink); padding: 1px 8px; font-size: 15px; background: var(--fd-white); }
.res-0 { background: var(--fd-ok); }
.res-1 { background: var(--fd-sticker); }
.mrow small { color: var(--fd-ink-soft); font-size: 14px; }

/* facilitator: hypothesis labels */
.hyp { display: none; align-self: flex-start; background: var(--fd-sun); color: var(--fd-ink); border: 2px dashed var(--fd-ink); padding: 1px 8px; font: 13px/1.3 var(--fd-font-body); transform: rotate(-1deg); }
.show-hyp .hyp { display: inline-block; }

/* overlays */
.sheet-wrap { position: absolute; inset: 0; z-index: 20; background: rgba(16, 24, 20, .55); display: flex; align-items: flex-end; }
.sheet { width: 100%; background: var(--fd-paper); color: var(--fd-ink); border-top: var(--fd-line) solid var(--fd-ink); padding: 20px 18px 24px; display: flex; flex-direction: column; gap: 10px; }
.sheet h3 { margin: 0; font: 20px var(--fd-font-display); font-weight: 400; }
.sheet p { margin: 0; font-size: 17px; }
.sheet-btns { display: flex; gap: 10px; margin-top: 6px; }
.sheet-btns button { flex: 1; }
.btn-solid { min-height: 52px; border: var(--fd-line) solid var(--fd-ink); background: var(--fd-ink); color: var(--fd-chalk); font-size: 18px; }
.btn-solid.danger { background: #B3261E; }
.toast { position: absolute; left: 50%; bottom: 100px; z-index: 30; max-width: 90%; transform: translateX(-50%) rotate(-2deg); background: var(--fd-sticker); color: var(--fd-ink);
  border: var(--fd-line) solid var(--fd-ink); box-shadow: var(--fd-shadow-sm); padding: 8px 14px; font-size: 17px; text-align: center; transition: opacity .2s; pointer-events: none; }
.confetti { position: absolute; inset: 0; z-index: 25; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 9px; height: 15px; border: 1.5px solid var(--fd-ink); animation: fall 1.4s ease-in forwards; }
@keyframes fall { to { transform: translateY(900px) rotate(540deg); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .confetti { display: none; } .shake, .lockbtn .ring circle { animation: none; transition: none; } }

/* facilitator panel, outside the phone: plain UI on purpose */
.host { width: 300px; color-scheme: dark; background: #0B110E; border: 1px solid #2A322D; border-radius: 16px; color: var(--fd-chalk); font: 14px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; }
.host summary { padding: 12px 14px; font-weight: 700; cursor: pointer; }
.host .h-body { padding: 0 14px 14px; display: flex; flex-direction: column; gap: 10px; }
.host button { width: 100%; padding: 9px 10px; border: 1px solid #34413A; border-radius: 10px; background: #1F2A24; text-align: center; }
.host button:hover { background: #28362E; }
.host .h-two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.host select { width: 100%; padding: 8px; border: 1px solid #34413A; border-radius: 10px; background: #1F2A24; }
.host label { display: flex; flex-direction: column; gap: 4px; color: rgba(244, 247, 236, .7); }
.host .h-chk { flex-direction: row; align-items: center; gap: 8px; color: var(--fd-chalk); }
.host .h-info { color: rgba(244, 247, 236, .7); }
.host .h-info b { color: var(--fd-chalk); }
.host p { margin: 0; font-size: 12.5px; color: rgba(244, 247, 236, .6); }
