:root {
    --navy: #081f3d;
    --navy-soft: #12345b;
    --blue: #1769e0;
    --teal: #00a99d;
    --mint: #daf7ef;
    --coral: #f05d4e;
    --yellow: #f4c34d;
    --ink: #172235;
    --muted: #667085;
    --line: #dbe2ea;
    --paper: #ffffff;
    --wash: #f4f7fb;
    --shadow: 0 14px 40px rgba(16, 35, 61, 0.10);
    --radius: 20px;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: var(--wash);
}

body {
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(circle at 8% 3%, rgba(0, 169, 157, 0.09), transparent 24rem),
        var(--wash);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

button,
input,
select {
    font: inherit;
}

button,
select {
    cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible,
a:focus-visible {
    outline: 3px solid rgba(23, 105, 224, 0.35);
    outline-offset: 3px;
}

[hidden] {
    display: none !important;
}

.site-header {
    min-height: 80px;
    padding: 14px clamp(20px, 4vw, 64px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    color: white;
    background: var(--navy);
    border-bottom: 4px solid var(--teal);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 13px;
    color: inherit;
    text-decoration: none;
}

.brand strong {
    font-size: 1.27rem;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.uob-logo {
    width: auto;
    height: 50px;
    display: block;
    object-fit: contain;
}

.brand-divider {
    width: 1px;
    height: 32px;
    display: block;
    background: rgba(255, 255, 255, 0.3);
}

.mode-pill {
    padding: 7px 12px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 99px;
    color: #dce8f2;
    font-size: 0.8rem;
    font-weight: 700;
}

main {
    width: min(1480px, 100%);
    min-height: calc(100vh - 84px);
    margin: 0 auto;
    padding: clamp(24px, 3vw, 42px);
}

.eyebrow,
.step-label {
    margin: 0 0 5px;
    color: var(--teal);
    font-size: 0.76rem;
    font-weight: 850;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    max-width: 850px;
    margin-bottom: 13px;
    font-size: clamp(2rem, 4vw, 4rem);
    line-height: 1.02;
    letter-spacing: -0.052em;
}

h2 {
    margin-bottom: 0;
    font-size: clamp(1.25rem, 2vw, 1.65rem);
    line-height: 1.15;
    letter-spacing: -0.025em;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(370px, 0.86fr) minmax(520px, 1.4fr);
    gap: 22px;
    align-items: start;
}

.connect-panel {
    position: relative;
    z-index: 2;
    grid-column: 1;
}

.readings-panel {
    grid-column: 2;
}

.collect-panel {
    grid-column: 1 / -1;
}

.panel {
    padding: clamp(22px, 2.4vw, 34px);
    border: 1px solid rgba(205, 216, 228, 0.9);
    border-radius: var(--radius);
    background: var(--paper);
    box-shadow: var(--shadow);
}

.model-column {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
    align-items: start;
    align-content: start;
}

.collect-panel .movement-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.panel-heading {
    margin-bottom: 22px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.panel-intro {
    margin: -9px 0 23px;
    color: var(--muted);
}

.status-chip {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 11px;
    color: #805d06;
    border-radius: 99px;
    background: #fff6d9;
    font-size: 0.76rem;
    font-weight: 750;
}

.status-chip span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--yellow);
    box-shadow: 0 0 0 4px rgba(244, 195, 77, 0.18);
}

.status-chip.connected {
    color: #08745f;
    background: var(--mint);
}

.status-chip.connected span {
    background: var(--teal);
    box-shadow: 0 0 0 4px rgba(0, 169, 157, 0.16);
}

.status-chip.error {
    color: #a33329;
    background: #fee8e5;
}

.status-chip.error span {
    background: var(--coral);
    box-shadow: 0 0 0 4px rgba(240, 93, 78, 0.13);
}

.pair-layout {
    display: grid;
    grid-template-columns: 178px 1fr;
    gap: 24px;
    align-items: center;
}

.qr-frame {
    width: 178px;
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    padding: 10px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: white;
}

.qr-frame img,
.qr-frame canvas {
    max-width: 100%;
    height: auto !important;
}

.qr-placeholder {
    color: #8a96a5;
    text-align: center;
    font-size: 0.84rem;
}

.pair-copy p {
    margin-bottom: 7px;
}

.muted {
    color: var(--muted);
    font-size: 0.88rem;
}

input,
select {
    width: 100%;
    min-height: 44px;
    padding: 9px 11px;
    color: var(--ink);
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: white;
}

label {
    display: grid;
    gap: 6px;
    color: #4b596b;
    font-size: 0.78rem;
    font-weight: 750;
}

.button {
    min-height: 44px;
    padding: 10px 16px;
    border: 0;
    border-radius: 11px;
    font-weight: 800;
    transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.button:not(:disabled):hover {
    transform: translateY(-1px);
}

.button:disabled {
    cursor: not-allowed;
    opacity: 0.48;
}

.button.primary {
    color: white;
    background: var(--blue);
    box-shadow: 0 8px 18px rgba(23, 105, 224, 0.2);
}

.button.primary:not(:disabled):hover {
    background: #0e5ccc;
    box-shadow: 0 10px 22px rgba(23, 105, 224, 0.28);
}

.button.secondary {
    color: var(--navy-soft);
    border: 1px solid #cad5e1;
    background: white;
}

.button.danger-action {
    color: #b43a30;
    border-color: #e8b7b2;
}

.button.danger-action:not(:disabled):hover {
    color: #982d25;
    border-color: #d98f88;
    background: #fff6f5;
}

.button.compact {
    min-height: 42px;
    padding-inline: 13px;
}

.button.wide {
    width: 100%;
}

.text-button {
    margin-top: 10px;
    padding: 3px 0;
    color: var(--blue);
    border: 0;
    border-bottom: 1px solid currentColor;
    background: none;
    font-size: 0.8rem;
    font-weight: 750;
}

.text-button.danger {
    margin-top: 0;
    color: #bd4034;
}

.text-button:disabled {
    cursor: not-allowed;
    opacity: 0.4;
}

.demo-box {
    margin-top: 22px;
    padding: 14px 16px;
    border-radius: 12px;
    background: #f4f8fc;
}

summary {
    color: var(--navy-soft);
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 800;
}

.demo-box p {
    margin: 10px 0 12px;
    color: var(--muted);
    font-size: 0.84rem;
}

@media (min-width: 1101px) {
    .demo-box {
        position: relative;
    }

    .demo-box[open] {
        z-index: 10;
    }

    .demo-content {
        position: absolute;
        z-index: 20;
        top: calc(100% + 8px);
        left: 0;
        width: min(430px, calc(100vw - 80px));
        padding: 14px 16px;
        border: 1px solid var(--line);
        border-radius: 12px;
        background: var(--paper);
        box-shadow: var(--shadow);
    }

    .demo-content p {
        margin-top: 0;
    }
}

.inline-controls {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: end;
}

.sample-rate,
.model-state {
    flex: none;
    padding: 6px 9px;
    color: #5f6f82;
    border-radius: 8px;
    background: #f1f5f9;
    font-size: 0.75rem;
    font-weight: 750;
}

.model-state.ready {
    color: #08745f;
    background: var(--mint);
}

.model-state.error {
    color: #a33329;
    background: #fee8e5;
}

.reading-cards {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    margin-bottom: 23px;
}

.reading-cards > div {
    min-width: 0;
    padding: 10px 8px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
    text-align: center;
}

.reading-cards span,
.reading-cards small,
.reading-cards strong {
    display: block;
}

.reading-cards span {
    color: #718096;
    font-size: 0.68rem;
    font-weight: 750;
}

.reading-cards strong {
    margin: 2px 0;
    overflow: hidden;
    font-variant-numeric: tabular-nums;
    font-size: 1.02rem;
}

.reading-cards small {
    color: #8b97a7;
    font-size: 0.61rem;
}

.chart-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

figure {
    min-width: 0;
    margin: 0;
    padding: 12px;
    border: 1px solid #e4e9ef;
    border-radius: 12px;
    background: #fbfcfe;
}

figcaption {
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    gap: 8px;
    color: #465569;
    font-size: 0.72rem;
    font-weight: 750;
}

canvas {
    width: 100%;
    height: 190px;
    display: block;
}

.legend {
    white-space: nowrap;
    color: #6d7888;
    font-size: 0.66rem;
}

.legend i {
    width: 7px;
    height: 7px;
    margin: 0 3px 0 6px;
    display: inline-block;
    border-radius: 50%;
}

.legend .x { background: #1769e0; }
.legend .y { background: #00a99d; }
.legend .z { background: #f05d4e; }

.movement-guide {
    margin-bottom: 22px;
}

.movement-guide-heading {
    margin-bottom: 12px;
}

.movement-guide-heading h3 {
    margin: 0 0 2px;
    color: var(--navy-soft);
    font-size: 0.98rem;
}

.movement-guide-heading p {
    margin: 0;
    color: var(--muted);
    font-size: 0.8rem;
}

.movement-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.movement-card {
    min-width: 0;
    padding: 0 0 12px;
    overflow: hidden;
    color: var(--ink);
    border: 1px solid #d8e1eb;
    border-radius: 13px;
    background: #fbfcfe;
    text-align: left;
    transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

.movement-card:hover {
    border-color: #9ebbe0;
    transform: translateY(-1px);
}

.movement-card.is-selected {
    border-color: var(--blue);
    box-shadow: 0 0 0 2px rgba(23, 105, 224, 0.13);
}

.movement-card.is-simulator-disabled {
    opacity: 0.48;
    cursor: not-allowed;
    filter: grayscale(0.55);
    transform: none;
}

.movement-card.is-simulator-disabled:hover {
    border-color: #d8e1eb;
}

.movement-card strong,
.movement-card > span:last-child {
    display: block;
    padding-inline: 12px;
}

.movement-card strong {
    margin-top: 10px;
    color: var(--navy-soft);
    font-size: 0.84rem;
}

.movement-card > span:last-child {
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.73rem;
    line-height: 1.4;
}

.movement-visual {
    position: relative;
    height: 92px;
    display: block;
    overflow: hidden;
    border-bottom: 1px solid #e3eaf2;
    background:
        radial-gradient(circle at center, rgba(23, 105, 224, 0.08), transparent 55%),
        #f1f6fb;
}

.motion-phone {
    position: absolute;
    z-index: 2;
    top: 17px;
    left: 50%;
    width: 34px;
    height: 58px;
    border: 3px solid var(--navy-soft);
    border-radius: 8px;
    background: #dcebf8;
    box-shadow: 0 4px 8px rgba(8, 31, 61, 0.13);
    transform: translateX(-50%);
}

.motion-phone::before {
    position: absolute;
    top: 4px;
    left: 50%;
    width: 9px;
    height: 2px;
    content: "";
    border-radius: 4px;
    background: var(--navy-soft);
    transform: translateX(-50%);
}

.motion-phone::after {
    position: absolute;
    right: 4px;
    bottom: 4px;
    left: 4px;
    height: 3px;
    content: "";
    border-radius: 4px;
    background: rgba(18, 52, 91, 0.22);
}

.motion-arrow {
    position: absolute;
    z-index: 1;
    top: 50%;
    left: 50%;
    display: block;
    background: var(--coral);
    transform: translate(-50%, -50%);
}

.motion-arrow::before,
.motion-arrow::after {
    position: absolute;
    content: "";
    width: 0;
    height: 0;
}

.motion-arrow.horizontal {
    width: 112px;
    height: 3px;
}

.motion-arrow.horizontal::before,
.motion-arrow.horizontal::after {
    top: -6px;
    border-top: 7px solid transparent;
    border-bottom: 7px solid transparent;
}

.motion-arrow.horizontal::before {
    left: -1px;
    border-right: 11px solid var(--coral);
}

.motion-arrow.horizontal::after {
    right: -1px;
    border-left: 11px solid var(--coral);
}

.motion-arrow.vertical {
    width: 3px;
    height: 74px;
}

.movement-vertical .motion-arrow.vertical {
    left: calc(50% + 36px);
}

.motion-arrow.vertical::before,
.motion-arrow.vertical::after {
    left: -6px;
    border-right: 7px solid transparent;
    border-left: 7px solid transparent;
}

.motion-arrow.vertical::before {
    top: -1px;
    border-bottom: 11px solid var(--coral);
}

.motion-arrow.vertical::after {
    bottom: -1px;
    border-top: 11px solid var(--coral);
}

.movement-still .motion-phone {
    top: 27px;
    width: 48px;
    height: 31px;
    border-radius: 7px;
}

.desk-line {
    position: absolute;
    right: 22px;
    bottom: 24px;
    left: 22px;
    height: 2px;
    background: #8fa2b7;
}

.still-mark {
    position: absolute;
    top: 37px;
    left: calc(50% + 35px);
    color: var(--teal);
    font-size: 0.57rem;
    font-weight: 900;
    letter-spacing: 0.09em;
}

.motion-loop {
    position: absolute;
    z-index: 1;
    top: 9px;
    left: 50%;
    width: 73px;
    height: 73px;
    border: 3px solid var(--coral);
    border-left-color: transparent;
    border-radius: 50%;
    transform: translateX(-50%);
}

.motion-loop::after {
    position: absolute;
    top: 4px;
    left: 1px;
    width: 0;
    height: 0;
    content: "";
    border-top: 6px solid transparent;
    border-right: 11px solid var(--coral);
    border-bottom: 6px solid transparent;
    transform: rotate(-22deg);
}

.custom-motion-path {
    position: absolute;
    z-index: 1;
    top: 20px;
    left: 50%;
    width: 100px;
    height: 50px;
    border: 3px dashed var(--coral);
    border-radius: 50%;
    transform: translateX(-50%) rotate(-12deg);
}

.movement-custom .motion-phone {
    top: 18px;
    transform: translateX(-50%) rotate(-8deg);
}

.custom-mark {
    position: absolute;
    z-index: 3;
    top: 7px;
    right: 20%;
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    color: white;
    border-radius: 50%;
    background: var(--teal);
    box-shadow: 0 3px 7px rgba(8, 31, 61, 0.16);
    font-size: 0.9rem;
    font-weight: 900;
}

.prediction-visual {
    width: 108px;
    flex: none;
    border: 1px solid #d9e4ed;
    border-radius: 12px;
}

.prediction-visual .desk-line,
.prediction-visual .motion-arrow,
.prediction-visual .motion-loop,
.prediction-visual .custom-motion-path,
.prediction-visual .still-mark,
.prediction-visual .custom-mark,
.prediction-visual .unknown-mark,
.prediction-visual .prediction-waiting-mark {
    display: none;
}

.prediction-visual.movement-still .desk-line,
.prediction-visual.movement-still .still-mark,
.prediction-visual.movement-horizontal .motion-arrow.horizontal,
.prediction-visual.movement-vertical .motion-arrow.vertical,
.prediction-visual.movement-circle .motion-loop,
.prediction-visual.movement-custom .custom-motion-path {
    display: block;
}

.prediction-visual.movement-custom .custom-mark,
.prediction-visual.movement-unknown .unknown-mark,
.prediction-visual.movement-waiting .prediction-waiting-mark {
    display: grid;
}

.prediction-visual .motion-arrow.horizontal {
    width: 78px;
}

.prediction-visual .custom-motion-path {
    top: 24px;
    width: 82px;
    height: 42px;
}

.prediction-visual .still-mark {
    top: 9px;
    left: 50%;
    transform: translateX(-50%);
}

.prediction-visual.movement-unknown .motion-phone,
.prediction-visual.movement-waiting .motion-phone {
    opacity: 0.42;
}

.unknown-mark,
.prediction-waiting-mark {
    position: absolute;
    z-index: 3;
    top: 8px;
    right: 17px;
    width: 28px;
    height: 28px;
    place-items: center;
    color: white;
    border-radius: 50%;
    background: var(--coral);
    box-shadow: 0 3px 7px rgba(8, 31, 61, 0.16);
    font-size: 0.95rem;
    font-weight: 900;
}

.prediction-waiting-mark {
    width: 34px;
    color: var(--navy-soft);
    background: white;
    font-size: 0.65rem;
    letter-spacing: 0.08em;
}

@keyframes still-preview {
    0%, 100% {
        box-shadow: 0 4px 8px rgba(8, 31, 61, 0.13);
    }
    50% {
        box-shadow:
            0 4px 8px rgba(8, 31, 61, 0.13),
            0 0 0 6px rgba(0, 169, 157, 0.14);
    }
}

@keyframes side-to-side-preview {
    0%, 100% {
        transform: translateX(-50%) translateX(-15px);
    }
    50% {
        transform: translateX(-50%) translateX(15px);
    }
}

@keyframes up-and-down-preview {
    0%, 100% {
        transform: translateX(-50%) translateY(8px);
    }
    50% {
        transform: translateX(-50%) translateY(-8px);
    }
}

@keyframes circle-preview {
    0%, 100% {
        transform: translateX(-50%) translate(0, -9px);
    }
    25% {
        transform: translateX(-50%) translate(-9px, 0);
    }
    50% {
        transform: translateX(-50%) translate(0, 9px);
    }
    75% {
        transform: translateX(-50%) translate(9px, 0);
    }
}

@keyframes custom-preview {
    0%, 100% {
        transform: translateX(-50%) translate(-12px, 7px) rotate(-11deg);
    }
    50% {
        transform: translateX(-50%) translate(12px, -7px) rotate(11deg);
    }
}

.movement-card:is(:hover, :focus-visible) .movement-still .motion-phone {
    animation: still-preview 900ms ease-in-out infinite;
}

.movement-card:is(:hover, :focus-visible) .movement-horizontal .motion-phone {
    animation: side-to-side-preview 850ms ease-in-out infinite;
}

.movement-card:is(:hover, :focus-visible) .movement-vertical .motion-phone {
    animation: up-and-down-preview 850ms ease-in-out infinite;
}

.movement-card:is(:hover, :focus-visible) .movement-circle .motion-phone {
    animation: circle-preview 1100ms linear infinite;
}

.movement-card:not(.is-simulator-disabled):is(:hover, :focus-visible) .movement-custom .motion-phone {
    animation: custom-preview 900ms ease-in-out infinite;
}

.record-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: end;
}

.record-controls > label {
    min-width: 0;
}

.record-controls.has-custom {
    grid-template-columns: minmax(180px, 0.8fr) minmax(220px, 1fr) auto;
}

.record-controls.has-custom .record-button {
    width: auto;
    grid-column: auto;
}

.record-button {
    white-space: nowrap;
}

.record-dot {
    width: 9px;
    height: 9px;
    margin-right: 6px;
    display: inline-block;
    border: 2px solid white;
    border-radius: 50%;
    background: var(--coral);
}

.record-progress {
    margin-top: 17px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: center;
}

.progress-track,
.confidence-track {
    overflow: hidden;
    border-radius: 99px;
    background: #e6edf5;
}

.progress-track {
    height: 9px;
}

.progress-track span,
.confidence-track span {
    height: 100%;
    width: 0;
    display: block;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--teal), #42d3bb);
    transition: width 160ms linear;
}

.record-progress strong {
    min-width: 95px;
    color: var(--navy-soft);
    font-size: 0.8rem;
}

.dataset-empty {
    min-height: 108px;
    margin-top: 20px;
    display: grid;
    place-content: center;
    color: #8a98a9;
    border: 1px dashed #cbd5e1;
    border-radius: 13px;
    text-align: center;
}

.dataset-empty span {
    font-size: 1.4rem;
    letter-spacing: 0.2em;
}

.dataset-empty p {
    margin: 2px 0 0;
    font-size: 0.82rem;
}

.dataset-summary {
    margin-top: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
    gap: 9px;
}

.recording-viewer {
    margin-top: 20px;
    padding: 16px;
    border: 1px solid #dce4ec;
    border-radius: 14px;
    background: #f8fafc;
}

.recording-viewer-heading {
    margin-bottom: 14px;
    display: grid;
    grid-template-columns: 1fr minmax(220px, 0.8fr);
    gap: 18px;
    align-items: end;
}

.recording-viewer h3 {
    margin: 0;
    color: var(--navy-soft);
    font-size: 1rem;
}

.recorded-chart-grid canvas {
    height: 155px;
}

.recording-meta {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 0.75rem;
}

.dataset-label {
    padding: 12px;
    border-left: 4px solid var(--teal);
    border-radius: 10px;
    background: #f3f8fa;
}

.dataset-label strong,
.dataset-label span {
    display: block;
}

.dataset-label strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.84rem;
}

.dataset-label span {
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.72rem;
}

.panel-actions {
    margin-top: 18px;
    display: flex;
    justify-content: flex-end;
    gap: 9px;
}

.trainingHint {
    margin: 10px 0 0;
    text-align: center;
}

.data-notice {
    margin-top: 22px;
    padding: 15px 18px;
    color: #465569;
    border: 1px solid #d6e0e9;
    border-radius: 13px;
    background: #f9fbfd;
    font-size: 0.82rem;
}

.data-notice strong {
    color: var(--navy-soft);
}

.data-notice p {
    margin: 2px 0 0;
}

.model-results {
    margin-top: 19px;
    display: block;
}

.classifier-choice {
    margin-bottom: 13px;
    padding: 13px;
    border: 1px solid #d9e4ed;
    border-radius: 12px;
    background: #f8fafc;
}

.classifier-choice-heading {
    position: relative;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.classifier-choice-heading label {
    display: block;
}

.classifier-choice .info-tooltip {
    position: static;
}

.classifier-choice .info-tooltip-trigger,
.unknown-option .info-tooltip-trigger {
    color: var(--navy-soft);
    border-color: #aebfd0;
    background: white;
}

.classifier-choice .info-tooltip-trigger:focus-visible,
.unknown-option .info-tooltip-trigger:focus-visible {
    outline-color: rgba(23, 105, 224, 0.35);
}

.classifier-choice .info-tooltip-content {
    top: calc(100% + 8px);
    left: 0;
    width: min(390px, 100%);
    transform: translateY(-4px);
}

.classifier-choice .info-tooltip:hover .info-tooltip-content,
.classifier-choice .info-tooltip:focus-within .info-tooltip-content {
    transform: translateY(0);
}

.accuracy-card,
.prediction-card {
    min-height: 132px;
    padding: 17px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-radius: 14px;
}

.accuracy-card {
    color: white;
    background: var(--navy-soft);
}

.prediction-card {
    display: grid;
    grid-template-columns: 108px minmax(0, 1fr);
    gap: 16px;
    align-items: center;
    justify-content: normal;
    border: 1px solid #d9e4ed;
    background: linear-gradient(145deg, #f7fbff, #f3faf7);
}

.accuracy-heading > span,
.prediction-card-copy > span:first-child {
    font-size: 0.74rem;
    font-weight: 750;
}

.prediction-card-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.accuracy-heading {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: fit-content;
    max-width: 100%;
}

.info-tooltip {
    position: relative;
    display: inline-flex;
}

.info-tooltip-trigger {
    width: 19px;
    height: 19px;
    padding: 0;
    display: inline-grid;
    place-items: center;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.65);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    cursor: help;
    font: inherit;
    font-size: 0.7rem;
    font-weight: 850;
    line-height: 1;
}

.info-tooltip-trigger:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.55);
    outline-offset: 2px;
}

.info-tooltip-content {
    position: absolute;
    z-index: 30;
    top: calc(100% + 9px);
    left: 50%;
    width: min(330px, calc(100vw - 56px));
    padding: 11px 12px;
    color: var(--navy);
    border: 1px solid var(--line);
    border-radius: 10px;
    background: white;
    box-shadow: var(--shadow);
    font-size: 0.76rem;
    font-weight: 550;
    line-height: 1.45;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -4px);
    transition: opacity 140ms ease, transform 140ms ease, visibility 140ms ease;
    visibility: hidden;
}

.info-tooltip:hover .info-tooltip-content,
.info-tooltip:focus-within .info-tooltip-content {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, 0);
    visibility: visible;
}

.accuracy-card strong {
    margin: 4px 0;
    font-size: 2rem;
}

.accuracy-card small {
    color: #bdcede;
}

#modelMethod {
    margin-bottom: 2px;
    color: white;
    font-weight: 750;
}

.prediction-card strong {
    margin: 7px 0 12px;
    font-size: clamp(1.05rem, 2vw, 1.4rem);
}

.confidence-track {
    height: 7px;
    margin-bottom: 7px;
}

.prediction-card small {
    color: var(--muted);
}

.prediction-card.unknown {
    border-color: #e8b7b2;
    background: #fff8f7;
}

.unknown-option {
    position: relative;
    grid-column: 1 / -1;
    margin-top: 11px;
    padding: 12px 14px;
    border: 1px solid #d9e4ed;
    border-radius: 12px;
    background: #f8fafc;
}

.unknown-option-row {
    display: flex;
    align-items: center;
    gap: 9px;
}

.unknown-option .info-tooltip {
    position: static;
}

.unknown-option .info-tooltip-content {
    top: calc(100% + 8px);
    right: 0;
    left: auto;
    width: min(390px, 100%);
    transform: translateY(-4px);
}

.unknown-option .info-tooltip:hover .info-tooltip-content,
.unknown-option .info-tooltip:focus-within .info-tooltip-content {
    transform: translateY(0);
}

.test-model-locked {
    padding: 18px;
    color: #708094;
    border: 1px dashed #bdc9d6;
    border-radius: 13px;
    background: #f8fafc;
    text-align: center;
    font-size: 0.82rem;
    font-weight: 700;
}

.unknown-toggle {
    position: relative;
    flex: 1;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 11px;
    align-items: center;
    cursor: pointer;
}

.unknown-toggle input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.toggle-track {
    width: 39px;
    height: 23px;
    padding: 3px;
    display: block;
    border-radius: 99px;
    background: #aab6c4;
    transition: background 120ms ease;
}

.toggle-track span {
    width: 17px;
    height: 17px;
    display: block;
    border-radius: 50%;
    background: white;
    box-shadow: 0 1px 4px rgba(8, 31, 61, 0.24);
    transition: transform 120ms ease;
}

.unknown-toggle input:checked + .toggle-track {
    background: var(--blue);
}

.unknown-toggle input:checked + .toggle-track span {
    transform: translateX(16px);
}

.unknown-toggle input:focus-visible + .toggle-track {
    outline: 3px solid rgba(23, 105, 224, 0.35);
    outline-offset: 3px;
}

.unknown-copy,
.unknown-copy strong {
    display: block;
}

.unknown-copy {
    min-width: 0;
}

.unknown-copy strong {
    color: var(--navy-soft);
    font-size: 0.8rem;
}

.test-prediction {
    margin-top: 16px;
    padding: 16px;
    border: 1px solid #d9e4ed;
    border-radius: 14px;
    background: #f8fafc;
}

.test-prediction-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 16px;
    align-items: center;
}

.test-prediction-heading strong {
    color: var(--navy-soft);
}

.test-prediction-heading p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 0.8rem;
}

.test-prediction-result {
    margin-top: 14px;
    padding: 13px 15px;
    display: grid;
    grid-template-columns: 108px minmax(0, 1fr);
    gap: 14px;
    align-items: center;
    color: var(--muted);
    border-left: 4px solid var(--teal);
    border-radius: 9px;
    background: white;
    font-size: 0.78rem;
}

.test-prediction-result-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.test-prediction-result strong {
    overflow: hidden;
    color: var(--navy-soft);
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 1.05rem;
}

.test-prediction-result.unknown {
    border-left-color: var(--coral);
}

.test-recording-series {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid #d9e4ed;
}

.test-recording-series .chart-grid {
    gap: 12px;
}

.test-recording-series figure {
    padding: 10px;
    background: white;
}

.phone-shell {
    width: min(620px, 100%);
    margin: 0 auto;
}

.phone-hero {
    margin: 8px 0 28px;
    text-align: center;
}

.phone-hero h1 {
    margin-inline: auto;
    font-size: clamp(2rem, 10vw, 3.2rem);
}

.phone-hero p:last-child {
    max-width: 470px;
    margin: 0 auto;
    color: var(--muted);
}

.phone-card {
    padding: 26px;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: white;
    box-shadow: var(--shadow);
    text-align: center;
}

.phone-card .status-chip {
    margin: 0 auto 18px;
}

.phone-start {
    width: 100%;
    min-height: 56px;
    font-size: 1.02rem;
}

.permission-note {
    margin: 12px auto 0;
    color: var(--muted);
    font-size: 0.78rem;
}

.phone-readings-heading {
    margin: 25px 0 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--navy-soft);
    text-align: left;
}

.phone-readings-heading span {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
}

.phone-readings-heading b {
    color: var(--navy-soft);
    font-variant-numeric: tabular-nums;
}

.phone-readings {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.phone-readings > div {
    padding: 12px 5px;
    border-radius: 11px;
    background: #f5f8fb;
}

.phone-readings span,
.phone-readings strong,
.phone-readings small {
    display: block;
}

.phone-readings span {
    color: #6e7c8e;
    font-size: 0.67rem;
    font-weight: 750;
}

.phone-readings strong {
    margin: 2px 0;
    font-variant-numeric: tabular-nums;
    font-size: 1.25rem;
}

.phone-readings small {
    color: #8995a4;
    font-size: 0.58rem;
}

.phone-tip {
    margin-top: 14px;
    padding: 17px 19px;
    color: #725800;
    border: 1px solid #f0dd9f;
    border-radius: 15px;
    background: #fff9e7;
}

.phone-tip p {
    margin: 2px 0 0;
    font-size: 0.82rem;
}

.phone-data-notice {
    margin-top: 14px;
    padding: 17px 19px;
    color: #725800;
    border-color: #f0dd9f;
    border-radius: 15px;
    background: #fff9e7;
}

.phone-data-notice strong {
    color: #725800;
}

.toast {
    position: fixed;
    z-index: 100;
    left: 50%;
    bottom: 28px;
    max-width: min(430px, calc(100% - 32px));
    padding: 11px 16px;
    color: white;
    border-radius: 10px;
    background: var(--navy);
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.22);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 15px);
    transition: opacity 160ms ease, transform 160ms ease;
}

.toast.visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

.noscript {
    padding: 18px;
    color: #8b261d;
    background: #ffe9e7;
    text-align: center;
}

@media (max-width: 1100px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .connect-panel,
    .readings-panel,
    .collect-panel,
    .model-column {
        grid-column: 1;
    }

    .model-column {
        grid-template-columns: 1fr;
    }

    .collect-panel .movement-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .site-header {
        min-height: 70px;
        padding: 11px 16px;
    }

    .uob-logo {
        width: 46px;
        height: 46px;
        object-fit: cover;
        object-position: left center;
    }

    .brand-divider {
        height: 26px;
    }

    .brand strong {
        font-size: 1rem;
    }

    .mode-pill {
        font-size: 0.7rem;
    }

    main {
        padding: 24px 14px 38px;
    }

    .panel {
        padding: 20px 17px;
        border-radius: 16px;
    }

    .panel-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .pair-layout,
    .chart-grid {
        grid-template-columns: 1fr;
    }

    .qr-frame {
        margin: auto;
    }

    .reading-cards {
        grid-template-columns: repeat(3, 1fr);
    }

    .record-controls {
        grid-template-columns: 1fr;
    }

    .record-controls.has-custom {
        grid-template-columns: 1fr;
    }

    .record-controls.has-custom .record-button {
        grid-column: auto;
    }

    .test-prediction-heading,
    .test-prediction-result {
        grid-template-columns: 1fr;
    }

    .test-prediction-heading .button {
        width: 100%;
    }

    .recording-viewer-heading {
        grid-template-columns: 1fr;
    }

    .inline-controls {
        grid-template-columns: 1fr;
    }

    .panel-actions {
        justify-content: stretch;
    }

    .panel-actions .button {
        flex: 1;
    }

}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
