/* Aligned Soroban Abacus v8.0.0 - Perfect Number Alignment */

.aligned-soroban-container {
    max-width: 100%;
    margin: 30px auto;
    text-align: center;
    font-family: 'Times New Roman', Georgia, serif;

    /* Beautiful wooden background */
    background: 
        radial-gradient(ellipse at top, #f4e4bc 0%, #e6d4a6 30%, #d2b48c 100%),
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(139, 69, 19, 0.03) 2px,
            rgba(139, 69, 19, 0.03) 4px
        );

    padding: 30px;
    border-radius: 20px;

    /* Rich wooden frame shadows */
    box-shadow: 
        0 20px 40px rgba(139, 69, 19, 0.3),
        0 10px 20px rgba(101, 67, 33, 0.2),
        inset 0 1px 0 rgba(255, 248, 220, 0.8),
        inset 0 -1px 0 rgba(139, 69, 19, 0.2);

    border: 5px solid #8b4513;
    position: relative;
}

/* Wood grain texture */
.aligned-soroban-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 20px,
            rgba(139, 69, 19, 0.05) 20px,
            rgba(139, 69, 19, 0.05) 22px
        ),
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 3px,
            rgba(139, 69, 19, 0.02) 3px,
            rgba(139, 69, 19, 0.02) 6px
        );
    border-radius: 15px;
    pointer-events: none;
}

/* Numbers container - PERFECT ALIGNMENT */
.aligned-numbers-container {
    position: relative;
    margin: 0 auto 20px;
    max-width: 900px;
    width: 100%;
    height: 65px;

    background: 
        linear-gradient(135deg, #f8f4e6 0%, #f0e68c 50%, #deb887 100%);

    border: 6px ridge #8b4513;
    border-radius: 12px;

    box-shadow: 
        inset 0 4px 8px rgba(139, 69, 19, 0.4),
        inset 0 2px 4px rgba(101, 67, 33, 0.3),
        inset 0 -1px 2px rgba(255, 248, 220, 0.8),
        0 2px 4px rgba(139, 69, 19, 0.2);
}

.aligned-numbers {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
    font-size: 36px;
    font-weight: 900;
    color: #654321;
    font-family: 'Times New Roman', Georgia, serif;

    text-shadow: 
        2px 2px 4px rgba(139, 69, 19, 0.6),
        1px 1px 2px rgba(101, 67, 33, 0.8),
        0 0 1px rgba(255, 248, 220, 0.9),
        -1px -1px 2px rgba(139, 69, 19, 0.3);
}

/* PERFECT NUMBER ALIGNMENT - Each number perfectly centered above its column */
.aligned-numbers span {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    font-weight: 900;
    width: 40px;
    pointer-events: none;
}

/* Canvas */
.aligned-canvas {
    border: 8px ridge #654321;
    border-radius: 15px;

    background: 
        radial-gradient(ellipse at center, #f9f5e7 0%, #f0e68c 100%);

    cursor: pointer;
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto 25px;

    box-shadow: 
        0 15px 30px rgba(139, 69, 19, 0.4),
        0 8px 16px rgba(101, 67, 33, 0.3),
        inset 0 2px 4px rgba(255, 248, 220, 0.7),
        inset 0 -2px 4px rgba(139, 69, 19, 0.2);

    transition: all 0.3s ease;

    /* Ensure canvas maintains aspect ratio */
    width: 100%;
    max-width: 900px;
}

.aligned-canvas:hover {
    box-shadow: 
        0 18px 35px rgba(139, 69, 19, 0.5),
        0 10px 20px rgba(101, 67, 33, 0.4),
        inset 0 2px 4px rgba(255, 248, 220, 0.8),
        inset 0 -2px 4px rgba(139, 69, 19, 0.3);

    transform: translateY(-2px);
}

/* BEAUTIFUL CLEAR RESET BUTTON */
.aligned-reset-panel {
    text-align: center;
    margin-top: 25px;
}

.aligned-reset-btn {
    /* Clean, modern gradient */
    background: linear-gradient(135deg, #2c5530 0%, #3d7c47 100%);

    /* Clear, high-contrast text */
    color: #ffffff;

    /* Clean border */
    border: 3px solid #1e3a21;

    padding: 16px 32px;
    border-radius: 10px;

    /* Clear, readable typography */
    font-size: 16px;
    font-weight: 700;
    font-family: 'Arial', 'Helvetica', sans-serif;

    cursor: pointer;
    transition: all 0.3s ease;

    /* Clean shadow */
    box-shadow: 
        0 6px 12px rgba(44, 85, 48, 0.3),
        0 2px 4px rgba(0, 0, 0, 0.2);

    /* Clear text rendering */
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;

    /* Perfect button layout */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    /* Clear text */
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.5px;
    text-transform: none;
}

.aligned-reset-btn:hover {
    /* Brighter on hover */
    background: linear-gradient(135deg, #3d7c47 0%, #4a9656 100%);

    /* Enhanced shadow */
    box-shadow: 
        0 8px 16px rgba(44, 85, 48, 0.4),
        0 4px 8px rgba(0, 0, 0, 0.2);

    /* Lift effect */
    transform: translateY(-2px);

    /* Brighter text */
    color: #ffffff;
}

.aligned-reset-btn:active {
    /* Pressed effect */
    transform: translateY(0);
    box-shadow: 
        0 3px 6px rgba(44, 85, 48, 0.3),
        0 1px 2px rgba(0, 0, 0, 0.2);
}

.aligned-reset-btn:focus {
    outline: none;
    /* Clear focus ring */
    box-shadow: 
        0 0 0 3px rgba(61, 124, 71, 0.5),
        0 6px 12px rgba(44, 85, 48, 0.3);
}

/* Reset icon */
.reset-icon {
    font-size: 18px;
    font-weight: bold;
    transition: transform 0.3s ease;
    color: #ffffff;
}

.aligned-reset-btn:hover .reset-icon {
    transform: rotate(180deg);
}

/* Reset text */
.reset-text {
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #ffffff;
}

/* Success state */
.aligned-reset-btn.success {
    background: linear-gradient(135deg, #28a745 0%, #34ce57 100%);
    border-color: #1e7e34;
}

/* === RESPONSIVE BREAKPOINTS === */

/* Large screens - maintain full size */
@media (min-width: 1200px) {
    .aligned-soroban-container {
        max-width: 960px;
    }
}

/* Desktop - slight reduction */
@media (min-width: 992px) and (max-width: 1199px) {
    .aligned-soroban-container {
        padding: 25px;
        max-width: 940px;
    }

    .aligned-numbers {
        font-size: 34px;
    }

    .aligned-numbers span {
        width: 38px;
    }

    .aligned-canvas {
        border-width: 7px;
    }
}

/* Tablet - moderate scaling */
@media (min-width: 768px) and (max-width: 991px) {
    .aligned-soroban-container {
        padding: 20px;
        margin: 20px auto;
        border-width: 4px;
    }

    .aligned-numbers-container {
        height: 55px;
        border-width: 4px;
    }

    .aligned-numbers {
        font-size: 30px;
    }

    .aligned-numbers span {
        width: 35px;
    }

    .aligned-canvas {
        border-width: 6px;
        margin-bottom: 20px;
    }

    .aligned-reset-btn {
        padding: 14px 28px;
        font-size: 15px;
    }
}

/* Mobile - optimized but not tiny */
@media (max-width: 767px) {
    .aligned-soroban-container {
        margin: 15px;
        padding: 18px;
        border-width: 3px;
        border-radius: 15px;
    }

    .aligned-numbers-container {
        height: 50px;
        border-width: 3px;
        margin-bottom: 15px;
    }

    .aligned-numbers {
        font-size: 26px;
    }

    .aligned-numbers span {
        width: 32px;
    }

    .aligned-canvas {
        border-width: 5px;
        border-radius: 10px;
        margin-bottom: 18px;
    }

    .aligned-reset-btn {
        width: 100%;
        max-width: 300px;
        padding: 18px 28px;
        font-size: 16px;
        border-radius: 8px;
    }
}

/* Small mobile - minimal scaling */
@media (max-width: 480px) {
    .aligned-soroban-container {
        margin: 12px;
        padding: 15px;
        border-radius: 12px;
    }

    .aligned-numbers-container {
        height: 45px;
        margin-bottom: 12px;
    }

    .aligned-numbers {
        font-size: 22px;
    }

    .aligned-numbers span {
        width: 28px;
    }

    .aligned-canvas {
        border-width: 4px;
        border-radius: 8px;
    }

    .aligned-reset-btn {
        padding: 20px 24px;
        font-size: 16px;
        max-width: 280px;
    }
}

/* Touch device optimization */
@media (hover: none) and (pointer: coarse) {
    .aligned-canvas {
        cursor: default;
    }

    .aligned-reset-btn {
        min-height: 48px;
        padding: 18px 32px;
    }
}