* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f8f9fa;
    min-height: 100vh;
    padding: 10px;
    margin: 0;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    padding: 20px;
}

@media (min-width: 768px) {
    body {
        padding: 20px;
    }
    
    .container {
        padding: 40px;
    }
}

h1 {
    text-align: center;
    color: #111;
    margin-bottom: 30px;
    font-size: 1.8rem;
    font-weight: 600;
}

@media (min-width: 768px) {
    h1 {
        font-size: 2.5rem;
        margin-bottom: 40px;
    }
}

.controls {
    background: #fff;
    border: 1px solid #e1e8ed;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

/* Controls Grid Styles */
.controls-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 25px;
}

@media (min-width: 768px) {
    .controls-grid {
        flex-direction: row;
        justify-content: center;
        gap: 40px;
    }
}

.control-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

@media (min-width: 768px) {
    .control-group {
        flex-direction: row;
        gap: 20px;
    }
}

.control-label {
    font-size: 16px;
    font-weight: 600;
    color: #34495e;
    text-align: center;
    min-width: 80px;
}

.toggle-group {
    display: flex;
    flex-flow: row nowrap;
    justify-content: center;
    align-items: stretch;
    font-size: 0;
        border-radius: 8px;
        overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.toggle-group input[type="radio"] {
    width: 0;
    height: 0;
    position: absolute;
    left: -9999px;
}

.toggle-group input[type="radio"] + label {
    margin: 0 -1px 0 0;
    padding: 14px 24px;
    box-sizing: border-box;
    position: relative;
    display: inline-block;
        border: 1px solid #ced4da;
    background: #f8f9fa;
    font-size: 14px;
    line-height: 1.4;
    font-weight: 600;
    text-align: center;
    color: #495057;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 80px;
}

.toggle-group input[type="radio"] + label:first-of-type {
    border-radius: 8px 0 0 8px;
    border-right: none;
}

.toggle-group input[type="radio"] + label:last-of-type {
    border-radius: 0 8px 8px 0;
    border-left: none;
}

.toggle-group input[type="radio"]:hover + label {
    background: #e2e6ea;
    z-index: 1;
}

.toggle-group input[type="radio"]:checked + label {
    background: #007bff;
    color: #fff;
    border-color: #007bff;
    z-index: 2;
}

.toggle-group input[type="radio"]:focus + label {
    border-color: #007bff;
    outline: 2px solid #80bdff;
    outline-offset: -2px;
    z-index: 3;
    /* Remove vertical movement on active */
    transform: none;
}

.toggle-group input[type="radio"]:disabled + label {
    background: #f8f9fa !important;
    color: #6c757d !important;
    cursor: not-allowed;
    box-shadow: none !important;
    transform: none !important;
}

@media (max-width: 480px) {
    .toggle-group input[type="radio"] + label {
        padding: 12px 16px;
        font-size: 13px;
        min-width: 70px;
    }
}

/* Action Buttons */
.button-row {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 25px;
}

@media (min-width: 768px) {
    .button-row {
        flex-direction: row;
        justify-content: center;
        gap: 15px;
    }
}

.action-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 14px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    width: 100%;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
    box-shadow: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

@media (min-width: 768px) {
    .action-btn {
        min-width: 160px;
        width: auto;
    }
}

.action-btn:hover {
    background: #0056b3;
    transform: translateY(-2px);
    box-shadow: none;
}

.action-btn:active {
    transform: translateY(0);
    box-shadow: none;
}

.action-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.instructions {
    background: #f8f9fa;
    border: 1px solid #e1e8ed;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 12px;
}

.instructions p {
    margin-bottom: 10px;
    color: #495057;
    font-size: 14px;
    line-height: 1.6;
}

.instructions p:last-child {
    margin-bottom: 0;
}

.instructions strong {
    color: #2c3e50;
    font-weight: 600;
}

#canvas-container {
    display: flex;
    justify-content: center;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
    margin: 0 -10px;
}

@media (min-width: 768px) {
    #canvas-container {
        margin: 0;
    }
}

canvas {
    display: block;
    max-width: 100%;
    height: auto;
}