:root {
    --bg: #0a0a0f;
    --bg-card: #111118;
    --bg-card-hover: #1a1a24;
    --text: #e0e0e8;
    --text-dim: #8888a0;
    --accent: #7c5cbf;
    --accent-glow: #9d7de8;
    --red: #e74c3c;
    --orange: #e67e22;
    --green: #2ecc71;
    --blue: #3498db;
    --purple: #9b59b6;
    --border: #222233;
    --model: #e74c3c;
    --product: #3498db;
    --api: #e67e22;
    --company: #9b59b6;
    --tombstone: #1e1e2a;
    --tombstone-border: #333350;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

#particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.particle {
    position: absolute;
    background: var(--accent);
    border-radius: 50%;
    opacity: 0;
    animation: float-up linear infinite;
}

@keyframes float-up {
    0% { opacity: 0; transform: translateY(0) scale(0); }
    10% { opacity: 0.6; }
    90% { opacity: 0.1; }
    100% { opacity: 0; transform: translateY(-100vh) scale(1); }
}

/* Header */
header {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 60px 20px 30px;
    background: linear-gradient(180deg, rgba(124, 92, 191, 0.08) 0%, transparent 100%);
}

header h1 {
    font-family: 'Creepster', cursive;
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    color: var(--text);
    letter-spacing: 0.05em;
    text-shadow: 0 0 40px rgba(124, 92, 191, 0.4);
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-dim);
    font-weight: 300;
    max-width: 600px;
    margin: 0 auto 20px;
}

.stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.stat {
    text-align: center;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-glow);
    display: block;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Controls */
.controls {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    padding: 20px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
}

.filter-btn {
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: transparent;
    color: var(--text-dim);
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn:hover {
    border-color: var(--accent);
    color: var(--text);
}

.filter-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.sort-group select {
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--bg);
    color: var(--text);
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    outline: none;
}

.sort-group select:focus {
    border-color: var(--accent);
}

.sort-group select option {
    background: var(--bg-card);
}

/* View Toggle */
.view-toggle {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-bottom: 20px;
}

.view-btn {
    padding: 8px 12px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.2s;
}

.view-btn:first-child { border-radius: 8px 0 0 8px; }
.view-btn:last-child { border-radius: 0 8px 8px 0; }

.view-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* Grid View */
.grid-view {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    padding: 0 20px 40px;
    max-width: 1400px;
    margin: 0 auto;
}

/* Tombstone Card */
.tombstone {
    background: var(--tombstone);
    border: 1px solid var(--tombstone-border);
    border-radius: 16px 16px 4px 4px;
    padding: 24px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
    animation: rise-from-grave 0.6s ease-out backwards;
}

.tombstone::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: 16px 16px 0 0;
}

.tombstone[data-type="model"]::before { background: var(--model); }
.tombstone[data-type="product"]::before { background: var(--product); }
.tombstone[data-type="api"]::before { background: var(--api); }
.tombstone[data-type="company"]::before { background: var(--company); }

.tombstone:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
    box-shadow: 0 8px 30px rgba(124, 92, 191, 0.15);
}

@keyframes rise-from-grave {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tombstone-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.tombstone-name {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
}

.tombstone-type {
    font-size: 0.65rem;
    padding: 3px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: 10px;
}

.tombstone-type[data-type="model"] { background: rgba(231, 76, 60, 0.15); color: var(--model); }
.tombstone-type[data-type="product"] { background: rgba(52, 152, 219, 0.15); color: var(--product); }
.tombstone-type[data-type="api"] { background: rgba(230, 126, 34, 0.15); color: var(--api); }
.tombstone-type[data-type="company"] { background: rgba(155, 89, 182, 0.15); color: var(--company); }

.tombstone-company {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-bottom: 12px;
}

.tombstone-dates {
    font-family: 'Creepster', cursive;
    font-size: 1.1rem;
    color: var(--accent-glow);
    text-align: center;
    margin: 16px 0;
    letter-spacing: 0.02em;
}

.tombstone-dates .cross {
    margin: 0 6px;
    color: var(--red);
}

.tombstone-lifespan {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-bottom: 12px;
}

.tombstone-description {
    font-size: 0.85rem;
    color: var(--text-dim);
    line-height: 1.6;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tombstone-cause {
    font-size: 0.8rem;
    padding: 8px 12px;
    background: rgba(231, 76, 60, 0.08);
    border-left: 2px solid var(--red);
    border-radius: 0 6px 6px 0;
    color: var(--red);
    font-style: italic;
}

/* RIP Cross decoration */
.tombstone-rip {
    position: absolute;
    top: 12px;
    right: 12px;
    font-size: 1.5rem;
    opacity: 0.15;
}

/* Timeline View */
.timeline-view {
    position: relative;
    z-index: 1;
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px 40px;
}

.hidden {
    display: none !important;
}

.timeline-year {
    margin-bottom: 40px;
}

.timeline-year-label {
    font-family: 'Creepster', cursive;
    font-size: 2rem;
    color: var(--accent-glow);
    margin-bottom: 20px;
    padding-left: 40px;
    position: relative;
}

.timeline-year-label::before {
    content: '†';
    position: absolute;
    left: 0;
    color: var(--red);
    font-size: 1.5rem;
}

.timeline-line {
    position: absolute;
    left: 50px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.timeline-item {
    display: flex;
    gap: 20px;
    margin-bottom: 16px;
    padding-left: 40px;
    position: relative;
    cursor: pointer;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: 34px;
    top: 8px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--accent);
    background: var(--bg);
    z-index: 1;
}

.timeline-item:hover::before {
    background: var(--accent);
}

.timeline-date {
    font-size: 0.8rem;
    color: var(--text-dim);
    min-width: 90px;
    padding-top: 4px;
}

.timeline-content {
    background: var(--tombstone);
    border: 1px solid var(--tombstone-border);
    border-radius: 8px;
    padding: 16px;
    flex: 1;
    transition: all 0.2s;
}

.timeline-item:hover .timeline-content {
    border-color: var(--accent);
}

.timeline-content h3 {
    font-size: 1rem;
    margin-bottom: 4px;
}

.timeline-content p {
    font-size: 0.8rem;
    color: var(--text-dim);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.hidden {
    display: none;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--tombstone-border);
    border-radius: 16px;
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    padding: 32px;
    animation: modal-in 0.3s ease;
}

@keyframes modal-in {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.modal-close:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
}

.modal-body .tombstone-name {
    font-size: 1.5rem;
    margin-bottom: 4px;
}

.modal-body .tombstone-dates {
    font-size: 1.4rem;
}

.modal-body .tombstone-description {
    -webkit-line-clamp: unset;
    overflow: visible;
    font-size: 0.95rem;
}

.modal-body .tombstone-cause {
    margin-top: 16px;
}

.modal-body .modal-link {
    display: inline-block;
    margin-top: 16px;
    color: var(--accent-glow);
    text-decoration: none;
    font-size: 0.85rem;
}

.modal-body .modal-link:hover {
    text-decoration: underline;
}

.modal-body .modal-lifespan-bar {
    margin: 20px 0;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.modal-body .modal-lifespan-fill {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--green), var(--orange), var(--red));
    transition: width 0.6s ease;
}

/* Footer */
footer {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 40px 20px;
    border-top: 1px solid var(--border);
    margin-top: 20px;
}

footer p {
    color: var(--text-dim);
    font-size: 0.85rem;
    margin-bottom: 8px;
}

footer a {
    color: var(--accent-glow);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

.footer-note {
    font-size: 0.75rem !important;
    opacity: 0.6;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* Search */
.search-group {
    width: 100%;
    margin-bottom: 12px;
}

.search-input {
    width: 100%;
    max-width: 400px;
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-family: 'Inter', sans-serif;
    font-size: 0.88rem;
    outline: none;
    transition: border-color 0.2s;
}

.search-input:focus {
    border-color: var(--accent);
}

.search-input::placeholder {
    color: var(--text-dim);
    opacity: 0.6;
}

/* Filter count badge */
.filter-count {
    font-size: 0.7rem;
    opacity: 0.6;
    margin-left: 2px;
}

/* No results */
.no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-dim);
    font-size: 1rem;
}
