/* ---- Diffusion Digit Generator ---- */

.diffusion-panel {
    max-width: 640px;
    gap: 18px;
}

.live-grid {
    image-rendering: pixelated;
    width: 100%;
    max-width: 480px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.scrub-row {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
}

.scrub-tag {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap;
}

.scrub-slider {
    flex: 1;
    accent-color: #f093fb;
}

.scrub-current {
    font-size: 0.8rem;
    color: #f093fb;
    min-width: 60px;
    text-align: right;
}

.diffusion-note {
    text-align: center;
    max-width: 680px;
    margin: 30px auto 20px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
    line-height: 1.7;
}

.diffusion-note a {
    color: #667eea;
    text-decoration: none;
    border-bottom: 1px solid rgba(102, 126, 234, 0.4);
}

.digit-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 16px;
    width: 100%;
    max-width: 900px;
    margin: 0 auto 50px;
}

.digit-slot {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.digit-flip {
    width: 100%;
    aspect-ratio: 1 / 1;
    max-width: 96px;
    cursor: pointer;
}

.digit-flip-inner {
    position: relative;
    width: 100%;
    height: 100%;
}

/* Plain 2D opacity crossfade instead of a 3D rotateY flip.
   Safari has a well-known bug where backdrop-filter on an ancestor
   (our .digit-slot cards use one for the glass panel look) breaks
   backface-visibility on nested 3D-transformed children -- the
   hidden face bleeds through intermittently. This sidesteps it
   entirely by never using 3D transforms here. */
.digit-face {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #0a0e27;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
    opacity: 1;
    pointer-events: auto;
    transition: opacity 0.3s ease;
}

.digit-face.back {
    gap: 4px;
    opacity: 0;
    pointer-events: none;
}

.digit-flip.flipped .digit-face.front {
    opacity: 0;
    pointer-events: none;
}

.digit-flip.flipped .digit-face.back {
    opacity: 1;
    pointer-events: auto;
}

.digit-canvas {
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
}

.nn-canvas {
    height: 80%;
}

.nn-caption {
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
    letter-spacing: 0.5px;
}

.digit-label {
    font-size: 1.4rem;
    font-weight: 700;
    background: linear-gradient(90deg, #f093fb, #667eea);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.digit-label.dim {
    -webkit-text-fill-color: rgba(255, 255, 255, 0.25);
    background: none;
}

.digit-conf {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
}

.digit-orig {
    font-size: 0.68rem;
    text-align: center;
    padding: 3px 8px;
    border-radius: 20px;
    line-height: 1.3;
}

.digit-orig.ok {
    color: #4fd1c5;
    background: rgba(79, 209, 197, 0.1);
}

.digit-orig.flag {
    color: #ffd166;
    background: rgba(255, 209, 102, 0.1);
}

.digit-orig.rough {
    color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.05);
}

.digit-empty {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
    text-align: center;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.retry-btn {
    font-size: 0.7rem;
    padding: 8px 16px;
}

.digit-unverified {
    font-size: 0.65rem;
    color: #ffd166;
    text-align: center;
    line-height: 1.3;
    opacity: 0.85;
}
