* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Segoe UI', Arial, sans-serif;
    background: linear-gradient(135deg, #3687C0, #3687C0);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    color: #333;
}

.container {
    width: 380px;
    background: white;
    padding: 40px 30px;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.25);
    text-align: center;
    position: relative;
    overflow: hidden;
}

h2 {
    margin-top: 0;
    margin-bottom: 25px;
    font-weight: 600;
    color: #333;
}

.step {
    display: none;
    animation: fadeSlide 0.3s ease;
}

.step.active {
    display: block;
}

@keyframes fadeSlide {
    from { opacity: 0; transform: translateX(10px); }
    to { opacity: 1; transform: translateX(0); }
}

button {
    padding: 12px 18px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.25s ease;
    margin: 6px;
}

.add-btn {
    background: #eef1ff;
    color: #3687C0;
}

.add-btn:hover {
    background: #61afe7;
    color: white;
    transform: translateY(-2px);
}

.next-btn {
    background: #3687C0;
    color: white;
    width: 100%;
    margin-top: 15px;
}

.next-btn:hover {
    background: #61afe7;
}

.wifi-btn {
    background: #3687C0;
}

.wifi-btn:hover {
    background: #61afe7;
    color: white;
}

select {
    width: 100%;
    padding: 10px;
    margin: 8px 0 15px 0;
    border-radius: 8px;
    border: 1px solid #ddd;
    font-size: 14px;
    transition: border 0.2s ease, box-shadow 0.2s ease;
}

select:focus {
    outline: none;
    border-color: #3687C0;
    box-shadow: 0 0 0 3px rgba(91,95,230,0.2);
}

.back {
    position: absolute;
    top: 15px;
    left: 15px;
    font-size: 38px;
    cursor: pointer;
    color: #3687C0;
    transition: 0.2s;
    display: none; /* nascosta di default */
}

.back:hover {
    color: #61afe7;
    transform: scale(1.12);
}

#result {
    font-size: 20px;
    font-weight: 600;
    margin: 20px 0;
    color: #3687C0;
}

.restart-btn {
    background: #3687C0;
}

.restart-btn:hover {
    background: #61afe7;
}

.add-line {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-top: 20px;
    cursor: pointer;
    user-select: none;
    transition: all 0.25s ease;
}

.add-text {
    font-size: 15px;
    font-weight: 600;
    color: #3687C0;
    margin-bottom: 10px;
    transition: color 0.25s ease;
}

.add-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1.5px solid #3687C0;
    display: flex;
    
    justify-content: center;
    transition: all 0.25s ease;
}

.add-circle span {
    font-size: 32px;
    color: #3687C0;
    line-height: 1;
    transition: all 0.25s ease;
}

/* HOVER ANIMATION */
.add-line:hover .add-circle {
    transform: scale(1.1);
    border-color: #61afe7;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: #ffffff;
    background-color: #474cd63c;
    
}
.remove-line {
    background: none;
    border: none;
    color: #3687C0;
    font-weight: bold;
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    transition: color 0.2s, transform 0.2s;
}

.remove-line:hover {
    color: #61afe7;
    transform: scale(1.2);
}

@media (max-width: 420px) {
    .container {
        width: 90%;
        padding: 30px 20px;
    }

    button {
        padding: 10px 14px;
        font-size: 14px;
    }

    .add-circle {
        width: 35px;
        height: 35px;
    }

    .add-circle span {
        font-size: 28px;
    }
}



.router-wrapper {
    margin-top: 30px;
    display:grid;
    justify-content:center;
    align-items: center;
    flex-wrap: wrap;
}

.router-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 5px 15px;
    text-align: center;
}

.router-title {
    font-size: 18px;
    font-weight: 600;
    color: #3687C0;
    margin-bottom: 5px;
    min-height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.router-img {
    max-width: 320px;
    height: auto;
    margin-bottom: 8px;
}

.router-separator {
    font-size: 20px;
    font-weight: bold;
    color: #3687C0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Mobile */
@media (max-width: 768px) {

    .router-wrapper {
        flex-direction: column;
    }

    .router-separator {
        margin: 10px 0;
    }
}

/* Access Point più piccolo */
.ap-img {
    max-width: 140px;
}


/* Riduce spazio generale tra dispositivi */
.router-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px; /* spazio ridotto tra router */
    margin-top: 20px;
}

/* Riduce padding interno */
.router-item {
    padding: 5px 8px;
}

/* Riduce spazio sotto immagini */
.router-img {
    max-width: 260px;
    margin-bottom: 4px;
}

/* Access Point più piccolo */
/* Access Point più piccolo */
.ap-img {
    max-width: 140px;
}

/* Modem 167 più compatto */
.modem-img {
    max-width: 160px;
}

/* Riduce spazio del + */
.router-separator {
    font-size: 26px;
    margin: 0 4px;
}

/* ===============================
   HOVER PREMIUM BUTTON EFFECT
================================ */

.wifi-btn,
.velocita-btn,
.restart-btn {

    background: #f2f2f2;
    transition: all 0.25s ease;
}

/* Hover effetto principale */
.wifi-btn:hover,
.velocita-btn:hover,
.restart-btn:hover {

    background: #61afe7;
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(91, 174, 230, 0.35);
}

/* Effetto click */
.wifi-btn:active,
.velocita-btn:active,
.restart-btn:active {

    transform: scale(0.97);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

/* ===============================
   PREMIUM DEVICE HOVER EFFECT
================================ */

.router-item {
    transition: transform 0.4s ease, filter 0.3s ease;
}

/* Hover standard dispositivi */
.router-item:hover {
    transform: translateY(-6px) scale(1.1);
    filter: drop-shadow(0 20px 30px rgba(244, 124, 124, 0.5));
}

/* Hover SOLO Access Point (blu) */
.router-item:hover:has(.ap-img) {
    filter: drop-shadow(0 20px 30px rgba(54, 135, 192, 0.6));
}

/* Effetto solo immagine */
.router-img {
    transition: transform 0.4s ease;
}

.router-item:hover .router-img {
    transform: scale(1.05);
}

.router-separator {
    display: none !important;
}

/* ===============================
   MOBILE OPTIMIZATION
================================ */

@media (max-width: 768px) {

    body {
        font-size: 18px;
    }

    h1 {
        font-size: 28px;
    }

    h2 {
        font-size: 24px;
    }

    p {
        font-size: 18px;
    }

    button {
        font-size: 18px;
        padding: 14px 20px;
    }

    .wifi-btn,
    .velocita-btn {
        width: 100%;
        font-size: 18px;
        padding: 16px;
    }

    .router-img {
        width: 140px;
    }

    .step {
        padding: 20px;
    }
}

@media (max-width: 768px) {

    .router-wrapper {
        flex-direction: column;
        align-items: center;
        gap: 30px;
    }

}

/* ===============================
   TOAST + VALIDAZIONE INLINE
================================ */

.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #3687C0;
    color: #fff;
    padding: 12px 22px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    opacity: 0;
    pointer-events: none;
    z-index: 1000;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

select.error {
    border-color: #e74c3c;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.2);
}

/* ===============================
   LOGO BITFONIA (solo Step 1)
================================ */

.brand-logo {
    display: block;
    width: 120px;
    height: auto;
    margin: 4px auto 16px;
}

.brand-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, #d7e6f4, transparent);
    margin: 0 0 22px;
}