:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #1a1a2e;
    --bg-glass: rgba(26, 26, 46, 0.6);
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent-1: #6c5ce7;
    --accent-2: #a29bfe;
    --accent-3: #fd79a8;
    --border-color: rgba(108, 92, 231, 0.2);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 20px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font-display: 'Orbitron', monospace;
    --font-body: 'Inter', sans-serif;
    --font-alt: 'Space Grotesk', sans-serif;
}

[data-theme="light"] {
    --bg-primary: #f8fafc;
    --bg-secondary: #f1f5f9;
    --bg-card: #ffffff;
    --bg-glass: rgba(255, 255, 255, 0.7);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border-color: rgba(108, 92, 231, 0.15);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    transition: var(--transition);
}

.cursor-glow {
    position: fixed;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(108,92,231,0.08) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
    transition: all 0.1s ease;
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    height: 64px;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
}

.brand-icon {
    color: var(--accent-1);
    font-size: 1.3rem;
    animation: spin 4s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.theme-toggle {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: var(--transition);
}

.theme-toggle:hover {
    background: var(--accent-1);
    transform: scale(1.05);
}

/* Main Content */
.main-content {
    padding-top: 64px;
    min-height: 100vh;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    color: white;
    box-shadow: 0 4px 15px rgba(108, 92, 231, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(108, 92, 231, 0.4);
}

.btn-glow {
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from { box-shadow: 0 4px 15px rgba(108, 92, 231, 0.3); }
    to { box-shadow: 0 4px 25px rgba(108, 92, 231, 0.6), 0 0 40px rgba(108, 92, 231, 0.2); }
}

.btn-secondary {
    background: var(--bg-glass);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-card);
    transform: translateY(-2px);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    font-size: 1.2rem;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
}

.btn-ghost:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.btn-glass {
    background: var(--bg-glass);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
}

.btn-glass:hover {
    background: var(--accent-1);
    color: white;
    border-color: transparent;
}

.btn-action {
    width: 100%;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    justify-content: center;
    padding: 0.6rem;
    font-size: 0.85rem;
}

.btn-action:hover {
    background: var(--accent-1);
    color: white;
    border-color: transparent;
}

/* Hero Section */
.hero-section {
    min-height: calc(100vh - 64px);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    padding: 2rem;
}

.hero-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
    animation: float 6s ease-in-out infinite;
}

.orb-1 {
    width: 400px;
    height: 400px;
    background: var(--accent-1);
    top: -10%;
    left: -10%;
}

.orb-2 {
    width: 300px;
    height: 300px;
    background: var(--accent-3);
    bottom: -10%;
    right: -10%;
    animation-delay: -2s;
}

.orb-3 {
    width: 200px;
    height: 200px;
    background: var(--accent-2);
    top: 50%;
    left: 50%;
    animation-delay: -4s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -30px) scale(1.1); }
    66% { transform: translate(-20px, 20px) scale(0.9); }
}

.hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 700px;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    padding: 0.4rem 1rem;
    border-radius: 50px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    backdrop-filter: blur(10px);
}

.badge-dot {
    width: 8px;
    height: 8px;
    background: var(--accent-1);
    border-radius: 50%;
    animation: pulse-dot 1.5s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

.hero-title {
    font-family: var(--font-display);
    font-size: 4rem;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
}

.title-line {
    display: block;
}

.title-line.accent {
    background: linear-gradient(135deg, var(--accent-1), var(--accent-3));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 5rem;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
    line-height: 1.8;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 3rem;
}

.hero-stats {
    display: flex;
    gap: 3rem;
    justify-content: center;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.stat-value {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* How to Section */
.howto-section {
    padding: 5rem 2rem;
    background: var(--bg-secondary);
}

.section-header {
    text-align: center;
    margin-bottom: 3rem;
}

.section-header h2 {
    font-family: var(--font-display);
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

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

.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    max-width: 1000px;
    margin: 0 auto;
}

.step-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    position: relative;
    transition: var(--transition);
}

.step-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow);
    border-color: var(--accent-1);
}

.step-number {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
}

.step-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    margin-top: 0.5rem;
}

.step-card h3 {
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.step-card p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.6;
}

/* Levels Section */
.levels-section {
    padding: 5rem 2rem;
}

.levels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    max-width: 900px;
    margin: 0 auto;
}

.level-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text-primary);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.level-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--level-color);
    opacity: 0;
    transition: var(--transition);
}

.level-card:hover {
    transform: translateX(5px);
    border-color: var(--level-color);
    box-shadow: var(--shadow);
}

.level-card:hover::before {
    opacity: 1;
}

.level-icon {
    font-size: 2rem;
    width: 50px;
    text-align: center;
}

.level-info {
    flex: 1;
}

.level-info h3 {
    font-size: 1rem;
    margin-bottom: 0.15rem;
}

.level-info p {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.level-diff {
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
}

.level-arrow {
    font-size: 1.2rem;
    opacity: 0;
    transition: var(--transition);
}

.level-card:hover .level-arrow {
    opacity: 1;
    transform: translateX(3px);
}

/* Footer */
.site-footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--border-color);
}

/* ---------- EDITOR ---------- */
.editor-container {
    display: flex;
    height: calc(100vh - 64px);
    overflow: hidden;
}

.editor-sidebar {
    width: 280px;
    min-width: 280px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    padding: 1rem;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h2 {
    font-family: var(--font-display);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.tool-section {
    margin-bottom: 1.5rem;
}

.tool-section h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.color-pickers {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.color-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.color-group label {
    font-size: 0.65rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.color-group input[type="color"] {
    width: 44px;
    height: 44px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    background: none;
    padding: 2px;
}

.color-group input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-group input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 6px;
}

.color-presets {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 4px;
}

.preset-btn {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 6px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: var(--transition);
}

.preset-btn:hover {
    border-color: var(--text-primary);
    transform: scale(1.1);
}

.tool-select {
    width: 100%;
    padding: 0.5rem;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.85rem;
    cursor: pointer;
    margin-bottom: 0.75rem;
}

.range-group {
    margin-bottom: 0.5rem;
}

.range-group label {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

input[type="range"] {
    width: 100%;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--accent-1);
    border-radius: 50%;
    border: 2px solid var(--bg-primary);
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.icon-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    margin-bottom: 0.75rem;
}

.icon-opt {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-primary);
}

.icon-opt:hover {
    border-color: var(--accent-1);
    background: rgba(108, 92, 231, 0.1);
}

.icon-opt.active {
    border-color: var(--accent-1);
    background: rgba(108, 92, 231, 0.2);
    box-shadow: 0 0 0 2px var(--accent-1);
}

/* Editor Main */
.editor-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    position: relative;
}

.editor-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    gap: 1rem;
    flex-wrap: wrap;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.level-indicator {
    padding: 0.35rem 1rem;
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    color: white;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.brand-name-display {
    font-family: var(--font-display);
    font-size: 0.9rem;
    color: var(--text-secondary);
    letter-spacing: 3px;
    text-transform: uppercase;
}

.toolbar-right {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.canvas-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

.canvas-wrapper::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 50%, rgba(108,92,231,0.03) 0%, transparent 70%);
    pointer-events: none;
}

#logoCanvas {
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    max-width: 100%;
    max-height: 100%;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal-overlay.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

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

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.modal-header h3 {
    font-family: var(--font-display);
    font-size: 1.1rem;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--text-primary);
    transform: rotate(90deg);
}

.compare-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.compare-item {
    flex: 1;
}

.compare-item h4 {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.75rem;
}

.compare-canvas {
    background: var(--bg-primary);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    aspect-ratio: 3/2;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.compare-canvas canvas {
    max-width: 100%;
    max-height: 100%;
}

.compare-divider {
    display: flex;
    align-items: center;
}

.vs-badge {
    padding: 0.5rem 0.75rem;
    background: linear-gradient(135deg, var(--accent-1), var(--accent-3));
    color: white;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.8rem;
}

.compare-slider-wrap {
    max-width: 400px;
    margin: 0 auto;
}

.compare-slider-wrap input[type="range"] {
    width: 100%;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Result Modal */
.result-content {
    max-width: 500px;
    text-align: center;
}

.result-header h2 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
}

.result-grid {
    display: flex;
    gap: 2rem;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.grade-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-1), var(--accent-3));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 30px rgba(108, 92, 231, 0.3);
    animation: pulseGrade 2s ease-in-out infinite;
}

@keyframes pulseGrade {
    0%, 100% { box-shadow: 0 0 30px rgba(108, 92, 231, 0.3); }
    50% { box-shadow: 0 0 50px rgba(108, 92, 231, 0.5); }
}

.grade-letter {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 900;
    color: white;
    line-height: 1;
}

.grade-label {
    font-size: 0.65rem;
    color: rgba(255,255,255,0.8);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.total-score {
    font-size: 3rem;
    font-weight: 800;
    font-family: var(--font-display);
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.result-bars {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.bar-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.bar-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-muted);
    width: 90px;
    text-align: right;
    letter-spacing: 0.5px;
}

.bar-track {
    flex: 1;
    height: 8px;
    background: var(--bg-card);
    border-radius: 4px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 1s ease;
    width: 0;
}

.bar-value {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-primary);
    width: 30px;
    text-align: left;
}

.result-feedback {
    text-align: left;
    background: var(--bg-card);
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
}

.result-feedback ul {
    list-style: none;
    padding: 0;
}

.result-feedback li {
    padding: 0.35rem 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.result-feedback li::before {
    content: '→ ';
    color: var(--accent-1);
}

.result-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-1);
}

/* Responsive */
@media (max-width: 768px) {
    .hero-title { font-size: 2.5rem; }
    .title-line.accent { font-size: 3rem; }
    .hero-stats { gap: 1.5rem; }
    .editor-container { flex-direction: column; }
    .editor-sidebar {
        width: 100%;
        min-width: unset;
        max-height: 40vh;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    .editor-toolbar { flex-direction: column; align-items: stretch; }
    .toolbar-right { justify-content: center; }
    .compare-container { flex-direction: column; }
    .result-grid { flex-direction: column; }
}

@media (max-width: 480px) {
    .hero-title { font-size: 1.8rem; }
    .title-line.accent { font-size: 2.2rem; }
    .hero-actions { flex-direction: column; }
    .navbar { padding: 0 1rem; }
}
