* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

.header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.header p {
    font-size: 1.1em;
    opacity: 0.9;
}

.pdf-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.pdf-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.pdf-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0,0,0,0.3);
}

.pdf-card h3 {
    color: #2196F3;
    margin-bottom: 15px;
    font-size: 1.3em;
}

.pdf-card p {
    color: #666;
    margin-bottom: 15px;
    line-height: 1.5;
}

.external-links {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.external-link {
    background: #f0f0f0;
    padding: 8px 15px;
    border-radius: 20px;
    text-decoration: none;
    color: #555;
    font-size: 0.9em;
    transition: background 0.3s ease;
}

.external-link:hover {
    background: #e0e0e0;
}

.wikipedia-link {
    background: #f6f6f6;
    border-left: 3px solid #000;
}

.maps-link {
    background: #e8f5e8;
    border-left: 3px solid #4CAF50;
}

.treccani-link {
    background: #fff4e5;
    border-left: 3px solid #584446;
}

.pdf-viewer {
    display: none;
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-top: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.pdf-viewer.active {
    display: block;
}

.back-btn {
    background: #2196F3;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1em;
    margin-bottom: 15px;
    transition: background 0.3s ease;
}

.back-btn:hover {
    background: #1976D2;
}

.pdf-container {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.pdf-frame {
    width: 100%;
    height: 70vh;
    border: none;
    border-radius: 10px;
    background: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.pdf-canvas-container {
    text-align: center;
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.pdf-canvas {
    max-width: 100%;
    height: auto;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-radius: 8px;
}

.pdf-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: white;
    border-radius: 10px;
    flex-wrap: wrap;
}

.pdf-controls button {
    background: #2196F3;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    min-width: 44px;
    min-height: 44px;
}

.pdf-controls button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.pdf-controls span {
    color: #666;
    font-weight: 500;
    white-space: nowrap;
}

.loading-message {
    text-align: center;
    padding: 40px;
    color: #666;
}

.install-prompt {
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    color: white;
    margin-bottom: 20px;
    display: none;
}

.install-btn {
    background: white;
    color: #2196F3;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    margin-top: 10px;
    transition: transform 0.3s ease;
}

.install-btn:hover {
    transform: scale(1.05);
}

@media (max-width: 600px) {
    .container {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 2em;
    }
    
    .pdf-grid {
        grid-template-columns: 1fr;
    }
}