/* Crew Trainer shell, canvas host and game overlays, plus the Operations > Training page. Theme vars only. */

/* /train loads without Bootstrap or app.css, so its document brings its own base */
.trainer-doc {
    margin: 0;
    background: var(--mud-palette-background);
    color: var(--mud-palette-text-primary);
    font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    line-height: 1.4;
    -webkit-text-size-adjust: 100%;
}

.trainer-doc *,
.trainer-doc *::before,
.trainer-doc *::after { box-sizing: border-box; }

.trainer-shell {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--mud-palette-background);
    color: var(--mud-palette-text-primary);
}

.trainer-bar {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .5rem 1rem;
    padding-top: max(.5rem, env(safe-area-inset-top));
    background: var(--mud-palette-surface);
    border-bottom: 1px solid var(--mud-palette-divider);
}

.trainer-brand {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    min-height: 44px;   /* touch target */
    color: inherit;
    font-weight: 600;
    text-decoration: none;
}

.trainer-brand:hover { color: var(--mud-palette-primary); }
.trainer-brand img { width: 32px; height: 32px; }

.trainer-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: .75rem;
    padding-bottom: max(.75rem, env(safe-area-inset-bottom));
}

.trainer-main {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

/* a page that docks nothing gets the full width (a hidden flex item leaves no gap) */
.trainer-side:empty { display: none; }
.trainer-side:not(:has(*)) { display: none; }

@media (min-width: 1024px) {
    .trainer-body {
        flex-direction: row;
        align-items: flex-start;
        padding: 1.25rem 1.5rem;
    }
    .trainer-side { flex: 0 0 22rem; position: sticky; top: 1.25rem; }
}

.trainer-status { margin: 1rem 0; color: var(--mud-palette-text-secondary); }
.trainer-reminder { margin: 0; font-size: .875rem; color: var(--mud-palette-text-secondary); }

#blazor-error-ui.trainer-error {
    display: none;   /* Blazor shows it inline on an unhandled error */
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    padding: .75rem 1rem;
    background: var(--mud-palette-warning);
    color: var(--mud-palette-warning-text);
}

#blazor-error-ui.trainer-error .reload { color: inherit; font-weight: 600; }

/* TrainerCanvas: the WebGL stage; the game fills the viewport under the bar once trainer.js is live */
.trainer-canvas-host {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    max-height: 70vh;
    max-height: 70dvh;
    overflow: hidden;
    border-radius: 12px;
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-divider);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

@media (min-width: 1024px) {
    .trainer-canvas-host { aspect-ratio: 16 / 9; max-height: calc(100vh - 12rem); }
}

.trainer-canvas-host.trainer-live {
    aspect-ratio: auto;
    height: calc(100vh - 6.5rem);
    height: calc(100dvh - 6.5rem);
    min-height: 22rem;
    max-height: none;
    overflow: clip;   /* hidden still scrolls when something focuses or scrolls into view; the parked ticket would shift the stage */
    background: var(--mud-palette-dark);
}

.trainer-reminder + .trainer-canvas-host.trainer-live { height: calc(100vh - 8.5rem); height: calc(100dvh - 8.5rem); }

.trainer-canvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;   /* drags look around instead of scrolling the page */
}

/* JS-built game UI (notice and start screens) */
.trainer-overlay {
    position: absolute;
    inset: 0;
    z-index: 5;   /* over the game HUD until the notice is accepted */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(var(--mud-palette-surface-rgb), .78);
}

.trainer-overlay-card {
    max-width: 26rem;
    padding: 1.25rem 1.5rem;
    text-align: center;
    border-radius: 12px;
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-divider);
    box-shadow: var(--mud-elevation-4);
}

.trainer-overlay-title { margin: 0 0 .5rem; font-size: 1.35rem; font-weight: 700; }
.trainer-overlay-body { margin: 0 0 1rem; color: var(--mud-palette-text-secondary); white-space: pre-line; }

.trainer-btn {
    min-height: 44px;
    min-width: 8rem;
    padding: .5rem 1.25rem;
    border: 0;
    border-radius: 10px;
    background: var(--mud-palette-primary);
    color: var(--mud-palette-primary-text);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.trainer-btn:disabled { opacity: .6; cursor: progress; }
.trainer-btn:focus-visible { outline: 3px solid var(--mud-palette-secondary); outline-offset: 2px; }
.trainer-overlay-status { margin: -.25rem 0 .5rem; font-size: .85rem; color: var(--mud-palette-text-secondary); min-height: 1.2em; font-variant-numeric: tabular-nums; }
.trainer-overlay-status.is-error { color: var(--mud-palette-error); }
.trainer-overlay-tip { margin: 0 0 1rem; padding: .55rem .75rem; border-left: 3px solid var(--mud-palette-primary); border-radius: 6px; background: rgba(var(--mud-palette-primary-rgb), .08); font-size: .9rem; line-height: 1.35; color: var(--mud-palette-text-primary); }
.trainer-overlay-tip::before { content: 'Tip: '; font-weight: 800; color: var(--mud-palette-primary); }
/* intro load bar: models, rows, build, then the ticket */
.trainer-progress { height: 10px; margin: 0 0 1rem; border-radius: 6px; background: rgba(var(--mud-palette-text-primary-rgb), .1); overflow: hidden; }
.trainer-progress-fill { width: 0; height: 100%; border-radius: inherit; background: var(--mud-palette-primary); transition: width .25s ease-out; }
.trainer-progress.is-error .trainer-progress-fill { background: var(--mud-palette-error); }
.trainer-overlay-actions { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; }
.trainer-btn[hidden] { display: none; }
.trainer-btn--ghost { background: transparent; color: var(--mud-palette-primary); box-shadow: inset 0 0 0 2px var(--mud-palette-primary); }
@media (prefers-reduced-motion: reduce) { .trainer-progress-fill { transition: none; } }
/* 1197 start card: Learn / Practice side by side, the Drinks chips, one wide Start */
.trainer-overlay-card.is-start { width: 100%; max-width: 34rem; }
.trainer-overlay-sub { margin: -.35rem 0 1rem; min-height: 1.3em; font-size: .9rem; color: var(--mud-palette-text-secondary); }
.trainer-choices { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin: 0 0 1rem; }
.trainer-choice { display: flex; flex-direction: column; gap: .3rem; padding: .8rem .9rem; text-align: left; border: 2px solid var(--mud-palette-divider); border-radius: 10px; background: var(--mud-palette-surface); color: var(--mud-palette-text-primary); font: inherit; cursor: pointer; }
.trainer-choice[aria-pressed="true"] { border-color: var(--mud-palette-primary); background: rgba(var(--mud-palette-primary-rgb), .06); }
.trainer-choice-title { font-size: 1.05rem; font-weight: 700; }
.trainer-choice-body { font-size: .85rem; line-height: 1.35; color: var(--mud-palette-text-secondary); }
.trainer-chips { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .4rem; margin: 0 0 1rem; }
.trainer-chips-label { margin-right: .25rem; font-size: .85rem; font-weight: 600; color: var(--mud-palette-text-secondary); }
.trainer-chip { min-height: 36px; padding: .25rem .9rem; border: 1px solid var(--mud-palette-divider); border-radius: 999px; background: transparent; color: var(--mud-palette-text-primary); font: inherit; font-size: .9rem; cursor: pointer; }
.trainer-chip[aria-pressed="true"] { border-color: var(--mud-palette-primary); background: rgba(var(--mud-palette-primary-rgb), .12); color: var(--mud-palette-primary); font-weight: 600; }
:is(.trainer-choice, .trainer-chip):focus-visible { outline: 3px solid var(--mud-palette-secondary); outline-offset: 2px; }
.trainer-btn--wide { flex: 1 1 100%; }
.trainer-overlay-note { margin: .5rem 0 0; font-size: .8rem; color: var(--mud-palette-text-secondary); }
@media (max-width: 480px) { .trainer-choices { grid-template-columns: 1fr; } }

/* ---- game HUD (hud.js, kds.js): docked panels on desktop, bottom bar + slide-in ticket on phones ---- */
.trh {
    position: absolute;
    inset: 0;
    overflow: clip;
    pointer-events: none;
    font-size: .9rem;
    color: var(--mud-palette-text-primary);
    --trh-panel: rgba(var(--mud-palette-surface-rgb), .93);
}
.trh button { font: inherit; }
.trh :is(button, a, input, select, details, summary) { pointer-events: auto; }
.trh :focus-visible { outline: 3px solid var(--mud-palette-secondary); outline-offset: 2px; }

.trh-top {
    position: absolute;
    top: .5rem;
    left: .5rem;
    right: .5rem;
    display: flex;
    gap: .5rem;
    align-items: center;
}
/* 1363: the Go to pill (the stand you are at, the next one beside it while the guide points there) and its station list */
.trh-goto { position: relative; flex: 0 1 auto; min-width: 0; pointer-events: auto; }
.trh--phone .trh-goto { flex: 1 1 0; }
.trh-goto-btn { display: inline-flex; align-items: center; gap: .4rem; max-width: 100%; padding-right: .6rem; }
.trh-goto-here, .trh-goto-next { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trh-goto-next { color: var(--mud-palette-primary); }
.trh-goto-next[hidden], .trh-goto-list[hidden] { display: none; }
.trh-goto-caret { flex: 0 0 auto; transition: transform .15s ease-out; }
.trh-goto.is-open .trh-goto-caret { transform: rotate(180deg); }
.trh-goto.is-open .trh-goto-btn { border-color: var(--mud-palette-primary); }
.trh-goto-list {
    position: absolute; top: calc(100% + .35rem); left: 0; z-index: 5; box-sizing: border-box;
    min-width: 13rem; max-height: min(70vh, 32rem); overflow-y: auto; overscroll-behavior: contain;
    margin: 0; padding: .3rem; list-style: none;
    border-radius: 12px; background: var(--mud-palette-surface); border: 1px solid var(--mud-palette-divider); box-shadow: var(--mud-elevation-8);
    pointer-events: auto;
}
.trh-goto-list:focus-visible { outline: none; }   /* the active row shows the focus */
.trh-goto-opt { box-sizing: border-box; display: flex; align-items: center; gap: .6rem; min-height: 40px; padding: .3rem .6rem; border: 2px solid transparent; border-radius: 8px; font-weight: 600; cursor: pointer; }
.trh-goto-opt:hover { background: rgba(var(--mud-palette-primary-rgb), .08); }
.trh-goto-opt.is-active { border-color: var(--mud-palette-primary); background: rgba(var(--mud-palette-primary-rgb), .1); }
.trh-goto-opt.is-on { color: var(--mud-palette-primary); }
.trh-goto-key { flex: 0 0 1.4rem; height: 1.4rem; display: inline-grid; place-items: center; border-radius: 5px; border: 1px solid var(--mud-palette-divider); font-size: .72rem; font-weight: 700; color: var(--mud-palette-text-secondary); }
.trh-goto-key:empty { visibility: hidden; }   /* past 9: no key, the names still line up */
.trh--phone .trh-goto-key { display: none; }
.trh-goto-name { flex: 1 1 auto; white-space: nowrap; }
.trh-goto-tag { flex: 0 0 auto; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--mud-palette-text-secondary); }
.trh-goto-opt.is-on .trh-goto-tag { color: var(--mud-palette-primary); }
.trh-goto-opt.is-pulse .trh-goto-tag { color: var(--mud-palette-success); }
.trh--phone .trh-gear { flex: 0 0 auto; margin-left: 0; }
.trh-steps-list:focus-visible { outline: none; }   /* a scroller is not a control: no stray ring */
.trh-chip {
    flex: 0 0 auto;
    min-height: 40px;
    padding: .35rem .85rem;
    border-radius: 999px;
    border: 1px solid var(--mud-palette-divider);
    background: var(--trh-panel);
    color: var(--mud-palette-text-primary);
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--mud-elevation-2);
}
.trh-chip:hover { border-color: var(--mud-palette-primary); }
.trh-chip.is-on { background: var(--mud-palette-primary); color: var(--mud-palette-primary-text); border-color: var(--mud-palette-primary); }
.trh-chip.is-pulse { border-color: var(--mud-palette-primary); }
.trh-walk { margin-left: auto; }

.trh-side {
    position: absolute;
    left: .5rem;
    top: 3.6rem;
    bottom: 8.6rem;
    width: 17.5rem;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    pointer-events: none;
}
.trh--phone .trh-side { left: .5rem; right: 0; width: auto; top: 3.4rem; bottom: auto; overflow: visible; }

.trh-steps {
    pointer-events: auto;
    background: var(--trh-panel);
    border: 1px solid var(--mud-palette-divider);
    border-radius: 10px;
    box-shadow: var(--mud-elevation-3);
    padding: .4rem .65rem;
    overflow: auto;
    min-height: 0;
}
.trh-steps.is-hidden .trh-steps-list { display: none; }
.trh-steps-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.trh-steps-title { background: none; border: 0; padding: .25rem .1rem; min-height: 32px; color: inherit; font-weight: 700; cursor: pointer; }
.trh-steps-title::after { content: ' \25BE'; font-size: .8em; color: var(--mud-palette-text-secondary); }
.trh-steps.is-hidden .trh-steps-title::after { content: ' \25B8'; }
.trh-link { background: none; border: 0; color: var(--mud-palette-primary); cursor: pointer; padding: .25rem .2rem; min-height: 32px; font-weight: 600; }
.trh-link.is-ask { padding: .2rem .8rem; border: 1px solid var(--mud-palette-primary); border-radius: 999px; }   /* 1197: Practice's Hint */
.trh-steps-list { list-style: none; margin: .35rem 0 0; padding: 0; display: grid; gap: .3rem; }
.trh-step-row { display: grid; grid-template-columns: 1.6rem 1fr; gap: .4rem; align-items: start; line-height: 1.25; }
.trh-step-mark {
    display: inline-grid;
    place-items: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    font-size: .75rem;
    font-weight: 700;
    background: rgba(var(--mud-palette-text-primary-rgb), .08);
    position: relative;
}
/* 1895: a modifier's mark on the bubble, as the kiosk card draws it ("+" added the step, a dot changed it), in its group's colour */
.trh-modmark { position: absolute; right: -5px; top: -5px; display: grid; place-items: center; width: 12px; height: 12px; border-radius: 50%;
    background: var(--mod-c); box-shadow: 0 0 0 2px var(--mud-palette-surface); }
.trh-modmark--added { border-radius: 3px; }
.trh-modmark--added::before { content: "+"; font-size: 11px; font-weight: 900; line-height: 1; color: rgb(var(--kiosk-brand-ink-rgb)); }
.trh-modmark--changed::before { content: ""; width: 4px; height: 4px; border-radius: 50%; background: rgb(var(--kiosk-brand-ink-rgb)); }
.trh-step-row.is-done .trh-step-mark { background: var(--mud-palette-success); color: var(--mud-palette-success-text); }
.trh-step-row.is-wrong .trh-step-mark { background: var(--mud-palette-warning); color: var(--mud-palette-warning-text); }
.trh-step-row.is-next .trh-step-mark { background: var(--mud-palette-primary); color: var(--mud-palette-primary-text); }
.trh-step-row.is-next .trh-step-text > span { font-weight: 700; }
.trh-step-row.is-done .trh-step-text > span { color: var(--mud-palette-text-secondary); }
.trh-step-text small { display: block; color: var(--mud-palette-warning-darken); font-weight: 600; }
/* 1537: the recap's flow bonus (steps done while their machine ran) */
.trh-fix-flow { display: flex; gap: .5rem; align-items: baseline; margin: .25rem 0 .5rem; padding: .35rem .6rem; border-radius: 8px;
    background: rgba(var(--mud-palette-success-rgb), .12); color: var(--mud-palette-text-primary); }
.trh-fix-flow b { color: var(--mud-palette-success); white-space: nowrap; }
/* 1537 (owner 10/21): a step that runs alongside an earlier machine step sits indented under it, a level per nested machine, with a
   smaller bubble and a gold bracket down its gutter (the Build card's "any order" look); "while the milk steams (step 2)" is its tooltip */
.trh-step-row.is-par { position: relative; margin-left: calc(var(--par-level, 1) * .8rem); grid-template-columns: 1.2rem 1fr; }
.trh-step-row.is-par .trh-step-mark { width: 1.1rem; height: 1.1rem; margin-top: .1rem; font-size: .62rem; }
.trh-step-row.is-par::before, .trh-step-row.is-par::after { content: ""; position: absolute; top: -.3rem; bottom: 0; pointer-events: none; }
.trh-step-row.is-par::before { left: -.45rem; width: .3rem; border-left: 2px solid var(--mud-palette-warning); }
.trh-step-row.is-par.is-par-end::before { bottom: auto; height: calc(.3rem + .55rem); border-bottom: 2px solid var(--mud-palette-warning); border-bottom-left-radius: .3rem; }
/* the outer levels' brackets run on past a nested row: one line per level, .8rem apart */
.trh-step-row.is-par::after { left: calc(-.45rem - (var(--par-level, 1) - 1) * .8rem); width: calc((var(--par-level, 1) - 1) * .8rem);
    background: repeating-linear-gradient(90deg, var(--mud-palette-warning) 0 2px, transparent 2px .8rem); }
.trh--phone .trh-steps {   /* top-left pill; the ticket peeks from the right edge */
    position: absolute;
    left: 0;
    top: 0;
    width: min(80vw, 18rem);
    max-height: 45vh;
}
.trh--phone .trh-steps.is-hidden { width: auto; padding: .15rem .5rem; }

/* bottom status line: what is in hand (Put down always reachable) and the next step */
.trh-bottom {
    position: absolute;
    left: 18.5rem;
    right: .5rem;
    bottom: .5rem;
}
.trh--phone .trh-bottom { left: .5rem; padding-bottom: env(safe-area-inset-bottom); }
.trh-status {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem .75rem;
    align-items: center;
    padding: .35rem .5rem;
    border-radius: 12px;
    background: var(--trh-panel);
    border: 1px solid var(--mud-palette-divider);
    box-shadow: var(--mud-elevation-3);
    min-height: 3.1rem;
}
.trh-held { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.trh-held-chip {
    display: inline-flex;
    gap: .5rem;
    align-items: center;
    min-height: 44px;
    padding: .3rem .7rem;
    border-radius: 10px;
    border: 1px solid var(--mud-palette-divider);
    background: var(--mud-palette-surface);
    color: var(--mud-palette-text-primary);
    text-align: left;
    cursor: pointer;
}
.trh-held-empty { padding: 0 .35rem; color: var(--mud-palette-text-secondary); font-size: .85rem; font-weight: 600; }
.trh-held-text { display: grid; line-height: 1.2; }
.trh-held-detail { font-size: .8rem; color: var(--mud-palette-text-secondary); }
.trh-swatch { width: 1.1rem; height: 1.1rem; border-radius: 50%; border: 1px solid rgba(var(--mud-palette-text-primary-rgb), .3); flex: 0 0 auto; }
.trh-prompt { flex: 1 1 16rem; margin: 0; font-weight: 600; line-height: 1.3; }
.trh-prompt::before { content: 'Next: '; color: var(--mud-palette-primary); font-weight: 700; }
.trh-btn {
    min-height: 44px;
    min-width: 44px;
    padding: .4rem .9rem;
    border-radius: 10px;
    border: 1px solid var(--mud-palette-divider);
    background: var(--mud-palette-surface);
    color: var(--mud-palette-text-primary);
    font-weight: 600;
    cursor: pointer;
    white-space: pre;
}
.trh-btn:hover { border-color: var(--mud-palette-primary); }
.trh-btn--ghost { background: var(--trh-panel); }
.trh-btn--put { border: 2px solid var(--mud-palette-primary); color: var(--mud-palette-primary); font-weight: 700; }
.trh-btn.is-off { border-style: dashed; color: var(--mud-palette-text-secondary); background: var(--trh-panel); cursor: help; }
.trh-go { background: var(--mud-palette-primary); color: var(--mud-palette-primary-text); border-color: var(--mud-palette-primary); min-width: 5rem; }
.trh-go:hover { background: var(--mud-palette-primary-darken); }
.is-pulse { animation: trh-pulse 1.4s ease-in-out infinite; }
@keyframes trh-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(var(--mud-palette-primary-rgb), .55); }
    50% { box-shadow: 0 0 0 7px rgba(var(--mud-palette-primary-rgb), 0); }
}

/* two hands (1212): left and right slots, the active one outlined and labelled; tap a slot to make it active */
.trh-hands { display: flex; gap: .35rem; }
.trh-hand {
    position: relative;
    display: inline-flex;
    gap: .45rem;
    align-items: center;
    min-height: 48px;
    min-width: 7.5rem;
    max-width: 14rem;
    padding: .3rem .6rem .3rem .35rem;
    border-radius: 10px;
    border: 2px solid var(--mud-palette-divider);
    background: var(--mud-palette-surface);
    color: var(--mud-palette-text-primary);
    text-align: left;
    cursor: pointer;
}
.trh-hand.is-empty { border-style: dashed; color: var(--mud-palette-text-secondary); }
.trh-hand.is-active { border-color: var(--mud-palette-primary); box-shadow: 0 0 0 2px rgba(var(--mud-palette-primary-rgb), .35); }
.trh-hand-tag { flex: 0 0 auto; display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: 50%; font-size: .72rem; font-weight: 800; background: rgba(var(--mud-palette-text-primary-rgb), .1); }
.trh-hand.is-active .trh-hand-tag { background: var(--mud-palette-primary); color: var(--mud-palette-primary-text); }
.trh-hand .trh-held-text { min-width: 0; grid-template-columns: minmax(0, 1fr); }
.trh-hand .trh-held-text strong, .trh-hand .trh-held-detail { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trh-hand-active { position: absolute; right: 6px; top: -9px; padding: 0 .35rem; border-radius: 6px; background: var(--mud-palette-primary); color: var(--mud-palette-primary-text); font-size: .62rem; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; }
.trh--phone .trh-hand { min-height: 44px; min-width: 0; flex: 1 1 0; max-width: none; padding: .2rem .45rem .2rem .25rem; }
.trh--phone .trh-hands { flex: 1 1 100%; }
/* the acting hand (1212): the strip mirrors the glowing arm, and a caption rides that hand */
.trh-hand.is-glow { border-color: var(--mud-palette-warning); box-shadow: 0 0 0 3px rgba(var(--mud-palette-warning-rgb), .55); animation: trh-hand-glow 1.5s ease-in-out infinite; }
.trh-hand.is-dim { opacity: .6; }
@keyframes trh-hand-glow { 50% { box-shadow: 0 0 0 6px rgba(var(--mud-palette-warning-rgb), .22); } }
/* gloves (1638): a badge left of the hands while they are on (amber when they need changing, "Gloves off" fading out), and a one-time callout over the hands */
.trh-glove {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    min-height: 2.1rem;
    padding: .15rem .65rem .15rem .4rem;
    border-radius: 999px;
    border: 2px solid var(--mud-palette-info);
    background: rgba(var(--mud-palette-info-rgb), .14);
    color: var(--mud-palette-text-primary);
    font-size: .8rem;
    font-weight: 800;
    white-space: nowrap;
}
.trh-glove[hidden] { display: none; }
.trh-glove-icon { flex: 0 0 auto; width: 1.3rem; height: 1.3rem; color: var(--mud-palette-info); }
.trh-glove--change { border-color: var(--mud-palette-warning); background: rgba(var(--mud-palette-warning-rgb), .22); }
.trh-glove--change .trh-glove-icon { color: var(--mud-palette-warning); }
.trh-glove--off { border-style: dashed; border-color: var(--mud-palette-divider); background: transparent; color: var(--mud-palette-text-secondary); }
.trh-glove--off .trh-glove-icon { color: var(--mud-palette-text-secondary); }
.trh-glove.is-pop { animation: trh-glove-pop .45s ease-out; }
.trh-glove--off.is-pop { animation: trh-glove-out 1.8s ease-in forwards; }
@keyframes trh-glove-pop { 0% { transform: scale(.6); opacity: 0; } 60% { transform: scale(1.15); opacity: 1; } 100% { transform: scale(1); } }
@keyframes trh-glove-out { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }
.trh-glove-call {
    position: absolute;
    left: 50%;
    bottom: 6.5rem;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .5rem 1.15rem .5rem .8rem;
    border-radius: 999px;
    background: var(--mud-palette-info);
    color: var(--mud-palette-info-text);
    font-size: 1.15rem;
    font-weight: 800;
    box-shadow: var(--mud-elevation-6);
    opacity: 0;
    transform: translateX(-50%);
    pointer-events: none;
}
.trh-glove-call .trh-glove-icon { width: 1.8rem; height: 1.8rem; color: inherit; }
.trh-glove-call.is-on { animation: trh-glove-call 1.7s ease-out forwards; }
@keyframes trh-glove-call {
    0% { opacity: 0; transform: translate(-50%, 12px) scale(.7); }
    14% { opacity: 1; transform: translate(-50%, 0) scale(1.08); }
    24% { transform: translate(-50%, 0) scale(1); }
    78% { opacity: 1; }
    100% { opacity: 0; transform: translate(-50%, -8px) scale(1); }
}
.trh-intent {
    position: absolute; left: 0; top: 0; z-index: 3; display: none; visibility: hidden; max-width: min(15rem, 62vw);
    padding: .3rem .7rem; border-radius: 14px; background: var(--trh-panel); border: 2px solid var(--mud-palette-warning);
    color: var(--mud-palette-text-primary); font-size: .85rem; font-weight: 700; line-height: 1.25; text-align: center; box-shadow: var(--mud-elevation-3); pointer-events: none;
}
.trh-intent.is-on { display: block; }
.trh-intent.is-on.is-ok { visibility: visible; }
.trh-intent.is-swap { border-style: dashed; }

/* the tool rail: always on the right; a grey tool says why (tap it for the reason) */
.trh-rail { position: absolute; right: .5rem; top: 50%; z-index: 2; display: flex; flex-direction: column; gap: .5rem; transform: translateY(-50%); pointer-events: none; }
.trh-rail-btn {
    display: grid;
    justify-items: center;
    align-content: center;
    gap: .1rem;
    width: 5.8rem;
    min-height: 4.1rem;
    padding: .35rem .3rem;
    border-radius: 14px;
    border: 2px solid var(--mud-palette-primary);
    background: var(--mud-palette-surface);
    color: var(--mud-palette-text-primary);
    font-weight: 700;
    box-shadow: var(--mud-elevation-3);
    cursor: pointer;
    touch-action: manipulation;
}
.trh-rail-btn:hover { background: rgba(var(--mud-palette-primary-rgb), .08); }
.trh-rail-btn.is-off { border-color: var(--mud-palette-divider); border-style: dashed; color: var(--mud-palette-text-secondary); box-shadow: none; background: var(--trh-panel); cursor: help; }
.trh-rail-btn.is-big { min-height: 4.8rem; border-color: var(--mud-palette-primary); background: var(--mud-palette-primary); color: var(--mud-palette-primary-text); }
.trh-rail-btn.is-big .trh-rail-sub { color: inherit; opacity: .9; }
.trh-rail-icon { width: 1.55rem; height: 1.55rem; }
.trh-rail-label { font-size: .95rem; line-height: 1.1; text-align: center; }
.trh-rail-label kbd { margin-left: .3rem; padding: 0 .25rem; border-radius: 4px; font: 600 .66rem ui-monospace, Consolas, monospace; background: rgba(var(--mud-palette-text-primary-rgb), .12); }
.trh-rail-sub { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 100%; font-size: .66rem; font-weight: 600; line-height: 1.2; text-align: center; color: var(--mud-palette-text-secondary); }
.trh--phone .trh-rail { top: auto; bottom: 6rem; right: .4rem; transform: none; gap: .4rem; }
.trh--phone .trh-rail-btn { width: 4.3rem; min-height: 3.7rem; padding: .3rem .2rem; border-radius: 12px; }
.trh--phone .trh-rail-btn.is-big { min-height: 4.4rem; }
.trh--phone .trh-rail-sub { display: none; }
.trh--phone .trh-rail-label { font-size: .8rem; }
.trh--phone .trh-rail-icon { width: 1.5rem; height: 1.5rem; }
.trh--phone .trh-cluster { max-width: calc(100% - 6rem); }   /* the rail stays reachable beside a cluster or the sheet */
.trh--phone .trh-cluster.is-sheet { right: 5.2rem; }

/* an impossible move (ice into a pitcher): a red ring on the thing and the reason, about 1.5 s */
.trh-bad { position: absolute; left: 0; top: 0; z-index: 4; display: none; border: 5px solid var(--mud-palette-error); border-radius: 50%; box-shadow: 0 0 0 4px rgba(var(--mud-palette-error-rgb), .28); pointer-events: none; }
.trh-bad.is-on { display: block; animation: trh-bad 0.5s ease-in-out 3; }
@keyframes trh-bad { 50% { box-shadow: 0 0 0 9px rgba(var(--mud-palette-error-rgb), .12); } }
.trh-bad-msg {
    position: absolute;
    left: 50%;
    top: 6.6rem;
    z-index: 5;
    display: none;
    max-width: min(90%, 22rem);
    padding: .45rem .75rem;
    border-radius: 10px;
    background: var(--mud-palette-error);
    color: var(--mud-palette-error-text);
    font-weight: 700;
    line-height: 1.3;
    box-shadow: var(--mud-elevation-6);
    transform: translateX(-50%);
    pointer-events: none;
}
.trh-bad-msg.is-on { display: block; }
.trh-bad.is-hint { border-color: var(--mud-palette-success); box-shadow: 0 0 0 4px rgba(var(--mud-palette-success-rgb), .3); }
.trh-bad.is-hint.is-on { animation: trh-hint-ring 0.6s ease-in-out 5; }
@keyframes trh-hint-ring { 50% { box-shadow: 0 0 0 10px rgba(var(--mud-palette-success-rgb), .12); } }
.trh-bad-msg.is-hint { background: var(--mud-palette-success); color: var(--mud-palette-success-text); }
.trh-bad-msg.is-anchored { left: 0; top: 0; }

/* floating action cluster: anchored beside the engaged object; a centred sheet on phones near the edges */
.trh-cluster {
    position: absolute;
    left: 0;
    top: 0;
    z-index: 3;
    display: none;
    width: max-content;
    max-width: min(27rem, calc(100% - 1rem));
    max-height: calc(100% - 9rem);
    overflow: auto;
    padding: .75rem .85rem;
    border-radius: 16px;
    border: 2px solid var(--mud-palette-primary);
    background: var(--mud-palette-surface);
    box-shadow: var(--mud-elevation-8);
    pointer-events: auto;
}
.trh-cluster.is-on { display: block; }
.trh-cluster.is-sheet { left: .5rem; right: .5rem; top: auto; bottom: 4.4rem; width: auto; max-width: none; transform: none; }
.trh-cl-head { display: grid; gap: .1rem; margin-bottom: .5rem; padding-right: .25rem; }
.trh-cl-title { font-size: 1.05rem; line-height: 1.25; }
.trh-cl-subtitle { font-size: .8rem; color: var(--mud-palette-text-secondary); }
.trh-cl-why { margin: 0 0 .25rem; color: var(--mud-palette-text-secondary); font-weight: 600; max-width: 22rem; }
.trh-cl-group + .trh-cl-group { margin-top: .55rem; }
.trh-cl-group-label { display: block; margin-bottom: .25rem; font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--mud-palette-text-secondary); }
.trh-cl-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.trh-cl-btn {
    display: inline-grid;
    align-content: center;
    justify-items: center;
    gap: .1rem;
    min-width: 56px;
    min-height: 56px;
    padding: .5rem 1rem;
    border-radius: 12px;
    border: 1px solid var(--mud-palette-divider);
    background: var(--mud-palette-surface);
    color: var(--mud-palette-text-primary);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.15;
    cursor: pointer;
    touch-action: manipulation;
}
.trh--phone .trh-cl-btn { min-height: 48px; }
.trh-cl-btn:hover { border-color: var(--mud-palette-primary); }
.trh-cl-btn:disabled { opacity: .5; cursor: default; }
.trh-cl-btn.is-primary, .trh-cl-btn--count {
    min-height: 64px;
    padding: .6rem 1.35rem;
    border-color: var(--mud-palette-primary);
    background: var(--mud-palette-primary);
    color: var(--mud-palette-primary-text);
    font-size: 1.15rem;
}
.trh-cl-btn.is-primary:hover, .trh-cl-btn--count:hover { background: var(--mud-palette-primary-darken); }
.trh-cl-btn.is-right { box-shadow: 0 0 0 3px var(--mud-palette-success); }
.trh-cl-sub { font-size: .75rem; font-weight: 600; opacity: .85; }
.trh-btn kbd { padding: 0 .25rem; border-radius: 4px; font: 600 .66rem ui-monospace, Consolas, monospace; background: rgba(var(--mud-palette-text-primary-rgb), .12); }
.trh-cl-btn kbd { margin-left: .4rem; padding: 0 .3rem; border-radius: 4px; font: 600 .7rem ui-monospace, Consolas, monospace; background: rgba(var(--mud-palette-text-primary-rgb), .1); }
.trh-cl-btn--count { grid-template-columns: auto auto; column-gap: .8rem; justify-items: start; min-width: 12rem; }
.trh--desktop .trh-cl-btn--count { min-height: 76px; }
.trh-count-wrap { position: relative; width: 52px; height: 52px; grid-row: span 2; }
.trh-ring { position: absolute; inset: 0; transform: rotate(-90deg); }
.trh-ring-bg, .trh-ring-fg { fill: none; stroke: currentColor; stroke-width: 5; }
.trh-ring-bg { opacity: .25; }
.trh-ring-fg { stroke-linecap: round; transition: stroke-dashoffset .2s; }
.trh-count { position: absolute; inset: 0; display: grid; place-items: center; font-size: 1.4rem; font-weight: 800; }
.trh-goal { font-size: .8rem; font-weight: 600; opacity: .92; }
.trh-cl-btn--count.is-met { box-shadow: 0 0 0 3px var(--mud-palette-success); }
.trh-cl-btn--count.is-over { border-color: var(--mud-palette-warning); background: var(--mud-palette-warning); color: var(--mud-palette-warning-text); }
.trh-cl-note { margin: .55rem 0 0; padding: .35rem .55rem; border-radius: 8px; background: rgba(var(--mud-palette-warning-rgb), .2); font-size: .85rem; font-weight: 600; }
.trh-cl-foot { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: flex-end; margin-top: .65rem; padding-top: .55rem; border-top: 1px solid var(--mud-palette-divider); }
.trh-cl-btn--foot { min-height: 44px; padding: .35rem .9rem; font-size: .9rem; font-weight: 600; }
.trh-cl-btn--foot.trh-cl-foot-done { border-color: var(--mud-palette-success); background: var(--mud-palette-success); color: var(--mud-palette-success-text); font-weight: 700; }
.trh-cl-btn--foot.trh-cl-foot-put { border: 2px solid var(--mud-palette-primary); color: var(--mud-palette-primary); font-weight: 700; }
.trh.is-busy .trh-cluster .trh-cl-btn:not(.trh-cl-btn--count) { opacity: .55; pointer-events: none; }

/* a counted popup: one running total on top, green at the target, amber over it */
.trh-cl-total { margin: 0 0 .4rem; padding: .25rem .6rem; border-radius: 8px; background: rgba(var(--mud-palette-text-primary-rgb), .06); font-size: .95rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.trh-cl-total-n { font-size: 1.35rem; font-weight: 800; }
.trh-cl-total.is-met { background: rgba(var(--mud-palette-success-rgb), .22); box-shadow: inset 0 0 0 2px var(--mud-palette-success); }
.trh-cl-total.is-over { background: var(--mud-palette-warning); color: var(--mud-palette-warning-text); }
.trh-cl-btn--tally { min-width: 7.5rem; min-height: 56px; font-size: 1.05rem; font-weight: 700; }

/* a secondary press beside a counted one (the half pump) */
.trh-cl-btn.is-small { align-self: center; min-width: 0; min-height: 44px; padding: .3rem .75rem; font-size: .9rem; }

/* an open popup owns the screen: no hover caption over it */
.trh.has-cluster .trh-intent, .trh.has-cluster .trh-tip { display: none; }
@keyframes trh-shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.trh-finger { position: relative; flex: 0 0 auto; display: inline-block; width: 1.1rem; height: 1.1rem; margin-right: .35rem; vertical-align: -.2rem; border-radius: 50% 50% 45% 45%; background: var(--mud-palette-text-primary); animation: trh-press 1.4s ease-in-out infinite; }
@keyframes trh-press { 0%, 100% { transform: translateY(-4px); opacity: .55; } 40%, 70% { transform: translateY(2px); opacity: 1; } }

/* the pour gauge IS the pour control (1196): press and hold anywhere on it; fixed centre-right beside the rail (game sets top/height),
   clear of the hand strip, the rail and the ticket; the band only in hint modes */
.trh-gauge {
    position: absolute; right: 7.4rem; top: 4rem; z-index: 3; display: none; flex-direction: column; gap: .3rem;
    width: 12rem; height: 30rem; padding: .5rem .6rem .6rem; border-radius: 16px; overflow: hidden;
    border: 2px solid var(--mud-palette-primary); background: var(--mud-palette-surface); box-shadow: var(--mud-elevation-8);
    color: var(--mud-palette-text-primary); pointer-events: auto; cursor: pointer;
    touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.trh-gauge.is-on { display: flex; }
.trh-gauge.is-held { border-color: var(--mud-palette-primary-darken); box-shadow: 0 0 0 4px rgba(var(--mud-palette-primary-rgb), .35), var(--mud-elevation-8); }
.trh-gauge.is-shake { animation: trh-shake .35s linear 1; }
.trh-gauge-head { display: flex; align-items: flex-start; gap: .3rem; }
.trh-gauge-title { flex: 1 1 auto; min-width: 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; font-size: .82rem; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.trh-gauge-x { flex: 0 0 auto; display: inline-grid; place-items: center; width: 30px; height: 30px; margin: -.15rem -.2rem 0 0; padding: 0; border: 1px solid var(--mud-palette-divider); border-radius: 50%; background: var(--trh-panel); color: var(--mud-palette-text-secondary); font-size: .85rem; font-weight: 700; line-height: 1; cursor: pointer; }
.trh-gauge-x:hover { border-color: var(--mud-palette-primary); color: var(--mud-palette-text-primary); }
.trh-gauge-pad { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: .4rem; border-radius: 10px; outline: none; }
.trh-gauge-pad:focus-visible { box-shadow: 0 0 0 3px rgba(var(--mud-palette-primary-rgb), .5); }
.trh-gauge-oz { font-size: 1.7rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.trh-gauge-bar { position: relative; flex: 1 1 auto; min-height: 4rem; width: 3.8rem; border-radius: 10px; border: 2px solid var(--mud-palette-divider); background: rgba(var(--mud-palette-text-primary-rgb), .05); }
/* owner 10/6: say how to use it, along the bar itself */
.trh-gauge-bar::before { content: 'CLICK AND HOLD'; position: absolute; inset: 0; z-index: 1; display: grid; place-items: center; writing-mode: vertical-rl; transform: rotate(180deg); font-size: 1rem; font-weight: 900; letter-spacing: .2em; white-space: nowrap; color: var(--mud-palette-primary); opacity: 1; text-shadow: 0 0 2px var(--mud-palette-surface); pointer-events: none; }
.trh-gauge.is-auto .trh-gauge-bar::before { content: 'TAP TO POUR'; }   /* 1364: one press pours to the band */
.trh-gauge.is-auto.is-flow .trh-gauge-bar::before { content: 'TAP TO STOP'; }
@media (pointer: coarse) { .trh-gauge-bar::before { content: 'PRESS AND HOLD'; } }
.trh-gauge.is-held .trh-gauge-bar::before { opacity: .3; }
.trh-gauge-fill { position: absolute; left: 0; right: 0; bottom: 0; border-radius: 0 0 8px 8px; background: var(--mud-palette-info, var(--mud-palette-primary)); opacity: .85; }
.trh-gauge.is-over .trh-gauge-fill { background: var(--mud-palette-error); }
.trh-gauge-band { position: absolute; left: -5px; right: -5px; border-radius: 4px; background: rgba(var(--mud-palette-success-rgb), .35); box-shadow: 0 0 0 2px var(--mud-palette-success); animation: trh-glow 1s ease-in-out infinite; }
.trh-gauge-band[hidden] { display: none; }
@keyframes trh-glow { 50% { box-shadow: 0 0 0 4px rgba(var(--mud-palette-success-rgb), .45); } }
.trh-gauge-ticks { position: absolute; inset: 0; pointer-events: none; }
.trh-gauge-tick { position: absolute; left: -5px; width: calc(100% + 10px); height: 0; border-top: 2px solid var(--mud-palette-error); }
.trh-gauge-tick > span { position: absolute; left: calc(100% + .3rem); top: 0; transform: translateY(-55%); font-size: .74rem; font-weight: 600; line-height: 1.1; white-space: nowrap; color: var(--mud-palette-text-secondary); }
.trh-gauge-tick.is-target > span { color: var(--mud-palette-text-primary); font-weight: 800; }
.trh-gauge-tick.is-quiet > span { display: none; }
.trh-gauge-say { margin: 0; min-height: 2.4em; font-size: .88rem; font-weight: 700; line-height: 1.2; }
.trh-gauge-say kbd { padding: 0 .3rem; border-radius: 4px; font: 600 .7rem ui-monospace, Consolas, monospace; background: rgba(var(--mud-palette-text-primary-rgb), .1); }
.trh-gauge.is-release { border-color: var(--mud-palette-success); }
.trh-gauge.is-release .trh-gauge-say { color: var(--mud-palette-success-darken, var(--mud-palette-success)); font-size: 1.15rem; font-weight: 800; }
.trh-gauge.is-met { border-color: var(--mud-palette-success); }
.trh-gauge.is-met .trh-gauge-say { color: var(--mud-palette-success-darken, var(--mud-palette-success)); }
.trh-gauge.is-under .trh-gauge-say, .trh-gauge.is-dry .trh-gauge-say { color: var(--mud-palette-warning-darken, var(--mud-palette-warning)); }
.trh-gauge.is-over { border-color: var(--mud-palette-error); }
.trh-gauge.is-over .trh-gauge-say { color: var(--mud-palette-error); }
.trh--phone .trh-gauge { left: .4rem; right: auto; width: 7.8rem; padding: .4rem .45rem .5rem; gap: .25rem; border-radius: 14px; }
.trh--phone .trh-gauge-title { font-size: .7rem; }
.trh--phone .trh-gauge-oz { font-size: 1.3rem; }
.trh--phone .trh-gauge-bar { width: 2.5rem; }
.trh--phone .trh-gauge-bar::before { font-size: .78rem; letter-spacing: .14em; }
.trh--phone .trh-gauge-tick > span { font-size: .62rem; }
.trh--phone .trh-gauge-say { font-size: .74rem; }
.trh--phone .trh-gauge.is-release .trh-gauge-say { font-size: .95rem; }
/* phones with the gauge up (left column): the ticket tucks behind its peek, the steps list folds to its header, and the
   gauge title stands in for the hand caption */
.trh--phone:is(.has-gauge, .has-dock) .trk--phone.is-in { transform: translateX(calc(100% + 1rem)); }
.trh--phone:is(.has-gauge, .has-dock) .trk-peek.is-in { opacity: 1; pointer-events: auto; }
.trh--phone:is(.has-gauge, .has-dock) .trh-steps-list { display: none; }
.trh--phone:is(.has-gauge, .has-dock) .trh-steps { width: auto; }
.trh--phone.has-gauge .trh-intent, .trh.has-dock .trh-intent { display: none; }
.trh.is-demo .trh-gauge { pointer-events: none; }

/* the docked count (1229): pumps and scoops sit in the gauge's slot (game sets top / right), off the action. Short title, a big
   live count (the target only in hint modes), big taps; a pop per tap, a green hit at the target, amber over it */
.trh-cluster.is-dock { left: auto; width: 12rem; max-width: none; padding: .5rem .6rem .6rem; transform: none; }
.trh-cluster.is-dock.is-on { display: flex; flex-direction: column; gap: .45rem; }
.trh-dock-head { display: flex; align-items: center; gap: .4rem; }
.trh-dock-ico { flex: none; display: grid; place-items: center; width: 2.3rem; height: 2.3rem; border-radius: 50%; background: var(--mud-palette-primary); color: var(--mud-palette-primary-text); }
.trh-dock-ico svg { width: 1.5rem; height: 1.5rem; }
.trh-cluster.is-dock.is-arrive { animation: trh-dock-arrive .7s ease-out 2; }
@keyframes trh-dock-arrive { 0% { box-shadow: 0 0 0 0 rgba(var(--mud-palette-primary-rgb), .6); } 100% { box-shadow: 0 0 0 16px rgba(var(--mud-palette-primary-rgb), 0); } }
.trh-dock-title { flex: 1 1 auto; min-width: 0; font-size: .9rem; font-weight: 800; line-height: 1.2; overflow-wrap: anywhere; }
.trh-dock-count { display: grid; justify-items: center; padding: .4rem .3rem .3rem; border-radius: 12px; background: rgba(var(--mud-palette-text-primary-rgb), .06); font-variant-numeric: tabular-nums; }
.trh-dock-big { display: flex; align-items: baseline; gap: .3rem; line-height: 1; }
.trh-dock-n { display: inline-block; font-size: 2.6rem; font-weight: 900; }
.trh-dock-of { font-size: 1.45rem; font-weight: 800; color: var(--mud-palette-text-secondary); }
.trh-dock-of:empty { display: none; }
.trh-dock-word { font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--mud-palette-text-secondary); }
.trh-dock-count.is-pop .trh-dock-n { animation: trh-count-pop .26s ease-out; }
@keyframes trh-count-pop { 40% { transform: scale(1.32); } }
.trh-cluster.is-dock.is-met { border-color: var(--mud-palette-success); }
.trh-cluster.is-dock.is-met .trh-dock-count { background: rgba(var(--mud-palette-success-rgb), .2); box-shadow: inset 0 0 0 2px var(--mud-palette-success); }
.trh-cluster.is-dock.is-met .trh-dock-big::after { content: '\2713'; align-self: center; font-size: 1.35rem; font-weight: 900; color: var(--mud-palette-success); }
.trh-cluster.is-dock.is-hit { animation: trh-hit .6s ease-out; }
@keyframes trh-hit { 0% { box-shadow: 0 0 0 0 rgba(var(--mud-palette-success-rgb), .75); } 100% { box-shadow: 0 0 0 18px rgba(var(--mud-palette-success-rgb), 0); } }
.trh-cluster.is-dock.is-over { border-color: var(--mud-palette-warning); }
.trh-cluster.is-dock.is-over .trh-dock-count { background: var(--mud-palette-warning); color: var(--mud-palette-warning-text); }
.trh-cluster.is-dock.is-over :is(.trh-dock-of, .trh-dock-word) { color: inherit; }
.trh-dock-taps { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
.trh-dock-taps > :first-child { grid-column: 1 / -1; }
.trh-dock-taps .trh-cl-btn { min-width: 0; min-height: 60px; padding: .3rem .25rem; border-radius: 14px; border: 2px solid var(--mud-palette-primary); background: var(--mud-palette-surface); color: var(--mud-palette-primary); }
.trh-dock-taps .trh-cl-btn:active:not(:disabled) { transform: scale(.94); }
.trh-dock-taps > .trh-dock-tap:first-child { min-height: 72px; background: var(--mud-palette-primary); color: var(--mud-palette-primary-text); }
.trh-dock-taps > .trh-dock-tap:first-child:hover { background: var(--mud-palette-primary-darken); }
.trh-dock-tap .trh-cl-label { font-size: 1.6rem; font-weight: 900; line-height: 1; }
.trh-dock-tap .trh-cl-sub { font-size: .7rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; opacity: .9; }
.trh-dock-taps .trh-dock-undo { min-height: 60px; border-color: var(--mud-palette-divider); color: var(--mud-palette-text-secondary); }
.trh-dock-undo .trh-cl-label { font-size: 1.4rem; font-weight: 800; line-height: 1; }
.trh-dock-taps .trh-cl-btn kbd { margin: 0; padding: 0 .25rem; font-size: .62rem; line-height: 1.3; }
.trh-dock-undo .trh-cl-sub { font-size: .66rem; font-weight: 700; text-transform: uppercase; }
.trh-cluster.is-dock .trh-cl-note { margin: 0; padding: .3rem .45rem; font-size: .78rem; line-height: 1.25; }
.trh--phone .trh-cluster.is-dock { left: .4rem; right: auto; width: 7.8rem; padding: .4rem .45rem .5rem; gap: .35rem; border-radius: 14px; }
.trh--phone .trh-dock-title { font-size: .74rem; }
.trh--phone .trh-dock-n { font-size: 2rem; }
.trh--phone .trh-dock-of { font-size: 1.15rem; }
.trh--phone .trh-dock-word { font-size: .62rem; }
.trh--phone .trh-dock-taps { gap: .3rem; }
.trh--phone .trh-dock-taps .trh-cl-btn { min-height: 52px; }
.trh--phone .trh-dock-taps > .trh-dock-tap:first-child { min-height: 60px; }
.trh--phone .trh-dock-tap .trh-cl-label { font-size: 1.3rem; }
.trh--phone .trh-dock-tap .trh-cl-sub, .trh--phone .trh-dock-undo .trh-cl-sub { font-size: .58rem; }
.trh--phone .trh-cluster.is-dock .trh-cl-note { font-size: .68rem; }

/* 1309: a ticket's first move cuts to its stand behind a quick fade */
.trh-fade { position: absolute; inset: 0; background: var(--mud-palette-black); opacity: 0; pointer-events: none; }
.trh-fade.is-on { animation: trh-fade .22s ease-out; }
@keyframes trh-fade { from { opacity: .85; } to { opacity: 0; } }

/* 1309: an Egro or a Blendtec docks in the same slot: one status line, the shots count, ONE big next action, small tiles for the rest */
.trh-cluster.is-dock.is-machine { width: 13.5rem; }
.trh-mc-say { margin: -.15rem 0 0; font-size: .76rem; font-weight: 700; line-height: 1.25; color: var(--mud-palette-text-secondary); overflow-wrap: anywhere; }
.trh-mc-say.is-why { color: var(--mud-palette-text-primary); }
.trh-cluster.is-machine .trh-cl-btn { min-width: 0; min-height: 48px; padding: .3rem .25rem; border-radius: 12px; font-size: .82rem; line-height: 1.1; text-align: center; overflow-wrap: anywhere; }
.trh-cluster.is-machine .trh-cl-btn:active:not(:disabled) { transform: scale(.95); }
.trh-cluster.is-machine .trh-cl-sub { font-size: .66rem; font-weight: 700; opacity: .8; }
.trh-cluster.is-machine .trh-cl-btn { position: relative; }
.trh-cluster.is-machine .trh-cl-btn kbd { position: absolute; top: 3px; right: 4px; margin: 0; padding: 0 .2rem; font-size: .58rem; line-height: 1.3; opacity: .8; }
.trh-cluster.is-machine .trh-mc-main { width: 100%; min-height: 64px; border: 2px solid var(--mud-palette-primary); background: var(--mud-palette-primary); color: var(--mud-palette-primary-text); }
.trh-cluster.is-machine .trh-mc-main:hover { background: var(--mud-palette-primary-darken); }
.trh-cluster.is-machine .trh-mc-main .trh-cl-label { font-size: 1.3rem; font-weight: 900; }
.trh-cluster.is-machine .trh-mc-main .trh-cl-sub { font-size: .72rem; letter-spacing: .04em; text-transform: uppercase; opacity: .9; }
.trh-mc-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: .35rem; }
.trh-mc-tile { border: 2px solid rgba(var(--mud-palette-primary-rgb), .55); color: var(--mud-palette-text-primary); }
.trh-mc-more { display: flex; gap: .35rem; }
.trh-mc-more .trh-cl-btn { flex: 1 1 0; min-height: 44px; font-size: .78rem; font-weight: 700; color: var(--mud-palette-text-secondary); }
.trh-cluster.is-machine .trh-cl-btn.is-pulse:not(.trh-mc-main) { border-color: var(--mud-palette-success); box-shadow: 0 0 0 2px var(--mud-palette-success); }
.trh-cluster.is-machine .trh-mc-main.is-pulse { box-shadow: 0 0 0 3px var(--mud-palette-success); }
.trh--phone .trh-cluster.is-dock.is-machine { width: 8.4rem; padding: .5rem; }
.trh--phone .trh-mc-say { font-size: .64rem; }
.trh--phone .trh-cluster.is-machine .trh-cl-btn { min-height: 44px; padding: .25rem .2rem; font-size: .74rem; }
.trh--phone .trh-cluster.is-machine .trh-mc-main { min-height: 56px; }
.trh--phone .trh-cluster.is-machine .trh-mc-main .trh-cl-label { font-size: 1.05rem; }
.trh--phone .trh-cluster.is-machine .trh-cl-sub { font-size: .56rem; }
.trh--phone .trh-mc-tiles { grid-template-columns: 1fr 1fr; gap: .25rem; }
.trh--phone .trh-mc-more { gap: .25rem; }
.trh-cluster.is-machine .trh-gauge-x { position: relative; margin: 0; }
.trh-cluster.is-machine .trh-gauge-x::after { content: ''; position: absolute; inset: -8px; }   /* a 44 px touch target round the small x */

/* open cooler door: a ring counting toward the idle limit */
.trh-door { position: absolute; left: -26px; top: -26px; z-index: 2; display: none; width: 52px; height: 52px; pointer-events: none; color: var(--mud-palette-info, var(--mud-palette-primary)); }
.trh-door.is-on { display: block; }
.trh-door svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.trh-door .trh-ring-bg { opacity: .3; }
.trh-door.is-late { color: var(--mud-palette-error); }
.trh-door-text { position: absolute; inset: 0; display: grid; place-items: center; border-radius: 50%; background: rgba(var(--mud-palette-surface-rgb), .85); margin: 7px; font-size: .78rem; font-weight: 800; color: var(--mud-palette-text-primary); }

.trh-health { flex: 0 0 auto; padding: .3rem .7rem; border-radius: 999px; background: var(--trh-panel); border: 1px solid var(--mud-palette-divider); font-weight: 700; font-size: .85rem; box-shadow: var(--mud-elevation-2); }
.trh-health.is-low { border-color: var(--mud-palette-warning); background: rgba(var(--mud-palette-warning-rgb), .25); }
/* 1349: the kiosk Demo plays itself; the play-only controls stay out of the way */
.is-demo-only .trh-goto, .is-demo-only .trh-walk, .is-demo-only .trh-health, .is-demo-only .trh-demo, .is-demo-only .trh-find, .is-demo-only .trh-gear,
.is-demo-only .trk-bump, .is-demo-only .trh-rail, .is-demo-only .trh-steps-head .trh-link { display: none !important; }
/* 1406: no key hints in the kiosk Demo (nobody is at the keys) */
.is-demo-only kbd { display: none !important; }
.trh-gear { margin-left: auto; display: inline-grid; place-items: center; min-width: 40px; padding: .35rem .55rem; }
.trh--phone .trh-steps-head .trh-link { font-size: .8rem; }
.trh--phone .trh-status { gap: .3rem .4rem; padding: .3rem .4rem; }
.trh--phone .trh-held .trh-btn { min-height: 40px; padding: .25rem .6rem; font-size: .85rem; }
.trh--phone .trh-held-chip { min-height: 40px; padding: .2rem .55rem; }
.trh--phone .trh-held-detail { font-size: .72rem; }
.trh--phone .trh-prompt { font-size: .85rem; }
/* phones with an object engaged: the sheet carries the hand actions, so the status line keeps only the prompt */
.trh--phone.has-cluster .trh-held, .trh--phone.has-cluster .trh-steps { display: none; }
.trh--phone.has-cluster .trk--phone.is-in { transform: translateX(calc(100% + 1rem)); }
.trh--phone.has-cluster .trk-peek.is-in { opacity: 1; pointer-events: auto; }
.trh--phone .trh-cluster.is-sheet .trh-cl-subtitle { display: none; }
.trh-walk + .trh-health, .trh-walk ~ .trh-gear { margin-left: 0; }
.trh-settings { position: absolute; right: .5rem; top: 3.5rem; z-index: 4; padding: .6rem .8rem; border-radius: 10px; background: var(--mud-palette-surface); border: 1px solid var(--mud-palette-divider); box-shadow: var(--mud-elevation-6); pointer-events: auto; }
.trh-setting { display: flex; gap: .5rem; align-items: center; min-height: 44px; cursor: pointer; font-weight: 600; }
.trh-setting input { width: 1.2rem; height: 1.2rem; }
.trh-layout { width: 100%; max-width: 16rem; margin-top: .2rem; padding: .45rem .7rem; border: 1px solid var(--mud-palette-divider); border-radius: 8px; background: none; color: inherit; font: inherit; font-weight: 600; text-align: left; white-space: normal; }
.trh-layout:hover { background: rgba(var(--mud-palette-primary-rgb), .08); }
.trh-layout[hidden] { display: none; }

/* next-step marker over the target, and the dot under an engaged object */
.trh-marker { position: absolute; left: 0; top: 0; z-index: 2; display: none; pointer-events: none; }
.trh-marker.is-on { display: block; }
.trh-marker-text {
    position: absolute;
    left: 0;
    bottom: 14px;
    transform: translateX(calc(-50% + var(--trh-mk-shift, 0px)));
    max-width: var(--trh-mk-max, none);
    overflow: hidden;
    text-overflow: ellipsis;
    padding: .25rem .6rem;
    border-radius: 999px;
    background: var(--mud-palette-primary);
    color: var(--mud-palette-primary-text);
    font-size: .8rem;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: var(--mud-elevation-3);
    animation: trh-bob 1.2s ease-in-out infinite;
}
/* the arrow tip is the marker's point; --trh-mk-shift slides the bubble to stay in the HUD-clear stage */
.trh-marker::after { content: ''; position: absolute; left: -7px; top: -14px; border: 7px solid transparent; border-top-color: var(--mud-palette-primary); }
.trh-marker.is-up .trh-marker-text { bottom: auto; top: 14px; animation-name: trh-bob-up; }
.trh-marker.is-up::after { top: 0; border-top-color: transparent; border-bottom-color: var(--mud-palette-primary); }
.trh-marker.is-left .trh-marker-text, .trh-marker.is-right .trh-marker-text { top: 0; bottom: auto; transform: translateY(calc(-50% + var(--trh-mk-shift, 0px))); }
.trh-marker.is-left .trh-marker-text { left: 14px; animation-name: trh-bob-left; }
.trh-marker.is-left::after { left: 0; top: -7px; border-top-color: transparent; border-right-color: var(--mud-palette-primary); }
.trh-marker.is-right .trh-marker-text { left: auto; right: 14px; animation-name: trh-bob-right; }
.trh-marker.is-right::after { left: -14px; top: -7px; border-top-color: transparent; border-left-color: var(--mud-palette-primary); }
@keyframes trh-bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -5px; } }
@keyframes trh-bob-up { 0%, 100% { translate: 0 0; } 50% { translate: 0 5px; } }
@keyframes trh-bob-left { 0%, 100% { translate: 0 0; } 50% { translate: 5px 0; } }
@keyframes trh-bob-right { 0%, 100% { translate: 0 0; } 50% { translate: -5px 0; } }
/* ?debug=1: the hint target's t.world vs its live box */
.trh-dbg { position: absolute; left: .5rem; bottom: 9rem; z-index: 3; margin: 0; padding: .4rem .55rem; border-radius: 8px; background: rgba(var(--mud-palette-dark-rgb), .82); color: var(--mud-palette-dark-text); font: 600 .72rem/1.35 ui-monospace, Consolas, monospace; pointer-events: none; white-space: pre; }
.trh-dbg[hidden], .trh-dbg-dot[hidden], .trh-dbg-rect[hidden] { display: none; }
.trh-dbg-dot { position: absolute; left: -5px; top: -5px; z-index: 3; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--mud-palette-surface); pointer-events: none; }
.trh-dbg-dot.is-world { background: var(--mud-palette-error); }
.trh-dbg-dot.is-live { background: var(--mud-palette-info); }
.trh-dbg-rect { position: absolute; left: 0; top: 0; z-index: 3; border: 2px dashed var(--mud-palette-info); pointer-events: none; }
.trh-anchor { position: absolute; left: -7px; top: -7px; z-index: 2; display: none; width: 14px; height: 14px; border-radius: 50%; border: 3px solid var(--mud-palette-surface); background: var(--mud-palette-primary); box-shadow: var(--mud-elevation-2); pointer-events: none; }
.trh-anchor.is-on { display: block; }

/* first-run coach */
.trh-coach { position: absolute; inset: 0; z-index: 6; background: rgba(var(--mud-palette-dark-rgb), .42); pointer-events: auto; }
.trh-coach-ring { position: absolute; border-radius: 14px; box-shadow: 0 0 0 4px var(--mud-palette-secondary); pointer-events: none; }
.trh-coach-card {
    position: absolute;
    width: min(22.5rem, calc(100% - 2rem));
    padding: 1rem 1.1rem;
    border-radius: 14px;
    border: 1px solid var(--mud-palette-divider);
    background: var(--mud-palette-surface);
    box-shadow: var(--mud-elevation-8);
}
.trh-coach-card.is-center { left: 50%; top: 50%; transform: translate(-50%, -50%); }
.trh-coach-count { font-size: .75rem; font-weight: 700; color: var(--mud-palette-text-secondary); }
.trh-coach-title { margin: .2rem 0 .35rem; font-size: 1.15rem; }
.trh-coach-body { margin: 0 0 .85rem; line-height: 1.4; }
.trh-coach-actions { display: flex; gap: .5rem; align-items: center; justify-content: flex-end; }
.trh-coach-actions .trh-link { margin-right: auto; }

.trh-toast {
    position: absolute;
    left: 50%;
    top: 3.7rem;
    transform: translate(-50%, -.5rem);
    max-width: min(90%, 34rem);
    padding: .5rem .9rem;
    border-radius: 10px;
    background: var(--mud-palette-dark);
    color: var(--mud-palette-dark-text);
    font-weight: 600;
    opacity: 0;
    transition: opacity .2s, transform .2s;
    text-align: center;
}
.trh-toast.is-on { opacity: .95; transform: translate(-50%, 0); }
.trh-toast--warn { background: var(--mud-palette-warning); color: var(--mud-palette-warning-text); }
.trh-toast--ok { background: var(--mud-palette-success); color: var(--mud-palette-success-text); }   /* owner 10/22: a counted step landing at done (the cold foam's last scoop) */
.trh-tip {
    position: absolute;
    padding: .2rem .5rem;
    border-radius: 6px;
    background: var(--mud-palette-dark);
    color: var(--mud-palette-dark-text);
    font-size: .8rem;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
}
.trh-tip.is-on { opacity: .92; }
.trh-stats {
    position: absolute;
    right: .5rem;
    top: 3.6rem;
    margin: 0;
    padding: .4rem .55rem;
    border-radius: 8px;
    background: rgba(var(--mud-palette-dark-rgb), .82);
    color: var(--mud-palette-dark-text);
    font: 600 .72rem/1.35 ui-monospace, Consolas, monospace;
    pointer-events: none;
}
.trh--phone .trh-stats { top: auto; bottom: 12rem; }
.trh-walkgate {
    position: absolute;
    right: .5rem;
    bottom: 5.5rem;
    padding: .2rem .45rem;
    border-radius: 6px;
    background: rgba(var(--mud-palette-dark-rgb), .72);
    color: var(--mud-palette-dark-text);
    font: 600 .68rem/1.3 ui-monospace, Consolas, monospace;
    pointer-events: none;
}
.trh--phone .trh-walkgate { bottom: 14rem; }

/* run summary */
.trh-summary {
    position: absolute;
    inset: 0;
    z-index: 6;   /* over the rail and the gauges */
    display: grid;
    place-items: center;
    padding: 1rem;
    background: rgba(var(--mud-palette-surface-rgb), .7);
    pointer-events: auto;
}
.trh-summary { transition: opacity .3s ease; }
.trh-summary.is-away { opacity: 0; pointer-events: none; }   /* 1226: the hand-off walk plays first */
.trh-summary-card {
    width: min(100%, 52rem);
    max-height: 100%;
    overflow: auto;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-divider);
    box-shadow: var(--mud-elevation-8);
}
.trh-summary-title { margin: 0 0 .5rem; font-size: 1.2rem; }
.trh-summary-facts { display: flex; flex-wrap: wrap; gap: .1rem 1.1rem; margin: 0 0 .75rem; font-size: .88rem; }
.trh-fact { display: flex; gap: .4rem; align-items: baseline; min-width: 0; }
.trh-fact.is-wide { flex-basis: 100%; }
.trh-summary-facts dt { color: var(--mud-palette-text-secondary); white-space: nowrap; }
.trh-summary-facts dd { margin: 0; font-weight: 600; }
.trh-fact-note { margin-left: .25rem; font-weight: 500; color: var(--mud-palette-text-secondary); }
.trh-log-wrap { overflow-x: auto; }
.trh-log { border-collapse: collapse; font-size: .8rem; width: 100%; }
.trh-log th, .trh-log td { border-bottom: 1px solid var(--mud-palette-divider); padding: .25rem .4rem; text-align: left; white-space: nowrap; }
.trh-log th { color: var(--mud-palette-text-secondary); font-weight: 600; font-family: ui-monospace, Consolas, monospace; }
.trh-json { margin-top: .75rem; }
.trh-json pre { max-height: 14rem; overflow: auto; padding: .5rem; border-radius: 8px; background: rgba(var(--mud-palette-text-primary-rgb), .05); font-size: .75rem; }
.trh-summary-actions { display: flex; gap: .5rem; justify-content: flex-end; position: sticky; bottom: -1rem; margin: .75rem -1.25rem -1rem; padding: .6rem 1.25rem; background: var(--mud-palette-surface); border-top: 1px solid var(--mud-palette-divider); }
.trh-actionlog { margin-top: .5rem; }
.trh-actionlog > summary, .trh-fix-ok > summary { cursor: pointer; min-height: 32px; display: flex; align-items: center; font-weight: 600; }
.trh-actionlog > summary::before, .trh-fix-ok > summary::before { content: '\25B8'; margin-right: .4rem; font-size: .85em; }
.trh-actionlog[open] > summary::before, .trh-fix-ok[open] > summary::before { content: '\25BE'; }

/* run recap: what to fix, grouped by score area (colour is never the only signal: each row says Wrong or Missed) */
.trh-fix { display: grid; gap: .5rem; margin: 0 0 .5rem; }
.trh-fix:empty { display: none; }
.trh-fix-head { display: flex; align-items: baseline; gap: .5rem; margin: 0; font-size: 1.05rem; }
.trh-fix-count { color: var(--mud-palette-text-secondary); font-size: .85rem; font-weight: 500; }
.trh-fix-cap { margin: 0; padding: .4rem .6rem; border-radius: 8px; border-left: 4px solid var(--mud-palette-error); background: rgba(var(--mud-palette-error-rgb), .12); font-weight: 600; }
.trh-fix-gh { display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem .6rem; margin: .1rem 0 .3rem; font-size: .8rem; letter-spacing: .04em; text-transform: uppercase; color: var(--mud-palette-text-secondary); }
.trh-fix-pts { color: var(--mud-palette-text-primary); font-weight: 700; }
.trh-fix-note { font-weight: 500; text-transform: none; letter-spacing: 0; font-style: italic; }
.trh-fix-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: .3rem; }
.trh-fix-row { display: grid; grid-template-columns: 1.5rem minmax(0, 1fr) auto; gap: .5rem; align-items: start; padding: .4rem .55rem; border-radius: 8px; border-left: 4px solid transparent; line-height: 1.3; }
.trh-fix-mark { display: inline-grid; place-items: center; width: 1.4rem; height: 1.4rem; border-radius: 50%; font-size: .75rem; font-weight: 700; color: #fff; background: var(--mud-palette-text-secondary); }
.trh-fix-text { display: grid; min-width: 0; overflow-wrap: anywhere; }
.trh-fix-text small { color: var(--mud-palette-text-secondary); }
.trh-fix-why { font-weight: 600; }
.trh-fix-badge { align-self: start; padding: 0 .45rem; border-radius: 999px; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; border: 1px solid currentColor; }
.trh-fix-row.is-wrong { background: rgba(var(--mud-palette-warning-rgb), .14); border-left-color: var(--mud-palette-warning); }
.trh-fix-row.is-wrong .trh-fix-mark { background: var(--mud-palette-warning); color: var(--mud-palette-warning-text); }
.trh-fix-row.is-wrong .trh-fix-why, .trh-fix-row.is-wrong .trh-fix-badge { color: var(--mud-palette-warning-darken); }
.trh-fix-row.is-missed { background: rgba(var(--mud-palette-error-rgb), .12); border-left-color: var(--mud-palette-error); }
.trh-fix-row.is-missed .trh-fix-mark { background: var(--mud-palette-error); color: var(--mud-palette-error-text); }
.trh-fix-row.is-missed .trh-fix-why, .trh-fix-row.is-missed .trh-fix-badge { color: var(--mud-palette-error-darken); }
.trh-fix-ok { padding: .1rem .55rem; border-radius: 8px; border-left: 4px solid var(--mud-palette-success); background: rgba(var(--mud-palette-success-rgb), .12); }
.trh-fix-ok > summary { color: var(--mud-palette-success-darken); }
:root[data-theme="dark"] .trh-fix-row.is-missed .trh-fix-why, :root[data-theme="dark"] .trh-fix-row.is-missed .trh-fix-badge { color: var(--mud-palette-error-lighten); }
:root[data-theme="dark"] .trh-fix-ok > summary { color: var(--mud-palette-success-lighten); }
.trh-fix-ok .trh-fix-rows { padding: .2rem 0 .4rem; }
/* 1377: a habit tip, no points */
.trh-fix-tips { padding: .3rem .6rem .4rem; border-radius: 8px; border-left: 4px solid var(--mud-palette-info); background: rgba(var(--mud-palette-info-rgb), .1); }
.trh-fix-tip { margin: 0; line-height: 1.35; }
.trh-fix-row.is-ok { padding: .1rem 0; grid-template-columns: 1.5rem minmax(0, 1fr); }
.trh-fix-row.is-ok .trh-fix-mark { background: var(--mud-palette-success); color: var(--mud-palette-success-text); }
.trh--phone .trh-summary { padding: .4rem; }
.trh--phone .trh-summary-card { padding: .75rem; }
.trh--phone .trh-summary-title { font-size: 1.05rem; }
.trh--phone .trh-summary-facts { font-size: .82rem; gap: .05rem .8rem; }
.trh--phone .trh-summary-actions { bottom: -.75rem; margin: .5rem -.75rem -.75rem; padding: .5rem .75rem; }

/* KDS ticket: Aloha-style card, colour band by elapsed time (the time is always printed too) */
.trk {
    pointer-events: auto;
    border-radius: 10px;
    overflow: hidden;
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-divider);
    box-shadow: var(--mud-elevation-4);
    transform: translateX(-110%);
    transition: transform .35s cubic-bezier(.2, .8, .2, 1), opacity .35s;
}
.trk.is-in { transform: none; }
.trk.is-bumped { opacity: .45; }
.trk-head { display: flex; gap: .5rem; align-items: center; padding: .45rem .7rem; font-weight: 700; font-size: 1.05rem; }
.trk-ch { padding: 0 .4rem; border-radius: 4px; background: rgba(var(--mud-palette-dark-rgb), .25); font-size: .85rem; }
.trk-time { margin-left: auto; font-variant-numeric: tabular-nums; }
.trk-remake { padding: 0 .4rem; border-radius: 4px; background: rgba(var(--mud-palette-dark-rgb), .25); font-size: .78rem; }
.trk--green { background: var(--mud-palette-success); color: var(--mud-palette-success-text); }
.trk--amber { background: var(--mud-palette-warning); color: var(--mud-palette-warning-text); }
.trk--red { background: var(--mud-palette-error); color: var(--mud-palette-error-text); }
.trk-lines { list-style: none; margin: 0; padding: .5rem .7rem; }
.trk-line { display: grid; grid-template-columns: 1.6rem 1fr; gap: .2rem .3rem; font-weight: 700; letter-spacing: .01em; }
/* 1201: a drink + food ticket - the line you work on; tap a line to switch */
.trk-line[data-focusable] { cursor: pointer; border-radius: 4px; }
.trk-line.is-focus { outline: 2px solid rgba(var(--mud-palette-primary-rgb), .9); outline-offset: 2px; }
/* 1201: MerryChef countdowns, over each oven (docked under the station chips when it is out of view) */
.trf-timers { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.trf-timer { position: absolute; left: 0; top: 0; margin: -16px 0 0 -64px; min-width: 128px; padding: 4px 10px; border-radius: 999px; text-align: center; white-space: nowrap;
    font-weight: 800; font-size: .82rem; font-variant-numeric: tabular-nums; color: #fff; background: rgba(var(--mud-palette-warning-rgb), .94); box-shadow: 0 2px 8px rgba(0, 0, 0, .35); }
.trf-timer.is-done { background: rgba(var(--mud-palette-success-rgb), .96); }
.trf-timer.is-paused { background: rgba(var(--mud-palette-error-rgb), .96); }
/* 1909: a machine wait sped up because nothing else is left to do */
.trf-timer.is-fast { background: rgba(var(--mud-palette-info-rgb), .96); }
.trf-run-fast { display: none; }
.trf-timer.is-fast .trf-run-fast { display: block; width: fit-content; margin: 2px auto 0; padding: 0 7px; border-radius: 999px; font-size: .66rem; letter-spacing: .06em;
    color: var(--mud-palette-info); background: var(--mud-palette-info-text); }
.trf-timer.is-docked { left: 50%; top: 76px; transform: none; }
.trh--phone .trf-timer.is-docked { top: 100px; }   /* under the ticket peek; the pour gauge owns the left column */
.trk-mods { grid-column: 2; list-style: none; margin: 0; padding: 0 0 0 .9rem; font-weight: 600; color: var(--mud-palette-error-darken); }
/* 1895: a drink's modifiers as chips in their group's colour (the kiosk card's picker chips) */
.trk-mods--chips { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .15rem; padding-left: 0; }
.trk-mod { padding: .05rem .5rem; border-radius: 999px; font-size: .78rem; font-weight: 700; letter-spacing: .02em; color: rgb(var(--kiosk-brand-ink-rgb));
    background: var(--mod-c, rgba(var(--mud-palette-dark-rgb), .4)); }
.trk-bump {
    display: block;
    width: calc(100% - 1.4rem);
    margin: 0 .7rem .7rem;
    min-height: 44px;
    border-radius: 8px;
    border: 0;
    background: var(--mud-palette-primary);
    color: var(--mud-palette-primary-text);
    font-weight: 700;
    cursor: pointer;
}
.trk-bump:disabled { opacity: .5; cursor: default; }
/* 1380: the next ticket is loading */
.trk-bump.is-loading { display: flex; align-items: center; justify-content: center; gap: .5rem; opacity: .85; cursor: progress; }
.trk-spin { width: 1rem; height: 1rem; border-radius: 50%; border: 2px solid rgba(var(--mud-palette-primary-text-rgb, 255, 255, 255), .35); border-top-color: var(--mud-palette-primary-text); animation: trk-spin .8s linear infinite; }
@keyframes trk-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .trk-spin { animation: none; border-color: var(--mud-palette-primary-text); border-right-color: transparent; } }
.trk--phone { position: absolute; right: .5rem; top: 0; z-index: 2; width: min(64vw, 17rem); transform: translateX(calc(100% + 1rem)); }
.trk--phone.is-in { transform: none; }
.trk-peek {
    position: absolute;
    right: 0;
    top: 0;
    display: grid;
    gap: .1rem;
    padding: .4rem .55rem;
    border: 0;
    border-radius: 10px 0 0 10px;
    font-weight: 700;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: var(--mud-elevation-3);
    transition: opacity .2s;
}
.trk-peek.is-in { opacity: 0; pointer-events: none; }
.trk-peek { display: flex; align-items: baseline; gap: .45rem; max-width: min(56vw, 15rem); white-space: nowrap; }
.trk-peek-time { font-variant-numeric: tabular-nums; }
.trk-peek-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: .8rem; font-weight: 600; }

/* Demo (1218): the chip, the banner while the autopilot plays, and its finger on the buttons it uses */
.trh-demo { border-color: var(--mud-palette-secondary); color: var(--mud-palette-text-primary); }
.trh-demo::before { content: ""; display: inline-block; width: 0; height: 0; margin-right: .4rem; border-style: solid; border-width: .32rem 0 .32rem .5rem; border-color: transparent transparent transparent currentColor; vertical-align: .02rem; }
.trh-demo-bar {
    position: absolute; left: 50%; top: 3.6rem; z-index: 5; display: none; align-items: center; gap: .6rem;
    max-width: min(40rem, calc(100% - 1rem)); padding: .35rem .4rem .35rem .8rem; transform: translateX(-50%);
    border-radius: 999px; background: var(--mud-palette-secondary); color: var(--mud-palette-secondary-text);
    box-shadow: var(--mud-elevation-6); pointer-events: auto;
}
.trh-demo-bar.is-on { display: flex; }
.trh-demo-tag { flex: 0 0 auto; letter-spacing: .08em; font-weight: 800; }
.trh-demo-text { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.trh-demo-stop { flex: 0 0 auto; min-height: 36px; }
.trh--phone .trh-demo-bar { top: 3.2rem; left: .5rem; right: .5rem; max-width: none; transform: none; }
.trh--phone .trh-demo-text { white-space: normal; font-size: .8rem; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.trh.is-demo :is(button, a, input, select, details, summary) { pointer-events: none; }
.trh.is-demo .trh-demo-bar .trh-demo-stop { pointer-events: auto; }
.trh .is-demo-press { animation: trh-demo-press .32s ease-out; box-shadow: 0 0 0 4px rgba(var(--mud-palette-secondary-rgb), .7); }
@keyframes trh-demo-press { 0% { transform: scale(1); } 40% { transform: scale(.94); } 100% { transform: scale(1); } }

/* Menu search (1236): the magnifier chip and its popup; works while the demo plays */
.trh-find { display: inline-grid; place-items: center; min-width: 40px; padding: .35rem .55rem; }
.trh-find[hidden], .trh-find-pop[hidden] { display: none; }
.trh-find.is-on { background: var(--mud-palette-primary); color: var(--mud-palette-primary-text); border-color: var(--mud-palette-primary); }
.trh.is-demo .trh-find, .trh.is-demo .trh-find-pop :is(button, input) { pointer-events: auto; }
.trh-find-pop {
    position: absolute; top: 3.5rem; right: .5rem; z-index: 5; display: flex; flex-direction: column;
    width: min(27rem, calc(100% - 1rem)); max-height: min(34rem, calc(100% - 5rem)); overflow: hidden;
    border-radius: 12px; background: var(--mud-palette-surface); border: 1px solid var(--mud-palette-divider);
    box-shadow: var(--mud-elevation-8); pointer-events: auto;
}
.trh--phone .trh-find-pop { left: .5rem; right: .5rem; top: 3.2rem; width: auto; max-height: calc(100% - 4rem); }
.trh-find-pop.is-busy { cursor: progress; }
.trh-find-head { display: flex; gap: .5rem; align-items: center; padding: .6rem .6rem .35rem .75rem; }
.trh-find-input {
    flex: 1 1 auto; min-width: 0; min-height: 40px; padding: .35rem .7rem; border-radius: 8px;
    border: 1px solid var(--mud-palette-divider); background: var(--mud-palette-background); color: var(--mud-palette-text-primary); font: inherit; font-size: 1rem;
}
.trh-find-input:focus-visible { outline: 2px solid var(--mud-palette-primary); outline-offset: 0; }
.trh-find-x { margin: 0; }
.trh-find-say { margin: 0; padding: 0 .9rem .35rem; font-size: .78rem; color: var(--mud-palette-text-secondary); }
.trh-find-say.is-bad { color: var(--mud-palette-error); font-weight: 600; }
.trh-find-list { list-style: none; margin: 0; padding: .1rem .35rem .5rem; overflow-y: auto; overscroll-behavior: contain; }
.trh-find-row { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .6rem; padding: .4rem .55rem; border: 2px solid transparent; border-radius: 8px; cursor: pointer; pointer-events: auto; }
.trh-find-row:hover { background: rgba(var(--mud-palette-primary-rgb), .06); }
.trh-find-row.is-active { border-color: var(--mud-palette-primary); background: rgba(var(--mud-palette-primary-rgb), .08); }
.trh-find-row.is-off { cursor: help; }
.trh-find-row[aria-busy="true"] { opacity: .65; }
.trh-find-main { display: flex; flex-direction: column; flex: 1 1 9rem; min-width: 0; }
.trh-find-name { font-weight: 600; overflow-wrap: anywhere; }
.trh-find-row.is-off .trh-find-name { color: var(--mud-palette-text-secondary); }
.trh-find-cat { font-size: .74rem; color: var(--mud-palette-text-secondary); }
.trh-find-coming { margin-left: .4rem; font-size: .74rem; font-weight: 700; color: var(--mud-palette-info); }   /* ADR 219 */
.trh-find-sizes { display: flex; flex: 0 0 auto; gap: .3rem; }
.trh-find-size {
    min-width: 40px; min-height: 36px; padding: .2rem .55rem; border-radius: 999px; border: 1px solid var(--mud-palette-divider);
    background: var(--trh-panel); color: var(--mud-palette-text-primary); font-weight: 700; cursor: pointer;
}
.trh-find-size:hover, .trh-find-size.is-on { border-color: var(--mud-palette-primary); }
.trh-find-row.is-active .trh-find-size.is-on { background: var(--mud-palette-primary); color: var(--mud-palette-primary-text); }
.trh-find-size.is-off { border-style: dashed; color: var(--mud-palette-text-secondary); cursor: help; }
.trh-find-badge {
    flex: 0 1 auto; max-width: 100%; padding: .1rem .5rem; border-radius: 10px; overflow-wrap: anywhere;
    background: rgba(var(--mud-palette-text-secondary-rgb), .1); color: var(--mud-palette-text-secondary); font-size: .74rem; font-weight: 600;
}
.trh-find-badge.is-nudge { animation: trh-find-nudge .36s ease-in-out; color: var(--mud-palette-text-primary); }
@keyframes trh-find-nudge { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

@media (prefers-reduced-motion: reduce) {
    .trk, .trh-toast, .trh-ring-fg, .trh-goto-caret { transition: none; }
    .trh-glove.is-pop, .trh-glove--off.is-pop, .trh-glove-call.is-on { animation: none; }
    .trh-glove-call.is-on { opacity: 1; }
    .is-pulse, .trh-marker-text, .trh-bad.is-on, .trh-hand.is-glow, .trh .is-demo-press, .trh-gauge-band, .trh-finger, .trh-dock-count.is-pop .trh-dock-n, .trh-cluster.is-dock.is-hit, .trh-find-badge.is-nudge, .trh-fade.is-on { animation: none; }
}

/* Operations > Training (an ERP page, full head) */
.trainer-admin {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
    gap: .75rem;
    align-items: start;
}

.trainer-panel {
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-divider);
    border-radius: 12px;
    padding: .75rem 1rem;
}

.trainer-panel-title { display: block; font-weight: 600; margin-bottom: .25rem; }

/* Operations > Training nav icon (Bootstrap Icons mortarboard-fill, white like the other nav glyphs) */
.bi-mortarboard-fill-nav-menu {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' viewBox='0 0 16 16'%3E%3Cpath d='M8.211 2.047a.5.5 0 0 0-.422 0l-7.5 3.5a.5.5 0 0 0 .025.917l7.5 3a.5.5 0 0 0 .372 0L14 7.14V13a1 1 0 0 0-1 1v2h3v-2a1 1 0 0 0-1-1V6.739l.686-.275a.5.5 0 0 0 .025-.917z'/%3E%3Cpath d='M4.176 9.032a.5.5 0 0 0-.656.327l-.5 1.7a.5.5 0 0 0 .294.605l4.5 1.8a.5.5 0 0 0 .372 0l4.5-1.8a.5.5 0 0 0 .294-.605l-.5-1.7a.5.5 0 0 0-.656-.327L8 10.466z'/%3E%3C/svg%3E");
}
