﻿.digit-hero-status {
    min-width: 280px;
    max-width: 360px;
}

.digit-page .conv-subtabs {
    margin-bottom: 0px;
}

.digit-page .digit-page-hero {
    margin-bottom: 0px;
    padding: 18px;
}

.digit-page .digit-page-hero h2 {
    margin: 0 0 8px;
    font-size: 30px;
}

.digit-page .digit-page-hero p {
    max-width: 720px;
    margin: 0;
    color: #64748b;
}

.digit-page .digit-page-hero .conv-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.digit-page .digit-page-hero .model-status {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    max-width: 380px;
    min-height: 42px;
    padding: 10px 16px;
    border-radius: 999px;
    background: #eff6ff;
}

.digit-page .digit-page-hero .model-status strong {
    max-width: 320px;
}

.digit-page .digit-page-hero .model-status span {
    flex: 0 0 auto;
}

.digit-page .digit-page-hero .model-status strong {
    display: inline-block;
    max-width: 260px;
    line-height: 1.35;
}

.digit-page {
    display: grid;
    gap: 18px;
}

.digit-hero,
.digit-card {
    border: 1px solid rgba(226, 232, 240, 0.94);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.06);
}

.digit-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 24px;
}


.model-status {
    display: grid;
    gap: 6px;
    min-width: 260px;
    padding: 14px 16px;
    border-radius: 18px;
    background: #f8fafc;
}

.model-status span {
    color: #64748b;
    font-size: 13px;
    font-weight: 800;
}

.model-status strong {
    color: #0f172a;
    line-height: 1.45;
}

.model-status.ready {
    border: 1px solid rgba(134, 239, 172, 0.8);
    background: #f0fdf4;
}

.model-status.missing {
    border: 1px solid rgba(251, 191, 36, 0.85);
    background: #fffbeb;
}

.digit-layout {
    display: grid;
    grid-template-columns: minmax(360px, 0.9fr) minmax(280px, 0.55fr) minmax(360px, 0.8fr);
    gap: 18px;
    align-items: stretch;
}

.digit-card {
    display: grid;
    align-content: start;
    gap: 16px;
    padding: 20px;
}

.digit-card h2,
.digit-card h3 {
    margin: 0;
}

.digit-card-title {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 16px;
}

.digit-message {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    color: #475569;
    font-size: 13px;
    font-weight: 800;
    background: #f1f5f9;
}

.canvas-wrap {
    display: grid;
    place-items: center;
    padding: 16px;
    border-radius: 20px;
    background:
        linear-gradient(45deg, #e2e8f0 25%, transparent 25%),
        linear-gradient(-45deg, #e2e8f0 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #e2e8f0 75%),
        linear-gradient(-45deg, transparent 75%, #e2e8f0 75%);
    background-color: #f8fafc;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0;
    background-size: 20px 20px;
}

#digitCanvas {
    width: 280px;
    height: 280px;
    border: 1px solid #cbd5e1;
    border-radius: 18px;
    touch-action: none;
    cursor: crosshair;
    background: #ffffff;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
}

.digit-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.auto-recognize {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 12px;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    color: #334155;
    font-weight: 800;
    background: #ffffff;
}

.inference-mode-panel {
    display: grid;
    gap: 10px;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    background: #f8fafc;
}

.inference-mode-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.inference-mode-options label,
.inference-mode-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    padding: 0 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 800;
}

.inference-mode-options label {
    border: 1px solid #cbd5e1;
    color: #334155;
    background: #ffffff;
}

.inference-mode-badge {
    width: fit-content;
    color: #1d4ed8;
    background: #eff6ff;
}

.prediction-box {
    display: grid;
    place-items: center;
    gap: 8px;
    min-height: 210px;
    border-radius: 22px;
    color: #ffffff;
    background: linear-gradient(135deg, #2563eb, #4f46e5);
    box-shadow: 0 20px 40px rgba(37, 99, 235, 0.25);
}

.prediction-box span {
    font-weight: 800;
    opacity: 0.9;
}

.prediction-box strong {
    font-size: 86px;
    line-height: 0.9;
}

.prediction-box small {
    font-size: 16px;
    font-weight: 800;
}

.preprocess-preview {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 140px;
    gap: 14px;
    align-items: center;
    padding: 14px;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    background: #f8fafc;
}

.preprocess-preview p {
    margin: 6px 0 0;
    color: #64748b;
    line-height: 1.55;
}

#preprocessedImage {
    width: 140px;
    height: 140px;
    image-rendering: pixelated;
    border-radius: 14px;
    background: #000000;
    box-shadow: inset 0 0 0 1px rgba(226, 232, 240, 0.8);
}

.probability-bars {
    display: grid;
    gap: 9px;
}

.prob-row {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) 58px;
    gap: 10px;
    align-items: center;
}

.prob-row strong {
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    border-radius: 10px;
    color: #2563eb;
    background: #eff6ff;
}

.prob-track {
    height: 14px;
    overflow: hidden;
    border-radius: 999px;
    background: #e2e8f0;
}

.prob-fill {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #60a5fa, #2563eb);
    transition: width 0.22s ease;
}

.prob-row span {
    color: #475569;
    font-variant-numeric: tabular-nums;
    font-weight: 800;
    text-align: right;
}

.model-flow-card {
    display: grid;
    gap: 14px;
}

.model-flow-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
}

.model-flow-head p {
    max-width: 520px;
    margin: 0;
    color: #64748b;
    line-height: 1.6;
}

.model-flow-figure {
    margin: 0;
    display: grid;
    gap: 12px;
    padding: 16px;
    border: 1px solid rgba(226, 232, 240, 0.92);
    border-radius: 20px;
    background: linear-gradient(180deg, #ffffff, #f8fafc);
}

.model-flow-figure img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

.model-flow-figure figcaption {
    color: #64748b;
    font-size: 14px;
    line-height: 1.6;
    text-align: center;
}

@media (max-width: 1180px) {
    .digit-layout {
        grid-template-columns: 1fr;
    }

    .digit-hero,
    .digit-page-hero {
        align-items: stretch;
        flex-direction: column;
    }

    .digit-hero-status {
        min-width: 0;
        max-width: none;
        width: 100%;
    }

    .model-flow-head {
        flex-direction: column;
        align-items: start;
    }
}

@media (max-width: 560px) {
    .preprocess-preview {
        grid-template-columns: 1fr;
    }

    #digitCanvas {
        width: 240px;
        height: 240px;
    }
}
