.bst-prof-training-shell {
    width: 100%;
    color: #332315;
}

.bst-prof-training-top {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #b98a3d;
}

.bst-prof-training-title {
    min-width: 0;
}

.bst-prof-training-title strong,
.bst-prof-training-title small {
    display: block;
}

.bst-prof-training-title strong {
    font-family: Cinzel, Georgia, serif;
    font-size: 19px;
    color: #7f201d;
}

.bst-prof-training-title small {
    margin-top: 3px;
    color: #6f5636;
}

.bst-prof-training-clock {
    min-width: 82px;
    padding: 7px 10px;
    border: 1px solid #8c6428;
    background: #3b2718;
    color: #ffe7a7;
    font: 700 16px Cinzel, Georgia, serif;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.bst-prof-training-meta {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
    margin: 0 0 10px;
}

.bst-prof-training-badge {
    padding: 5px 8px;
    border: 1px solid #b98a3d;
    background: #f3e1b3;
    color: #563817;
    font-weight: 700;
}

.bst-prof-training-badge.is-master {
    border-color: #9c2621;
    background: #9c2621;
    color: #fff1ce;
}

.bst-prof-training-help {
    max-width: 780px;
    margin: 0 auto 12px;
    color: #634a2d;
    text-align: center;
}

.bst-prof-training-stage {
    position: relative;
    display: grid;
    place-items: center;
    width: 100%;
    min-height: 360px;
    max-height: 690px;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border: 2px solid #6b421d;
    background: #24180f;
    box-sizing: border-box;
    isolation: isolate;
    touch-action: manipulation;
}

.bst-prof-training-stage.is-light {
    background: #f7e8bf;
}

.bst-prof-training-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.bst-prof-training-status {
    position: absolute;
    z-index: 4;
    left: 12px;
    right: 12px;
    bottom: 10px;
    min-height: 24px;
    padding: 6px 10px;
    background: rgba(29, 19, 12, .88);
    color: #fff1c9;
    text-align: center;
    pointer-events: none;
}

.bst-prof-timing-wrap {
    width: min(720px, 88%);
}

.bst-prof-timing-bar {
    position: relative;
    height: 74px;
    overflow: hidden;
    border: 3px solid #5f3919;
    background: #c89d55;
}

.bst-prof-timing-zone,
.bst-prof-timing-decoy,
.bst-prof-timing-marker {
    position: absolute;
    top: 0;
    bottom: 0;
}

.bst-prof-timing-zone {
    background: rgba(60, 123, 70, .8);
    box-shadow: inset 0 0 0 2px #d9f2a8;
}

.bst-prof-timing-decoy {
    display: none;
    background: rgba(137, 37, 38, .65);
}

.bst-prof-timing-decoy.is-visible {
    display: block;
}

.bst-prof-timing-marker {
    width: 8px;
    background: #fff6d6;
    box-shadow: 0 0 0 2px #9d1e1c, 0 0 16px #fff2a8;
}

.bst-prof-timing-readout {
    margin-top: 12px;
    color: #ffe9b0;
    font: 700 18px Cinzel, Georgia, serif;
    text-align: center;
}
.bst-prof-training-stage.is-warrior {
    background: #23160d;
}

.bst-prof-warrior-field {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 360px;
    overflow: hidden;
    background-color: #342116;
    background-image:
        linear-gradient(rgba(255, 239, 188, .05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 239, 188, .05) 1px, transparent 1px);
    background-size: 42px 42px;
    cursor: crosshair;
    touch-action: none;
}

.bst-prof-warrior-field::before {
    content: "";
    position: absolute;
    inset: 9%;
    border: 1px solid rgba(218, 178, 93, .26);
    box-shadow: inset 0 0 0 5px rgba(58, 30, 16, .42);
    pointer-events: none;
}

.bst-prof-warrior-readout {
    position: absolute;
    z-index: 3;
    top: 10px;
    left: 50%;
    display: flex;
    gap: 18px;
    align-items: center;
    min-height: 34px;
    padding: 4px 12px;
    border: 1px solid #b9873d;
    background: rgba(35, 22, 13, .92);
    color: #ffe9b0;
    font: 700 15px Cinzel, Georgia, serif;
    transform: translateX(-50%);
    white-space: nowrap;
    pointer-events: none;
}

.bst-prof-warrior-target {
    position: absolute;
    z-index: 2;
    top: 0;
    left: 0;
    display: block;
    margin: 0;
    padding: 0;
    border: 2px dashed rgba(255, 240, 200, .9);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 181, 45, .95) 0%, rgba(194, 92, 25, .72) 42%, rgba(126, 28, 25, .08) 70%);
    box-shadow: 0 0 0 0 rgba(255, 200, 80, .5);
    cursor: crosshair;
    animation: bst-prof-warrior-pulse 1.2s ease-in-out infinite;
    will-change: transform;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
}

.bst-prof-warrior-target::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border-radius: 50%;
    background: #fff0b0;
    box-shadow: 0 0 0 5px rgba(125, 24, 21, .68), 0 0 16px rgba(255, 255, 255, .9);
}

.bst-prof-warrior-target.is-hit {
    border-style: solid;
    border-color: #d7ef9f;
    background: rgba(70, 125, 65, .78);
}

.bst-prof-warrior-target.is-miss {
    border-style: solid;
    border-color: #db766d;
    background: rgba(132, 36, 33, .72);
    opacity: .55;
}

.bst-prof-warrior-feedback {
    position: absolute;
    z-index: 3;
    left: 50%;
    bottom: 12px;
    min-width: 180px;
    padding: 7px 12px;
    border: 1px solid #719053;
    background: rgba(32, 61, 32, .94);
    color: #f1ffd0;
    font-weight: 700;
    text-align: center;
    opacity: 0;
    transform: translateX(-50%);
    transition: opacity .12s ease;
    pointer-events: none;
}

.bst-prof-warrior-feedback.is-visible {
    opacity: 1;
}

.bst-prof-warrior-feedback.is-miss {
    border-color: #b75850;
    background: rgba(104, 27, 25, .94);
    color: #ffe2cf;
}

@keyframes bst-prof-warrior-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 200, 80, .5); }
    50% { box-shadow: 0 0 0 14px rgba(255, 200, 80, 0); }
}

.bst-prof-memory-grid,
.bst-prof-forage-grid,
.bst-prof-track-grid {
    display: grid;
    grid-template-columns: repeat(var(--bst-cols, 4), minmax(44px, 1fr));
    gap: 7px;
    width: min(650px, 92%);
}

.bst-prof-memory-tile,
.bst-prof-forage-tile,
.bst-prof-track-tile {
    position: relative;
    min-height: 58px;
    border: 1px solid #815b25;
    background: #dfc486;
    color: #3b2718;
    font-size: 24px;
    cursor: pointer;
    touch-action: manipulation;
}

.bst-prof-memory-tile:focus-visible,
.bst-prof-forage-tile:focus-visible,
.bst-prof-track-tile:focus-visible,
.bst-prof-training-controls button:focus-visible {
    outline: 3px solid #2d6f86;
    outline-offset: 2px;
}

.bst-prof-memory-tile.is-lit,
.bst-prof-track-tile.is-lit {
    background: #286c7b;
    color: #fff7d8;
    box-shadow: inset 0 0 0 3px #d8f3ef;
}

.bst-prof-memory-tile.is-correct,
.bst-prof-forage-tile.is-correct,
.bst-prof-track-tile.is-correct {
    background: #557d3e;
    color: #fff;
}

.bst-prof-memory-tile.is-wrong,
.bst-prof-forage-tile.is-wrong,
.bst-prof-track-tile.is-wrong {
    background: #9e2d28;
    color: #fff;
}

.bst-prof-forage-tile {
    min-height: 72px;
    font-size: 29px;
}

.bst-prof-forage-tile small {
    display: block;
    margin-top: 3px;
    font-size: 12px;
}

.bst-prof-formula {
    width: min(720px, 92%);
    text-align: center;
}

.bst-prof-formula-sequence {
    display: flex;
    justify-content: center;
    gap: 7px;
    flex-wrap: wrap;
    min-height: 48px;
    margin-bottom: 18px;
}

.bst-prof-formula-step {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border: 2px solid #f0d486;
    background: #56391d;
    color: #fff2c4;
    font-size: 22px;
}

.bst-prof-formula-buttons {
    display: grid;
    grid-template-columns: repeat(var(--bst-reagents, 3), minmax(82px, 1fr));
    gap: 10px;
}

.bst-prof-formula-button {
    min-height: 92px;
    border: 2px solid #8e642b;
    background: #eedaa5;
    color: #3c2918;
    cursor: pointer;
    touch-action: manipulation;
}

.bst-prof-formula-button b,
.bst-prof-formula-button small {
    display: block;
}

.bst-prof-formula-button b {
    font-size: 30px;
}

.bst-prof-carpenter-canvas {
    display: block;
    width: min(760px, 94%);
    height: auto;
    aspect-ratio: 2 / 1;
    border: 4px solid #60401f;
    background: #b87c3f;
    cursor: crosshair;
    touch-action: none;
}

.bst-prof-mastery {
    position: absolute;
    inset: 0;
    overflow: hidden;
    background: #17110d;
}

.bst-prof-mastery-scene,
.bst-prof-mastery-canvas,
.bst-prof-mastery-vignette {
    position: absolute;
    inset: 0;
}

.bst-prof-mastery-scene {
    background-position: center;
    background-size: cover;
}

.bst-prof-mastery-scene::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(12, 8, 5, .38);
}

.bst-prof-mastery-canvas {
    z-index: 1;
    width: 100%;
    height: 100%;
    touch-action: none;
}

.bst-prof-mastery-vignette {
    z-index: 2;
    box-shadow: inset 0 0 90px rgba(0, 0, 0, .72);
    pointer-events: none;
}

.bst-prof-mastery-hud {
    position: absolute;
    z-index: 3;
    top: 12px;
    left: 12px;
    right: 12px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    pointer-events: none;
}

.bst-prof-mastery-objective,
.bst-prof-mastery-score {
    padding: 8px 10px;
    border: 1px solid rgba(242, 208, 126, .7);
    background: rgba(30, 19, 12, .86);
    color: #fff0c4;
}

.bst-prof-mastery-objective strong,
.bst-prof-mastery-objective small {
    display: block;
}

.bst-prof-mastery-objective strong {
    font-family: Cinzel, Georgia, serif;
}

.bst-prof-mastery-score {
    min-width: 104px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.bst-prof-mastery-progress {
    position: absolute;
    z-index: 3;
    left: 12px;
    right: 12px;
    bottom: 48px;
    height: 8px;
    border: 1px solid #d7b55f;
    background: rgba(22, 14, 9, .8);
    pointer-events: none;
}

.bst-prof-mastery-progress > i {
    display: block;
    width: 0;
    height: 100%;
    background: #c4362f;
    transition: width .2s ease;
}

.bst-prof-mastery-message {
    position: absolute;
    z-index: 4;
    left: 50%;
    top: 52%;
    width: min(520px, calc(100% - 30px));
    padding: 12px 16px;
    transform: translate(-50%, -50%);
    border: 1px solid #e0bd66;
    background: rgba(37, 23, 13, .92);
    color: #fff1c7;
    font: 700 18px Cinzel, Georgia, serif;
    text-align: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity .18s ease;
}

.bst-prof-mastery-message.is-visible {
    opacity: 1;
}

.bst-prof-training-loading {
    padding: 30px;
    color: #fff1c7;
    text-align: center;
}

@media (max-width: 700px) {
    .bst-prof-training-top {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .bst-prof-training-clock {
        grid-column: 1 / -1;
        width: 100%;
        box-sizing: border-box;
    }

    .bst-prof-training-stage {
        min-height: min(62dvh, 560px);
        max-height: none;
        aspect-ratio: auto;
    }
    .bst-prof-warrior-field {
        min-height: min(62dvh, 560px);
    }

    .bst-prof-warrior-readout {
        top: 7px;
        gap: 10px;
        width: calc(100% - 14px);
        justify-content: space-between;
        box-sizing: border-box;
        font-size: 13px;
    }

    .bst-prof-training-title strong {
        font-size: 16px;
    }

    .bst-prof-memory-grid,
    .bst-prof-forage-grid,
    .bst-prof-track-grid {
        gap: 5px;
        width: 96%;
    }

    .bst-prof-memory-tile,
    .bst-prof-track-tile {
        min-height: 48px;
        font-size: 20px;
    }

    .bst-prof-forage-tile {
        min-height: 58px;
        font-size: 24px;
    }

    .bst-prof-formula-buttons {
        grid-template-columns: repeat(2, minmax(90px, 1fr));
    }

    .bst-prof-mastery-hud {
        grid-template-columns: 1fr;
    }

    .bst-prof-mastery-score {
        width: fit-content;
        text-align: left;
    }
}

@media (prefers-reduced-motion: reduce) {
    .bst-prof-mastery-progress > i,
    .bst-prof-mastery-message,
    .bst-prof-warrior-feedback {
        transition: none;
    }

    .bst-prof-warrior-target {
        animation: none;
    }
}
