.animated-twos-widget {
    border: 1px solid #dbe3ef;
    border-radius: 18px;
    padding: 1.25rem;
    background: #f8fafc;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.animated-twos-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
    align-items: end;
}

.animated-twos-widget label {
    font-weight: 700;
    color: #334155;
    display: block;
    margin-bottom: 0.35rem;
}

.animated-twos-widget input,
.animated-twos-widget select {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 0.7rem 0.8rem;
    font-size: 1rem;
    background: white;
}

.animated-twos-speed {
    margin: 0.8rem 0 1rem;
    padding: 0.9rem 1rem;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
}

.animated-twos-speed label {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.45rem;
}

.animated-twos-speed input[type="range"] {
    width: 100%;
    padding: 0;
    cursor: pointer;
}

.animated-twos-speed-notes {
    display: flex;
    justify-content: space-between;
    color: #64748b;
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

.animated-twos-buttons {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.animated-twos-buttons button {
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    padding: 0.55rem 1rem;
    font-weight: 700;
    background: white;
    color: #334155;
    cursor: pointer;
}

.animated-twos-buttons button:hover {
    background: #e2e8f0;
}

.animated-twos-working {
    overflow-x: auto;
    margin-top: 1rem;
}

.animated-twos-paper {
    display: inline-grid;
    grid-template-columns: auto repeat(var(--bit-count), 2.7rem);
    column-gap: 0.35rem;
    row-gap: 0.25rem;
    align-items: center;
    padding: 1rem 1.2rem;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    min-width: max-content;
}

.animated-twos-label {
    padding-right: 1rem;
    color: #475569;
    font-weight: 700;
    text-align: left;
    white-space: nowrap;
}

.animated-twos-bit {
    min-height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 1.3rem;
    font-weight: 800;
    color: #0f172a;
    border-radius: 10px;
    transition: all 0.35s ease;
}

.animated-twos-soft-line {
    grid-column: 1 / -1;
    border-top: 1px dashed #cbd5e1;
    height: 0;
    margin: 0.35rem 0;
}

.animated-twos-line {
    grid-column: 1 / -1;
    border-top: 2px solid #334155;
    height: 0;
    margin: 0.25rem 0;
}

.animated-twos-current {
    background: #dbeafe;
    outline: 2px solid #3b82f6;
}

.animated-twos-done {
    background: #dcfce7;
    color: #166534;
}

.animated-twos-invert {
    background: #fef3c7;
    color: #92400e;
    outline: 2px solid #f59e0b;
}

.animated-twos-carry {
    color: #64748b;
    font-size: 1rem;
}

.animated-twos-carry-mark {
    background: #fef3c7;
    color: #92400e;
    outline: 2px solid #f59e0b;
}

.animated-twos-warning {
    background: #fee2e2;
    color: #991b1b;
    outline: 2px solid #ef4444;
}

.animated-twos-changed {
    animation: twosBitPulse 0.65s ease;
}

.animated-twos-final {
    margin-top: 0.85rem;
    font-size: 1.05rem;
    color: #334155;
    font-weight: 700;
}

.animated-twos-final strong {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    background: #e0f2fe;
    color: #075985;
    padding: 0.15rem 0.45rem;
    border-radius: 8px;
}

.animated-twos-message {
    margin-top: 0.9rem;
    font-weight: 700;
    color: #334155;
}

@keyframes twosBitPulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.18);
    }

    100% {
        transform: scale(1);
    }
}

@media (max-width: 700px) {
    .animated-twos-paper {
        grid-template-columns: auto repeat(var(--bit-count), 2rem);
        padding: 0.8rem;
    }

    .animated-twos-bit {
        font-size: 1.05rem;
    }
}