/* Training story: Real conversation -> Real sales gap -> AI roleplay -> Feedback -> Try again -> Improvement -> back to real conversation.
   Driven by assets/js/train-story.js. Vertical by design, so desktop and mobile share one layout. */
.ts { width: 100%; max-width: 560px; margin: 0 auto; border-radius: 20px; background: var(--color-p-card); border: 1px solid var(--color-p-border-line); box-shadow: 0 40px 100px -40px rgba(0,0,0,0.6); padding: 18px; text-align: left; }
@media (min-width: 768px) { .ts { padding: 22px; } }
.ts-body { transition: opacity .5s ease; }
.ts-body.ts-fading { opacity: 0; }
.ts-k { font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--color-p-muted); }
.ts-av { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex-shrink: 0; border: 2px solid var(--color-p-border-hover); background: var(--color-p-bg-secondary); }
.ts-av--ai { border-color: rgba(20,184,166,0.55); }
.ts-av--rep { border-color: rgba(232,108,93,0.55); }

/* source: always visible once it appears */
.ts-source { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 560px) { .ts-source { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: stretch; } }
.ts-call { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--color-p-bg-secondary); border: 1px solid var(--color-p-border-line); }
.ts-call-meta { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ts-quote { font-size: 13px; font-weight: 600; line-height: 1.35; color: var(--color-p-text); }
.ts-quote em { display: block; margin-top: 2px; font-style: normal; font-size: 11px; font-weight: 700; color: var(--color-p-muted); }
.ts-gap { padding: 12px 14px; border-radius: 14px; background: rgba(234,179,8,0.08); border: 1px solid rgba(234,179,8,0.4); opacity: 0; transform: translateY(6px) scale(.97); transition: opacity .5s ease, transform .5s cubic-bezier(0.22, 1, 0.36, 1); }
.ts-gap.visible { opacity: 1; transform: none; }
.ts-gap small { display: block; font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--color-p-warning); }
.ts-gap b { display: block; margin-top: 3px; font-family: var(--font-geist, inherit); font-size: 16px; font-weight: 800; color: var(--color-p-text); }

.ts-arrow { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 14px 0; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--color-p-teal); opacity: 0; transition: opacity .5s ease; }
.ts-arrow.visible { opacity: 1; }
.ts-arrow i { font-style: normal; font-size: 16px; }

/* roleplay */
.ts-rp { padding: 14px; border-radius: 14px; border: 1px solid var(--color-p-border-line); background: var(--color-p-card); opacity: .35; transition: opacity .6s ease, border-color .6s ease; }
.ts-rp.visible { opacity: 1; border-color: rgba(20,184,166,0.3); }
.ts-rp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.ts-rp-head .ts-k { color: var(--color-p-teal); }
.ts-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--color-p-muted); border: 1px solid var(--color-p-border-line); transition: color .4s ease, border-color .4s ease, background-color .4s ease; }
.ts-pill.warn { color: var(--color-p-warning); border-color: rgba(234,179,8,0.4); background: rgba(234,179,8,0.08); }
.ts-pill.ok { color: var(--color-p-success); border-color: rgba(34,197,94,0.4); background: rgba(34,197,94,0.08); }

.ts-msg { display: flex; align-items: flex-end; gap: 10px; margin-bottom: 10px; opacity: 0; transform: translateY(8px); transition: opacity .4s ease, transform .4s ease; }
.ts-msg.visible { opacity: 1; transform: none; }
.ts-msg--rep { flex-direction: row-reverse; }
.ts-bubble { position: relative; max-width: 78%; padding: 10px 14px; border-radius: 14px; font-size: 13.5px; line-height: 1.4; font-weight: 600; color: var(--color-p-text); background: var(--color-p-bg-secondary); border: 1px solid var(--color-p-border-line); }
.ts-msg--ai .ts-bubble { border-bottom-left-radius: 4px; border-color: rgba(20,184,166,0.3); }
.ts-msg--rep .ts-bubble { border-bottom-right-radius: 4px; border-color: rgba(232,108,93,0.3); }
.ts-dots { display: none; gap: 4px; padding: 4px 2px; }
.ts-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--color-p-muted); animation: ts-dot 1s ease-in-out infinite; }
.ts-dots i:nth-child(2) { animation-delay: .15s; } .ts-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes ts-dot { 0%, 100% { opacity: .3; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }
.ts-msg.typing .ts-dots { display: inline-flex; }
.ts-msg.typing .ts-text { display: none; }
.ts-msg .ts-pill { align-self: center; opacity: 0; transition: opacity .4s ease, color .4s ease, border-color .4s ease, background-color .4s ease; }
.ts-msg .ts-pill.visible { opacity: 1; }

.ts-fb { margin: 4px 0 12px; padding: 12px 14px; border-radius: 12px; background: rgba(234,179,8,0.07); border: 1px solid rgba(234,179,8,0.35); opacity: 0; transform: translateY(8px); transition: opacity .5s ease, transform .5s ease; }
.ts-fb.visible { opacity: 1; transform: none; }
.ts-fb-top { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 800; color: var(--color-p-warning); }
.ts-fb-top b { color: var(--color-p-text); }
.ts-fb-ic { display: inline-flex; width: 16px; height: 16px; border-radius: 50%; background: #EAB308; color: #241c00; font-size: 10px; font-weight: 900; align-items: center; justify-content: center; }
.ts-fb p { margin: 6px 0 0; font-size: 13.5px; font-weight: 700; line-height: 1.35; color: var(--color-p-text); }
.ts-retry { display: flex; justify-content: center; margin: 2px 0 12px; opacity: 0; transition: opacity .4s ease; }
.ts-retry.visible { opacity: 1; }
.ts-retry span { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--color-p-teal); border: 1px solid rgba(20,184,166,0.4); border-radius: 999px; padding: 4px 12px; background: rgba(20,184,166,0.08); }
.ts-result { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 12px; background: rgba(34,197,94,0.08); border: 1px solid rgba(34,197,94,0.35); font-size: 14px; font-weight: 800; color: var(--color-p-success); opacity: 0; transform: scale(.97); transition: opacity .5s ease, transform .5s cubic-bezier(0.22, 1, 0.36, 1); }
.ts-result.visible { opacity: 1; transform: none; }
.ts-result i { display: inline-flex; width: 18px; height: 18px; border-radius: 50%; background: #22C55E; color: #fff; font-style: normal; font-size: 11px; font-weight: 900; align-items: center; justify-content: center; }

.ts-ready { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 14px; margin-top: 14px; padding: 12px 14px; border-radius: 14px; background: linear-gradient(135deg, rgba(34,197,94,0.12), rgba(34,197,94,0.03)); border: 1px solid rgba(34,197,94,0.4); opacity: 0; transform: translateY(8px); transition: opacity .6s ease, transform .6s ease; }
.ts-ready.visible { opacity: 1; transform: none; }
.ts-ready b { font-family: var(--font-geist, inherit); font-size: 14px; font-weight: 800; color: var(--color-p-text); }
.ts-ready span { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--color-p-success); }
@media (min-width: 640px) { .ts-body { min-height: 470px; } }
@media (prefers-reduced-motion: reduce) { .ts-dots i { animation: none; } }
.ts-pill { white-space: nowrap; flex-shrink: 0; }
@media (max-width: 639px) { .ts-msg .ts-pill { display: none; } .ts-bubble { max-width: 84%; } }

/* ---- Roleplay as a video call (replaces the chat bubbles) ---- */
.ts-live { display: inline-flex; align-items: center; gap: 6px; margin-left: 10px; font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--color-p-muted); }
.ts-live i { width: 7px; height: 7px; border-radius: 50%; background: #EF4444; animation: ts-rec 1.4s ease-in-out infinite; }
@keyframes ts-rec { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.ts-stage { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; opacity: 0; transform: translateY(8px); transition: opacity .5s ease, transform .5s ease; }
.ts-stage.visible { opacity: 1; transform: none; }
.ts-tile { position: relative; aspect-ratio: 1 / 1; border-radius: 14px; overflow: hidden; background: var(--color-p-bg-secondary); border: 2px solid var(--color-p-border-line); transition: border-color .4s ease, box-shadow .5s ease; }
.ts-tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ts-tile::after { content: ""; position: absolute; inset: auto 0 0 0; height: 46%; background: linear-gradient(to top, rgba(0,0,0,0.62), transparent); pointer-events: none; }
.ts-name { position: absolute; left: 10px; bottom: 9px; z-index: 2; font-size: 11px; font-weight: 800; letter-spacing: .04em; color: #fff; text-shadow: 0 1px 6px rgba(0,0,0,0.6); }
.ts-name small { margin-left: 6px; padding: 1px 6px; border-radius: 999px; font-size: 9px; letter-spacing: .08em; text-transform: uppercase; background: rgba(20,184,166,0.85); color: #04211e; }
.ts-wave { position: absolute; right: 10px; bottom: 10px; z-index: 2; display: flex; align-items: flex-end; gap: 2px; height: 14px; opacity: 0; transition: opacity .3s ease; }
.ts-wave i { width: 3px; height: 4px; border-radius: 2px; background: #fff; }
.ts-tile.speaking .ts-wave { opacity: 1; }
.ts-tile.speaking .ts-wave i { animation: dm-wave .9s ease-in-out infinite; }
.ts-tile.speaking .ts-wave i:nth-child(2) { animation-delay: .12s; } .ts-tile.speaking .ts-wave i:nth-child(3) { animation-delay: .24s; } .ts-tile.speaking .ts-wave i:nth-child(4) { animation-delay: .36s; }
.ts-tile--ai.speaking { border-color: var(--color-p-teal); box-shadow: 0 0 0 3px rgba(20,184,166,0.25), 0 0 34px -6px rgba(20,184,166,0.55); }
.ts-tile--rep.speaking { border-color: var(--color-p-accent); box-shadow: 0 0 0 3px rgba(232,108,93,0.25), 0 0 34px -6px rgba(232,108,93,0.55); }
.ts-tile--rep.warn { border-color: #EAB308; box-shadow: 0 0 0 3px rgba(234,179,8,0.22), 0 0 30px -8px rgba(234,179,8,0.5); }
.ts-tile--rep.ok { border-color: #22C55E; box-shadow: 0 0 0 3px rgba(34,197,94,0.22), 0 0 30px -8px rgba(34,197,94,0.5); }
.ts-tilepill { position: absolute; top: 9px; right: 9px; z-index: 2; padding: 3px 9px; border-radius: 999px; font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; opacity: 0; transform: scale(.9); transition: opacity .4s ease, transform .4s ease, background-color .4s ease; color: #1b1500; background: #EAB308; }
.ts-tilepill.visible { opacity: 1; transform: none; }
.ts-tilepill.ok { background: #22C55E; color: #04210f; }
.ts-caption { grid-column: 1 / -1; display: flex; align-items: baseline; gap: 10px; min-height: 46px; padding: 10px 14px; border-radius: 12px; background: rgba(0,0,0,0.35); border: 1px solid var(--color-p-border-line); opacity: 0; transition: opacity .35s ease; }
.ts-caption.show { opacity: 1; }
.ts-caption b { flex-shrink: 0; font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--color-p-teal); }
.ts-caption.rep b { color: var(--color-p-accent-text); }
.ts-caption span { font-size: 14px; font-weight: 600; line-height: 1.35; color: var(--color-p-text); }
@media (min-width: 640px) { .ts-body { min-height: 650px; } }
@media (max-width: 639px) { .ts-tile { aspect-ratio: 4 / 5; } .ts-caption { min-height: 62px; } }
@media (prefers-reduced-motion: reduce) { .ts-live i, .ts-tile.speaking .ts-wave i { animation: none; } }

.ts-rp-head { flex-wrap: wrap; gap: 6px 10px; }
