:root {
    --theme-bg: #f5f6f8;
    --theme-surface: #ffffff;
    --theme-surface-soft: #f1f5f9;
    --theme-text: #111827;
    --theme-muted: #4b5563;
    --theme-accent: #7c3aed;
    --theme-border: #d1d5db;
    --theme-shadow: 0 16px 30px rgba(17, 24, 39, 0.12);
}

html,
body {
    transition: background-color 0.45s ease, color 0.45s ease;
}

body {
    background-image: radial-gradient(circle at 20% 20%, rgba(124, 58, 237, 0.08), transparent 40%),
        radial-gradient(circle at 85% 0%, rgba(16, 185, 129, 0.08), transparent 42%);
    background-attachment: fixed;
}

[data-ui-theme] body,
[data-ui-theme] nav > div,
[data-ui-theme] main > div,
[data-ui-theme] section,
[data-ui-theme] article,
[data-ui-theme] .project-card,
[data-ui-theme] .reveal {
    transition: background-color 0.45s ease, color 0.45s ease, border-color 0.45s ease, box-shadow 0.45s ease,
        transform 0.35s ease;
}

[data-ui-theme] .theme-surface,
[data-ui-theme] .project-card,
[data-ui-theme] .rounded-\[2rem\],
[data-ui-theme] .rounded-full {
    border-color: var(--theme-border);
}

#theme-selector-overlay {
    position: fixed;
    inset: 0;
    z-index: 12000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    background: linear-gradient(130deg, rgba(6, 9, 20, 0.88), rgba(17, 24, 39, 0.92));
    backdrop-filter: blur(7px);
    transition: opacity 0.35s ease, visibility 0.35s ease;
}

#theme-selector-overlay.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.theme-selector-panel {
    width: min(1080px, 100%);
    max-height: 90vh;
    overflow: auto;
    border-radius: 1.75rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(15, 23, 42, 0.86);
    padding: 1.5rem;
    box-shadow: 0 35px 70px rgba(0, 0, 0, 0.45);
    transform: scale(0.93);
    opacity: 0;
    transition: transform 0.35s ease, opacity 0.35s ease;
}

#theme-selector-overlay.is-visible .theme-selector-panel {
    transform: scale(1);
    opacity: 1;
}

.theme-selector-title {
    font-size: clamp(1.8rem, 4vw, 2.7rem);
    line-height: 1.1;
    color: #f9fafb;
    font-weight: 900;
    letter-spacing: -0.02em;
}

.theme-selector-subtitle {
    margin-top: 0.4rem;
    color: #cbd5e1;
    font-family: "JetBrains Mono", monospace;
    font-size: 0.9rem;
}

.theme-selector-grid {
    margin-top: 1.5rem;
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(1, minmax(0, 1fr));
}

.theme-option-card {
    position: relative;
    border-radius: 1.2rem;
    padding: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.04);
    cursor: pointer;
    text-align: left;
    color: #e5e7eb;
    min-height: 190px;
    transform-style: preserve-3d;
    transition: transform 0.35s ease, box-shadow 0.35s ease, border-color 0.35s ease;
}

.theme-option-card:focus-visible {
    outline: 2px solid #a3e635;
    outline-offset: 3px;
}

.theme-option-card:hover {
    border-color: rgba(163, 230, 53, 0.8);
}

.theme-option-card h3 {
    font-weight: 800;
    font-size: 1.1rem;
}

.theme-option-card p {
    margin-top: 0.3rem;
    color: #cbd5e1;
    font-size: 0.78rem;
    line-height: 1.45;
}

.theme-mini-preview {
    margin-top: 0.9rem;
    height: 94px;
    border-radius: 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    overflow: hidden;
    position: relative;
    display: grid;
    grid-template-columns: 35% 65%;
}

.theme-mini-preview::before,
.theme-mini-preview::after {
    content: "";
    position: absolute;
}

.theme-mini-preview .left,
.theme-mini-preview .right {
    position: relative;
}

.theme-mini-preview .left {
    border-right: 1px solid rgba(255, 255, 255, 0.18);
}

.theme-mini-preview .right {
    display: grid;
    gap: 0.45rem;
    align-content: center;
    padding: 0.7rem;
}

.theme-mini-preview .line {
    height: 8px;
    border-radius: 999px;
}

.theme-option-card[data-theme="minimalism"] .theme-mini-preview {
    background: #ffffff;
}

.theme-option-card[data-theme="minimalism"] .left {
    background: #f8fafc;
}

.theme-option-card[data-theme="minimalism"] .line {
    background: #d1d5db;
}

.theme-option-card[data-theme="minimalism"]:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 15px 35px rgba(255, 255, 255, 0.16);
}

.theme-option-card[data-theme="glassmorphism"] .theme-mini-preview {
    background: linear-gradient(130deg, rgba(148, 163, 184, 0.2), rgba(30, 41, 59, 0.42));
    backdrop-filter: blur(12px);
}

.theme-option-card[data-theme="glassmorphism"] .left {
    background: rgba(255, 255, 255, 0.16);
    backdrop-filter: blur(8px);
}

.theme-option-card[data-theme="glassmorphism"] .line {
    background: rgba(248, 250, 252, 0.45);
}

.theme-option-card[data-theme="glassmorphism"]:hover {
    transform: translateY(-6px) scale(1.02) rotateX(6deg);
    box-shadow: 0 20px 35px rgba(56, 189, 248, 0.28);
}

.theme-option-card[data-theme="depth"] .theme-mini-preview {
    background: linear-gradient(160deg, #e0e7ff, #c7d2fe);
}

.theme-option-card[data-theme="depth"] .left {
    background: #a5b4fc;
    box-shadow: inset -6px 0 10px rgba(49, 46, 129, 0.22);
}

.theme-option-card[data-theme="depth"] .line {
    background: #6366f1;
    box-shadow: 0 5px 8px rgba(67, 56, 202, 0.25);
}

.theme-option-card[data-theme="depth"]:hover {
    transform: perspective(900px) rotateY(-8deg) translateY(-5px);
    box-shadow: 0 22px 35px rgba(79, 70, 229, 0.32);
}

.theme-option-card[data-theme="brutalism"] .theme-mini-preview {
    background: #fde047;
    border: 3px solid #111827;
}

.theme-option-card[data-theme="brutalism"] .left {
    background: #fb7185;
    border-right: 3px solid #111827;
}

.theme-option-card[data-theme="brutalism"] .line {
    height: 10px;
    border-radius: 0;
    border: 2px solid #111827;
    background: #2dd4bf;
}

.theme-option-card[data-theme="brutalism"]:hover {
    transform: translate(-4px, -4px) scale(1.01);
    box-shadow: 8px 8px 0 #111827;
}

.theme-option-card[data-theme="neumorphism"] .theme-mini-preview {
    background: #e5e7eb;
}

.theme-option-card[data-theme="neumorphism"] .left {
    background: #e5e7eb;
    box-shadow: inset -7px -7px 12px rgba(255, 255, 255, 0.75), inset 7px 7px 12px rgba(156, 163, 175, 0.5);
}

.theme-option-card[data-theme="neumorphism"] .line {
    background: #d1d5db;
    box-shadow: -4px -4px 8px rgba(255, 255, 255, 0.72), 4px 4px 8px rgba(156, 163, 175, 0.45);
}

.theme-option-card[data-theme="neumorphism"]:hover {
    transform: translateY(-4px);
    box-shadow: -9px -9px 17px rgba(255, 255, 255, 0.68), 10px 10px 18px rgba(100, 116, 139, 0.35);
}

.theme-option-card.is-active {
    border-color: #a3e635;
    box-shadow: 0 0 0 2px rgba(163, 230, 53, 0.45);
}

[data-ui-theme="minimalism"] {
    --theme-bg: #f8fafc;
    --theme-surface: #ffffff;
    --theme-surface-soft: #f1f5f9;
    --theme-text: #0f172a;
    --theme-muted: #475569;
    --theme-accent: #0ea5e9;
    --theme-border: #dbe3ee;
    --theme-shadow: 0 14px 26px rgba(15, 23, 42, 0.08);
}

[data-ui-theme="glassmorphism"] {
    --theme-bg: #0f172a;
    --theme-surface: rgba(148, 163, 184, 0.12);
    --theme-surface-soft: rgba(255, 255, 255, 0.08);
    --theme-text: #f8fafc;
    --theme-muted: #cbd5e1;
    --theme-accent: #22d3ee;
    --theme-border: rgba(148, 163, 184, 0.45);
    --theme-shadow: 0 24px 45px rgba(15, 23, 42, 0.45);
}

[data-ui-theme="depth"] {
    --theme-bg: #eef2ff;
    --theme-surface: #ffffff;
    --theme-surface-soft: #e0e7ff;
    --theme-text: #1e1b4b;
    --theme-muted: #4338ca;
    --theme-accent: #4f46e5;
    --theme-border: #c7d2fe;
    --theme-shadow: 0 28px 42px rgba(67, 56, 202, 0.23);
}

[data-ui-theme="brutalism"] {
    --theme-bg: #fef08a;
    --theme-surface: #ffffff;
    --theme-surface-soft: #fca5a5;
    --theme-text: #111827;
    --theme-muted: #1f2937;
    --theme-accent: #ef4444;
    --theme-border: #111827;
    --theme-shadow: 8px 8px 0 #111827;
}

[data-ui-theme="neumorphism"] {
    --theme-bg: #e5e7eb;
    --theme-surface: #e5e7eb;
    --theme-surface-soft: #d1d5db;
    --theme-text: #334155;
    --theme-muted: #64748b;
    --theme-accent: #0f766e;
    --theme-border: #d1d5db;
    --theme-shadow: -11px -11px 22px rgba(255, 255, 255, 0.7), 11px 11px 22px rgba(148, 163, 184, 0.45);
}

[data-ui-theme] body {
    background-color: var(--theme-bg);
    color: var(--theme-text);
}

[data-ui-theme] nav > div,
[data-ui-theme] .project-card,
[data-ui-theme] .rounded-\[2rem\] {
    box-shadow: var(--theme-shadow);
}

[data-ui-theme] .text-neutral-500,
[data-ui-theme] .text-neutral-400,
[data-ui-theme] .text-neutral-600 {
    color: var(--theme-muted) !important;
}

[data-ui-theme] .text-neutral-900,
[data-ui-theme] .text-neutral-800,
[data-ui-theme] .text-black,
[data-ui-theme] .dark\:text-black,
[data-ui-theme] .group-hover\:text-black:hover,
[data-ui-theme] .hover\:text-black:hover {
    color: var(--theme-text) !important;
}

[data-ui-theme] .text-white,
[data-ui-theme] .dark\:text-white,
[data-ui-theme] .group-hover\:text-white:hover,
[data-ui-theme] .dark\:group-hover\:text-white:hover {
    color: var(--theme-text) !important;
}

[data-ui-theme] .bg-white,
[data-ui-theme] .bg-neutral-50,
[data-ui-theme] .bg-neutral-100,
[data-ui-theme] .dark\:bg-neutral-900,
[data-ui-theme] .dark\:bg-neutral-800,
[data-ui-theme] .dark\:bg-neutral-900\/80,
[data-ui-theme] .dark\:bg-neutral-800\/50 {
    background-color: var(--theme-surface) !important;
}

[data-ui-theme] .border-neutral-200,
[data-ui-theme] .dark\:border-neutral-800,
[data-ui-theme] .border-neutral-300,
[data-ui-theme] .dark\:border-neutral-700 {
    border-color: var(--theme-border) !important;
}

[data-ui-theme] .text-purple-600,
[data-ui-theme] .dark\:text-brand-lime,
[data-ui-theme] .hover\:text-purple-600:hover,
[data-ui-theme] .dark\:hover\:text-brand-lime:hover {
    color: var(--theme-accent) !important;
}

[data-ui-theme] .dark\:text-neutral-400,
[data-ui-theme] .dark\:text-neutral-300,
[data-ui-theme] .dark\:text-neutral-500 {
    color: var(--theme-muted) !important;
}

[data-ui-theme="glassmorphism"] .text-neutral-900,
[data-ui-theme="glassmorphism"] .text-neutral-800,
[data-ui-theme="glassmorphism"] .text-black,
[data-ui-theme="glassmorphism"] .dark\:text-black {
    color: #f8fafc !important;
}

[data-ui-theme="glassmorphism"] .rounded-\[2rem\],
[data-ui-theme="glassmorphism"] .project-card,
[data-ui-theme="glassmorphism"] nav > div {
    backdrop-filter: blur(12px);
    background: linear-gradient(140deg, rgba(248, 250, 252, 0.12), rgba(148, 163, 184, 0.06)) !important;
}

[data-ui-theme="brutalism"] .rounded-\[2rem\],
[data-ui-theme="brutalism"] .project-card,
[data-ui-theme="brutalism"] nav > div {
    border-width: 3px !important;
    border-radius: 0.8rem !important;
    box-shadow: 7px 7px 0 #111827 !important;
}

[data-ui-theme="neumorphism"] .rounded-\[2rem\],
[data-ui-theme="neumorphism"] .project-card,
[data-ui-theme="neumorphism"] nav > div {
    border-color: transparent !important;
    box-shadow: -10px -10px 20px rgba(255, 255, 255, 0.72), 10px 10px 20px rgba(148, 163, 184, 0.55) !important;
}

.theme-change-btn {
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    padding: 0.45rem 0.85rem;
    font-size: 0.72rem;
    font-family: "JetBrains Mono", monospace;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #e5e7eb;
    background: rgba(255, 255, 255, 0.07);
    transition: transform 0.28s ease, background-color 0.28s ease;
}

.theme-change-btn:hover {
    transform: translateY(-1px);
    background: rgba(163, 230, 53, 0.22);
}

@media (min-width: 640px) {
    .theme-selector-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .theme-selector-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }

    .theme-option-card {
        min-height: 230px;
    }
}

@media (max-width: 640px) {
    .theme-selector-panel {
        padding: 1rem;
        border-radius: 1.2rem;
    }

    #theme-selector-overlay {
        padding: 0.8rem;
    }
}
