/* ============================================================
   Shared scene styles for HowTo "session" animations
   (live-setup-session + live-join-session-phone + live-ongoing-session).
   Dashboard structure/look mirrored from maestra-captioner
   (StartSessionPanel.vue / ShareLinkInput.vue). All sizes use cqi so the
   scene scales with the 1:1 media frame. Per-animation files scope phone
   position/state under .hta-setup / .hta-join / .hta-ongoing.
   ============================================================ */

.hta-anim {
    /* mirrored design tokens (maestra-captioner, light theme) */
    --ls-primary: #1073e6;
    --ls-on-primary: #ffffff;
    --ls-text: #334260;
    --ls-bg: #ffffff;
    --ls-el1: #f9fafb;
    --ls-border: #e5e7eb;
    --ls-tertiary: #ff9f11;

    width: 100%;
    height: 100%;
}

.hta-stage {
    position: relative;
    width: 100%;
    height: 100%;
    container-type: inline-size;
    overflow: hidden;
    background: var(--ls-bg);
    font-family: var(--appFont, 'Plus Jakarta Sans', sans-serif);
    color: var(--ls-text);
}

/* ---------------- Desktop dashboard ---------------- */
.ls-desktop {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3cqi;
}

.session-grid-container {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 42cqi));
    justify-content: center;
    align-items: stretch;
    gap: 2.7cqi;
    width: 100%;
}

.grid-cell {
    display: flex;
    min-width: 0;
}

.summary-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--ls-border);
    border-radius: 2.2cqi;
    overflow: hidden;
    background: var(--ls-bg);
}

.summary-card__header {
    padding: 1.8cqi 2.7cqi;
    background: var(--ls-el1);
    border-bottom: 1px solid var(--ls-border);
}

.summary-card__title {
    margin: 0;
    font-size: 2.1cqi;
    font-weight: 500;
    color: var(--ls-text);
}

.summary-card__body--qr {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2cqi;
    padding: 2.4cqi;
}

.join-qr {
    background: #fff;
    padding: 1.2cqi;
    border-radius: 1.35cqi;
    line-height: 0;
}

.join-qr svg {
    display: block;
    width: 26cqi;
    height: 26cqi;
}

.share-link-container {
    width: 100%;
}

.secondary-card {
    border: 1px solid var(--ls-border);
    border-radius: 1.35cqi;
    padding: 1.4cqi 2cqi;
    background: var(--ls-bg);
}

.share-link-container {
    display: flex;
    align-items: center;
}

.share-link-input {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 1.35cqi;
    width: 100%;
    margin-inline-end: 0.9cqi;
    color: var(--ls-text);
}

.share-link__copy-icon {
    width: 2.2cqi;
    height: 2.2cqi;
    flex-shrink: 0;
    color: color-mix(in srgb, var(--ls-text) 55%, transparent);
}

.session-details {
    margin: 0;
    padding: 0.5cqi 2.7cqi;
}

.summary-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 2cqi;
    padding: 1.2cqi 0;
}

.summary-row + .summary-row {
    border-top: 1px solid var(--ls-border);
}

.summary-row dt {
    margin: 0;
    font-size: 1.6cqi;
    font-weight: 500;
    color: var(--ls-text);
    white-space: nowrap;
}

.summary-row dd {
    margin: 0;
    font-size: 1.6cqi;
    font-weight: 500;
    color: var(--ls-text);
    text-align: right;
}

.summary-card__footer {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 1.6cqi;
    padding: 1.6cqi 2.7cqi 2.7cqi;
}

.ls-credits {
    text-align: center;
    font-size: 1.5cqi;
    color: color-mix(in srgb, var(--ls-text) 80%, transparent);
}

.trial-credits-count {
    font-weight: 600;
    color: var(--ls-tertiary);
}

.action-button {
    width: 100%;
    border: 1px solid var(--ls-primary);
    border-radius: 999px;
    font-weight: 600;
    padding: 1.6cqi 2.7cqi;
    font-size: 1.8cqi;
    cursor: default;
    transition: transform 0.12s ease, filter 0.2s ease;
}

.app-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1cqi;
    background-color: var(--ls-primary);
    color: var(--ls-on-primary);
}

.start-session-panel__btn-icon {
    width: 1em;
    height: 1em;
}

.summary-card__start.is-pressed {
    transform: scale(0.97);
    filter: brightness(0.93);
}

/* ---------------- Phone ---------------- */
.ls-phone {
    position: absolute;
    z-index: 10;
    width: 31cqi;
    aspect-ratio: 200 / 420;
    padding: 1.1cqi;
    background: #0d1117;
    border-radius: 5.5cqi;
    box-shadow: 0 4cqi 9cqi rgba(0, 0, 0, 0.3);
}

.ls-phone-screen {
    position: relative;
    width: 100%;
    height: 100%;
    background: #fff;
    border-radius: 4.4cqi;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    color: var(--ls-text);
}

.ls-phone-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1cqi;
    padding: 1.8cqi 2cqi;
    border-bottom: 1px solid var(--ls-border);
    flex-shrink: 0;
    opacity: 0; /* hidden while scanning; WAAPI/`.is-joined` shows it */
}

.ls-phone.is-joined .ls-phone-head {
    opacity: 1;
}

.ls-phone-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.8cqi;
    white-space: nowrap;
}

.ls-phone-mark {
    width: 3cqi;
    height: 3cqi;
    flex-shrink: 0;
    display: block;
    transform: translateY(0.45cqi); /* sit a little lower, aligned with the wordmark baseline */
}

.ls-phone-name {
    font-size: 1.9cqi;
    font-weight: 700;
    color: var(--ls-text);
}

.ls-phone-brand-suffix {
    font-size: 1.7cqi;
    color: color-mix(in srgb, var(--ls-text) 55%, transparent);
}

/* camera viewfinder — fills the screen below the header; the QR slides in
   from the top of the phone as the phone rises */
.ls-phone-scan {
    position: absolute;
    inset: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0b1622;
    opacity: 1;
}

.ls-scan-qr {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 17cqi;
    height: 17cqi;
    padding: 1cqi;
    background: #fff;
    border-radius: 1cqi;
    transform: translate(-50%, -50%) translateY(-260%);
}

.ls-scan-qr svg {
    width: 100%;
    height: 100%;
    display: block;
}

.ls-scan-frame {
    position: relative;
    width: 19cqi;
    height: 19cqi;
    z-index: 2;
}

.ls-scan-corner {
    position: absolute;
    width: 3.6cqi;
    height: 3.6cqi;
    border: 0.6cqi solid #fff;
}

.ls-scan-corner.ls-tl { top: 0; left: 0; border-right: none; border-bottom: none; border-top-left-radius: 1cqi; }
.ls-scan-corner.ls-tr { top: 0; right: 0; border-left: none; border-bottom: none; border-top-right-radius: 1cqi; }
.ls-scan-corner.ls-bl { bottom: 0; left: 0; border-right: none; border-top: none; border-bottom-left-radius: 1cqi; }
.ls-scan-corner.ls-br { bottom: 0; right: 0; border-left: none; border-top: none; border-bottom-right-radius: 1cqi; }

.ls-scan-beam {
    position: absolute;
    left: 0;
    right: 0;
    height: 0.5cqi;
    border-radius: 1cqi;
    background: linear-gradient(90deg, transparent, var(--ls-primary), transparent);
    box-shadow: 0 0 2cqi var(--ls-primary);
    animation: ls-scan-sweep 1.3s ease-in-out infinite;
}

@keyframes ls-scan-sweep {
    0%   { top: 0; opacity: 0.3; }
    50%  { top: calc(100% - 0.5cqi); opacity: 1; }
    100% { top: 0; opacity: 0.3; }
}

/* join screen (revealed after scan) — start-aligned, small text */
.ls-phone-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 1.6cqi;
    padding: 2.4cqi;
    text-align: left;
    opacity: 0;
}

.ls-phone.is-joined .ls-phone-scan { opacity: 0; pointer-events: none; }
.ls-phone.is-joined .ls-phone-body { opacity: 1; }

.ls-phone-title {
    margin: 0 0 0.4cqi;
    font-size: 2.2cqi;
    font-weight: 600;
    color: var(--ls-text);
}

.ls-phone-line {
    display: flex;
    align-items: center;
    gap: 1.2cqi;
    font-size: 1.45cqi;
    color: var(--ls-text);
}

.ls-phone-line svg {
    width: 2cqi;
    height: 2cqi;
    flex-shrink: 0;
    color: color-mix(in srgb, var(--ls-text) 55%, transparent);
}

.ls-phone-field {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 1cqi;
}

.ls-phone-label {
    font-size: 1.4cqi;
    color: var(--ls-text);
}

.ls-phone-select {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1cqi;
    padding: 1.4cqi 1.8cqi;
    border: 1px solid var(--ls-border);
    border-radius: 999px;
    font-size: 1.55cqi;
    color: var(--ls-text);
    background: var(--ls-bg);
    transition: border-color 0.2s ease;
}

.ls-phone-select.is-open {
    border-color: color-mix(in srgb, var(--ls-primary) 55%, transparent);
}

.ls-phone-caret {
    width: 1.6cqi;
    height: 1.6cqi;
    color: color-mix(in srgb, var(--ls-text) 55%, transparent);
    flex-shrink: 0;
    transition: transform 0.25s ease;
}

.ls-phone-select.is-open .ls-phone-caret { transform: rotate(180deg); }

/* menu (list) — mirrors maestra-captioner AppMenu: el1 bg, tinted border, large
   radius, soft shadow, padded, gap between pill items */
.ls-phone-menu {
    position: absolute;
    top: calc(100% + 0.8cqi);
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4cqi;
    background: var(--ls-el1);
    border: 1px solid color-mix(in srgb, var(--ls-primary) 15%, #fff);
    border-radius: 2.4cqi;
    box-shadow: 0 1cqi 3cqi rgba(0, 0, 0, 0.13);
    padding: 0.8cqi;
    z-index: 5;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-1cqi);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.ls-phone-select.is-open .ls-phone-menu {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.ls-phone-option {
    display: flex;
    align-items: center;
    gap: 0.8cqi;
    padding: 1cqi 1.6cqi;
    border-radius: 999px;
    font-size: 1.4cqi;
    font-weight: 500;
    color: var(--ls-text);
    transition: background-color 0.15s ease, color 0.15s ease;
}

.ls-phone-option-label {
    flex: 1;
    min-width: 0;
}

.ls-phone-check {
    width: 1.7cqi;
    height: 1.7cqi;
    margin-left: auto;
    color: var(--ls-primary);
    opacity: 0;
    flex-shrink: 0;
}

/* hover: subtle dark highlight + primary text (captioner --cHoverHighlight) */
.ls-phone-option[data-hover] {
    background: rgba(0, 0, 0, 0.04);
    color: var(--ls-primary);
}

/* active/selected: primary 10% bg, primary text, semibold, checkmark shown */
.ls-phone-option.is-current {
    background: color-mix(in srgb, var(--ls-primary) 10%, transparent);
    color: var(--ls-primary);
    font-weight: 600;
}

.ls-phone-option.is-current .ls-phone-check {
    opacity: 1;
}

.ls-phone-option.is-current[data-hover] {
    background: color-mix(in srgb, var(--ls-primary) 20%, transparent);
}

.ls-phone-join {
    margin-top: 0.6cqi;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1cqi;
    padding: 1.6cqi;
    border: none;
    border-radius: 999px;
    background: var(--ls-primary);
    color: var(--ls-on-primary);
    font: inherit;
    font-size: 1.6cqi;
    font-weight: 600;
    cursor: default;
    transition: transform 0.12s ease, filter 0.2s ease;
}

.ls-phone-join svg {
    width: 2.2cqi;
    height: 2.2cqi;
    flex-shrink: 0;
}

.ls-phone-join.is-pressed {
    transform: scale(0.96);
    filter: brightness(0.92);
}

/* disabled "Session not started" state (before the host starts the session) */
.ls-phone-join.is-disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

/* ---------------- Live caption state (ongoing-session main phone) ---------------- */
.ls-phone-caption {
    position: absolute;
    left: 0;
    right: 0;
    top: 6.6cqi;
    bottom: 0;
    padding: 2.6cqi;
    /* block so the revealed word <span>s wrap (a flex container would lay them
       out in a single non-wrapping row) and stack from the top (start-aligned) */
    display: block;
    overflow: hidden;
    font-size: 2cqi;
    line-height: 1.45;
    color: var(--ls-text);
    text-align: start;
    opacity: 0;
    pointer-events: none;
}

.ls-phone.is-caption .ls-phone-caption {
    opacity: 1;
}

.ls-phone.is-caption .ls-phone-body {
    opacity: 0;
    pointer-events: none;
}

.ls-phone-caption .word.latest {
    color: color-mix(in srgb, var(--ls-text) 30%, transparent);
}

/* ---------------- Live session screen (post-start desktop / theater) ---------------- */
.ls-live {
    position: absolute;
    inset: 0;
    z-index: 2;
    container-type: inline-size; /* internal cqi scale with the screen (theater shrink) */
    background: var(--ls-bg);
    border: 1px solid var(--ls-border);
    border-radius: 2.4cqi;
    overflow: hidden;
    opacity: 0;
}

.ls-live.is-active {
    opacity: 1;
}

.ls-live-pill {
    position: absolute;
    top: 3cqi;
    left: 3cqi;
    padding: 1.2cqi 2.4cqi;
    border: 1px solid var(--ls-border);
    border-radius: 999px;
    background: var(--ls-el1);
    font-size: 2cqi;
    font-weight: 600;
    color: var(--ls-text);
}

.ls-live-body {
    position: absolute;
    left: 6cqi;
    right: 6cqi;
    top: 8cqi;
    bottom: 12cqi; /* sits a little higher than the screen bottom */
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.ls-live-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 4cqi;
    color: var(--ls-text);
}

.ls-live.is-filled .ls-live-empty {
    display: none;
}

.ls-live-transcript {
    width: 100%;
    font-size: 3cqi;
    line-height: 1.5;
    color: var(--ls-text);
    text-align: left;
    display: none;
}

.ls-live.is-filled .ls-live-transcript {
    display: block;
}

.ls-live-transcript .word,
.ls-phone-caption .word {
    transition: color 0.15s ease;
}

.ls-live-transcript .word.latest {
    color: color-mix(in srgb, var(--ls-text) 30%, transparent);
}

.ls-live-logo {
    position: absolute;
    bottom: 3cqi;
    left: 3cqi;
    width: 5cqi;
    height: 5cqi;
}

.ls-live-mark {
    width: 100%;
    height: 100%;
    display: block;
}

.ls-live-controls {
    position: absolute;
    bottom: 3cqi;
    right: 3cqi;
}

.ls-live-qr {
    width: 6cqi;
    height: 6cqi;
    border: none;
    background: var(--ls-el1);
    border-radius: 999px;
    color: var(--ls-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: default;
}

.ls-live-qr svg {
    width: 3.4cqi;
    height: 3.4cqi;
}
