:root {
    --bg-color: #0f1115;
    --card-bg: #1c1f26;
    --text-primary: #f0f0f0;
    --text-secondary: #9aa0a6;
    --accent: #5e6ad2;
    --accent-hover: #7380f3;
    
    --display-size: 200px;
    --border-radius: 20px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.app-container {
    width: 100%;
    max-width: 450px;
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

header {
    text-align: center;
}

header h1 {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 0.2rem;
    background: linear-gradient(90deg, #ff8a00, #e52e71, #9b2deb);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* General Stage Config */
.stage {
    display: none;
    flex-direction: column;
    gap: 1.5rem;
    animation: fadeIn 0.4s ease forwards;
}

.stage.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Color Display Blocks */
.color-display {
    width: 100%;
    height: var(--display-size);
    border-radius: var(--border-radius);
    background-color: #333; /* default neutral grey */
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.1);
    transition: background-color 0.3s ease;
    position: relative;
    overflow: hidden;
}



.timer {
    font-size: 4rem;
    font-weight: 800;
    color: rgba(255,255,255,0.9);
    text-shadow: 0 4px 10px rgba(0,0,0,0.5);
    display: none; /* hidden until started */
}

/* Difficulty Selector */
.difficulty-selector {
    display: flex;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.5rem;
    border-radius: 12px;
}

.diff-btn {
    flex: 1;
    padding: 0.8rem 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.diff-btn.active {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.diff-btn:hover:not(.active) {
    background: rgba(255,255,255,0.1);
}

/* Controls */
.controls {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.slider-group label {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.slider-group span {
    color: var(--text-primary);
    font-weight: 800;
}

/* Custom Input Range Styling */
input[type=range] {
    -webkit-appearance: none;
    width: 100%;
    background: transparent;
}

input[type=range]:focus {
    outline: none;
}

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 8px;
    cursor: pointer;
    border-radius: 4px;
}

/* Tracks */
#hue-slider::-webkit-slider-runnable-track {
    background: linear-gradient(to right, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);
}
#sat-slider::-webkit-slider-runnable-track {
    background: linear-gradient(to right, #808080, #5e6ad2); /* dynamic in js */
}
#lit-slider::-webkit-slider-runnable-track {
    background: linear-gradient(to right, #000, #5e6ad2, #fff); /* dynamic in js */
}

input[type=range]::-webkit-slider-thumb {
    height: 24px;
    width: 24px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    -webkit-appearance: none;
    margin-top: -8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.4);
    border: 2px solid #222;
}

/* FireFox */
input[type=range]::-moz-range-track {
    width: 100%;
    height: 8px;
    cursor: pointer;
    border-radius: 4px;
}
input[type=range]::-moz-range-thumb {
    height: 24px;
    width: 24px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.4);
    border: 2px solid #222;
}

/* Results Stage */
.results-visual {
    display: flex;
    gap: 1rem;
    height: 100px;
}

.result-color {
    flex: 1;
    border-radius: 12px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 0.5rem;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.1);
    position: relative;
    overflow: hidden;
}



.result-color span {
    font-size: 0.8rem;
    font-weight: 600;
    color: #fff;
    background: rgba(0,0,0,0.5);
    padding: 0.2rem 0.6rem;
    border-radius: 10px;
}

.score-container {
    text-align: center;
    padding: 1rem 0;
}

.score-text {
    font-size: 1rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.score-value {
    font-size: 4rem;
    font-weight: 800;
    color: #4CAF50;
    line-height: 1;
}

/* Buttons */
.btn {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn.primary {
    background-color: var(--accent);
    color: #fff;
}

.btn.primary:hover {
    background-color: var(--accent-hover);
    transform: translateY(-2px);
}

.btn.outline {
    background-color: transparent;
    color: var(--text-primary);
    border: 2px solid var(--text-secondary);
}

.btn.outline:hover {
    border-color: var(--text-primary);
    background-color: rgba(255,255,255,0.05);
}

.hidden {
    display: none !important;
}

/* Custom UI components */
.menu-options {
    background: rgba(255, 255, 255, 0.03);
    padding: 1rem;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
    font-weight: 600;
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input { 
  opacity: 0;
  width: 0;
  height: 0;
}

.slider.round {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #333;
  transition: .4s;
  border-radius: 34px;
}

.slider.round:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

input:checked + .slider.round {
  background-color: var(--accent);
}

input:checked + .slider.round:before {
  transform: translateX(20px);
}

.leaderboard-panel {
    text-align: center;
    background: rgba(0,0,0,0.3);
    padding: 0.8rem;
    border-radius: 8px;
    font-weight: 800;
    font-size: 0.9rem;
    color: #FFD700;
}

.extreme-mode .slider-group span {
    color: transparent !important;
    text-shadow: 0 0 5px rgba(255,255,255,0.8);
}

.color-name-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 0.65rem;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-weight: bold;
}
