:root {
    --accent: #e59400;
    --accent-dark: #c27d00;
    --bg: #0b0b0b;
    --bg-gradient: linear-gradient(135deg, #0b0b0b 0%, #1a1a1a 100%);
    --card: #181818;
    --card-hover: #202020;
    --text: #d1d1d1;
    --border: #333;
    --shadow: rgba(0, 0, 0, 0.5);
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-gradient);
    color: var(--text);
    padding: 15px;
    max-width: 75vw;
    margin: auto;
    min-height: 100vh;
}

/* Header fisso in alto */
header {
    position: sticky;
    top: 0;
    background: linear-gradient(180deg, rgba(11,11,11,0.98) 0%, rgba(11,11,11,0.95) 100%);
    backdrop-filter: blur(10px);
    padding: 20px 15px;
    z-index: 100;
    border-bottom: 2px solid var(--accent);
    margin-bottom: 25px;
    text-align: center;
    border-radius: 0 0 15px 15px;
    box-shadow: 0 4px 20px var(--shadow);
}

h1 {
    margin: 0 0 15px 0;
    font-size: 1.8rem;
    background: linear-gradient(90deg, var(--accent) 0%, #ffb347 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Search wrapper con pulsante X */
.search-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
    max-width: 500px;
    margin-bottom: 15px;
}

#search {
    padding: 12px 40px 12px 15px;
    width: 100%;
    background: #222;
    border: 2px solid #444;
    color: white;
    border-radius: 25px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

#search:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 15px rgba(229, 148, 0, 0.3);
}

#clearSearch {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: #888;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 5px 10px;
    display: none;
    transition: color 0.2s;
}

#clearSearch:hover {
    color: var(--accent);
}

#search:not(:placeholder-shown) ~ #clearSearch {
    display: block;
}

/* Progress bar */
.progress-container {
    width: 100%;
    max-width: 500px;
    height: 8px;
    background: #222;
    border-radius: 10px;
    overflow: hidden;
    margin: 15px auto 0;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.5);
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent) 0%, #ffb347 100%);
    width: 0%;
    transition: width 0.5s ease;
    border-radius: 10px;
    box-shadow: 0 0 10px var(--accent);
}

#stats {
    margin-top: 12px;
    color: var(--accent);
    font-weight: bold;
    font-size: 1rem;
}

label {
    font-size: 0.9rem;
    cursor: pointer;
    transition: color 0.2s;
}

label:hover {
    color: var(--accent);
}

/* Stile delle cartelle dei Trader */
.trader-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 15px;
    overflow: hidden;
    box-shadow: 0 4px 15px var(--shadow);
    transition: all 0.3s ease;
}

.trader-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(229, 148, 0, 0.2);
}

.trader-header {
    background: linear-gradient(135deg, #222 0%, #2a2a2a 100%);
    padding: 16px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    color: var(--accent);
    transition: all 0.3s ease;
    position: relative;
}

.trader-header::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background: var(--accent);
    transition: width 0.3s ease;
}

.trader-header:hover::before {
    width: 8px;
}

.trader-header:hover {
    background: linear-gradient(135deg, #2a2a2a 0%, #333 100%);
}

/* Icona circolare trader */
.trader-header span:first-child {
    display: flex;
    align-items: center;
    gap: 12px;
}

.trader-header span:first-child::before {
    content: attr(data-initial);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.1rem;
    color: #000;
    box-shadow: 0 2px 10px rgba(229, 148, 0, 0.4);
}

/* Freccetta che ruota */
.trader-header::after {
    content: '▼';
    font-size: 0.9rem;
    transition: transform 0.3s ease;
}

.trader-card.active .trader-header::after {
    transform: rotate(180deg);
}

/* Lista quest - GRIGLIA invece di lista */
.quest-list {
    display: none;
    padding: 15px;
    background: #111;
    border-top: 1px solid var(--border);
}

.trader-card.active .quest-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 5000px;
    }
}

/* Card delle quest - stile Windows */
.quest-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 15px 10px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    cursor: pointer;
    text-align: center;
    position: relative;
    min-height: 100px;
}

.quest-item:hover {
    background: #252525;
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(229, 148, 0, 0.2);
}

.quest-item input[type="checkbox"] {
    position: absolute;
    top: 8px;
    left: 8px;
    cursor: pointer;
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}

/* Icona quest dinamica */
/* Icona quest - Teschio CIRCOLARE */
.quest-item::before {
    content: '💀';
    font-size: 1.5rem;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
    border: 2px solid #444;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

.quest-item.completed::before {
    content: '💀';
    background: linear-gradient(135deg, #1a3a1a 0%, #0d1f0d 100%);
    border-color: #2a5a2a;
}

.quest-name {
    flex-grow: 1;
    margin: 8px 0;
    cursor: pointer;
    transition: color 0.2s;
    font-weight: 500;
    line-height: 1.3;
}

.quest-name:hover {
    color: var(--accent);
}

.completed {
    color: #555 !important;
    text-decoration: line-through;
}

.quest-item a {
    color: #5ca3ff;
    text-decoration: none;
    font-size: 0.7rem;
    border: 1px solid #333;
    padding: 4px 8px;
    border-radius: 5px;
    transition: all 0.2s ease;
    white-space: nowrap;
    margin-top: 8px;
}

.quest-item a:hover {
    background: #5ca3ff;
    color: #000;
    border-color: #5ca3ff;
}

/* Mobile Responsive per griglia */
@media (max-width: 768px) {
    .trader-card.active .quest-list {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
    }

    .quest-item {
        min-height: 90px;
        padding: 12px 8px;
        font-size: 0.8rem;
    }

    .quest-item::before {
        font-size: 1.5rem;
        margin-bottom: 5px;
    }
}

@media (max-width: 480px) {
    .trader-card.active .quest-list {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 8px;
    }

    .quest-item {
        min-height: 80px;
        padding: 10px 6px;
        font-size: 0.75rem;
    }
}
/* Desktop grande: mantieni 75% */
@media (min-width: 1920px) {
    body {
        max-width: 75vw;
    }
}

/* Tablet: aumenta al 85% */
@media (max-width: 1024px) {
    body {
        max-width: 85vw;
    }
}

/* Mobile: 95% per non toccare i bordi */
@media (max-width: 768px) {
    body {
        max-width: 95vw;
        padding: 10px;
    }
}

/* Cartella Quest Completate */
.category-card {
    background: #0f0f0f;
    border: 1px solid #2a5a2a;
    border-radius: 8px;
    margin: 10px 0;
    overflow: hidden;
}

.category-header {
    background: linear-gradient(135deg, #1a3a1a 0%, #0d1f0d 100%);
    padding: 12px 15px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    color: #5adb5a;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.category-header:hover {
    background: linear-gradient(135deg, #1f4a1f 0%, #122612 100%);
}

.category-header::after {
    content: '▼';
    font-size: 0.7rem;
    transition: transform 0.3s ease;
}

.category-card.active .category-header::after {
    transform: rotate(180deg);
}

.category-card .quest-list {
    display: none;
    padding: 10px;
    background: #0a0a0a;
}

.category-card.active .quest-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
}