/* General body styling */
body {
    margin: 0;
    font-family: 'Segoe UI', Arial, sans-serif;
    background-color: #f4f4f4;
    color: #222;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    background: linear-gradient(90deg, #4fd1ff 0%, #aeefff 100%);
    padding: 24px 0 16px 0;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
header h1 {
    margin: 0;
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: 1px;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px 8px 0 8px;
    box-sizing: border-box;
}

.flex-row {
    display: flex;
    align-items: flex-start;
    gap: 32px;
    width: 100%;
    flex-wrap: wrap;
    justify-content: center;
}

.canvas-group {
    display: flex;
    flex-direction: row;
    gap: 16px;
    flex-wrap: wrap;
    position: relative;
}

canvas {
    border: 1.5px solid #b2e0f7;
    box-shadow: 2px 2px 12px rgba(0,0,0,0.08);
    border-radius: 12px;
    background: transparent;
    max-width: 100%;
    height: auto;
    transition: box-shadow 0.2s;
}
canvas:focus, canvas:hover {
    box-shadow: 0 0 0 3px #4fd1ff44;
}

.card, #aiStats {
    background: rgba(255, 255, 255, 0.96);
    padding: 24px 20px;
    min-width: 240px;
    max-width: 320px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    border-radius: 12px;
    line-height: 1.7;
    font-size: 1.08rem;
    margin-top: 8px;
}

#fitness-section {
    width: 100%;
    display: flex;
    justify-content: center;
    margin: 32px 0 0 0;
}
#fitnessCanvas {
    display: block;
    margin: 0 auto;
    border: 1.5px solid #b2e0f7;
    background: #fff;
    box-shadow: 2px 2px 12px rgba(0,0,0,0.08);
    border-radius: 12px;
    max-width: 100%;
    height: auto;
}

footer {
    background: #e0f7fa;
    color: #333;
    text-align: center;
    padding: 18px 0 14px 0;
    font-size: 1.05rem;
    letter-spacing: 0.5px;
    margin-top: 32px;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.03);
}

@media (max-width: 1100px) {
    .flex-row {
        flex-direction: column;
        align-items: center;
        gap: 24px;
    }
    .canvas-group {
        flex-direction: column;
        align-items: center;
        gap: 16px;
    }
    #aiStats.card {
        max-width: 90vw;
        min-width: unset;
    }
}

@media (max-width: 900px) {
    .flex-row {
        flex-direction: column;
        align-items: center;
        gap: 18px;
    }
    .canvas-group {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
    canvas {
        max-width: 98vw;
        width: 98vw !important;
        height: auto !important;
    }
    #fitnessCanvas {
        max-width: 98vw;
        width: 98vw !important;
    }
}

@media (max-width: 600px) {
    header h1 {
        font-size: 1.1rem;
        padding: 0 4px;
    }
    main {
        padding: 4px 0 0 0;
    }
    .card, #aiStats {
        font-size: 0.92rem;
        padding: 8px 4px;
        min-width: unset;
        max-width: 98vw;
    }
    .flex-row {
        gap: 8px;
    }
    .canvas-group {
        gap: 6px;
    }
    #fitness-section {
        margin: 10px 0 0 0;
    }
    #fitnessCanvas {
        border-radius: 8px;
        font-size: 0.9rem;
    }
    footer {
        font-size: 0.85rem;
        padding: 7px 0 5px 0;
    }
}

/* Make overlay box and text scale on small screens */
@media (max-width: 600px) {
    canvas {
        font-size: 0.9rem !important;
    }
}

.floating-panel {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 1000;
    background: rgba(255,255,255,0.97);
    border-radius: 14px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.10);
    padding: 20px 22px 16px 22px;
    min-width: 220px;
    max-width: 90vw;
    font-size: 1rem;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
}
.floating-panel h2 {
    font-size: 1.1rem;
    margin: 0 0 8px 0;
    font-weight: 600;
    letter-spacing: 0.5px;
}
.floating-panel label {
    font-size: 0.98rem;
    margin-top: 6px;
    margin-bottom: 2px;
}
.floating-panel input[type="range"] {
    width: 100%;
    margin-bottom: 6px;
}
.floating-panel button {
    margin-top: 8px;
    padding: 8px 0;
    border: none;
    border-radius: 8px;
    background: linear-gradient(90deg, #4fd1ff 0%, #aeefff 100%);
    color: #222;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
}
.floating-panel button:hover {
    background: linear-gradient(90deg, #aeefff 0%, #4fd1ff 100%);
}

@media (max-width: 700px) {
    .floating-panel {
        top: unset;
        bottom: 12px;
        right: 50%;
        transform: translateX(50%);
        min-width: 180px;
        padding: 12px 8px 10px 8px;
        font-size: 0.95rem;
    }
    .floating-panel h2 {
        font-size: 1rem;
    }
}

.settings-toggle {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 1100;
    background: #fff;
    border: 2px solid #222c38;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    font-size: 1.7rem;
    color: #222c38;
    box-shadow: 0 2px 12px rgba(0,0,0,0.10);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s, border 0.2s;
    text-align: center;
    line-height: 1;
}
.settings-toggle:hover {
    background: #f4f8fb;
    color: #36405a;
    border: 2px solid #4fd1ff;
}

.floating-panel.hidden {
    display: none !important;
}

.nn-visualizer-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 12px;
}
.nn-visualizer-title {
    font-size: 1.08rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: #4fd1ff;
    letter-spacing: 0.5px;
    text-align: center;
}

@media (max-width: 700px) {
    .settings-toggle {
        top: unset;
        bottom: 70px;
        right: 16px;
        width: 38px;
        height: 38px;
        font-size: 1.2rem;
    }
}

.ai-overlay-controls.overlay-top-left {
    position: absolute;
    top: 30px;
    left: 30px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: rgba(255,255,255,0.85);
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    padding: 10px 12px;
}

.ai-overlay-controls.overlay-top-left button {
    font-size: 1rem;
    padding: 6px 12px;
    border-radius: 6px;
    border: none;
    background: linear-gradient(90deg, #4fd1ff 0%, #aeefff 100%);
    color: #222;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 4px;
    transition: background 0.2s;
}
.ai-overlay-controls.overlay-top-left button:hover {
    background: linear-gradient(90deg, #aeefff 0%, #4fd1ff 100%);
}

.ai-overlay-controls.overlay-top-right {
    position: absolute;
    top: 30px;
    right: 30px;
    left: auto;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: rgba(255,255,255,0.85);
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    padding: 10px 12px;
}

.ai-overlay-controls.overlay-top-right button {
    font-size: 1rem;
    padding: 6px 12px;
    border-radius: 6px;
    border: none;
    background: linear-gradient(90deg, #4fd1ff 0%, #aeefff 100%);
    color: #222;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 4px;
    transition: background 0.2s;
}
.ai-overlay-controls.overlay-top-right button:hover {
    background: linear-gradient(90deg, #aeefff 0%, #4fd1ff 100%);
}

@media (max-width: 700px) {
    .ai-overlay-controls.overlay-top-right {
        position: static;
        top: unset;
        right: unset;
        left: unset;
        bottom: unset;
        transform: none;
        flex-direction: row;
        gap: 12px;
        padding: 8px 10px;
        border-radius: 14px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.13);
        width: max-content;
        margin: 18px auto 0 auto;
        pointer-events: auto;
        background: rgba(255,255,255,0.95);
        justify-content: center;
    }
    .ai-overlay-controls.overlay-top-right button {
        margin-bottom: 0;
        font-size: 1.1rem;
        padding: 8px 14px;
    }
}

.ai-overlay-controls.overlay-top-right, .ai-overlay-controls.overlay-top-right button {
    pointer-events: auto;
}

