* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: #111;
    color: #e0e0e0;
    font-family: -apple-system, 'Segoe UI', Arial, sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Setup Screen */
.setup-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.setup-box {
    text-align: center;
    width: 100%;
    max-width: 360px;
}

.setup-box h1 {
    font-size: 24px;
    margin-bottom: 24px;
    color: #4fc3f7;
}

.setup-box button {
    display: block;
    width: 100%;
    padding: 14px;
    font-size: 17px;
    background: #1976d2;
    color: #fff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    margin-bottom: 8px;
}

.setup-box button:active {
    background: #1565c0;
}

.divider {
    color: #666;
    margin: 16px 0;
    font-size: 14px;
}

.setup-box input {
    width: 100%;
    padding: 14px;
    font-size: 24px;
    text-align: center;
    letter-spacing: 6px;
    text-transform: uppercase;
    background: #1a1a1a;
    border: 2px solid #333;
    border-radius: 10px;
    color: #fff;
    outline: none;
    margin-bottom: 8px;
}

.setup-box input:focus {
    border-color: #4fc3f7;
}

.error {
    color: #ef5350;
    margin-top: 8px;
    min-height: 20px;
    font-size: 14px;
}

/* Control Panel */
.control-panel {
    max-width: 500px;
    margin: 0 auto;
    padding-bottom: 40px;
}

/* Tablet: two-column layout */
@media (min-width: 768px) {
    .control-panel {
        max-width: 900px;
    }

    .controls-scroll {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        padding: 12px 20px;
    }

    .control-group {
        margin-bottom: 0;
    }

    .control-group.scenarios {
        grid-column: 1 / -1;
    }

    .rhythm-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .scenario-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Desktop: three-column layout */
@media (min-width: 1200px) {
    .control-panel {
        max-width: 1400px;
    }

    .controls-scroll {
        grid-template-columns: 1fr 1fr 1fr;
    }

    .header {
        padding: 16px 24px;
    }

    .header h2 {
        font-size: 22px;
    }

    .control-header label {
        font-size: 16px;
    }

    .control-value {
        font-size: 22px;
    }

    .preset-row button {
        padding: 10px 6px;
        font-size: 13px;
    }

    .rhythm-btn {
        padding: 14px 8px;
        font-size: 14px;
    }

    .scenario-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .scenario-btn {
        padding: 16px 10px;
        font-size: 15px;
    }
}

.header {
    position: sticky;
    top: 0;
    background: #111;
    padding: 12px 16px;
    border-bottom: 1px solid #333;
    z-index: 10;
}

.header h2 {
    font-size: 18px;
    color: #4fc3f7;
}

.header-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 4px;
    gap: 12px;
}

.hint {
    font-size: 12px;
    color: #666;
}

.copy-btn {
    flex-shrink: 0;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    background: #2a2a2a;
    color: #4fc3f7;
    border: 1px solid #4fc3f7;
    border-radius: 6px;
    cursor: pointer;
}

.copy-btn:active {
    background: #1a3a4a;
}

.controls-scroll {
    padding: 8px 16px;
}

.control-group {
    background: #1a1a1a;
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 10px;
}

.control-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.control-header label {
    font-weight: 600;
    font-size: 15px;
}

.control-value {
    font-size: 18px;
    font-weight: bold;
    color: #4fc3f7;
    font-variant-numeric: tabular-nums;
}

.sub-label {
    font-size: 12px;
    color: #888;
    margin-top: 6px;
    display: block;
}

/* Range sliders */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 36px;
    background: transparent;
    outline: none;
}

input[type="range"]::-webkit-slider-track {
    height: 6px;
    background: #333;
    border-radius: 3px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 28px;
    height: 28px;
    background: #4fc3f7;
    border-radius: 50%;
    margin-top: -11px;
    cursor: pointer;
}

input[type="range"]::-moz-range-track {
    height: 6px;
    background: #333;
    border-radius: 3px;
    border: none;
}

input[type="range"]::-moz-range-thumb {
    width: 28px;
    height: 28px;
    background: #4fc3f7;
    border-radius: 50%;
    border: none;
    cursor: pointer;
}

/* Preset buttons */
.preset-row {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.preset-row button {
    flex: 1;
    min-width: 70px;
    padding: 8px 4px;
    font-size: 12px;
    background: #2a2a2a;
    color: #ccc;
    border: 1px solid #444;
    border-radius: 8px;
    cursor: pointer;
}

.preset-row button:active {
    background: #3a3a3a;
    border-color: #4fc3f7;
}

/* Rhythm buttons */
.rhythm-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.rhythm-btn {
    padding: 12px 6px;
    font-size: 13px;
    font-weight: 600;
    background: #2a2a2a;
    color: #ccc;
    border: 2px solid #444;
    border-radius: 10px;
    cursor: pointer;
}

.rhythm-btn.active {
    background: #1a3a4a;
    border-color: #4fc3f7;
    color: #4fc3f7;
}

.rhythm-btn.danger {
    border-color: #633;
    color: #ef9a9a;
}

.rhythm-btn.danger.active {
    background: #4a1a1a;
    border-color: #ef5350;
    color: #ef5350;
}

.rhythm-btn:active {
    transform: scale(0.96);
}

/* Scenario buttons */
.scenario-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}

.scenario-btn {
    padding: 14px 8px;
    font-size: 14px;
    font-weight: 600;
    background: #1a2a1a;
    color: #a5d6a7;
    border: 1px solid #2e5a2e;
    border-radius: 10px;
    cursor: pointer;
}

.scenario-btn.danger {
    background: #3a1a1a;
    color: #ef9a9a;
    border-color: #5a2a2a;
}

.scenario-btn:active {
    transform: scale(0.96);
}
