:root { --preview-bg: #1e293b; }

body {
    background-color: #0f172a; color: #f8fafc;
    font-family: 'Segoe UI', system-ui, sans-serif;
    padding: 20px; margin: 0; transition: background 0.3s; overflow-x: hidden;
}

.header { text-align: center; margin-bottom: 30px; }
h1 { margin-bottom: 15px; font-size: 2rem; letter-spacing: -1px; }

.toolbar {
    max-width: 650px; margin: 0 auto 40px auto;
    display: flex; flex-direction: column; gap: 20px; align-items: center;
}

.view-switcher {
    display: flex; background: rgba(30, 41, 59, 0.7);
    padding: 5px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.1);
}

.view-btn {
    padding: 8px 24px; border: none; background: transparent;
    color: #94a3b8; cursor: pointer; border-radius: 8px; font-weight: bold; transition: 0.2s;
}

.view-btn.active {
    background: #38bdf8; color: #0f172a; box-shadow: 0 4px 12px rgba(56, 189, 248, 0.3);
}

.theme-selector {
    display: flex; justify-content: center; flex-wrap: wrap; gap: 10px;
    padding: 12px; background: rgba(30, 41, 59, 0.7); border-radius: 30px; border: 1px solid rgba(255,255,255,0.1);
}

.swatch { 
    width: 24px; height: 24px; border-radius: 50%; cursor: pointer; 
    border: 2px solid #0f172a; transition: 0.2s; 
}

.swatch.active { 
    border-color: #38bdf8; transform: scale(1.2); 
    box-shadow: 0 0 10px #38bdf8; 
}

.count-badge {
    font-weight: bold; font-size: 0.85rem; color: #38bdf8;
    background: rgba(56, 189, 248, 0.1); padding: 4px 16px; border-radius: 20px; border: 1px solid rgba(56, 189, 248, 0.3);
}

#search-container { position: relative; width: 100%; }

#search-input {
    width: 100%; box-sizing: border-box; padding: 14px 50px 14px 25px;
    background: #1e293b; border: 2px solid #334155; border-radius: 30px; color: white; font-size: 1rem; outline: none;
}

#clear-search {
    position: absolute; right: 15px; top: 50%; transform: translateY(-50%);
    background: #334155; color: white; border: none; border-radius: 50%;
    width: 26px; height: 26px; cursor: pointer; display: none; align-items: center; justify-content: center;
}

.icon-flex-list {
    display: flex; flex-wrap: wrap; justify-content: center;
    gap: 15px; list-style: none; padding: 0; max-width: 1600px; margin: 0 auto;
}

.icon-item {
    background: var(--preview-bg); padding: 12px 18px; border-radius: 14px;
    display: flex; align-items: center; border: 1px solid rgba(255,255,255,0.05);
    box-shadow: 4px 4px 10px rgba(0,0,0,0.2), inset 1px 1px 2px rgba(255,255,255,0.05);
    cursor: pointer; transition: all 0.2s ease; width: 260px; box-sizing: border-box;
}

.light-theme .icon-item { color: #0f172a; border-color: rgba(0,0,0,0.1); box-shadow: 4px 4px 8px rgba(0,0,0,0.05); }
.icon-item:hover { transform: translateY(-3px); filter: brightness(1.1); }

.preview-box {
    width: 45px; height: 45px; margin-right: 15px;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
    background: rgba(0,0,0,0.1); border-radius: 10px; box-shadow: inset 2px 2px 4px rgba(0,0,0,0.2);
}

[data-b31] { width: 34px; height: 34px; }

.name-text {
    font-family: monospace; font-size: 0.85rem; color: #94a3b8;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-grow: 1;
}

.light-theme .name-text { color: #334155; }

.collection-section { margin-bottom: 50px; padding: 0 20px; }
.collection-title { 
    font-size: 1.4rem; color: #38bdf8; margin-bottom: 25px; 
    padding-bottom: 8px; border-bottom: 1px solid rgba(56, 189, 248, 0.2);
    text-align: center; max-width: 800px; margin-left: auto; margin-right: auto;
}

.copy-trigger { width: 18px; height: 18px; color: #38bdf8; opacity: 0.4; margin-left: 10px; }
.icon-item.copied-state { border-color: #00ff6a !important; box-shadow: 0 0 20px rgba(0, 255, 106, 0.4); }

/* Pozwalamy ikoncie wyjść poza ramy kafelka */
.icon-item {
    position: relative;
    overflow: visible; /* Ważne! Bez tego ikona zostanie przycięta przy powiększeniu */
    z-index: 1;
}

/* Kontener ikony - to on będzie się powiększał */
.preview-box {
    transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 2;
}

/* Efekt Hover (Desktop) oraz klasa aktywnego dotyku (Mobile) */
.icon-item:hover .preview-box,
.icon-item.touch-active .preview-box {
    transform: scale(2.2); /* Powiększenie nieco ponad 2x */
    background: var(--preview-bg); /* Tło pod ikoną, by nie prześwitywały inne elementy */
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    border-radius: 8px;
}

/* Dodatkowy efekt dla samej ikony wewnątrz */
.icon-item:hover [data-b31],
.icon-item.touch-active [data-b31] {
    filter: drop-shadow(0 0 5px rgba(56, 189, 248, 0.5));
}

/* Ukrywamy nazwę i przycisk kopiowania podczas powiększenia, żeby nie przeszkadzały */
.icon-item:hover .name-text,
.icon-item:hover .copy-trigger {
    opacity: 0.2;
}