/* RESET & BOX SIZING */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Horizontal Sliders for Visual Feedback */
.horizontal-sliders {
    position: absolute;
    right: 25%;
    top: 45%;
    transform: translate(50%, -50%);
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 280px;
    z-index: 10;
    transition: top 0.8s ease-in-out;
}

.horizontal-sliders.results-mode {
    top: 60%;
}

.horizontal-sliders .slider-group {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(240, 240, 240, 0.9);
    padding: 8px 12px;
    border-radius: 8px;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(200, 200, 200, 0.6);
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.horizontal-sliders .slider-group label {
    color: #333;
    font-weight: 700;
    font-size: 14px;
    min-width: 20px;
    text-align: center;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

.horizontal-sliders .slider-group input[type="range"] {
    flex: 1;
    height: 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.4);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
}

.horizontal-sliders .slider-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
    transition: all 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.3);
}

.horizontal-sliders .slider-group input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    border: 1px solid rgba(0, 0, 0, 0.3);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
    transition: all 0.3s ease;
}

.horizontal-sliders .slider-group .slider-value {
    color: #333;
    font-weight: 700;
    font-size: 14px;
    min-width: 30px;
    text-align: center;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

.horizontal-sliders .slider-group.active-slider {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(0, 184, 148, 0.6);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 184, 148, 0.2);
}



.horizontal-sliders .slider-group input[type="range"]:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Slider markers for attempts and solutions */


/* Ensure all markers have identical dimensions */
.slider-marker-first,
.slider-marker-second,
.slider-marker-third,
.slider-marker-solution {
    position: absolute;
    top: -10px;
    width: 6px;
    height: 24px;
    border-radius: 3px;
    pointer-events: none;
    z-index: 5;
    opacity: 0;
    transition: opacity 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    box-sizing: border-box;
    border: none;
    outline: none;
    margin: 0;
    padding: 0;
}

.slider-marker-first {
    background: #ff6b6b;
}

.slider-marker-second {
    background: #4ecdc4;
}

.slider-marker-third {
    background: #fdcb6e;
}

.slider-marker-solution {
    background: #2d3436;
}

.slider-marker-first.active,
.slider-marker-second.active,
.slider-marker-third.active,
.slider-marker-solution.active {
    opacity: 1;
}

/* Slider knob colors based on attempts */
.horizontal-sliders .slider-group input[type="range"].use-attempt1::-webkit-slider-thumb {
    background: #ff6b6b;
}

.horizontal-sliders .slider-group input[type="range"].use-attempt1::-moz-range-thumb {
    background: #ff6b6b;
}

.horizontal-sliders .slider-group input[type="range"].use-attempt2::-webkit-slider-thumb {
    background: #4ecdc4;
}

.horizontal-sliders .slider-group input[type="range"].use-attempt2::-moz-range-thumb {
    background: #4ecdc4;
}

.horizontal-sliders .slider-group input[type="range"].use-attempt3::-webkit-slider-thumb {
    background: #fdcb6e;
}

.horizontal-sliders .slider-group input[type="range"].use-attempt3::-moz-range-thumb {
    background: #fdcb6e;
}

/* Responsive adjustments for horizontal sliders */
@media (max-width: 480px) {
    .horizontal-sliders {
        right: 25%;
        transform: translate(50%, -50%);
        width: 200px;
        gap: 10px;
    }
    
    .slider-legend {
        top: 67%;
        gap: 0.5rem;
    }
    
    .legend-item {
        font-size: 0.65rem;
        gap: 0.2rem;
    }
    
    .legend-marker {
        width: 3px;
        height: 12px;
    }
    
    .rgb-stats {
        top: 20%;
    }
    
    .stats-header {
        font-size: 0.7rem;
        margin-bottom: 0.4rem;
    }
    
    .stat-row {
        font-size: 0.65rem;
        gap: 0.3rem;
    }
    
    #buttonsRow {
        top: 75%;
        right: 25%;
        gap: 0.5rem;
    }
    
    #buttonsRow.results-mode {
        top: 42%;
    }
    
    .horizontal-sliders .slider-group {
        padding: 6px 10px;
        gap: 8px;
        background: rgba(240, 240, 240, 0.9);
    }
    
    .horizontal-sliders .slider-group label {
        font-size: 12px;
        min-width: 18px;
        font-weight: 700;
    }
    
    .horizontal-sliders .slider-group input[type="range"] {
        height: 6px;
    }
    
    .horizontal-sliders .slider-group input[type="range"]::-webkit-slider-thumb {
        width: 12px;
        height: 12px;
    }
    
    .horizontal-sliders .slider-group input[type="range"]::-moz-range-thumb {
        width: 12px;
        height: 12px;
    }
    
    .horizontal-sliders .slider-group .slider-value {
        font-size: 12px;
        min-width: 25px;
    }
    
    .slider-marker-first,
    .slider-marker-second,
    .slider-marker-third,
    .slider-marker-solution {
        width: 5px;
        height: 20px;
        top: -8px;
        border-radius: 2.5px;
        transform: translateX(-6.75px) !important;
    }
}

@media (max-width: 768px) {
    .horizontal-sliders {
        right: 25%;
        transform: translate(50%, -50%);
        width: 240px;
    }
    
    .slider-legend {
        top: 37%;
    }
    
    .rgb-stats {
        top: 35%;
    }
    
    #buttonsRow {
        top: 72%;
        right: 25%;
    }
    
    #buttonsRow.results-mode {
        top: 42%;
    }
}

/* PREVENT TEXT SELECTION, PINCH ZOOM, SCROLL, ETC. */
html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    touch-action: manipulation;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;

    /* Modern sans-serif font stack */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    color: #2d4a3e;
    background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);

    display: flex;
    justify-content: center;
    align-items: center;
}

/* Start Screen - Modern overlay style */
#startScreen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.4s ease-out;
}

#startScreen.hidden {
    opacity: 0;
    pointer-events: none;
}

#startScreen h1 {
    color: #2d4a3e;
    font-size: 7rem;
    font-weight: 700;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    text-align: center;
    margin: 20px 0;
    letter-spacing: 0em;
    -webkit-text-stroke: 1px rgba(0, 0, 0, 0.8);
    background: linear-gradient(135deg, #00b894 0%, #00a085 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Game subtitle styling */
.game-subtitle {
    color: #2d4a3e;
    font-size: 1.8rem;
    font-weight: 400;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    text-align: center;
    margin: 0 0 30px 0;
    letter-spacing: 0.05em;
    opacity: 0.8;
    text-transform: lowercase;
}

/* Controls info styling */
.controls-info {
    text-align: center;
    margin: 0 0 1.5rem 0;
    padding: 0;
}

/* Mode Selection Styling */
.mode-selection {
    text-align: center;
    margin: 0 0 2rem 0;
    padding: 0;
}

.mode-title-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.mode-title {
    color: #2d4a3e;
    font-size: 1.4rem;
    font-weight: 600;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    opacity: 0.8;
}

.mode-options {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.mode-option-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.mode-option {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 0.75rem 1.5rem;
    border: 2px solid rgba(0, 184, 148, 0.3);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.mode-option:hover {
    border-color: rgba(0, 184, 148, 0.6);
    background: rgba(255, 255, 255, 0.9);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 184, 148, 0.2);
}

.mode-option input[type="radio"] {
    margin: 0 0.75rem 0 0;
    width: 18px;
    height: 18px;
    accent-color: #00b894;
    cursor: pointer;
}

.mode-label {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    cursor: pointer;
}

.mode-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: #2d4a3e;
    line-height: 1.2;
}

.mode-desc {
    font-size: 0.9rem;
    font-weight: 400;
    color: #666;
    opacity: 0.8;
    line-height: 1.2;
}

/* Selected mode styling */
.mode-option:has(input[type="radio"]:checked) {
    border-color: #00b894;
    background: rgba(0, 184, 148, 0.1);
    box-shadow: 0 6px 20px rgba(0, 184, 148, 0.3);
}

.mode-option:has(input[type="radio"]:checked) .mode-name {
    color: #00a085;
}

/* Circular Info Button Styling */
.info-button-circle {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1px solid rgba(0, 184, 148, 0.4);
    background: rgba(255, 255, 255, 0.8);
    color: #2d4a3e;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    font-style: italic;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
}

.info-button-circle:hover {
    border-color: rgba(0, 184, 148, 0.7);
    background: rgba(255, 255, 255, 0.95);
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0, 184, 148, 0.2);
}

.info-button-circle:active {
    transform: scale(1.05);
    box-shadow: 0 1px 4px rgba(0, 184, 148, 0.3);
}

/* RGB Modal Overlay */
.rgb-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.rgb-modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.rgb-modal-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 2rem;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transform: scale(1);
    transition: transform 0.3s ease;
}

.rgb-modal-overlay.hidden .rgb-modal-content {
    transform: scale(0.9);
}

.rgb-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(0, 184, 148, 0.2);
}

.rgb-modal-header h3 {
    color: #2d4a3e;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.close-modal-button {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #666;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 50%;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close-modal-button:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #333;
}

.rgb-explanation {
    margin-bottom: 1.5rem;
}

.rgb-explanation p {
    color: #2d4a3e;
    font-size: 1rem;
    line-height: 1.5;
    margin-bottom: 0.75rem;
}

/* RGB Color Examples */
.rgb-examples {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.75rem;
    margin: 1.5rem 0;
}

.color-example {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    text-align: center;
}

.example-color {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.color-example span {
    font-size: 0.8rem;
    font-weight: 600;
    color: #2d4a3e;
}

/* RGB Visualization */
.rgb-visualization {
    margin: 2rem 0;
    display: flex;
    justify-content: center;
}

.rgb-circles {
    position: relative;
    width: 280px;
    height: 280px;
    background-color: rgba(30, 30, 30, 0.8);
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    mix-blend-mode: normal;
    overflow: hidden;
}

.rgb-circle {
    position: absolute;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    mix-blend-mode: screen;
    opacity: 0.9;
    display: flex;
    align-items: center;
    justify-content: center;
}

.circle-label {
    color: white;
    font-weight: 700;
    font-size: 1.2rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    mix-blend-mode: difference;
    z-index: 10;
}

.red-circle {
    background: #ff0000;
    top: 20px;
    left: 50px;
}

.green-circle {
    background: #00ff00;
    top: 80px;
    left: 10px;
}

.blue-circle {
    background: #0000ff;
    top: 80px;
    left: 90px;
}

/* RGB Demo Section */
.rgb-demo-section {
    margin-top: 2rem;
    border-top: 1px solid rgba(0, 184, 148, 0.2);
    padding-top: 1.5rem;
}

.demo-section-title {
  color: #2d4a3e;
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0 0 1rem 0;
  text-align: center;
  opacity: 0.8;
}

.demo-instruction {
  text-align: center;
  margin-bottom: 1.5rem;
}

.demo-instruction p {
  color: #2d4a3e;
  font-size: 1rem;
  font-weight: 500;
  margin: 0 0 0.75rem 0;
  opacity: 0.8;
}

.demo-target {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.demo-target .example-color {
  width: 60px;
  height: 60px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

/* RGB Demo Sliders */
.rgb-demo-sliders {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.demo-slider-group {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(240, 240, 240, 0.9);
    padding: 8px 12px;
    border-radius: 8px;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(200, 200, 200, 0.6);
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    width: 280px;
}

.demo-slider-group label {
    color: #333;
    font-weight: 700;
    font-size: 14px;
    min-width: 20px;
    text-align: center;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

.demo-slider-group input[type="range"] {
    flex: 1;
    height: 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.4);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
}

.demo-slider-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
    transition: all 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.3);
}

.demo-slider-group input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    border: 1px solid rgba(0, 0, 0, 0.3);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
    transition: all 0.3s ease;
}

.demo-value {
    color: #333;
    font-weight: 700;
    font-size: 14px;
    min-width: 30px;
    text-align: center;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

.demo-color-result {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    margin-bottom: 1rem;
    background: rgb(128, 128, 128);
    transition: background-color 0.3s ease;
}

/* Demo Controls */
.demo-controls {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
    align-items: center;
}

.demo-stop-button {
    padding: 1rem 2rem;
    font-size: 1.2rem;
    font-weight: 600;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #00b894 0%, #00a085 100%);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(0, 184, 148, 0.3);
    position: relative;
}

.demo-new-game-button {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #00b894 0%, #00a085 100%);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(0, 184, 148, 0.3);
    position: relative;
}

.demo-stop-button:hover,
.demo-new-game-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 184, 148, 0.4);
}

.demo-stop-button:active,
.demo-new-game-button:active {
    transform: translateY(0);
    box-shadow: 0 6px 20px rgba(0, 184, 148, 0.3);
}

/* Active slider styling for demo */
.demo-slider-group.active-slider {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(0, 184, 148, 0.6);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 184, 148, 0.2);
}

.demo-slider-group.inactive-slider {
    opacity: 0.6;
}

/* Demo sliders use default white thumbs like the main game */



/* Hidden class for modals */
.hidden {
    display: none !important;
}

/* HSL Info Modal - similar structure to RGB modal */
.hsl-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.hsl-modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.hsl-modal-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 2rem;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transform: scale(1);
    transition: transform 0.3s ease;
}

.hsl-modal-overlay.hidden .hsl-modal-content {
    transform: scale(0.9);
}

.hsl-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(0, 184, 148, 0.2);
}

.hsl-modal-header h3 {
    color: #2d4a3e;
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.hsl-explanation {
    margin-bottom: 2rem;
}

.hsl-explanation p {
    color: #2d4a3e;
    line-height: 1.6;
    margin: 0 0 1rem 0;
    font-size: 1rem;
    opacity: 0.9;
}

/* HSL Color Examples - same spacing as RGB */
.hsl-examples {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.75rem;
    margin: 1.5rem 0;
}

/* HSL Visualization - Three Component Bars */
.hsl-visualization {
    margin: 2rem 0;
}

.hsl-components {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    max-width: 500px;
    margin: 0 auto;
}

.hsl-component {
    text-align: center;
}

.hsl-component h5 {
    color: #2d4a3e;
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    opacity: 0.9;
}

.hsl-component p {
    color: #2d4a3e;
    font-size: 0.85rem;
    margin: 0.5rem 0 0 0;
    opacity: 0.7;
    font-style: italic;
}

/* Hue Bar - Rainbow gradient */
.hue-bar {
    height: 20px;
    border-radius: 10px;
    background: linear-gradient(to right, 
        hsl(0, 100%, 50%),
        hsl(60, 100%, 50%),
        hsl(120, 100%, 50%),
        hsl(180, 100%, 50%),
        hsl(240, 100%, 50%),
        hsl(300, 100%, 50%),
        hsl(360, 100%, 50%)
    );
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
}

/* Saturation Bar - Gray to Red */
.saturation-bar {
    height: 20px;
    border-radius: 10px;
    background: linear-gradient(to right, 
        hsl(0, 0%, 50%),
        hsl(0, 100%, 50%)
    );
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
}

/* Lightness Bar - Black to White */
.lightness-bar {
    height: 20px;
    border-radius: 10px;
    background: linear-gradient(to right, 
        hsl(0, 0%, 0%),
        hsl(0, 0%, 50%),
        hsl(0, 0%, 100%)
    );
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
}

/* HSL Demo Section */
.hsl-demo-section {
    margin-top: 2rem;
    border-top: 1px solid rgba(270, 100%, 50%, 0.2);
    padding-top: 1.5rem;
}

.hsl-demo-sliders {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

/* Mobile responsive adjustments for mode selection */
@media (max-width: 480px) {
    .mode-options {
        gap: 1rem;
        flex-direction: column;
        align-items: center;
    }
    
    .mode-option-wrapper {
        flex-direction: column;
        gap: 0.5rem;
        align-items: center;
    }
    
    .mode-option {
        padding: 0.5rem 1rem;
        width: 200px;
    }
    

    
    .mode-title {
        font-size: 1.2rem;
    }
    
    .mode-title-row {
        margin-bottom: 0.75rem;
    }
    
    .mode-name {
        font-size: 1.1rem;
    }
    
    .mode-desc {
        font-size: 0.85rem;
    }
    
    .info-button-circle {
        width: 18px;
        height: 18px;
        font-size: 0.7rem;
    }
    
    .rgb-modal-content {
        margin: 1rem;
        padding: 1.5rem;
        max-width: calc(100vw - 2rem);
    }
    
    .rgb-circles {
        width: 220px;
        height: 220px;
    }
    
    .rgb-circle {
        width: 140px;
        height: 140px;
    }
    
    .red-circle {
        top: 15px;
        left: 40px;
    }
    
    .green-circle {
        top: 65px;
        left: 10px;
    }
    
    .blue-circle {
        top: 65px;
        left: 70px;
    }
    
    .circle-label {
        font-size: 1rem;
    }
    
    .demo-slider-group {
        width: 240px;
        padding: 6px 10px;
        gap: 8px;
    }
    
    .demo-slider-group label {
        font-size: 12px;
        min-width: 18px;
    }
    
    .demo-slider-group input[type="range"] {
        height: 6px;
    }
    
    .demo-slider-group input[type="range"]::-webkit-slider-thumb {
        width: 12px;
        height: 12px;
    }
    
    .demo-slider-group input[type="range"]::-moz-range-thumb {
        width: 12px;
        height: 12px;
    }
    
    .demo-value {
        font-size: 12px;
        min-width: 25px;
    }
    
    .demo-color-result {
        width: 60px;
        height: 60px;
    }
    
    .demo-stop-button {
        padding: 0.8rem 1.6rem;
        font-size: 1rem;
    }
    
    .demo-new-game-button {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
    }
    
    .rgb-examples {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
        margin: 1rem 0;
    }
    
    .hsl-examples {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
        margin: 1rem 0;
    }
    
    .example-color {
        width: 30px;
        height: 30px;
    }
    
    .color-example span {
        font-size: 0.7rem;
    }
    
    .demo-instruction p {
        font-size: 0.9rem;
    }
    
    .demo-target .example-color {
        width: 60px;
        height: 60px;
    }
    
    .hsl-components {
        gap: 1rem;
    }
    
    .hsl-component h5 {
        font-size: 0.9rem;
    }
    
    .hsl-component p {
        font-size: 0.75rem;
    }
}

.control-text {
    color: #2d4a3e;
    font-size: 1.3rem;
    font-weight: 500;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0.5rem 0;
    opacity: 0.7;
    letter-spacing: 0.02em;
}

.ring-o {
    color: #000;
    -webkit-text-fill-color: #000;
    font-size: 4.5rem;
    margin: 0 -5px;
    display: inline-block;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    animation: ringSpin 3s linear infinite;
}

@keyframes ringSpin {
    0% { 
        transform: rotate(0deg);
    }
    100% { 
        transform: rotate(360deg);
    }
}

/* Overlay styles - Modern glass morphism */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    color: #2d4a3e;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.4s ease;
}

.overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.overlay-content {
    text-align: center;
    background: transparent;
    padding: 4rem;
    border-radius: 0;
    box-shadow: none;
    border: none;
    backdrop-filter: none;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.overlay-content h1 {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    color: #2d4a3e;
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* Modern button style */
#startButton {
    font-size: 1.3rem;
    font-weight: 600;
    padding: 1rem 2rem;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #00b894 0%, #00a085 100%);
    color: white;
    cursor: pointer;
    margin-top: 2rem;
    display: inline-block;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(0, 184, 148, 0.3);
    position: relative;
    overflow: hidden;
}

#startButton::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

#startButton:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 184, 148, 0.4);
}

#startButton:hover::before {
    left: 100%;
}

#startButton:active {
    transform: translateY(0);
    box-shadow: 0 6px 20px rgba(0, 184, 148, 0.3);
}

/* Bouncing slider hint - Modern continuous loop */
.bouncing-slider-hint {
    position: relative;
    width: 350px;
    height: 70px;
    margin: 2rem auto;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.bouncing-slider-hint .slider-line {
    position: absolute;
    width: 100%;
    height: 5px;
    background: linear-gradient(90deg, #e8f5e8, #00b894, #e8f5e8);
    border-radius: 3px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.bouncing-slider-hint .slider-knob {
    position: absolute;
    width: 35px;
    height: 35px;
    background: linear-gradient(135deg, #00b894 0%, #00a085 100%);
    border-radius: 50%;
    box-shadow: 0 6px 20px rgba(0, 184, 148, 0.4);
    animation: continuousLoop 2s linear infinite;
}

@keyframes continuousLoop {
    0% {
        left: -28px;
        transform: scale(0.8);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        left: 100%;
        transform: scale(0.8);
    }
}

/* MAIN CONTAINER - Modern app layout */
#gameContainer {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #f0f8f0 0%, #e8f5e8 100%);
    overflow: hidden;
    padding: 0.5rem;
}

/* iPhone Portrait Mode Optimization */
@media (max-width: 480px) and (orientation: portrait) {
    #gameContainer {
        padding: 0.25rem;
        height: 100vh;
        height: 100dvh; /* Use dynamic viewport height for better mobile support */
    }
    
    #gameCanvas {
        max-height: 45vh;
        max-height: 45dvh;
    }
    
    /* Move spiral higher and make it smaller for portrait */
    .spiral-container {
        width: 450px !important;
        height: 450px !important;
        top: 38% !important;
        left: 35% !important;
        transform: translate(-50%, -50%) !important;
        perspective: 700px !important;
    }
    
    /* Smaller rings for portrait */
    .color-ring {
        width: 65px;
        height: 65px;
    }
    
    /* Adjust horizontal sliders for portrait - show only active slider */
    .horizontal-sliders {
        right: 50%;
        top: 78%;
        transform: translate(50%, -50%);
        width: 280px;
        gap: 12px;
    }
    
    /* Info buttons positioning for iPhone portrait */
    .mode-option-wrapper {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        width: 200px;
        gap: 0.5rem;
    }
    
    .mode-option {
        flex: 1;
    }
    
    .horizontal-sliders.results-mode {
        top: 82%;
    }
    
    /* Show all sliders at all times on iPhone portrait */
    .horizontal-sliders .slider-group.inactive-slider {
        display: flex;
        opacity: 0.7;
        transform: scale(0.9);
    }
    
    /* Show active slider with slight emphasis */
    .horizontal-sliders .slider-group.active-slider {
        background: rgba(255, 255, 255, 0.95);
        border-color: rgba(0, 184, 148, 0.6);
        transform: scale(1.0);
        box-shadow: 0 4px 12px rgba(0, 184, 148, 0.2);
        width: 100%;
        justify-content: center;
    }
    
    /* When game is complete, show all sliders again */
    .horizontal-sliders .slider-group {
        transition: all 0.3s ease;
    }
    
    /* Override: Show all sliders when game is complete */
    .horizontal-sliders.results-mode .slider-group.inactive-slider {
        display: flex;
        opacity: 0.8;
        transform: scale(0.95);
    }
    
    .horizontal-sliders.results-mode .slider-group.active-slider {
        transform: scale(1.0);
    }
    
    /* Move slider legend to bottom left on iPhone */
    .slider-legend {
        top: 90% !important;
        left: 5% !important;
        right: auto !important;
        transform: none !important;
        width: 280px;
        justify-content: flex-start;
    }
    
    .slider-legend.results-mode {
        top: 90% !important;
    }
    
    /* Move the entire buttons container to the right of slider legend on iPhone portrait */
    #buttonsRow {
        top: 90% !important;
        right: 35% !important;
        transform: translateX(50%) !important;
        left: auto !important;
        bottom: auto !important;
    }
    
    /* Adjust score box for portrait */
    #scoreBox {
        bottom: 8%;
        left: 50%;
        transform: translateX(-50%);
        width: 280px;
        max-width: 90%;
    }
    

    
    /* Adjust stop slider button for portrait - positioned to the left of slider legend */
    #stopSliderButton {
        top: 95% !important;
        left: 25% !important;
        bottom: auto !important;
        right: auto !important;
        transform: translateY(-50%) !important;
        padding: 14px 28px !important;
        font-size: 18px !important;
        position: absolute !important;
    }
    
    /* Override hover/active transforms for iPhone portrait to prevent button jumping */
    #stopSliderButton:hover {
        transform: translateY(-52%) !important;
    }
    
    #stopSliderButton:active {
        transform: translateY(-48%) !important;
    }
    
    /* Ensure the button doesn't inherit any other transform styles */
    #stopSliderButton:focus {
        transform: translateY(-50%) !important;
        outline: none;
    }
    

    
    /* Mobile styling for active slider labels */
    .active-slider-label {
        font-size: 0.85rem;
        top: -22px;
        max-width: 120px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    /* Start screen adjustments for portrait */
    #startScreen h1 {
        font-size: 3.2rem;
        margin: 15px 0;
    }
    
    .game-subtitle {
        font-size: 1.1rem;
        margin: 0 0 18px 0;
    }
    
    .overlay-content {
        padding: 1.2rem;
        margin: 0.3rem;
    }
    
    /* Hide spacebar controls on iPhone portrait */
    .controls-info {
        display: none;
    }
    
    /* Hide attempt labels on iPhone to clean up interface */
    #statusDisplay {
        display: none !important;
    }
    
    .active-slider-label {
        display: none !important;
    }
    
    /* Results table overlay for iPhone portrait */
    .color-stats {
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        right: auto !important;
        transform: translate(-50%, -50%) !important;
        background: rgba(255, 255, 255, 0.88) !important;
        backdrop-filter: blur(10px) !important;
        border-radius: 12px !important;
        padding: 20px !important;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3) !important;
        border: 1px solid rgba(0, 184, 148, 0.3) !important;
        max-width: 90vw !important;
        max-height: 80vh !important;
        overflow-y: auto !important;
        z-index: 1000 !important;
    }
    
    /* Hide regular score box on iPhone portrait since we have it in overlay */
    #scoreBox {
        display: none !important;
    }
    
    /* Hide original new game button on iPhone portrait since we have one in overlay */
    #newGameButton {
        display: none !important;
    }
    
    /* Back button positioning for iPhone portrait */
    body #backButton {
        top: 5% !important;
        left: 5% !important;
        bottom: auto !important;
        right: auto !important;
        width: 32px !important;
        height: 32px !important;
        font-size: 18px !important;
        z-index: 9999 !important;
        position: absolute !important;
    }
}

/* iPhone Landscape Mode Optimization */
@media (max-width: 926px) and (orientation: landscape) and (max-height: 480px) {
    #gameContainer {
        padding: 0.2rem;
        height: 100vh;
        height: 100dvh;
    }
    
    #gameCanvas {
        max-height: 60vh;
        max-height: 60dvh;
    }
    
    /* Compact spiral for landscape */
    .spiral-container {
        width: 400px;
        height: 400px;
        top: 50%;
        left: 35%;
        transform: translate(-50%, -50%);
        perspective: 600px;
    }
    
    /* Smaller rings for landscape */
    .color-ring {
        width: 60px;
        height: 60px;
    }
    
    /* Move horizontal sliders to the right for landscape */
    .horizontal-sliders {
        right: 8%;
        top: 45%;
        transform: translate(0, -50%);
        width: 220px;
        gap: 8px;
    }
    
    .horizontal-sliders.results-mode {
        top: 50%;
    }
    
    /* Compact buttons for landscape */
    #scoreBox {
        bottom: 5%;
        right: 8%;
        transform: none;
        width: 220px;
        max-width: none;
    }
    
    #newGameButton {
        bottom: 2%;
        right: 8%;
        transform: none;
        padding: 10px 20px;
        font-size: 14px;
    }
    
    #stopSliderButton {
        top: 65% !important;
        right: 3% !important;
        transform: translateY(-50%) !important;
        padding: 20px 32px !important;
        font-size: 18px !important;
        bottom: auto !important;
        left: auto !important;
        position: absolute !important;
    }
    
    /* Compact slider labels */
    .active-slider-label {
        font-size: 0.8rem;
        top: -20px;
        max-width: 100px;
    }
    
    /* Optimize start screen for landscape */
    #startScreen h1 {
        font-size: 2.2rem;
        margin: 5px 0;
        line-height: 1.1;
    }
    
    .game-subtitle {
        font-size: 0.9rem;
        margin: 0 0 10px 0;
    }
    
    .controls-info {
        display: none;
    }
    
    .mode-selection {
        margin: 0 0 15px 0;
    }
    
    .mode-title {
        font-size: 1.1rem;
        margin: 0 0 8px 0;
    }
    
    .mode-options {
        gap: 1.5rem;
    }
    
    .mode-option {
        padding: 8px 12px;
    }
    
    .mode-name {
        font-size: 1rem;
    }
    
    .mode-desc {
        font-size: 0.8rem;
    }
    
    .bouncing-slider-hint {
        width: 150px;
        height: 30px;
        margin: 1rem auto;
    }
    
    .slider-knob {
        width: 20px;
        height: 20px;
    }
    
    #startButton {
        padding: 10px 20px;
        font-size: 1rem;
        margin-top: 10px;
    }
    
    .overlay-content {
        padding: 1rem;
        margin: 0.2rem;
    }
    
    /* Show all sliders at all times on iPhone landscape */
    .horizontal-sliders .slider-group.inactive-slider {
        display: flex;
        opacity: 0.7;
        transform: scale(0.9);
    }
    
    .horizontal-sliders .slider-group.active-slider {
        display: flex;
        opacity: 1.0;
        transform: scale(1.0);
    }
    
    /* Hide attempt labels on iPhone landscape to clean up interface */
    #statusDisplay {
        display: none !important;
    }
    
    .active-slider-label {
        display: none !important;
    }
    
    /* Position slider legend directly to the left of stop button in iPhone landscape */
    #sliderLegend.slider-legend {
        top: 70% !important;
        right: 8% !important;
        left: auto !important;
        transform: translateY(-50%) !important;
        width: 150px !important;
        justify-content: flex-end !important;
        flex-direction: row !important;
        gap: 0.5rem !important;
        align-items: center !important;
        flex-wrap: nowrap !important;
    }
    
    /* Align legend items consistently in landscape */
    .slider-legend .legend-item {
        display: flex !important;
        align-items: center !important;
        gap: 0.5rem !important;
        width: 100% !important;
    }
    
    /* Ensure consistent tick alignment */
    .slider-legend .legend-marker {
        flex-shrink: 0 !important;
        width: 4px !important;
        height: 14px !important;
    }
    
    .slider-legend.results-mode {
        top: 75% !important;
    }
    
    /* Position buttons container to the right of slider legend on iPhone landscape */
    #buttonsRow {
        top: 85% !important;
        right: 20% !important;
        transform: translateX(50%) !important;
        left: auto !important;
        bottom: auto !important;
    }
    
    /* Results table overlay for iPhone landscape */
    .color-stats {
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        right: auto !important;
        transform: translate(-50%, -50%) !important;
        background: rgba(255, 255, 255, 0.88) !important;
        backdrop-filter: blur(10px) !important;
        border-radius: 12px !important;
        padding: 15px !important;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3) !important;
        border: 1px solid rgba(0, 184, 148, 0.3) !important;
        max-width: 85vw !important;
        max-height: 70vh !important;
        overflow-y: auto !important;
        z-index: 1000 !important;
    }
    
    /* Hide regular score box on iPhone landscape since we have it in overlay */
    #scoreBox {
        display: none !important;
    }
    
    /* Hide original new game button on iPhone landscape since we have one in overlay */
    #newGameButton {
        display: none !important;
    }
    
    /* Back button positioning for iPhone landscape */
    #backButton {
        top: 12% !important;
        left: 5% !important;
        bottom: auto !important;
        right: auto !important;
        width: 28px !important;
        height: 28px !important;
        font-size: 16px !important;
        z-index: 9999 !important;
        position: absolute !important;
    }
    

}

/* Mobile optimization */
@media (max-width: 480px) {
    #gameContainer {
        padding: 0.25rem;
    }
    
    #gameCanvas {
        max-height: 55vh;
    }
    
    .spiral-container {
        width: 600px;
        height: 600px;
        top: 42.5%;
        left: 50%;
        transform: translate(-50%, -50%);
        perspective: 800px;
    }
    
    .color-ring {
        width: 80px;
        height: 80px;
    }
    
    .ring-group {
        margin: 0;
        padding: 0.5rem;
    }
    
    .ring-group label {
        font-size: 1rem;
    }
    
    /* Mobile styling for active slider labels */
    .active-slider-label {
        font-size: 0.95rem;
        top: -25px;
        max-width: 120px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    #sliderSection {
        padding: 0.75rem;
        margin-top: 0.5rem;
        gap: 0.75rem;
        width: 100%;
        max-width: 350px;
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
    }
    
    #startScreen h1 {
        font-size: 3.5rem;
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
        -webkit-text-stroke: 0.5px rgba(0, 0, 0, 0.8);
    }
    
    .game-subtitle {
        font-size: 1.2rem;
        margin: 0 0 20px 0;
    }
    
    .controls-info {
        margin: 0 0 1.5rem 0;
    }
    
    .control-text {
        font-size: 1.1rem;
        margin: 0.3rem 0;
    }
    
    .overlay-content {
        padding: 1.5rem;
        margin: 0.5rem;
    }
    
    .bouncing-slider-hint {
        width: 200px;
        height: 40px;
    }
    
    .bouncing-slider-hint .slider-knob {
        width: 24px;
        height: 24px;
    }
    
    /* Force stop button position for iPhone portrait */
    #stopSliderButton {
        position: fixed !important;
        top: 95% !important;
        left: 25% !important;
        bottom: auto !important;
        right: auto !important;
        transform: translateY(-50%) !important;
        z-index: 9999 !important;
    }
    
    /* Hide regular score box on mobile since we have it in overlay */
    #scoreBox {
        display: none !important;
    }
    
    /* Position new game button for mobile (fallback) */
    #newGameButton {
        position: fixed !important;
        top: 65% !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        right: auto !important;
        bottom: auto !important;
        z-index: 1001 !important;
    }
}

/* Tablet optimization */
@media (min-width: 481px) and (max-width: 768px) {
    .spiral-container {
        width: 800px;
        height: 800px;
        left: 37%;
        perspective: 1000px;
    }
    
    .color-ring {
        width: 100px;
        height: 100px;
    }
    
    /* Tablet styling for active slider labels */
    .active-slider-label {
        font-size: 1rem;
        top: -28px;
        max-width: 140px;
    }
}

/* Canvas - Modern drawing area */
#gameCanvas {
    flex-shrink: 0;
    max-width: 100%;
    max-height: 85vh;
    background-color: rgba(255, 255, 255, 0.4);
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    margin: 0 auto;
    display: block;
}

/* Score Box - Only used on iPhone, hidden on desktop */
#scoreBox {
    display: none;
}

/* Show scoreBox only on iPhone */
@media screen and (max-width: 480px) and (orientation: portrait),
       screen and (max-width: 926px) and (orientation: landscape) and (max-height: 480px) {
    #scoreBox {
        display: block;
        position: absolute;
        top: 10%;
        right: 1%;
        transform: translateX(0);
        opacity: 0;
        transition: all 0.4s ease;
        
        text-align: center;
        font-size: 0.85rem;
        color: #2d4a3e;
        font-weight: 600;
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
        
        pointer-events: none;
        background: transparent;
        backdrop-filter: none;
        border-radius: 0;
        padding: 0;
        box-shadow: none;
        border: none;
    }

    #scoreBox.visible {
        opacity: 1;
        pointer-events: auto;
    }
}

/* Status Display - Hidden since info is now on canvas */
#statusDisplay {
    display: none;
}



.results-summary {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
}

.score-display {
    font-size: 4rem;
    font-weight: 800;
    line-height: 1;
    color: #2d4a3e;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    letter-spacing: -0.02em;
}

.score-label {
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: #6c7b7f;
    font-weight: 600;
    margin-top: 0.5rem;
}

/* Slider Section - Spiral staircase container */
#sliderSection {
    position: absolute;
    width: 100%;
    height: 100%;
    background: transparent;
    padding: 0;
    margin: 0;
}

/* Ring container for circular slider arrangement */
.spiral-container {
    position: absolute;
    top: 42.5%;
    left: 35%;
    width: 1000px;
    height: 1000px;
    transition: transform 0.6s ease-out;
    transform: translate(-50%, -50%);
    transform-style: preserve-3d;
    perspective: 1200px;
    z-index: 10;
}

.spiral {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.6s ease-out;
}



/* Color rings container */
.color-rings {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
}

/* Ring-based controls - Spiral arrangement */
.ring-group {
    position: absolute;
    top: 50%;
    left: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0;
    padding: 0.75rem;
    border-radius: 10px;
    background: transparent;
    border: none;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
    cursor: pointer;
    transform-origin: center center;
}

.ring-group:hover {
    transform: scale(1.05) translateZ(10px);
}

.ring-group label {
    display: none; /* Hide labels */
}

/* Active slider label styling */
.active-slider-label {
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.1rem;
    font-weight: 600;
    font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
    color: rgba(102, 102, 102, 0.9);
    text-align: center;
    white-space: nowrap;
    pointer-events: none;
    z-index: 15;
    display: none;
    background: transparent;
    padding: 0;
    margin: 0;
    border: none;
    box-shadow: none;
    /* Ensure label follows the 3D transform of the ring group */
    transform-style: preserve-3d;
    /* Add subtle text shadow for better readability */
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

.color-ring {
    position: relative;
    width: 160px;
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
    transform: translateZ(0px);
    transform-style: preserve-3d;
}

.ring-track {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 3px solid #e8f5e8;
    border-radius: 50%;
    background: transparent;
    top: 0;
    left: 0;
    z-index: 5;
}

.ring-fill {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: conic-gradient(from 0deg, #00b894 0deg, #00b894 0deg, transparent 0deg);
    mask: radial-gradient(circle at center, transparent 0px, black 45px);
    -webkit-mask: radial-gradient(circle at center, transparent 0px, black 45px);
    top: 0;
    left: 0;
    z-index: 6;
}

.ring-value {
    font-size: 0.9rem;
    font-weight: 700;
    color: #2d4a3e;
    background: rgba(255, 255, 255, 0.9);
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    text-align: center;
    min-width: 40px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

/* Active ring highlighting */
.active-ring {
    transition: all 0.3s ease;
    z-index: 10;
}

.active-ring label {
    display: none; /* Hide labels */
}



.inactive-ring {
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 1;
}

.inactive-ring label {
    display: none; /* Hide labels */
}

/* Slider Legend - Simplified */
.slider-legend {
    position: absolute;
    top: 60%;
    right: 25%;
    transform: translateX(50%);
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    align-items: center;
    z-index: 15;
    transition: top 0.8s ease-in-out;
}

.slider-legend.results-mode {
    top: 75%;
}

.legend-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #888;
    margin-right: 0.5rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: #666;
}

/* Smooth transition for target legend item */
#targetLegendItem {
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

#targetLegendItem.visible {
    opacity: 1;
}

.legend-marker {
    width: 4px;
    height: 14px;
    border-radius: 2px;
}

.legend-marker.first {
    background: linear-gradient(135deg, #e17055 0%, #d63031 100%);
}

.legend-marker.second {
    background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
}

.legend-marker.third {
    background: linear-gradient(135deg, #fdcb6e 0%, #e17055 100%);
}

.legend-marker.solution {
    background: linear-gradient(135deg, #2d4a3e 0%, #1e3a2e 100%);
}

/* Color Stats */
.color-stats {
    position: absolute;
    top: 8%;
    right: 25%;
    transform: translateX(50%);
    z-index: 16;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.color-stats.visible {
    opacity: 1;
}

.stats-header {
    font-size: 0.8rem;
    font-weight: 600;
    color: #888;
    margin-bottom: 0.5rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid #ddd;
    display: grid;
    grid-template-columns: 20px 80px 60px 60px;
    gap: 0.8rem;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    align-items: center;
}

.stats-header span:nth-child(3),
.stats-header span:nth-child(4) {
    transform: translateY(0.3rem);
}

.stats-grid {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.stat-row {
    display: grid;
    grid-template-columns: 20px 80px 60px 60px;
    gap: 0.8rem;
    align-items: center;
    font-size: 0.95rem;
    font-weight: 600;
}

.channel {
    color: #666;
    font-weight: 700;
    text-align: center;
}

.final-value {
    font-weight: 700;
    text-align: center;
    color: #666;
}

.target-value {
    color: #666;
    font-weight: 700;
    text-align: center;
}

/* Difference display with color coding for accuracy */
.difference {
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
}

.difference.very-close {
    color: #00b894; /* Green - very close (0-10 difference) */
}

.difference.close {
    color: #fdcb6e; /* Yellow - medium (11-30 difference) */
}

.difference.far {
    color: #e17055; /* Red - far (31+ difference) */
}

/* Total score */
.total-score {
    margin-top: 0.5rem;
    padding-top: 0.3rem;
    border-top: 1px solid #ddd;
    font-size: 0.9rem;
    font-weight: 600;
}

.total-value {
    color: #2d4a3e;
    font-weight: 700;
}

/* Buttons Row - Positioned between table and sliders in results mode */
#buttonsRow {
    position: absolute;
    top: 70%;
    right: 25%;
    transform: translateX(50%);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    justify-content: center;
    align-items: center;
    background: transparent;
    backdrop-filter: none;
    border-radius: 0;
    box-shadow: none;
    border: none;
    z-index: 20;
    transition: top 0.8s ease-in-out;
}

#buttonsRow.results-mode {
    top: 42%;
}

/* Game Buttons - Modern style */
#stopSliderButton,
#newGameButton,
#backButton {
    padding: 0.75rem 1.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #00b894 0%, #00a085 100%);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(0, 184, 148, 0.3);
    z-index: 20;
    position: relative;
}

/* Back Button - Subtle circular design */
#backButton {
    position: absolute;
    top: 60px;
    left: 55px;
    z-index: 30;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    padding: 0;
    font-size: 22px;
    line-height: 1;
    background: rgba(255, 255, 255, 0.15);
    color: #888;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
    transform: translateY(-1px);
}

/* Hide back button when start screen is visible */
#startScreen:not(.hidden) {
    z-index: 9999;
}

#startScreen:not(.hidden) ~ #gameContainer #backButton {
    display: none !important;
}

#stopSliderButton:hover,
#newGameButton:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 184, 148, 0.4);
}

#backButton:hover {
    background: rgba(255, 255, 255, 0.25);
    color: #666;
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

#stopSliderButton:active,
#newGameButton:active {
    transform: translateY(0);
    box-shadow: 0 6px 20px rgba(0, 184, 148, 0.3);
}

#backButton:active {
    background: rgba(255, 255, 255, 0.3);
    color: #444;
    transform: scale(0.95);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Active/Inactive states */
.active-slider {
    border: 2px solid #00b894;
    background: rgba(0, 184, 148, 0.1);
    box-shadow: 0 8px 25px rgba(0, 184, 148, 0.2);
}

.inactive-slider {
    opacity: 0.6;
    pointer-events: none;
}

/* Marker Styles - Nature-inspired colors */
.slider-marker-first {
    position: absolute;
    width: 3px;
    height: 10px;
    background: linear-gradient(135deg, #e17055 0%, #d63031 100%);
    pointer-events: none;
    top: 3px;
    transform: translateX(-50%);
    border-radius: 2px;
    box-shadow: 0 2px 6px rgba(225, 112, 85, 0.3);
}

.slider-marker-second {
    position: absolute;
    width: 3px;
    height: 10px;
    background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
    pointer-events: none;
    top: 3px;
    transform: translateX(-50%);
    border-radius: 2px;
    box-shadow: 0 2px 6px rgba(116, 185, 255, 0.3);
}

.slider-marker-third {
    position: absolute;
    width: 3px;
    height: 10px;
    background: linear-gradient(135deg, #fdcb6e 0%, #e17055 100%);
    pointer-events: none;
    top: 3px;
    transform: translateX(-50%);
    border-radius: 2px;
    box-shadow: 0 2px 6px rgba(253, 203, 110, 0.3);
}

.slider-marker-solution {
    position: absolute;
    width: 3px;
    height: 10px;
    background: linear-gradient(135deg, #2d4a3e 0%, #1e3a2e 100%);
    pointer-events: none;
    top: 3px;
    transform: translateX(-50%);
    border-radius: 2px;
    box-shadow: 0 2px 6px rgba(45, 74, 62, 0.3);
}

/* Slider thumb colors based on attempts */
.slider-group input[type="range"].use-attempt1::-webkit-slider-thumb {
    background: linear-gradient(135deg, #e17055 0%, #d63031 100%);
}
.slider-group input[type="range"].use-attempt1::-moz-range-thumb {
    background: linear-gradient(135deg, #e17055 0%, #d63031 100%);
}
.slider-group input[type="range"].use-attempt1::-ms-thumb {
    background: linear-gradient(135deg, #e17055 0%, #d63031 100%);
}

.slider-group input[type="range"].use-attempt2::-webkit-slider-thumb {
    background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
}
.slider-group input[type="range"].use-attempt2::-moz-range-thumb {
    background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
}
.slider-group input[type="range"].use-attempt2::-ms-thumb {
    background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
}

/* Score key - Modern style */
.score-key {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1rem;
    font-size: 0.8rem;
    color: #2d4a3e;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-weight: 600;
    opacity: 1;
    transition: opacity 0.4s ease;
}

.score-key.fade-out {
    opacity: 0;
}

.key-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.8rem;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 6px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.key-color {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
    box-sizing: border-box;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.key-color.red {
    background: linear-gradient(135deg, #e17055 0%, #d63031 100%);
}

.key-color.blue {
    background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
}

.key-color.black {
    background: linear-gradient(135deg, #2d4a3e 0%, #1e3a2e 100%);
}

/* Animations */
@keyframes flyDown {
    0% {
        transform: translateY(0);
        opacity: 1;
    }
    100% {
        transform: translateY(100px);
        opacity: 0;
    }
}

@keyframes flyUp {
    0% {
        transform: translateY(0);
        opacity: 1;
    }
    100% {
        transform: translateY(-100px);
        opacity: 0;
    }
}

.fly-down {
    animation: flyDown 0.5s ease forwards;
}

.fly-up {
    animation: flyUp 0.5s ease forwards;
}

/* Color Name Preview - Modern style */
.color-name-preview {
    position: absolute;
    bottom: 1.5rem;
    left: 0;
    width: 100%;
    text-align: center;
    font-size: 1rem;
    height: 1.5em;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-weight: 600;
    color: #2d4a3e;
}

.preview-name {
    position: absolute;
    width: 100%;
    animation: slideUp 3s ease-in-out;
    opacity: 0;
    transform: translateY(100%);
}

@keyframes slideUp {
    0% {
        opacity: 0;
        transform: translateY(100%);
    }
    20% {
        opacity: 1;
        transform: translateY(0);
    }
    80% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(-100%);
    }
}

/* Ring knob colors based on attempt used */
.ring-group.use-attempt1 .ring-indicator {
    background: linear-gradient(135deg, #e17055 0%, #d63031 100%);
}

.ring-group.use-attempt2 .ring-indicator {
    background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
}

/* Fade in animation */
@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}    