/* =========================================================
   General converter card
========================================================= */

.number-converter,
.hex-converter-widget,
.hex-division-widget,
.binary-visualiser-widget {
    max-width: 850px;
    margin-top: 1.5rem;
    padding: 1.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 22px;
    background: #f8fafc;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

.number-converter label,
.hex-converter-widget label,
.hex-division-widget label,
.binary-visualiser-widget label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 700;
    color: #334155;
}

.number-converter input,
.hex-converter-widget input,
.hex-division-widget input,
.binary-visualiser-widget input {
    width: 100%;
    padding: 0.75rem 0.9rem;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    font-size: 1.05rem;
    background: white;
}

.number-converter input:focus,
.hex-converter-widget input:focus,
.hex-division-widget input:focus,
.binary-visualiser-widget input:focus {
    outline: none;
    border-color: #0f172a;
    box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.12);
}

.converter-field {
    margin-bottom: 1rem;

}

.converter-error {
    margin-top: 1rem;
    color: #dc2626;
    font-weight: 600;
}


/* =========================================================
   Final result box
========================================================= */

.final-hex-box {
    margin-top: 1.25rem;
    padding: 1rem;
    border-radius: 18px;
    background: #0f172a;
    color: white;
    font-weight: 600;
}

.final-hex-box strong {
    margin-left: 0.5rem;
    font-size: 1.5rem;
}


/* =========================================================
   Visualiser tabs
========================================================= */

.visualiser-tabs {
    display: inline-flex;
    background: #e2e8f0;
    padding: 4px;
    border-radius: 999px;
    gap: 4px;
    margin-bottom: 1.25rem;
}

.visualiser-tab {
    border: none;
    background: transparent;
    color: #475569;

    padding: 0.5rem 1.1rem;
    border-radius: 999px;

    font-weight: 600;
    font-size: 0.95rem;

    cursor: pointer;
    transition: all 0.2s ease;
}

.visualiser-tab:hover {
    color: #0f172a;

}

.visualiser-tab.active {
    background: white;
    color: #0f172a;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.08);
}

.visualiser-input-row {
    margin-top: 0.5rem;

}


/* =========================================================
   Binary visualiser
========================================================= */

.binary-steps-table {
    margin-top: 1.25rem;

}

.binary-place-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
    gap: 0.7rem;
    margin-top: 1.25rem;
}

.binary-place-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 0.85rem;
    text-align: center;
    transition: all 0.2s ease;
}

.binary-place-card.active {
    background: #dcfce7;
    border-color: #86efac;
    transform: translateY(-2px);
}

.place-value {
    display: block;
    font-size: 0.8rem;
    color: #64748b;
}

.binary-digit {
    display: block;
    font-size: 1.6rem;
    font-weight: 800;
    color: #0f172a;
    margin: 0.25rem 0;
}

.included-value {
    display: block;
    font-size: 0.8rem;
    color: #334155;
}


/* =========================================================
   Binary to hexadecimal visualiser
========================================================= */

.hex-converter-widget input {
    letter-spacing: 0.08em;

}

.nibble-display {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1.25rem;
}

.nibble-card {
    padding: 1rem;
    border-radius: 18px;
    background: white;
    border: 1px solid #e2e8f0;
}

.nibble-label {
    display: block;
    color: #64748b;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.nibble-card strong {
    display: block;
    font-size: 1.5rem;
    color: #0f172a;
    letter-spacing: 0.08em;
}

.nibble-card span:last-child {
    display: inline-block;
    margin-top: 0.75rem;
    font-size: 1.4rem;
    font-weight: 800;
    color: #334155;
}


/* =========================================================
   Responsive
========================================================= */

@media (max-width: 640px) {
    .number-converter,
    .hex-converter-widget,
    .hex-division-widget,
    .binary-visualiser-widget {
        padding: 1rem;
    }

    .visualiser-tabs {
        display: grid;
        grid-template-columns: 1fr;
        border-radius: 18px;
        width: 100%;
    }

    .visualiser-tab {
        width: 100%;
    }

    .nibble-display {
        grid-template-columns: 1fr;
    }
}

/* =========================================================
   Animated powers of 2 method
========================================================= */

.power-animation-panel {
    margin-top: 1.25rem;
    padding: 1.25rem;
    border-radius: 22px;
    background: white;
    border: 1px solid #e2e8f0;
}

.power-animation-header {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.power-animation-header div {
    padding: 1rem;
    border-radius: 18px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.power-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
    margin-bottom: 0.35rem;
}

.power-animation-header strong {
    font-size: 1.4rem;
    color: #0f172a;
}

.power-step-btn,
.power-reset-btn {
    margin: 0.5rem 0.5rem 1rem 0;
    padding: 0.65rem 1.1rem;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.2s ease;
}

.power-step-btn {
    background: #0f172a;
    color: white;
}

.power-step-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.18);
}

.power-step-btn:disabled {
    opacity: 0.5;
    cursor: default;
    transform: none;
    box-shadow: none;
}

.power-reset-btn {
    background: #e2e8f0;
    color: #334155;
}

.power-reset-btn:hover {
    background: #cbd5e1;

}

.power-step-explanation {
    margin: 1rem 0;
    padding: 1rem;
    border-radius: 18px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #334155;
    line-height: 1.6;
}

.power-step-grid {
    margin-top: 1rem;

}

.power-card {
    position: relative;

}

.power-card.checking {
    border-color: #facc15;
    background: #fefce8;
    transform: translateY(-4px) scale(1.03);
    box-shadow: 0 12px 24px rgba(250, 204, 21, 0.25);
}

.power-card.active {
    background: #dcfce7;
    border-color: #86efac;
}

.power-card.skipped {
    background: #f8fafc;
    border-color: #cbd5e1;
    opacity: 0.75;
}

.power-card.skipped .binary-digit {
    color: #64748b;

}

@media (max-width: 760px) {
    .power-animation-header {
        grid-template-columns: 1fr;
    }
}