/* Practice player (stage, toolbar, drawer, turns). Shared by /practice/ and the home demo. */

.practice__icons {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

.practice__toolbar {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    max-width: calc(100vw - 1.5rem);
    padding: 0.3rem;
    background: rgba(255, 255, 255, 0.88);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    backdrop-filter: blur(14px) saturate(140%);
    border: 1px solid rgba(26, 26, 26, 0.08);
    border-radius: 999px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.14), 0 2px 8px rgba(0, 0, 0, 0.06);
}

.practice__wake-note {
    position: fixed;
    z-index: 10;
    left: 50%;
    bottom: 5rem;
    transform: translateX(-50%);
    max-width: calc(100vw - 1.5rem);
    margin: 0;
    padding: 0.45rem 0.75rem;
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.94);
    color: #1a1a1a;
    font-size: 0.85rem;
    line-height: 1.35;
    text-align: left;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.practice__wake-note p {
    margin: 0;
}

.practice__wake-note-close {
    width: 2rem;
    height: 2rem;
    flex: 0 0 auto;
}

.practice__group {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.practice__speed-toggle {
    border: 1px solid #c9c2b8;
    background: #fff;
    color: #1a1a1a;
    border-radius: 999px;
    padding: 0.3rem 0.6rem;
    font: inherit;
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    cursor: pointer;
}

.practice__speed-toggle:hover {
    border-color: #8a8175;
}

.practice__scrim {
    position: fixed;
    inset: 0;
    z-index: 30;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    background: rgba(26, 26, 26, 0.35);
    opacity: 0;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.practice__scrim.is-open {
    opacity: 1;
}

.practice__scrim[hidden] {
    display: none;
}

.practice__drawer {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 31;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    width: min(22.5rem, 92vw);
    height: 100%;
    margin: 0;
    padding: 0;
    background: #f3efe8;
    color: var(--learnpali-ink);
    box-shadow: -16px 0 40px rgba(20, 34, 34, 0.16);
    transform: translateX(100%);
    overflow: hidden;
    transition: transform 0.22s ease;
}

.practice__drawer.is-open {
    transform: translateX(0);
}

.practice__drawer[hidden] {
    display: none;
}

.practice__drawer-head {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    flex: none;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.85rem 0.7rem 0.75rem 1.05rem;
    background: rgba(243, 239, 232, 0.94);
    border-bottom: 1px solid rgba(20, 34, 34, 0.08);
}

.practice__drawer-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.8;
    color: var(--learnpali-ink);
}

.practice__drawer-body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 0.75rem;
    min-height: 0;
    padding: 0.85rem 0.75rem 0.35rem;
    overflow: auto;
}

.practice__panel {
    margin: 0;
    padding: 0.65rem 0.45rem 0.5rem;
    background: #fff;
    border: 1px solid rgba(20, 34, 34, 0.06);
    border-radius: 16px;
    box-shadow: 0 1px 2px rgba(20, 34, 34, 0.04);
}

.practice__drawer-foot {
    display: flex;
    flex: none;
    justify-content: center;
    padding: 0.85rem 1rem 1.15rem;
    background: #f3efe8;
}

body.practice-drawer-open {
    overflow: hidden;
}

.practice__menu-title {
    margin: 0;
    padding: 0.15rem 0.55rem 0.35rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: normal;
    text-transform: uppercase;
    color: var(--learnpali-teal);
}

.practice__menu-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.35rem 0.2rem 0.55rem;
    border-radius: 0.6rem;
    font-size: 0.9rem;
    white-space: nowrap;
}

.practice__menu-item:hover {
    background: rgba(26, 26, 26, 0.06);
}

.practice__menu-item.is-dragging {
    background: rgba(26, 26, 26, 0.1);
}

.practice__menu-item label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1 1 auto;
    min-width: 0;
    cursor: pointer;
}

/* Wagtail 8.1 admin checkbox (core.css input[type=checkbox]):
   1.5rem field, grey-150 border, secondary check from check.svg.
   Show and Practice share this box. */
.practice__menu-item input[type="checkbox"],
.practice__toggle input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    box-sizing: border-box;
    flex: none;
    width: 1.5rem;
    height: 1.5rem;
    margin: 0;
    padding: 0;
    position: relative;
    background-color: #fff;
    border: 1px solid hsl(0 0% 78.4%);
    border-radius: 0.1875rem;
    cursor: pointer;
}

.practice__menu-item input[type="checkbox"]:hover,
.practice__toggle input[type="checkbox"]:hover {
    border-color: hsl(0 0% 57.3%);
}

.practice__menu-item input[type="checkbox"]:focus-visible,
.practice__toggle input[type="checkbox"]:focus-visible {
    outline: 3px solid #00a885;
}

.practice__menu-item input[type="checkbox"]:disabled,
.practice__menu-item input[type="checkbox"]:disabled:hover,
.practice__toggle input[type="checkbox"]:disabled,
.practice__toggle input[type="checkbox"]:disabled:hover {
    background-color: hsl(240 12.5% 96.9%);
    border-color: hsl(0 0% 78.4%);
    cursor: not-allowed;
    opacity: 1;
}

.practice__menu-item input[type="checkbox"]::before,
.practice__toggle input[type="checkbox"]::before {
    content: "";
    position: absolute;
    top: 0.1875rem;
    inset-inline-start: 0.1875rem;
    width: 1rem;
    height: 1rem;
}

.practice__menu-item input[type="checkbox"]:checked::before,
.practice__toggle input[type="checkbox"]:checked::before {
    /* Same path as wagtailadmin/images/icons/check.svg. That file has no
       width or height, so a mask URL to it paints nothing. */
    background-color: hsl(180.5 100% 24.7%);
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='%23000' d='M14.688 3.313a.964.964 0 0 1 0 1.406l-8 8a.964.964 0 0 1-1.407 0l-4-4a.964.964 0 0 1 0-1.406.964.964 0 0 1 1.407 0l3.28 3.28 7.313-7.28a.964.964 0 0 1 1.406 0Z'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='%23000' d='M14.688 3.313a.964.964 0 0 1 0 1.406l-8 8a.964.964 0 0 1-1.407 0l-4-4a.964.964 0 0 1 0-1.406.964.964 0 0 1 1.407 0l3.28 3.28 7.313-7.28a.964.964 0 0 1 1.406 0Z'/%3E%3C/svg%3E");
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-size: contain;
    mask-size: contain;
    mask-mode: alpha;
}

.practice__menu-item input:disabled + span {
    cursor: default;
}

/* Faces match the Wagtail dialogue fields: Sarabun for Thai script,
   Gentium for Roman Pāli and English. Size follows display order, below. */

.practice__drag {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.75rem;
    padding: 0;
    border: 0;
    background: transparent;
    color: #8a8175;
    cursor: grab;
    touch-action: none;
}

.practice__drag:active,
.practice__menu-item.is-dragging .practice__drag {
    cursor: grabbing;
}

.practice__drag .practice__icon {
    width: 1rem;
    height: 1rem;
}

.practice__toggle {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    margin: 0;
    padding: 0.45rem 0.5rem;
    border-radius: 12px;
    cursor: pointer;
}

.practice__toggle:hover {
    background: rgba(13, 148, 136, 0.06);
}

.practice__toggle input[type="checkbox"] {
    margin-top: 0.1rem;
}

.practice__toggle-copy {
    display: block;
    min-width: 0;
}

.practice__toggle-name {
    display: block;
    font-size: 0.92rem;
    font-weight: 650;
    line-height: 1.3;
    color: var(--learnpali-ink);
}

.practice__toggle-hint {
    display: block;
    margin-top: 0.12rem;
    font-size: 0.75rem;
    font-weight: 400;
    line-height: 1.35;
    color: #6b6358;
    white-space: normal;
}

.practice__takeaway {
    padding: 0 0.55rem 0.25rem;
    font-size: 0.88rem;
    font-weight: 400;
    line-height: 1.45;
    color: var(--learnpali-ink);
    white-space: normal;
}

.practice__takeaway > :first-child {
    margin-top: 0;
}

.practice__takeaway > :last-child {
    margin-bottom: 0;
}

.practice__takeaway p {
    margin: 0 0 0.5rem;
}

.practice__takeaway ul,
.practice__takeaway ol {
    margin: 0 0 0.5rem;
    padding-inline-start: 1.25rem;
}

.practice__takeaway a {
    color: var(--learnpali-teal);
}

.practice__study-block {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.practice__roles {
    display: flex;
    gap: 0.4rem;
    padding: 0 0.5rem 0.35rem 2rem;
}

.practice__roles[hidden] {
    display: none;
}

.practice__role {
    min-width: 0;
    max-width: calc(50% - 0.2rem);
    padding: 0.28rem 0.7rem;
    border: 1px solid #c9c2b8;
    border-radius: 999px;
    background: #fff;
    color: var(--learnpali-ink);
    font: inherit;
    font-size: 0.8rem;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

.practice__role.is-selected {
    border-color: #0d9488;
    background: #0d9488;
    color: #fff;
}

.practice__repeat-gap {
    position: relative;
}

.practice__repeat-gap-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Share uses the public .button from components/_buttons.scss.
   Radius, border, label weight, and hover stay on that component. */
.practice__copy-icon {
    width: 1.15rem;
    height: 1.15rem;
}

.practice__reveal {
    display: inline-flex;
    margin: 0.35rem 0 0;
    padding: 0.18rem 0.6rem;
    border: 1px solid rgba(13, 148, 136, 0.35);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    color: var(--learnpali-teal);
    font: inherit;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
}

.practice__bubble.is-covered {
    cursor: pointer;
}

.practice__cue {
    margin: 0;
    flex-shrink: 0;
}

.practice__cue-rec {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    background: #0d9488;
    color: #fff;
    box-shadow: 0 0 0 0 rgba(13, 148, 136, 0.55);
    animation: practice-cue-pulse 1.5s ease-out infinite;
}

.practice__cue-rec .practice__icon {
    width: 1.1rem;
    height: 1.1rem;
}

@keyframes practice-cue-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(13, 148, 136, 0.55);
    }

    70% {
        box-shadow: 0 0 0 0.45rem rgba(13, 148, 136, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(13, 148, 136, 0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .practice__cue-rec {
        animation: none;
        box-shadow: 0 0 0 2px rgba(13, 148, 136, 0.45);
    }
}

.practice__turn.is-your-turn .practice__bubble {
    box-shadow: 0 0 0 2px #0d9488, 0 10px 24px -6px rgba(26, 26, 26, 0.22);
}

.practice__controls {
    gap: 0.125rem;
    padding: 0 0.2rem;
}

.practice__btn {
    border: 1px solid #c9c2b8;
    background: #fff;
    color: #1a1a1a;
    border-radius: 999px;
    padding: 0.5rem 1rem;
    font: inherit;
    cursor: pointer;
}

.practice__btn:hover {
    border-color: #8a8175;
}

.practice__btn--icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    border: none;
    background: transparent;
    transition: background-color 0.15s ease, transform 0.05s ease;
}

.practice__btn--icon:hover {
    background: rgba(26, 26, 26, 0.08);
}

.practice__btn--icon:active {
    transform: scale(0.94);
}

/* The menu button keeps the grey hover tint at rest so it
   reads as an always-available control. */
.practice__btn--icon[data-options-toggle] {
    background: rgba(26, 26, 26, 0.08);
}

.practice__btn--primary {
    width: 3rem;
    height: 3rem;
    background: #1a1a1a;
    color: #fff;
}

.practice__btn--primary:hover {
    background: #000;
}

.practice__icon {
    width: 1.25rem;
    height: 1.25rem;
}

.practice__btn--primary .practice__icon {
    width: 1.4rem;
    height: 1.4rem;
}

.practice__btn:disabled {
    opacity: 0.5;
    cursor: default;
}

@media (max-width: 640px) {
    .practice__toolbar {
        left: 0.75rem;
        right: 0.75rem;
        transform: none;
        border-radius: 1.25rem;
        justify-content: center;
        gap: 0.375rem;
        padding: 0.3rem;
        flex-wrap: wrap;
    }

    .practice__wake-note {
        left: 0.75rem;
        right: 0.75rem;
        bottom: 5.5rem;
        transform: none;
        max-width: none;
    }
}

@media (pointer: coarse) {
    .practice__speed-toggle {
        padding: 0.45rem 0.7rem;
    }

    .practice__btn--icon {
        width: 2.75rem;
        height: 2.75rem;
    }

    .practice__btn--primary {
        width: 3.25rem;
        height: 3.25rem;
    }
}

.practice__stage {
    margin: 1rem 0;
}

/* Chat-style turns: speaker A sits left, speaker B sits right, like a messaging app. */
.practice__turn {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    margin: 0.9rem 0;
}

.practice__turn--a {
    flex-direction: row;
}

.practice__turn--b {
    flex-direction: row-reverse;
}

.practice__bubble {
    position: relative;
    max-width: 78%;
    padding: 0.55rem 0.85rem 0.65rem;
    border-radius: 16px;
    box-shadow: 0 1px 2px rgba(26, 26, 26, 0.08);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.practice__turn--a .practice__bubble {
    background: #e6f4f3;
}

.practice__turn--b .practice__bubble {
    background: #faf0e4;
}

.practice__bubble--playable {
    cursor: pointer;
}

.practice__turn.is-repeat-wait .practice__speak {
    opacity: 0.55;
}

.practice__repeat-countdown {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.85rem;
    font-variant-numeric: tabular-nums;
    pointer-events: none;
}

.practice__turn.is-repeat-wait.is-active .practice__bubble {
    box-shadow: 0 0 0 2px rgba(200, 16, 46, 0.45), 0 10px 24px -6px rgba(26, 26, 26, 0.22),
        0 4px 8px rgba(26, 26, 26, 0.1);
}

.practice__turn.is-active .practice__bubble {
    transform: translateY(-3px);
    box-shadow: 0 0 0 2px #c8102e, 0 10px 24px -6px rgba(26, 26, 26, 0.28), 0 4px 8px rgba(26, 26, 26, 0.1);
}

.practice__turn.is-your-turn.is-active .practice__bubble {
    box-shadow: 0 0 0 2px #0d9488, 0 10px 24px -6px rgba(26, 26, 26, 0.22);
}

.practice__corpus-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0.15rem;
    border-radius: 999px;
    border: 1px solid #99f6e4;
    background: rgba(255, 255, 255, 0.82);
    color: #0f766e;
    line-height: 0;
    box-shadow: 0 1px 2px rgba(15, 118, 110, 0.12);
}

.practice__corpus-badge-icon {
    width: 0.95rem;
    height: 0.95rem;
    flex-shrink: 0;
}

.practice__speaker-aside {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
    margin-left: auto;
}

.practice__speaker-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin: 0 0 0.25rem;
}

.practice__speaker-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    flex-shrink: 0;
}

.practice__speaker {
    margin: 0;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: normal;
}

.practice__speak {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    border: none;
    background: transparent;
    color: #6b6358;
    border-radius: 50%;
    flex-shrink: 0;
}

.practice__speak-status {
    cursor: default;
    pointer-events: none;
}

.practice__speak .practice__icon {
    width: 1.1rem;
    height: 1.1rem;
}

.practice__turn--a .practice__speaker {
    color: #0d9488;
}

.practice__turn--b .practice__speaker {
    color: #c2410c;
}

.practice__line {
    margin: 0;
    /* An Enter in the turn text is a verse line. Spaces still collapse.
       Later language blocks add padding-top. Verse lines stay on line-height. */
    white-space: pre-line;
}

.practice__line + .practice__line {
    padding-top: 18px;
}

.practice__line--pith + .practice__line--pi,
.practice__line--pi + .practice__line--pith {
    padding-top: 0.2em;
}

.practice__line--en,
.practice__line--pi {
    font-family: var(--inscribe-font-roman);
}

.practice__line--th,
.practice__line--pith {
    font-family: var(--inscribe-font-thai);
}

/* The first shown line uses 1.15rem. Later lines use 1rem, except the
   later of the two Pāli scripts, which uses 0.9rem. Menu samples follow
   the lead rule. The menu rules are more specific than one class, so the
   lead override names the menu item too. */
.practice__line--en,
.practice__line--pi,
.practice__line--th,
.practice__line--pith,
.practice__menu-item .practice__line--en,
.practice__menu-item .practice__line--pi,
.practice__menu-item .practice__line--th,
.practice__menu-item .practice__line--pith {
    font-size: 1rem;
    line-height: 1.5;
}

.practice__line--en,
.practice__line--pi,
.practice__line--th,
.practice__line--pith,
.practice__menu-item .practice__line--en,
.practice__menu-item .practice__line--pi,
.practice__menu-item .practice__line--th,
.practice__menu-item .practice__line--pith {
    letter-spacing: normal;
    line-height: 1.8;
}

.practice__line--lead,
.practice__menu-item .practice__line--lead {
    font-size: 1.15rem;
    font-style: normal;
}

/* 0.9rem is 18px when the root is 20px. Only the Pāli script that comes
   second is smaller. English and Thai stay at 1rem. */
.practice__line--pith ~ .practice__line--pi,
.practice__line--pi ~ .practice__line--pith {
    font-size: 0.9rem;
}

/* Pāli in either script is italic and lighter after it leaves the first
   shown slot. That slot is the first line of both the display and the
   playback order. English and Thai stay upright and at full colour.
   The spoken word keeps #c8102e because that rule is more specific. */
.practice__line--pi:not(.practice__line--lead),
.practice__line--pith:not(.practice__line--lead) {
    font-style: italic;
    color: #6b6358;
}

.practice__line--pith {
  /* Mirror printing.py \spaceskip=0.6em: widen the interword space so the
     less-familiar Thai-script Pāli reads more easily. CSS word-spacing is
     additive to the font's natural space, so 0.3em lands near the 0.6em total. */
  word-spacing: 0.3em;
}

/* A Pali word (Roman or Thai script) must never break across a line.
   Rule lives in syllabus/pali-word.css; load that stylesheet before this file. */

/* Karaoke highlight: the word the audio is currently speaking.
   Thai-script words are used when they split like the spoken Roman line.
   Otherwise the Roman words take the mark. Colour-only so the word does not
   gain background/padding and reflow the bubble. */
.practice__line--pith .pali-word.is-current,
.practice__line--pi .pali-word.is-current,
.practice__line--en .pali-word.is-current,
.practice__line--th .pali-word.is-current {
  color: #c8102e;
}

.practice__note {
    color: #777;
    margin: 0.5rem 0;
}
