@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap');

/* --- CSS Variables for Premium Theme --- */
:root {
    --bg-color: #0f172a;
    --panel-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.08);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    
    --accent-cyan: #06b6d4;
    --accent-blue: #3b82f6;
    --accent-purple: #8b5cf6;
    --accent-green: #10b981;
    --accent-danger: #ef4444;
}

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

body {
    background: radial-gradient(circle at top right, #1e1b4b 0%, var(--bg-color) 60%, #020617 100%);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    padding-bottom: 30px;
    overflow-x: hidden;
}

/* --- App Header --- */
.app-header {
    text-align: center;
    padding: 20px 15px;
    width: 100%;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
    position: sticky;
    top: 0;
    z-index: 100;
}

h1 { font-size: 1.8rem; font-weight: 800; letter-spacing: 0.5px; }
h1 span { 
    background: linear-gradient(to right, var(--accent-cyan), var(--accent-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 20px rgba(6, 182, 212, 0.4);
}
.premium-icon { color: #f59e0b; font-size: 1.2rem; filter: drop-shadow(0 0 5px rgba(245, 158, 11, 0.5)); margin-left: 5px; }
.app-header p { color: var(--text-muted); font-size: 0.85rem; margin-top: 5px; font-weight: 400; }

.main-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    padding: 25px 20px;
    max-width: 500px;
    width: 100%;
}

/* --- Premium 3D Cube Scene --- */
.cube-workspace {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

/* Adding a glowing platform effect below the cube */
.cube-workspace::after {
    content: '';
    position: absolute;
    bottom: 10px;
    width: 150px;
    height: 20px;
    background: radial-gradient(ellipse, rgba(6,182,212,0.3) 0%, transparent 70%);
    filter: blur(10px);
    z-index: -1;
}

.scene {
    width: 210px;
    height: 210px;
    perspective: 1200px;
    margin-bottom: 20px;
    cursor: grab;
}
.scene:active { cursor: grabbing; }

.cube {
    width: 100%; height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transform: rotateX(-25deg) rotateY(45deg);
    transition: transform 0.7s cubic-bezier(0.25, 1, 0.5, 1);
}

.face {
    position: absolute;
    width: 210px; height: 210px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 4px;
    background: #000; /* Black core of the cube */
    padding: 4px;
    border-radius: 12px;
    border: 2px solid #1e293b;
    box-shadow: 0 0 15px rgba(0,0,0,0.8);
}

.facelet {
    width: 100%; height: 100%;
    border-radius: 6px;
    background-color: #334155;
    cursor: pointer;
    /* Premium realistic plastic effect */
    box-shadow: inset -3px -3px 6px rgba(0,0,0,0.4), inset 3px 3px 6px rgba(255,255,255,0.2);
    transition: background-color 0.3s ease, transform 0.1s;
}

.facelet:active { transform: scale(0.95); }

/* Math for depth: 210px / 2 = 105px */
.front  { transform: rotateY(0deg) translateZ(105px); }
.right  { transform: rotateY(90deg) translateZ(105px); }
.back   { transform: rotateY(180deg) translateZ(105px); }
.left   { transform: rotateY(-90deg) translateZ(105px); }
.top    { transform: rotateX(90deg) translateZ(105px); }
.bottom { transform: rotateX(-90deg) translateZ(105px); }

.instruction-text {
    color: var(--text-muted);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0,0,0,0.3);
    padding: 6px 15px;
    border-radius: 20px;
}

/* --- Control Panel (Glassmorphism) --- */
.control-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 25px;
    border-radius: 24px;
    width: 100%;
    border: 1px solid var(--glass-border);
    box-shadow: 0 20px 40px rgba(0,0,0,0.4), inset 0 1px 1px rgba(255,255,255,0.1);
}

.control-section { display: none; animation: slideUp 0.5s ease; }
.control-section.active { display: block; }
@keyframes slideUp { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: translateY(0); } }

h3 { color: var(--text-main); font-size: 1.15rem; margin-bottom: 6px; font-weight: 600; display: flex; align-items: center; gap: 8px;}
h3 i { color: var(--accent-cyan); }
.sub-text { color: var(--text-muted); font-size: 0.8rem; margin-bottom: 20px; line-height: 1.4; }

/* --- Premium Color Palette --- */
.color-palette {
    display: flex;
    justify-content: space-between;
    margin-bottom: 25px;
    padding: 10px;
    background: rgba(0,0,0,0.2);
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.05);
}

.color-btn {
    width: 42px; height: 42px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #334155;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 10px rgba(0,0,0,0.3), inset -2px -2px 4px rgba(0,0,0,0.3), inset 2px 2px 4px rgba(255,255,255,0.4);
}

.color-btn.selected { 
    border-color: var(--text-main); 
    transform: scale(1.15) translateY(-3px); 
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.5), inset 0 0 10px rgba(255,255,255,0.5); 
}

/* Base Colors */
.white { background: #f8fafc; } .red { background: #ef4444; } .blue { background: #3b82f6; }
.orange { background: #f97316; } .green { background: #10b981; } .yellow { background: #eab308; }

/* --- Action Grid & Buttons --- */
.action-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.action-btn {
    padding: 14px 10px;
    border: none;
    border-radius: 14px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

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

/* Auto Mix - Purple Gradient */
.auto-btn {
    grid-column: span 2;
    background: linear-gradient(135deg, #a855f7 0%, #7e22ce 100%);
    box-shadow: 0 6px 20px rgba(168, 85, 247, 0.3), inset 0 1px 1px rgba(255,255,255,0.3);
}
.auto-btn:hover { box-shadow: 0 8px 25px rgba(168, 85, 247, 0.5); filter: brightness(1.1); }

/* AI Solve - Cyan/Blue Gradient */
.solve-btn {
    background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-blue) 100%);
    box-shadow: 0 6px 20px rgba(6, 182, 212, 0.3), inset 0 1px 1px rgba(255,255,255,0.3);
}
.solve-btn:hover { box-shadow: 0 8px 25px rgba(6, 182, 212, 0.5); filter: brightness(1.1); }

/* Reset Button - Dark Glass */
.reset-btn {
    background: rgba(51, 65, 85, 0.6);
    border: 1px solid rgba(255,255,255,0.1);
}
.reset-btn:hover { background: rgba(71, 85, 105, 0.8); }

/* --- Validation Box --- */
.validation-box {
    background: rgba(239, 68, 68, 0.1);
    border-left: 4px solid var(--accent-danger);
    padding: 14px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.85rem;
    color: #fca5a5;
    line-height: 1.5;
    backdrop-filter: blur(5px);
}
.validation-box strong { color: #fee2e2; }

/* --- Live Solver Player UI --- */
.solver-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.move-badge { 
    background: rgba(6, 182, 212, 0.15); 
    color: var(--accent-cyan); 
    padding: 6px 12px; 
    border-radius: 20px; 
    font-weight: 700; 
    font-size: 0.85rem; 
    border: 1px solid rgba(6, 182, 212, 0.3);
    letter-spacing: 1px;
}

.progress-container {
    width: 100%; height: 8px; 
    background: rgba(0,0,0,0.4); 
    border-radius: 4px; 
    margin: 18px 0; 
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.5);
}

.progress-bar { 
    height: 100%; width: 0%; 
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-blue)); 
    border-radius: 4px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.5);
}

.step-title { color: var(--text-main); font-size: 1rem; margin-bottom: 10px; font-weight: 600; }

.instruction-box {
    background: rgba(0, 0, 0, 0.25);
    padding: 18px; 
    border-radius: 14px;
    font-size: 0.95rem; 
    line-height: 1.6; 
    border: 1px solid rgba(255,255,255,0.05);
    margin-bottom: 25px; 
    color: var(--text-main); 
    min-height: 90px; 
    display: flex; 
    align-items: center;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.2);
}
.hindi-text strong { color: var(--accent-cyan); font-size: 1.05rem; }

/* Media Controls */
.player-controls { display: flex; justify-content: space-between; align-items: center; }
.media-btns { display: flex; gap: 15px; align-items: center; }

.media-btn { 
    background: rgba(51, 65, 85, 0.5); 
    color: white; 
    border: 1px solid rgba(255,255,255,0.1);
    width: 44px; height: 44px; 
    border-radius: 50%; 
    cursor: pointer; 
    transition: 0.3s; 
    display: flex; justify-content: center; align-items: center;
}
.media-btn:hover { background: rgba(71, 85, 105, 0.9); transform: scale(1.05); }

.play-pause-btn { 
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue)); 
    border: none;
    width: 56px; height: 56px; 
    font-size: 1.3rem; 
    box-shadow: 0 8px 20px rgba(6, 182, 212, 0.4); 
}
.play-pause-btn:hover { box-shadow: 0 10px 25px rgba(6, 182, 212, 0.6); transform: scale(1.05); }

.speed-btn, .edit-btn { 
    background: transparent; 
    color: var(--text-muted); 
    border: none; 
    cursor: pointer; 
    font-size: 0.85rem; 
    font-weight: 500; 
    padding: 8px 12px;
    border-radius: 8px;
    transition: 0.3s;
    display: flex; gap: 6px; align-items: center;
}
.speed-btn:hover, .edit-btn:hover { color: var(--text-main); background: rgba(255,255,255,0.05); }

/* Responsive adjustments */
@media (max-width: 400px) {
    .action-grid { grid-template-columns: 1fr; }
    .auto-btn { grid-column: span 1; }
    .scene { width: 180px; height: 180px; }
    .face { width: 180px; height: 180px; }
    
    .front  { transform: rotateY(0deg) translateZ(90px); }
    .right  { transform: rotateY(90deg) translateZ(90px); }
    .back   { transform: rotateY(180deg) translateZ(90px); }
    .left   { transform: rotateY(-90deg) translateZ(90px); }
    .top    { transform: rotateX(90deg) translateZ(90px); }
    .bottom { transform: rotateX(-90deg) translateZ(90px); }
}
