.discomfort-stack-container {
    width: 100%;
    max-width: 600px;
    margin: 20px auto;
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    text-align: center;
}

.discomfort-stack-svg {
    width: 100%;
    height: 350px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 20px;
}

.discomfort-block {
    rx: 6;
    ry: 6;
}

.discomfort-block.green {
    fill: var(--bia-teal);
}

.discomfort-block.red {
    fill: #fb7179;
}

.popping {
    animation: block-pop-in 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    transform-box: fill-box;
    transform-origin: center;
}

@keyframes block-pop-in {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.falling {
    animation: block-fall-off 0.8s ease-in forwards;
}

@keyframes block-fall-off {
    0% { transform: translate(0, 0) rotate(0deg); opacity: 1; }
    100% { transform: translate(300px, 400px) rotate(45deg); opacity: 0; }
}

.bracket-line {
    fill: none;
    stroke: #ccc;
    stroke-width: 2;
}

.bracket-text {
    font-size: 12px;
    font-weight: 600;
    fill: #888;
}

.waveform-path {
    fill: none;
    stroke-width: 3;
    stroke-linecap: round;
}

.waveform-path.green {
    stroke: rgba(85, 204, 170, 0.4);
}

.waveform-path.red {
    stroke: rgba(251, 113, 121, 0.6);
}

.discomfort-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.discomfort-btn {
    padding: 8px 16px;
    border-radius: 20px;
    border: 2px solid #eee;
    background: #fff;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    font-weight: 600;
}

.discomfort-btn.clean {
    border-color: #2e9d7a;
    color: #237355;
}

.discomfort-btn.dirty {
    border-color: #d1495b;
    color: #c0392b;
}

.discomfort-btn.recovery {
    background: var(--bia-accent);
    color: #fff;
    border: none;
    padding: 12px 24px;
    font-size: 16px;
}

.discomfort-btn.recovery:hover {
    background: var(--bia-accent);
    transform: scale(1.05);
}

.recovery-slider-container {
    width: 100%;
    margin-top: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 0 20px;
}

.recovery-slider {
    flex-grow: 1;
    -webkit-appearance: none;
    height: 8px;
    border-radius: 4px;
    background: #eee;
    outline: none;
}

.recovery-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    background: var(--bia-accent);
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.play-btn {
    background: var(--bia-accent);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.play-btn:hover {
    transform: scale(1.1);
}

.play-btn svg {
    fill: #fff;
    width: 20px;
    height: 20px;
}

/* Applied tension timer (x_buildAppliedTensionTimer in js/lessons.js) */
.at-timer {
    margin: 1rem auto;
    max-width: 420px;
    padding: 1.25rem 1rem;
    border: 1px solid var(--bia-border);
    border-radius: 16px;
    text-align: center;
}

.at-phase {
    margin: 0;
    font-weight: 600;
    color: var(--bia-fg);
}

.at-sub,
.at-round {
    margin: 0.25rem 0 0;
    color: var(--bia-muted);
    min-height: 1.5em;
}

.at-count {
    margin: 0.5rem 0;
    font-size: 2.75rem;
    font-weight: 700;
    line-height: 1;
    color: var(--bia-fg);
    font-variant-numeric: tabular-nums;
}

.at-count:empty,
.at-timer:not(.at-running) .at-bar {
    display: none;
}

.at-bar {
    height: 10px;
    border-radius: 5px;
    border: 1px solid var(--bia-border);
    overflow: hidden;
}

.at-barFill {
    height: 100%;
    width: 0;
    background: var(--bia-accent);
    transition: width 1s linear;
}

.at-release .at-barFill {
    background: var(--bia-muted);
}

.at-timer .standardButton {
    margin-top: 0.75rem;
}

.at-still .at-barFill {
    transition: none;
}

@media (prefers-reduced-motion: reduce) {
    .at-barFill {
        transition: none;
    }
}

/* Fainting dip simulator (x_buildVasovagalSim in js/lessons.js) */
.vvs {
    margin: 1rem auto;
    max-width: 640px;
    padding: 1.25rem 1rem;
    border: 1px solid var(--bia-border);
    border-radius: 16px;
    text-align: left;
    color: var(--bia-fg);
}

.vvs-section + .vvs-section {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--bia-border);
}

.vvs h5 {
    margin: 0 0 0.5rem;
    font-weight: 700;
}

.vvs p {
    margin: 0.5rem 0;
}

.vvs-choices {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.5rem 0 0.75rem;
}

.vvs-choice {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 44px;
    padding: 0.5rem 0.9rem;
    border: 1px solid var(--bia-border);
    border-radius: 12px;
    background: transparent;
    color: var(--bia-fg);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.vvs-choice[aria-pressed="true"] {
    border: 2px solid var(--bia-accent);
    padding: calc(0.5rem - 1px) calc(0.9rem - 1px);
    font-weight: 600;
}

.vvs-check {
    display: none;
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    fill: var(--bia-accent);
}

.vvs-choice[aria-pressed="true"] .vvs-check {
    display: block;
}

.vvs-feedback:empty {
    display: none;
}

.vvs-feedback {
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--bia-border);
    border-radius: 12px;
}

.vvs-chart svg {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
}

.vvs-hatchLine {
    stroke: var(--bia-muted);
    stroke-width: 2;
    opacity: 0.35;
}

.vvs-zoneEdge {
    stroke: var(--bia-muted);
    stroke-width: 1.5;
    stroke-dasharray: 2 4;
}

.vvs-stageLine {
    stroke: var(--bia-border);
    stroke-width: 1;
}

.vvs-band {
    fill: var(--bia-accent);
    opacity: 0;
}

.vvs-hasPlan .vvs-band {
    opacity: 0.12;
}

.vvs-base {
    fill: none;
    stroke: var(--bia-muted);
    stroke-width: 3;
    stroke-dasharray: 8 6;
    stroke-linecap: round;
}

.vvs-plan {
    fill: none;
    stroke: var(--bia-accent);
    stroke-width: 4;
    stroke-linecap: round;
    stroke-linejoin: round;
    display: none;
}

.vvs-hasPlan .vvs-plan {
    display: inline;
}

.vvs-marker {
    stroke: var(--bia-fg);
    stroke-width: 1;
    opacity: 0.5;
}

.vvs-markerDot {
    fill: var(--bia-fg);
}

.vvs-stages {
    display: flex;
    margin-top: 0.25rem;
    font-size: 0.8rem;
    color: var(--bia-muted);
}

.vvs-stages span {
    flex-grow: 0;
    flex-shrink: 1;
    min-width: 0;
    text-align: center;
    overflow-wrap: anywhere;
}

.vvs-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1rem;
    margin: 0.75rem 0 0;
    padding: 0;
    list-style: none;
    font-size: 0.9rem;
}

.vvs-legend li {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.vvs-planLegend {
    display: none !important;
}

.vvs-hasPlan .vvs-planLegend {
    display: inline-flex !important;
}

.vvs-key {
    display: inline-block;
    width: 28px;
    height: 12px;
}

.vvs-keyBase {
    border-top: 3px dashed var(--bia-muted);
    height: 0;
}

.vvs-keyPlan {
    border-top: 4px solid var(--bia-accent);
    height: 0;
}

.vvs-keyBand {
    background: var(--bia-accent);
    opacity: 0.25;
}

.vvs-keyZone {
    border: 1px dashed var(--bia-muted);
    background: repeating-linear-gradient(45deg, transparent 0 4px, var(--bia-border) 4px 6px);
}

.vvs-note,
.vvs-caution {
    color: var(--bia-muted);
    font-size: 0.9rem;
}

.vvs-label {
    display: block;
    margin-top: 0.75rem;
    font-weight: 600;
}

.vvs-scrub {
    width: 100%;
    min-height: 24px;
    accent-color: var(--bia-accent);
}

.vvs-cue {
    min-height: 3em;
}

.vvs-run {
    margin: 0.25rem 0 0.5rem;
}

.vvs-sources {
    margin-top: 1rem;
    font-size: 0.8rem;
    color: var(--bia-muted);
}

.vvs-sourcesTitle {
    font-weight: 600;
}

.vvs-sources ol {
    margin: 0.25rem 0 0;
    padding-left: 1.25rem;
}

.vvs-sources a {
    color: var(--bia-link);
    /* Inside muted text, colour alone does not mark these as links (WCAG 1.4.1). */
    text-decoration: underline;
    overflow-wrap: anywhere;
}
