/* ═══════════════════════════════════════════
   SYNESTHESIA — Infinite Color Mixer
   Multi-Theme Floaty Glass Aesthetic
   ═══════════════════════════════════════════ */

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

:root {
    --bg:         #01050a;
    --glass:      rgba(255, 255, 255, 0.02);
    --glass-lit:  rgba(255, 255, 255, 0.05);
    --text:       rgba(255, 255, 255, 0.9);
    --text-dim:   rgba(255, 255, 255, 0.45);
    --text-muted: rgba(255, 255, 255, 0.25);
    --accent:     #a78bfa;
    --danger:     #f87171;
    --gold:       #fbbf24;
    --sans:  'Inter', -apple-system, sans-serif;
    --serif: 'Playfair Display', Georgia, serif;
    --ease:  cubic-bezier(0.4, 0, 0.2, 1);
    --spring: cubic-bezier(0.16, 1, 0.3, 1);
}

html, body {
    height: 100%;
    font-family: var(--sans);
    background: var(--bg);
    color: var(--text);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent); color: #fff; }
.hidden { display: none !important; }

/* ═══ Animations ═══ */
@keyframes floatSlow {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50%      { transform: translateY(-12px) rotate(1deg); }
}
@keyframes floatAlt {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50%      { transform: translateY(-10px) rotate(-1deg); }
}
@keyframes floatFast {
    0%, 100% { transform: translateY(0px); }
    50%      { transform: translateY(-6px); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ═══ Canvases ═══ */
#bg-canvas {
    position: fixed; inset: 0; width: 100%; height: 100%;
    z-index: 0; pointer-events: none;
}
.parallax-layer {
    position: fixed; inset: 0; z-index: 1;
    pointer-events: none; overflow: hidden;
}
.parallax-orb {
    position: absolute; border-radius: 50%;
    filter: blur(50px); opacity: 0.15;
    will-change: transform; transition: transform 1.5s var(--ease);
    animation: floatSlow 12s ease-in-out infinite;
}
#particle-canvas {
    position: fixed; inset: 0; width: 100%; height: 100%;
    z-index: 5; pointer-events: none;
}

/* ═══ Achievement Banner ═══ */
.achievement {
    position: fixed; top: 20px; left: 50%;
    transform: translateX(-50%) translateY(-100px);
    z-index: 200; display: flex; align-items: center; gap: 12px;
    padding: 12px 24px;
    background: rgba(10, 15, 25, 0.5);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border-radius: 99px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3), inset 0 2px 10px rgba(251,191,36,0.1);
    animation: none;
}
.achievement.show { animation: achIn 0.8s var(--spring) forwards, achOut 0.8s ease 3.5s forwards; }
.ach-icon { font-size: 1.2rem; }
.ach-title { font-size: 0.75rem; font-weight: 700; color: var(--gold); letter-spacing: 0.08em; text-transform: uppercase; }
.ach-desc { font-size: 0.7rem; color: var(--text-dim); margin-top: 1px; }
@keyframes achIn { to { transform: translateX(-50%) translateY(0); } }
@keyframes achOut { to { transform: translateX(-50%) translateY(-100px); opacity: 0; } }

/* ═══ Modal (Floating Glass) ═══ */
.modal-overlay {
    position: fixed; inset: 0; z-index: 100;
    display: flex; align-items: center; justify-content: center;
    background: rgba(1, 3, 8, 0.8);
    backdrop-filter: blur(40px); -webkit-backdrop-filter: blur(40px);
    animation: fadeIn 0.6s ease;
}
.modal-card {
    width: 90%; max-width: 400px;
    padding: 48px 40px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 40px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4), inset 0 1px 20px rgba(255,255,255,0.03);
    animation: modalUp 0.8s var(--spring), floatSlow 8s ease-in-out infinite;
    position: relative;
}
.modal-title {
    font-family: var(--serif); font-size: 2.2rem; font-weight: 400;
    font-style: italic; letter-spacing: -0.02em; margin-bottom: 6px;
    background: linear-gradient(135deg, #fff, var(--text-dim));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.modal-sub {
    color: var(--text-dim); font-size: 0.85rem; font-weight: 300;
    letter-spacing: 0.04em; margin-bottom: 36px;
}
.modal-prism {
    width: 54px; height: 54px; margin: 0 auto 28px;
    background: conic-gradient(from 0deg, #60a5fa, #34d399, #a78bfa, #60a5fa);
    border-radius: 50%;
    animation: hueShift 10s linear infinite, floatAlt 4s ease-in-out infinite;
    box-shadow: 0 10px 40px rgba(96, 165, 250, 0.3);
    filter: blur(2px);
}
@keyframes hueShift { to { filter: hue-rotate(360deg) blur(2px); } }

/* ═══ Inputs (Bubble style) ═══ */
.input-group { text-align: left; margin-bottom: 20px; }
.input-group label {
    display: block; font-size: 0.65rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.15em;
    color: var(--text-muted); margin-bottom: 10px; padding-left: 14px;
}
.input-group input, .input-group select {
    width: 100%; padding: 14px 20px;
    background: rgba(0, 0, 0, 0.2);
    border: none; border-radius: 99px;
    color: var(--text); font-family: var(--sans); font-size: 0.9rem;
    outline: none; transition: all 0.3s var(--ease);
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.3), inset 0 0 0 1px rgba(255,255,255,0.02);
}
.input-group input:focus, .input-group select:focus {
    background: rgba(0, 0, 0, 0.4);
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.4), inset 0 0 0 1px rgba(255,255,255,0.08);
}
.input-group select {
    cursor: pointer; appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' fill='rgba(255,255,255,0.3)' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 20px center;
}
.input-group select option { background: #050a14; color: #fff; }

/* ═══ Buttons (Liquid Drops) ═══ */
.btn-primary {
    width: 100%; padding: 16px;
    background: rgba(255,255,255,0.05);
    color: #fff; font-family: var(--sans); font-size: 0.85rem;
    font-weight: 600; letter-spacing: 0.05em;
    border: none; border-radius: 99px;
    cursor: pointer; transition: all 0.4s var(--spring);
    box-shadow: 0 8px 20px rgba(0,0,0,0.2), inset 0 2px 10px rgba(255,255,255,0.05);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.btn-primary:hover {
    background: rgba(255,255,255,0.1);
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 12px 30px rgba(0,0,0,0.3), inset 0 2px 15px rgba(255,255,255,0.1);
}
.btn-ghost {
    padding: 12px 24px; background: transparent;
    color: var(--text-dim); font-family: var(--sans);
    font-size: 0.8rem; font-weight: 500;
    border: none; border-radius: 99px; cursor: pointer; transition: all 0.3s;
}
.btn-ghost:hover { background: rgba(255,255,255,0.04); color: var(--text); }
.btn-danger {
    width: 100%; padding: 14px; background: rgba(248,113,113,0.05);
    color: var(--danger); font-family: var(--sans); font-size: 0.75rem;
    font-weight: 500; border: none; border-radius: 99px; cursor: pointer; transition: all 0.3s;
}
.btn-danger:hover { background: rgba(248,113,113,0.1); }
.api-link {
    display: inline-block; margin-top: 22px;
    color: var(--text-dim); font-size: 0.75rem; text-decoration: none; transition: color 0.3s;
}
.api-link:hover { color: #fff; }
.modal-actions { display: flex; gap: 12px; }
.modal-actions > * { flex: 1; }
.divider { border: none; height: 1px; background: rgba(255,255,255,0.03); margin: 28px 0; }
.settings-card { max-width: 420px; }

/* ═══ Game Container ═══ */
.game-container {
    position: relative; z-index: 10;
    display: flex; flex-direction: column;
    min-height: 100vh; max-width: 900px;
    margin: 0 auto; padding: 0 24px;
    animation: fadeIn 1s ease;
}

/* ═══ Header ═══ */
.game-header {
    display: flex; align-items: center;
    padding: 24px 0; gap: 16px;
}
.logo { display: flex; align-items: center; gap: 12px; }
.logo-prism {
    font-size: 1.2rem; filter: blur(1px);
    animation: floatFast 3s ease-in-out infinite, hueShift 8s linear infinite;
}
.logo-text {
    font-size: 0.65rem; font-weight: 700;
    letter-spacing: 0.3em; color: var(--text-muted); text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}
.header-stats { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.stat-pill {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 16px;
    background: rgba(0,0,0,0.2); border-radius: 99px;
    font-size: 0.75rem; backdrop-filter: blur(10px);
    box-shadow: inset 0 1px 5px rgba(255,255,255,0.02);
}
.stat-num { font-weight: 700; color: var(--text); }
.stat-label { color: var(--text-muted); font-weight: 400; }
.streak-pill { background: rgba(251,191,36,0.05); }
.streak-pill .stat-num { color: var(--gold); }
.streak-fire { font-size: 0.85rem; }
.header-actions { display: flex; gap: 8px; }
.icon-btn {
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.2); border: none;
    border-radius: 50%; color: var(--text-muted);
    cursor: pointer; transition: all 0.3s var(--ease);
    backdrop-filter: blur(10px);
}
.icon-btn:hover { background: rgba(255,255,255,0.05); color: #fff; transform: scale(1.05); }
.icon-btn.muted svg { opacity: 0.3; }

/* ═══ Merge Station (Floating Bubbles) ═══ */
.merge-station {
    display: flex; flex-direction: column; align-items: center;
    padding: 60px 0 40px; gap: 40px;
}
.merge-slots { display: flex; align-items: center; gap: 30px; }
.merge-slot {
    width: 140px; height: 140px;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 12px;
    background: rgba(255, 255, 255, 0.015);
    border-radius: 50%; cursor: pointer;
    transition: all 0.5s var(--spring); position: relative;
    backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
    box-shadow: 0 15px 40px rgba(0,0,0,0.2), inset 0 2px 20px rgba(255,255,255,0.02);
    animation: floatSlow 7s ease-in-out infinite;
}
.merge-slot:nth-child(3) { animation: floatAlt 8s ease-in-out infinite; animation-delay: -3s; }

.merge-slot:not(.empty) {
    background: rgba(255, 255, 255, 0.03);
    box-shadow: 0 20px 50px rgba(0,0,0,0.3), inset 0 2px 25px rgba(255,255,255,0.05);
}
.merge-slot:not(.empty):hover { transform: scale(0.96) translateY(-5px); }

.slot-ring {
    position: absolute; width: 90px; height: 90px;
    border-radius: 50%; border: none;
    top: 50%; left: 50%; transform: translate(-50%, -50%);
    pointer-events: none; transition: all 0.5s var(--spring);
}
.merge-slot:not(.empty) .slot-ring {
    box-shadow: 0 0 0 1px rgba(255,255,255,0.08);
    animation: ringPulse 4s ease-in-out infinite;
}
@keyframes ringPulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    50% { transform: translate(-50%, -50%) scale(1.1); opacity: 0.3; }
}

.slot-swatch {
    width: 60px; height: 60px; border-radius: 50%;
    background: rgba(0,0,0,0.2);
    transition: all 0.6s var(--spring);
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.5);
}
.merge-slot:not(.empty) .slot-swatch {
    width: 76px; height: 76px;
    box-shadow: none; /* Shadow injected via JS based on color */
}

.slot-name {
    font-size: 0.65rem; font-weight: 500;
    color: var(--text-muted); letter-spacing: 0.08em;
    text-align: center; position: absolute; bottom: -28px;
    width: 150px; white-space: nowrap;
}
.merge-slot:not(.empty) .slot-name {
    color: var(--text-dim); font-style: italic;
    font-family: var(--serif); font-size: 0.75rem; letter-spacing: 0.02em;
}

.merge-operator { display: flex; flex-direction: column; align-items: center; gap: 8px; animation: floatFast 5s ease-in-out infinite; }
.op-line { width: 1px; height: 12px; background: rgba(255,255,255,0.1); border-radius: 2px; }
.op-symbol { font-size: 1.1rem; font-weight: 300; color: var(--text-muted); }

/* ═══ Merge Actions ═══ */
.merge-actions { display: flex; align-items: center; gap: 16px; margin-top: 10px; }
.merge-btn-wrap { animation: fadeIn 0.4s ease; }
.btn-merge {
    padding: 16px 64px;
    background: rgba(255,255,255,0.03); color: var(--text);
    font-family: var(--serif); font-size: 1.1rem;
    font-weight: 400; font-style: italic; letter-spacing: 0.08em;
    border: none; border-radius: 99px; cursor: pointer;
    transition: all 0.4s var(--spring);
    backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.2), inset 0 0 0 1px rgba(255,255,255,0.1);
}
.btn-merge:hover {
    background: rgba(255,255,255,0.06);
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 15px 40px rgba(0,0,0,0.3), inset 0 0 0 1px rgba(255,255,255,0.2);
}
.btn-merge:active { transform: translateY(0) scale(0.98); }
.btn-merge:disabled { opacity: 0.2; cursor: not-allowed; transform: none; }

.btn-random {
    display: flex; align-items: center; gap: 8px;
    padding: 12px 20px;
    background: rgba(0,0,0,0.2); color: var(--text-muted);
    font-family: var(--sans); font-size: 0.75rem; font-weight: 500;
    border: none; border-radius: 99px; cursor: pointer;
    transition: all 0.3s var(--ease); backdrop-filter: blur(10px);
}
.btn-random:hover { color: #fff; background: rgba(255,255,255,0.05); transform: translateY(-2px); }

/* ═══ Loading ═══ */
.merge-loading {
    display: flex; align-items: center; gap: 12px;
    color: var(--text-dim); font-size: 0.85rem;
    font-style: italic; font-family: var(--serif);
    animation: fadeIn 0.4s ease;
}
.spinner {
    width: 18px; height: 18px;
    border: 2px solid rgba(255,255,255,0.1); border-top-color: #fff;
    border-radius: 50%; animation: spin 0.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══ Result ═══ */
.merge-result {
    display: flex; flex-direction: column;
    align-items: center; gap: 14px;
    animation: resultReveal 0.8s var(--spring);
}
@keyframes resultReveal {
    0% { opacity: 0; transform: translateY(-30px) scale(0.8); }
    50% { transform: translateY(5px) scale(1.05); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}
.result-connector {
    width: 1px; height: 30px;
    background: linear-gradient(to bottom, rgba(255,255,255,0.1), transparent);
}
.result-swatch {
    width: 100px; height: 100px; border-radius: 50%;
    position: relative; transition: box-shadow 0.6s ease;
    animation: floatSlow 6s ease-in-out infinite;
}
.result-ring {
    position: absolute; inset: -10px;
    border-radius: 50%; box-shadow: 0 0 0 1px rgba(255,255,255,0.05);
    animation: ringPulse 3s ease-in-out infinite;
}
.result-name {
    font-family: var(--serif); font-size: 1.8rem;
    font-weight: 400; font-style: italic;
    letter-spacing: -0.01em; margin: 4px 0 0;
}
.result-hex {
    font-size: 0.75rem; font-weight: 500;
    color: var(--text-muted); cursor: pointer;
    padding: 6px 16px; border-radius: 99px;
    background: rgba(0,0,0,0.2); font-family: 'SF Mono', 'Fira Code', monospace;
    transition: all 0.3s var(--ease); backdrop-filter: blur(5px);
}
.result-hex:hover { background: rgba(255,255,255,0.1); color: #fff; }
.result-parents { font-size: 0.65rem; color: var(--text-muted); font-style: italic; font-family: var(--serif); }
.result-badge {
    font-size: 0.6rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
    color: var(--gold); padding: 6px 16px;
    background: rgba(251,191,36,0.08); border-radius: 99px;
    box-shadow: 0 0 20px rgba(251,191,36,0.1);
    animation: pulse 3s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.6; transform: scale(0.98); } }

/* ═══ Recent Mixes (Floating Bubbles) ═══ */
.recent-section { padding: 12px 0 24px; position: relative; z-index: 20; }
.section-title {
    font-family: var(--serif); font-size: 0.9rem;
    font-weight: 400; font-style: italic;
    color: var(--text-dim); letter-spacing: 0.04em; margin-bottom: 16px;
    padding-left: 8px;
}
.recent-strip {
    display: flex; gap: 12px; overflow-x: auto;
    padding: 10px 8px; scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 2%, #000 98%, transparent);
}
.recent-strip::-webkit-scrollbar { display: none; }
.recent-item {
    flex-shrink: 0; display: flex; align-items: center; gap: 10px;
    padding: 10px 18px 10px 10px;
    background: rgba(255,255,255,0.02);
    border-radius: 99px; cursor: pointer;
    transition: all 0.4s var(--spring);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    animation: slideIn 0.5s var(--spring);
}
.recent-item:hover {
    background: rgba(255,255,255,0.05);
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}
.recent-swatch { width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0; }
.recent-name { font-size: 0.68rem; font-weight: 500; color: var(--text-dim); white-space: nowrap; font-family: var(--serif); font-style: italic; }
.recent-arrow { font-size: 0.6rem; color: var(--text-muted); opacity: 0.5; }
.recent-parent-swatch { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; }
@keyframes slideIn { from { opacity: 0; transform: translateX(-20px); } to { opacity: 1; transform: translateX(0); } }

/* ═══ Palette (Water Drops) ═══ */
.palette-section { flex: 1; padding-bottom: 60px; position: relative; z-index: 20; }
.palette-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 24px; gap: 16px; padding: 0 8px;
}
.palette-search {
    width: 200px; padding: 10px 18px;
    background: rgba(0,0,0,0.2); border: none;
    border-radius: 99px; color: var(--text);
    font-family: var(--sans); font-size: 0.75rem; outline: none;
    transition: all 0.3s var(--ease);
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.2);
}
.palette-search::placeholder { color: var(--text-muted); }
.palette-search:focus { background: rgba(0,0,0,0.4); box-shadow: inset 0 2px 10px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.1); }

.palette-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 16px; padding: 10px;
}
.palette-item {
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    padding: 20px 10px 16px;
    background: rgba(255,255,255,0.015);
    border-radius: 40px; cursor: pointer;
    transition: all 0.4s var(--spring); user-select: none; position: relative;
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15), inset 0 2px 10px rgba(255,255,255,0.02);
    animation: itemIn 0.6s var(--spring) backwards, floatSlow 6s ease-in-out infinite;
}
/* Alternate floats for organic feel */
.palette-item:nth-child(2n) { animation: itemIn 0.6s var(--spring) backwards, floatAlt 7s ease-in-out infinite; }
.palette-item:nth-child(3n) { animation: itemIn 0.6s var(--spring) backwards, floatSlow 8s ease-in-out infinite; }

.palette-item:hover {
    background: rgba(255,255,255,0.04);
    transform: translateY(-8px) scale(1.03) !important;
    box-shadow: 0 15px 35px rgba(0,0,0,0.25), inset 0 2px 15px rgba(255,255,255,0.05);
}
.palette-item.selected {
    background: rgba(255,255,255,0.06);
    box-shadow: 0 10px 30px rgba(255,255,255,0.05), inset 0 0 0 1px rgba(255,255,255,0.2);
}
.palette-item.base-item .palette-hex::after { content: ' · base'; color: var(--text-muted); font-family: var(--sans); }
.palette-swatch {
    width: 48px; height: 48px; border-radius: 50%; flex-shrink: 0;
    transition: transform 0.5s var(--spring), box-shadow 0.5s;
}
.palette-item:hover .palette-swatch { transform: scale(1.15) translateY(-2px); }
.palette-name {
    font-family: var(--serif); font-size: 0.72rem;
    font-weight: 400; font-style: italic;
    color: var(--text); text-align: center;
    max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.palette-hex { font-size: 0.55rem; font-weight: 500; color: var(--text-muted); font-family: 'SF Mono', 'Fira Code', monospace; }

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

/* ═══ Toast ═══ */
.toast {
    position: fixed; bottom: 32px; left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 12px 24px;
    background: rgba(5, 8, 15, 0.7);
    border-radius: 99px;
    color: var(--text); font-size: 0.75rem; font-weight: 500;
    z-index: 200; opacity: 0;
    animation: toastIn 0.4s var(--spring) forwards, toastOut 0.4s ease 2.5s forwards;
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}
@keyframes toastIn { to { opacity: 1; transform: translateX(-50%) translateY(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(-50%) translateY(10px); } }

/* ═══ Responsive ═══ */
@media (max-width: 600px) {
    .game-container { padding: 0 16px; }
    .merge-slot { width: 110px; height: 110px; }
    .slot-swatch { width: 44px; height: 44px; }
    .merge-slot:not(.empty) .slot-swatch { width: 56px; height: 56px; }
    .merge-slots { gap: 16px; }
    .merge-station { padding: 40px 0 30px; gap: 30px; }
    .slot-name { bottom: -24px; font-size: 0.6rem; }
    .btn-merge { padding: 14px 48px; }
    .palette-grid { grid-template-columns: repeat(auto-fill, minmax(95px, 1fr)); gap: 12px; }
    .palette-item { padding: 16px 8px 14px; border-radius: 30px; }
    .palette-swatch { width: 38px; height: 38px; }
    .palette-search { width: 140px; }
    .modal-card { padding: 36px 24px; border-radius: 32px; }
    .result-name { font-size: 1.4rem; }
    .header-stats { gap: 6px; }
    .stat-pill { padding: 6px 12px; font-size: 0.7rem; }
    .logo-text { display: none; }
}

/* ═══════════════════════════════════════════
   THEME OVERRIDES — DISTINCT REWORKS
   ═══════════════════════════════════════════ */

/* ── 🌊 Underwater (Default) ── */
.theme-underwater { --accent: #60a5fa; --gold: #34d399; }
.theme-underwater .modal-prism {
    background: conic-gradient(from 0deg, #60a5fa, #34d399, #a78bfa, #60a5fa);
}
.theme-underwater .parallax-orb { border-radius: 50%; }

/* ── 🌌 Cosmic Nebula (Sci-Fi / Angular) ── */
.theme-nebula { --accent: #c084fc; --gold: #f0abfc; }
.theme-nebula .modal-prism {
    background: conic-gradient(from 0deg, #7c3aed, #f0abfc, #06b6d4, #7c3aed);
    box-shadow: 0 10px 40px rgba(192, 132, 252, 0.4);
    border-radius: 4px;
    transform: rotate(45deg);
}
.theme-nebula .parallax-orb {
    border-radius: 0;
    transform: rotate(45deg);
    animation: floatSlow 15s ease-in-out infinite;
    filter: blur(80px);
}
.theme-nebula .merge-slot {
    border-radius: 4px; border: 1px solid rgba(192, 132, 252, 0.3);
    background: rgba(0,0,0,0.4);
    animation: none;
}
.theme-nebula .merge-slot .slot-ring { border-radius: 4px; }
.theme-nebula .palette-item {
    border-radius: 4px;
    background: rgba(10, 5, 20, 0.6);
    border: 1px solid rgba(192, 132, 252, 0.2);
    box-shadow: 0 8px 25px rgba(0,0,0,0.4);
}
.theme-nebula .palette-item:hover {
    border-color: rgba(192, 132, 252, 0.6);
    box-shadow: 0 8px 30px rgba(192, 132, 252, 0.2);
}
.theme-nebula .btn-primary, .theme-nebula .stat-pill, .theme-nebula .palette-search {
    border-radius: 4px;
    text-transform: uppercase; letter-spacing: 0.1em;
    border: 1px solid rgba(192, 132, 252, 0.3);
}
.theme-nebula .modal-card {
    border-radius: 8px;
    border: 1px solid rgba(192, 132, 252, 0.2);
    background: rgba(5, 2, 15, 0.8);
}
.theme-nebula .result-badge {
    border-radius: 4px;
    color: #c084fc;
    background: rgba(192, 132, 252, 0.1);
    border: 1px solid #c084fc;
    box-shadow: 0 0 20px rgba(192, 132, 252, 0.15);
}
.theme-nebula .streak-pill { background: rgba(192,132,252,0.06); }
.theme-nebula .streak-pill .stat-num { color: #c084fc; }
.theme-nebula .logo-text { display: block; font-family: monospace; letter-spacing: 0.4em; }

/* ── 🔬 Microscopic / Cellular (Organic Blobs) ── */
.theme-cellular { --accent: #22d3ee; --gold: #10b981; }
.theme-cellular .modal-prism {
    background: conic-gradient(from 0deg, #22d3ee, #10b981, #a3e635, #22d3ee);
    box-shadow: 0 10px 40px rgba(34, 211, 238, 0.3);
    border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%;
    filter: blur(3px);
    animation: floatFast 3s ease-in-out infinite, hueShift 10s linear infinite;
}
.theme-cellular .parallax-orb {
    border-radius: 50%;
    animation: floatSlow 10s ease-in-out infinite;
    opacity: 0.04 !important;
}
.theme-cellular .merge-slot {
    border-radius: 40% 60% 50% 70% / 50% 40% 70% 50%;
    background: rgba(34, 211, 238, 0.05);
    animation: floatFast 4s ease-in-out infinite;
}
.theme-cellular .merge-slot .slot-ring { border-radius: inherit; }
.theme-cellular .palette-item {
    border-radius: 30% 70% 50% 50% / 50% 40% 60% 50%;
    background: rgba(0, 10, 15, 0.5);
    box-shadow: inset 0 0 0 1px rgba(34,211,238,0.1);
}
.theme-cellular .palette-item:hover {
    border-radius: 50% 50% 30% 70% / 60% 50% 40% 50%;
    box-shadow: inset 0 0 0 2px rgba(34,211,238,0.3), 0 10px 20px rgba(34,211,238,0.1);
}
.theme-cellular .btn-primary, .theme-cellular .stat-pill, .theme-cellular .modal-card {
    border-radius: 50px;
}
.theme-cellular .btn-merge {
    border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2), inset 0 0 0 1px rgba(34,211,238,0.15);
}
.theme-cellular .result-badge {
    border-radius: 30px;
    color: #22d3ee;
    background: rgba(34, 211, 238, 0.08);
}
.theme-cellular .streak-pill { background: rgba(34,211,238,0.06); }
.theme-cellular .streak-pill .stat-num { color: #22d3ee; }

/* ── ⚗️ Arcane Alchemist (Gothic / Ornate) ── */
.theme-arcane { --accent: #f59e0b; --gold: #fbbf24; }
.theme-arcane { font-family: var(--serif); }
.theme-arcane input, .theme-arcane button, .theme-arcane .stat-label { font-family: var(--serif); }
.theme-arcane .modal-prism {
    background: conic-gradient(from 0deg, #f59e0b, #b45309, #fbbf24, #f59e0b);
    box-shadow: 0 10px 50px rgba(245, 158, 11, 0.4);
    filter: blur(1px);
    border-radius: 0;
    transform: rotate(45deg);
}
.theme-arcane .parallax-orb {
    border-radius: 30% 50% 40% 60%;
    animation: floatAlt 12s ease-in-out infinite;
    background: radial-gradient(circle, #f59e0b, transparent 70%);
}
.theme-arcane .merge-slot {
    border-radius: 0;
    border: 1px solid rgba(245, 158, 11, 0.2);
    background: rgba(20, 10, 0, 0.6);
    animation: none;
    box-shadow: inset 0 0 20px rgba(245, 158, 11, 0.05);
}
.theme-arcane .merge-slot .slot-ring { border-radius: 50%; border: 1px dashed rgba(245, 158, 11, 0.4); }
.theme-arcane .palette-item {
    border-radius: 0;
    background: rgba(20, 10, 0, 0.6);
    border: 1px solid rgba(245, 158, 11, 0.15);
    box-shadow: inset 0 0 15px rgba(245, 158, 11, 0.05);
}
.theme-arcane .palette-item:hover {
    border: 1px solid rgba(245, 158, 11, 0.5);
    box-shadow: inset 0 0 20px rgba(245, 158, 11, 0.15), 0 10px 20px rgba(0,0,0,0.5);
}
.theme-arcane .palette-name, .theme-arcane .result-name { font-style: italic; }
.theme-arcane .btn-primary, .theme-arcane .modal-card, .theme-arcane .stat-pill, .theme-arcane .palette-search {
    border-radius: 0;
    border: 1px solid rgba(245, 158, 11, 0.3);
    background: rgba(20, 10, 0, 0.7);
}
.theme-arcane .result-badge {
    border-radius: 0;
    color: #fbbf24;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid #fbbf24;
}
.theme-arcane .streak-pill { background: rgba(245,158,11,0.06); border-color: rgba(245,158,11,0.2); }
.theme-arcane .streak-pill .stat-num { color: #f59e0b; }
.theme-arcane .btn-merge {
    border-radius: 0;
    border: 1px solid #fbbf24;
    background: rgba(245,158,11,0.1);
    font-size: 1.1rem; font-style: italic;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4), inset 0 0 15px rgba(245,158,11,0.2);
}
.theme-arcane .btn-merge:hover {
    background: rgba(245,158,11,0.2);
}
.theme-arcane .logo-prism {
    animation: none; transform: rotate(45deg);
    filter: blur(0px); border-radius: 0;
}
.theme-arcane .logo-text { display: block; font-family: var(--serif); font-style: italic; color: #fbbf24; }
.theme-arcane .ach-title { color: #f59e0b; font-family: var(--serif); }
.theme-arcane .achievement {
    border-radius: 0; border: 1px solid #fbbf24;
    background: rgba(20,10,0,0.8);
    box-shadow: 0 10px 40px rgba(0,0,0,0.5), inset 0 0 20px rgba(245,158,11,0.1);
}

