/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Courier New', monospace;
    line-height: 1.6;
    color: #fff;
    background-color: #000;
    position: relative;
    min-height: 100vh;
}

/* Screensaver Background */
.screensaver {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
    background: #000;
}

/* Prime Topbar */
.prime-topbar {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    justify-content: center;
    gap: 30px;
    white-space: nowrap;
    z-index: 10;
}

.topbar-prime {
    font-size: 24px;
    font-weight: bold;
    color: #ff0000;
    text-shadow: 0 0 10px rgba(255, 0, 0, 0.8);
    padding: 5px 15px;
    background: rgba(200, 0, 0, 0.3);
    border: 2px solid #ff0000;
    border-radius: 4px;
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.5);
}

.falling-element {
    position: absolute;
    padding: 6px 8px;
    background: rgba(200, 0, 0, 0.9);
    color: #fff;
    border-radius: 4px;
    font-size: 14px;
    white-space: nowrap;
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.5);
    z-index: 5;
    font-weight: bold;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.8);
    transition: opacity 0.3s ease;
}

.falling-element.afterimage {
    opacity: 0.7;
    background: rgba(150, 0, 0, 0.8);
    box-shadow: 0 0 5px rgba(255, 0, 0, 0.3);
}

.prime-highlight {
    font-size: 1.3em;
    font-weight: 900;
    color: #000000;
    text-shadow: 0 0 8px rgba(255, 0, 0, 1), 0 0 15px rgba(255, 50, 50, 0.8);
}

.result-highlight {
    font-size: 1.3em;
    font-weight: 900;
    color: #ffff00;
    text-shadow: 0 0 8px rgba(255, 255, 0, 1), 0 0 15px rgba(255, 200, 0, 0.8);
}

.multiplier-highlight {
    text-shadow: 0 0 8px rgba(255, 255, 255, 1), 0 0 15px rgba(255, 255, 255, 0.6);
}

/* Animated Tree on Screensaver */
.animated-tree {
    position: fixed;
    top: 100px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid #ff0000;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 18px;
    color: #fff;
    z-index: 20;
    max-width: 45vw;
    overflow: visible;
    box-shadow: 0 0 20px rgba(255, 0, 0, 0.5);
}

.animated-tree.left {
    left: 20px;
}

.animated-tree.right {
    right: 20px;
}

.animated-tree.single {
    left: 20px;
    max-width: 90vw;
}

.tree-title {
    margin-bottom: 15px;
    font-size: 32px;
    font-weight: 900;
    color: #ffffff;
    animation: titlePulse 2s ease-in-out infinite;
    text-shadow: 
        0 0 5px rgba(255, 255, 255, 1),
        0 0 10px rgba(255, 255, 255, 1),
        0 0 20px rgba(255, 255, 255, 1),
        0 0 40px rgba(255, 255, 255, 0.8),
        0 0 60px rgba(255, 255, 255, 0.6),
        0 0 80px rgba(255, 255, 255, 0.4),
        0 0 100px rgba(255, 255, 255, 0.2),
        3px 3px 6px rgba(0, 0, 0, 0.9);
}

.tree-node {
    opacity: 0;
    animation: fadeInGlow 0.5s forwards, pulse 2s ease-in-out infinite;
    font-weight: 900;
    font-size: 24px;
    color: #ff0000;
    text-shadow: 
        0 0 5px rgba(255, 0, 0, 1),
        0 0 10px rgba(255, 0, 0, 1),
        0 0 20px rgba(255, 0, 0, 1),
        0 0 40px rgba(255, 0, 0, 0.8),
        0 0 60px rgba(255, 0, 0, 0.6),
        0 0 80px rgba(255, 0, 0, 0.4),
        2px 2px 4px rgba(0, 0, 0, 0.8);
}

.tree-node.tree-root {
    font-size: 28px;
    font-weight: 900;
    color: #ffffff;
    animation: fadeInGlow 0.5s forwards, titlePulse 2s ease-in-out infinite;
    text-shadow: 
        0 0 5px rgba(255, 255, 255, 1),
        0 0 10px rgba(255, 255, 255, 1),
        0 0 20px rgba(255, 255, 255, 1),
        0 0 40px rgba(255, 255, 255, 0.8),
        0 0 60px rgba(255, 255, 255, 0.6),
        0 0 80px rgba(255, 255, 255, 0.4),
        0 0 100px rgba(255, 255, 255, 0.2),
        3px 3px 6px rgba(0, 0, 0, 0.9);
}

.tree-node.shared {
    color: #00ff00;
    font-weight: 900;
    font-size: 18px;
    text-shadow: 
        0 0 5px rgba(0, 255, 0, 1),
        0 0 10px rgba(0, 255, 0, 1),
        0 0 20px rgba(0, 255, 0, 1),
        0 0 40px rgba(0, 255, 0, 0.8),
        0 0 60px rgba(0, 255, 0, 0.6),
        0 0 80px rgba(0, 255, 0, 0.4),
        2px 2px 4px rgba(0, 0, 0, 0.8);
}

.shared-prime {
    color: #00ff00;
    font-weight: 900;
    font-size: 24px;
    animation: greenPulse 1.5s ease-in-out infinite;
    text-shadow: 
        0 0 5px rgba(0, 255, 0, 1),
        0 0 10px rgba(0, 255, 0, 1),
        0 0 20px rgba(0, 255, 0, 1),
        0 0 40px rgba(0, 255, 0, 1),
        0 0 60px rgba(0, 255, 0, 0.8),
        0 0 80px rgba(0, 255, 0, 0.6),
        0 0 100px rgba(0, 255, 0, 0.4),
        2px 2px 4px rgba(0, 0, 0, 0.9);
}

@keyframes fadeInGlow {
    to {
        opacity: 1;
    }
}

@keyframes titlePulse {
    0%, 100% {
        text-shadow: 
            0 0 5px rgba(255, 255, 255, 1),
            0 0 10px rgba(255, 255, 255, 1),
            0 0 20px rgba(255, 255, 255, 1),
            0 0 40px rgba(255, 255, 255, 0.8),
            0 0 60px rgba(255, 255, 255, 0.6),
            0 0 80px rgba(255, 255, 255, 0.4),
            0 0 100px rgba(255, 255, 255, 0.2),
            3px 3px 6px rgba(0, 0, 0, 0.9);
    }
    50% {
        text-shadow: 
            0 0 10px rgba(255, 255, 255, 1),
            0 0 20px rgba(255, 255, 255, 1),
            0 0 30px rgba(255, 255, 255, 1),
            0 0 50px rgba(255, 255, 255, 1),
            0 0 70px rgba(255, 255, 255, 0.8),
            0 0 90px rgba(255, 255, 255, 0.6),
            0 0 120px rgba(255, 255, 255, 0.4),
            3px 3px 6px rgba(0, 0, 0, 0.9);
    }
}

@keyframes pulse {
    0%, 100% {
        text-shadow: 
            0 0 5px rgba(255, 0, 0, 1),
            0 0 10px rgba(255, 0, 0, 1),
            0 0 20px rgba(255, 0, 0, 1),
            0 0 40px rgba(255, 0, 0, 0.8),
            0 0 60px rgba(255, 0, 0, 0.6),
            0 0 80px rgba(255, 0, 0, 0.4),
            2px 2px 4px rgba(0, 0, 0, 0.8);
    }
    50% {
        text-shadow: 
            0 0 10px rgba(255, 0, 0, 1),
            0 0 20px rgba(255, 0, 0, 1),
            0 0 30px rgba(255, 0, 0, 1),
            0 0 50px rgba(255, 0, 0, 1),
            0 0 70px rgba(255, 0, 0, 0.8),
            0 0 90px rgba(255, 0, 0, 0.6),
            2px 2px 4px rgba(0, 0, 0, 0.8);
    }
}

@keyframes greenPulse {
    0%, 100% {
        text-shadow: 
            0 0 5px rgba(0, 255, 0, 1),
            0 0 10px rgba(0, 255, 0, 1),
            0 0 20px rgba(0, 255, 0, 1),
            0 0 40px rgba(0, 255, 0, 1),
            0 0 60px rgba(0, 255, 0, 0.8),
            0 0 80px rgba(0, 255, 0, 0.6),
            0 0 100px rgba(0, 255, 0, 0.4),
            2px 2px 4px rgba(0, 0, 0, 0.9);
    }
    50% {
        text-shadow: 
            0 0 10px rgba(0, 255, 0, 1),
            0 0 20px rgba(0, 255, 0, 1),
            0 0 30px rgba(0, 255, 0, 1),
            0 0 50px rgba(0, 255, 0, 1),
            0 0 70px rgba(0, 255, 0, 1),
            0 0 90px rgba(0, 255, 0, 0.8),
            0 0 120px rgba(0, 255, 0, 0.6),
            2px 2px 4px rgba(0, 0, 0, 0.9);
    }
}

.falling-prime {
    position: absolute;
    padding: 15px 20px;
    background: linear-gradient(135deg, #ff0000, #ff6600);
    color: #fff;
    border-radius: 8px;
    font-size: 32px;
    font-weight: bold;
    white-space: nowrap;
    box-shadow: 0 0 30px rgba(255, 100, 0, 0.9), 0 0 60px rgba(255, 0, 0, 0.6);
    z-index: 15;
    text-shadow: 0 0 10px rgba(255, 255, 255, 1), 0 0 20px rgba(255, 200, 0, 0.8);
    animation: glow 1.5s ease-in-out infinite alternate, fall linear forwards;
    border: 3px solid rgba(255, 200, 0, 0.8);
    cursor: pointer;
    transition: transform 0.2s;
    pointer-events: auto; /* Enable clicks even though parent has pointer-events: none */
}

.falling-prime:hover {
    transform: scale(1.2);
    box-shadow: 0 0 50px rgba(255, 150, 0, 1), 0 0 100px rgba(255, 50, 0, 0.9);
}

@keyframes glow {
    from {
        box-shadow: 0 0 20px rgba(255, 100, 0, 0.9), 0 0 40px rgba(255, 0, 0, 0.6);
        text-shadow: 0 0 10px rgba(255, 255, 255, 1), 0 0 20px rgba(255, 200, 0, 0.8);
    }
    to {
        box-shadow: 0 0 40px rgba(255, 150, 0, 1), 0 0 80px rgba(255, 50, 0, 0.8);
        text-shadow: 0 0 15px rgba(255, 255, 255, 1), 0 0 30px rgba(255, 255, 0, 1);
    }
}

@keyframes fall {
    to {
        transform: translateY(100vh);
        opacity: 0;
    }
}

/* Fullscreen Overlay */
.fullscreen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.fullscreen-overlay.hidden {
    display: none;
}

.screensaver-fullscreen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.exit-fullscreen-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    padding: 10px 20px;
    background: rgba(200, 0, 0, 0.8);
    color: #fff;
    border: 2px solid #ff0000;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    z-index: 1001;
    transition: all 0.3s;
}

.exit-fullscreen-btn:hover {
    background: rgba(255, 0, 0, 0.9);
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.8);
}

/* Header Styles */
header {
    background-color: #1a0000;
    color: #ff0000;
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(255, 0, 0, 0.3);
    position: relative;
    z-index: 10;
    border-bottom: 2px solid #ff0000;
}

header h1 {
    text-align: center;
    margin-bottom: 1rem;
    font-size: 2rem;
    text-shadow: 0 0 10px rgba(255, 0, 0, 0.8);
}

nav ul {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

nav a {
    color: #ff6666;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: all 0.3s;
    border: 1px solid transparent;
}

nav a:hover {
    background-color: rgba(255, 0, 0, 0.2);
    border-color: #ff0000;
    text-shadow: 0 0 5px rgba(255, 0, 0, 0.8);
}

/* Main Content */
main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
    position: relative;
    z-index: 10;
}

.tool-section {
    background-color: rgba(26, 0, 0, 0.9);
    padding: 2rem;
    margin-bottom: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(255, 0, 0, 0.3);
    border: 1px solid rgba(255, 0, 0, 0.3);
    backdrop-filter: blur(5px);
}

.tool-section h2 {
    color: #ff0000;
    margin-bottom: 1rem;
    font-size: 1.8rem;
    text-shadow: 0 0 5px rgba(255, 0, 0, 0.5);
}

.collapsible-header {
    cursor: pointer;
    user-select: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: color 0.3s;
}

.collapsible-header:hover {
    color: #ff6666;
}

.collapse-icon {
    font-size: 1.2rem;
    transition: transform 0.3s;
}

.collapsible-header.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

.collapsible-content {
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
    max-height: 5000px;
    opacity: 1;
}

.collapsible-content.collapsed {
    max-height: 0;
    opacity: 0;
}

.tool-section p {
    margin-bottom: 1.5rem;
    color: #ff9999;
}

/* Input Groups */
.input-group {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.input-group label {
    font-weight: 500;
    color: #ff6666;
}

.input-group input[type="number"] {
    padding: 0.5rem;
    border: 2px solid #660000;
    border-radius: 4px;
    font-size: 1rem;
    width: 150px;
    background: #1a0000;
    color: #fff;
}

.input-group input[type="number"]:focus {
    outline: none;
    border-color: #ff0000;
    box-shadow: 0 0 5px rgba(255, 0, 0, 0.5);
}

.input-group input[type="range"] {
    flex: 1;
    max-width: 200px;
}

.input-group input[type="checkbox"] {
    margin-right: 0.5rem;
    cursor: pointer;
}

.input-group label {
    cursor: pointer;
    display: flex;
    align-items: center;
}

.input-group button {
    padding: 0.5rem 1.5rem;
    background-color: #cc0000;
    color: #fff;
    border: 2px solid #ff0000;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: bold;
}

.input-group button:hover {
    background-color: #ff0000;
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.8);
}

.input-group button:active {
    transform: scale(0.98);
}

/* Tree Container */
.tree-container {
    margin-top: 2rem;
    padding: 1rem;
    background-color: #0a0000;
    border-radius: 4px;
    min-height: 100px;
    border: 1px solid rgba(255, 0, 0, 0.2);
}

/* Compare Container */
.compare-container {
    margin-top: 2rem;
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.compare-tree {
    flex: 1;
    min-width: 300px;
    padding: 1rem;
    background-color: #0a0000;
    border-radius: 4px;
    border: 1px solid rgba(255, 0, 0, 0.2);
}

.compare-tree h4 {
    color: #ff0000;
    margin-bottom: 1rem;
    text-align: center;
}

.tree-display {
    font-family: 'Courier New', monospace;
    font-size: 16px;
    line-height: 1.8;
    padding: 1rem;
    background-color: #000;
    border-radius: 4px;
    margin-bottom: 1rem;
    overflow-x: auto;
    color: #ff0000;
    border: 1px solid rgba(255, 0, 0, 0.3);
}

.tree-line {
    white-space: pre;
    color: #ff6666;
}

.prime-factors {
    font-size: 1.2rem;
    font-weight: 500;
    color: #ff0000;
    margin-top: 1rem;
    padding: 0.5rem;
    background-color: rgba(255, 0, 0, 0.1);
    border-radius: 4px;
    border-left: 4px solid #ff0000;
}

.divisibility-tricks {
    margin-top: 1.5rem;
    padding: 1rem;
    background-color: rgba(0, 100, 255, 0.1);
    border-radius: 4px;
    border-left: 4px solid #0066ff;
}

.divisibility-tricks h4 {
    color: #66aaff;
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

.trick-explanation {
    color: #99ccff;
    font-size: 1rem;
    margin: 0.5rem 0;
    padding-left: 0.5rem;
}

.shared-factor {
    color: #00ff00;
    background-color: rgba(0, 255, 0, 0.2);
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: bold;
}

/* Result Display */
.result-display {
    margin-top: 1rem;
    padding: 1rem;
    min-height: 60px;
}

.result-success {
    font-size: 1.3rem;
    color: #00ff00;
    padding: 1rem;
    background-color: rgba(0, 100, 0, 0.2);
    border-radius: 4px;
    border-left: 4px solid #00ff00;
}

.progress-display {
    margin-top: 0.5rem;
    padding: 0.5rem;
    color: #ff9999;
    font-style: italic;
}

.loading {
    text-align: center;
    padding: 2rem;
    color: #ff6666;
    font-style: italic;
}

.error {
    color: #ff0000;
    padding: 1rem;
    background-color: rgba(255, 0, 0, 0.1);
    border-radius: 4px;
    border-left: 4px solid #ff0000;
}

/* Footer */
footer {
    background-color: #1a0000;
    color: #ff6666;
    text-align: center;
    padding: 1rem 0;
    margin-top: 2rem;
    position: relative;
    z-index: 10;
    border-top: 2px solid #ff0000;
}

/* Fullscreen mode - hide content */
body.fullscreen-mode .content-header,
body.fullscreen-mode .content-main,
body.fullscreen-mode .content-footer {
    display: none;
}

body.fullscreen-mode .screensaver {
    z-index: 999;
}

/* Responsive Design */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.5rem;
    }

    nav ul {
        flex-direction: column;
        gap: 0.5rem;
        align-items: center;
    }

    main {
        margin: 1rem auto;
    }

    .tool-section {
        padding: 1.5rem;
    }

    .input-group {
        flex-direction: column;
        align-items: stretch;
    }

    .input-group input[type="number"],
    .input-group input[type="range"] {
        width: 100%;
    }

    .tree-display {
        font-size: 12px;
    }

    .result-success {
        font-size: 1.1rem;
    }
    
    /* Ensure main content is visible above screensaver on small screens */
    main {
        position: relative;
        z-index: 10;
    }
}

/* Animation for falling elements */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.falling-element {
    animation: fadeIn 0.3s ease-in;
}

/* Divisibility Tricks Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.8);
    animation: fadeIn 0.3s ease-in;
}

.modal-content {
    background: linear-gradient(135deg, #1a0000, #330000);
    margin: 5% auto;
    padding: 2rem;
    border: 2px solid #ff0000;
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    box-shadow: 0 0 30px rgba(255, 0, 0, 0.5);
    position: relative;
}

.modal-close {
    color: #ff6666;
    float: right;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    transition: color 0.3s;
}

.modal-close:hover,
.modal-close:focus {
    color: #ff0000;
}

.modal-content h2 {
    color: #ff0000;
    margin-bottom: 1.5rem;
    text-align: center;
}

.divisibility-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
}

.divisibility-table thead {
    background-color: rgba(255, 0, 0, 0.2);
}

.divisibility-table th {
    color: #ff6666;
    padding: 0.75rem;
    text-align: left;
    border-bottom: 2px solid #ff0000;
    font-weight: bold;
}

.divisibility-table td {
    color: #ffcccc;
    padding: 0.75rem;
    border-bottom: 1px solid rgba(255, 0, 0, 0.2);
}

.divisibility-table td:first-child {
    color: #ff0000;
    font-weight: bold;
    text-align: center;
    width: 80px;
}

.divisibility-table tr:hover {
    background-color: rgba(255, 0, 0, 0.1);
}

.modal-sources {
    text-align: center;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 0, 0, 0.3);
}

.modal-sources small {
    color: #666;
    font-size: 0.85rem;
}

.modal-sources a {
    color: #999;
    text-decoration: none;
    transition: color 0.3s;
}

.modal-sources a:hover {
    color: #ff6666;
}

@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 1rem;
    }
    
    .divisibility-table {
        font-size: 0.9rem;
    }
    
    .divisibility-table th,
    .divisibility-table td {
        padding: 0.5rem;
    }
}

/* Divisibility Check Results */
.divisibility-results {
    margin-top: 1rem;
    padding: 1.5rem;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    border: 2px solid #ff0000;
}

.divisibility-results h4 {
    color: #ff0000;
    margin-bottom: 1.5rem;
    text-align: center;
    font-size: 1.3rem;
}

.divisibility-results h5 {
    margin: 1rem 0 0.75rem 0;
    font-size: 1.1rem;
}

.divisible-section,
.not-divisible-section {
    margin-bottom: 1.5rem;
}

.divisible-list,
.not-divisible-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.divisible-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    background-color: rgba(0, 255, 0, 0.2);
    color: #00ff00;
    border: 2px solid #00ff00;
    border-radius: 4px;
    font-weight: bold;
    font-size: 1.1rem;
}

.not-divisible-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    background-color: rgba(255, 0, 0, 0.1);
    color: #ff6666;
    border: 1px solid rgba(255, 0, 0, 0.3);
    border-radius: 4px;
    font-size: 1rem;
}

.secondary-btn {
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #0066ff, #0044cc);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    transition: all 0.3s;
    box-shadow: 0 2px 5px rgba(0, 100, 255, 0.3);
}

.secondary-btn:hover {
    background: linear-gradient(135deg, #0088ff, #0066ff);
    box-shadow: 0 4px 10px rgba(0, 100, 255, 0.5);
    transform: translateY(-2px);
}

/* Update table to accommodate 3 columns */
.divisibility-table td:first-child {
    width: 60px;
}

.divisibility-table td:last-child {
    color: #99ccff;
    font-style: italic;
    font-size: 0.9rem;
}

/* Green highlighting for examples in divisibility table */
.highlight-green {
    color: #00ff00;
    font-weight: bold;
    background-color: rgba(0, 255, 0, 0.15);
    padding: 2px 4px;
    border-radius: 3px;
}

/* Divisibility tricks display in check results */
.tricks-for-number {
    margin-top: 1.5rem;
    padding: 1rem;
    background-color: rgba(0, 100, 255, 0.1);
    border-radius: 4px;
    border-left: 4px solid #0066ff;
}

.trick-item {
    margin: 1rem 0;
    padding: 0.75rem;
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.trick-header {
    color: #66aaff;
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.trick-application {
    color: #99ccff;
    font-size: 0.95rem;
    padding-left: 1rem;
    font-style: italic;
}

/* Calculator button in nav */
.nav-btn {
    background: linear-gradient(135deg, #ff0000, #cc0000);
    color: #fff;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    transition: all 0.3s;
}

.nav-btn:hover {
    background: linear-gradient(135deg, #ff3333, #ff0000);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(255, 0, 0, 0.5);
}

/* Calculator Modal */
.calculator-content {
    max-width: 400px;
    padding: 1.5rem;
}

.calculator {
    margin-top: 1rem;
}

.calc-display {
    width: 100%;
    padding: 1rem;
    font-size: 2rem;
    text-align: right;
    background-color: rgba(0, 0, 0, 0.5);
    border: 2px solid #ff0000;
    border-radius: 4px;
    color: #fff;
    margin-bottom: 1rem;
    font-family: 'Courier New', monospace;
}

.calc-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.calc-btn {
    padding: 1.25rem;
    font-size: 1.25rem;
    font-weight: bold;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    color: #fff;
}

.calc-number {
    background: linear-gradient(135deg, #333, #222);
}

.calc-number:hover {
    background: linear-gradient(135deg, #444, #333);
    transform: scale(1.05);
}

.calc-operator {
    background: linear-gradient(135deg, #ff6600, #cc5500);
}

.calc-operator:hover {
    background: linear-gradient(135deg, #ff8833, #ff6600);
    transform: scale(1.05);
}

.calc-equals {
    background: linear-gradient(135deg, #00cc00, #009900);
    grid-row: span 2;
}

.calc-equals:hover {
    background: linear-gradient(135deg, #00ff00, #00cc00);
    transform: scale(1.05);
}

.calc-clear {
    background: linear-gradient(135deg, #cc0000, #990000);
}

.calc-clear:hover {
    background: linear-gradient(135deg, #ff0000, #cc0000);
    transform: scale(1.05);
}

.calc-delete {
    background: linear-gradient(135deg, #666, #444);
}

.calc-delete:hover {
    background: linear-gradient(135deg, #777, #555);
    transform: scale(1.05);
}

.calc-zero {
    grid-column: span 2;
}

.calc-decimal {
    background: linear-gradient(135deg, #333, #222);
}

.calc-decimal:hover {
    background: linear-gradient(135deg, #444, #333);
    transform: scale(1.05);
}

.calculator-close {
    color: #ff6666;
}

@media (max-width: 768px) {
    .calculator-content {
        width: 95%;
        max-width: 350px;
    }
    
    .calc-btn {
        padding: 1rem;
        font-size: 1.1rem;
    }
    
    .calc-display {
        font-size: 1.5rem;
    }
}
