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

:root {
    --bg-0: #0f1318;
    --bg-1: #171d24;
    --bg-2: #1f2731;
    --bg-3: #25303d;
    --surface: #11171d;
    --surface-soft: #1a222c;
    --surface-soft-2: #212b36;
    --text-0: #e4ebf2;
    --text-1: #b9c6d3;
    --text-2: #8fa0b3;
    --accent: #5f7996;
    --accent-hover: #6d8aaa;
    --danger: #b55555;
    --danger-hover: #c46767;
    --border: #2a3644;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: radial-gradient(circle at 20% 0%, #1a222c 0%, var(--bg-0) 45%, #0b0f13 100%);
    color: var(--text-0);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: linear-gradient(180deg, var(--surface) 0%, #0f151b 100%);
    border-radius: 15px;
    padding: 40px;
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.45);
    border: 1px solid var(--border);
}

h1 {
    color: var(--text-0);
    text-align: center;
    margin-bottom: 10px;
    font-size: 2.5em;
}

.subtitle {
    text-align: center;
    color: var(--text-2);
    margin-bottom: 30px;
    font-style: italic;
}

h2 {
    color: var(--text-0);
    margin-top: 25px;
    margin-bottom: 15px;
    border-bottom: 2px solid var(--border);
    padding-bottom: 10px;
}

h3 {
    color: var(--text-0);
    margin-bottom: 15px;
}

.year-selector {
    background: var(--surface-soft);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.year-selector label {
    font-weight: bold;
    color: var(--text-1);
}

.year-selector input {
    padding: 8px 12px;
    border: 1px solid var(--border);
    background: var(--bg-2);
    color: var(--text-0);
    border-radius: 5px;
    font-size: 1em;
}

.form-section {
    background: var(--surface-soft);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

input[type="text"],
input[type="number"],
select {
    flex: 1;
    min-width: 150px;
    padding: 12px;
    border: 1px solid var(--border);
    background: var(--bg-2);
    color: var(--text-0);
    border-radius: 5px;
    font-size: 1em;
    transition: border-color 0.3s;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(95, 121, 150, 0.2);
}

button {
    padding: 12px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
    transition: all 0.3s;
}

.btn-primary {
    background: var(--accent);
    color: #f5f9ff;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35);
}

.btn-secondary {
    background: #3f5166;
    color: #f5f9ff;
    margin-right: 10px;
    margin-top: 10px;
}

.btn-secondary:hover {
    background: #4b6078;
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35);
}

.btn-danger {
    background: var(--danger);
    color: #fef3f3;
}

.btn-danger:hover {
    background: var(--danger-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35);
}

.stats-section {
    margin-bottom: 30px;
}

.deaths-section {
    margin-bottom: 30px;
}

.section-card {
    background: linear-gradient(135deg, rgba(95, 121, 150, 0.18) 0%, rgba(28, 38, 50, 0.2) 100%);
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid var(--accent);
    border: 1px solid var(--border);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.section-title {
    margin: 0;
    flex: 1;
    color: var(--text-0);
    font-size: 1.5em;
    border-bottom: 2px solid var(--border);
    padding-bottom: 10px;
}

.ranking-content {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.ranking-content.collapsed,
.deaths-list.collapsed {
    display: none;
}

.ranking-chart {
    background: rgba(10, 14, 18, 0.62);
    border-radius: 10px;
    padding: 16px;
    box-shadow: inset 0 0 0 1px rgba(143, 160, 179, 0.14);
}

.ranking-chart svg {
    width: 100%;
    height: auto;
    display: block;
}

.chart-grid {
    stroke: rgba(143, 160, 179, 0.18);
    stroke-width: 1;
}

.chart-axis {
    stroke: rgba(185, 198, 211, 0.35);
    stroke-width: 1.5;
}

.chart-label {
    fill: var(--text-2);
    font-size: 12px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.chart-line {
    fill: none;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.chart-point {
    stroke: #0f151b;
    stroke-width: 2;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

.chart-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: rgba(27, 36, 46, 0.9);
    border-radius: 999px;
    color: var(--text-1);
    font-size: 0.9em;
    border: 1px solid var(--border);
}

.chart-legend-color {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.ranking-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: var(--surface-soft-2);
    border-radius: 5px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    transition: transform 0.3s;
}

.ranking-item:hover {
    transform: translateX(5px);
}

.rank-position {
    font-weight: bold;
    color: var(--text-1);
    font-size: 1.2em;
    min-width: 40px;
}

.rank-name {
    flex: 1;
    color: var(--text-0);
    font-weight: 500;
}

.rank-score {
    background: var(--accent);
    color: #f5f9ff;
    padding: 8px 16px;
    border-radius: 5px;
    font-weight: bold;
    min-width: 80px;
    text-align: center;
}

.toggle-btn {
    background: #304355;
    color: #e8eef5;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    transition: all 0.3s ease;
}

.toggle-btn:hover {
    background: #3c546b;
    transform: scale(1.1);
}

.ranking-list,
.deaths-list {
    display: flex;
    flex-direction: column;
}

.ranking-list {
    gap: 12px;
}

.deaths-list {
    gap: 10px;
}

.death-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--surface-soft-2);
    border-radius: 5px;
    border-left: 3px solid #4f667f;
    border: 1px solid var(--border);
}

.death-main {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.death-photo {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
    border: 2px solid rgba(15, 21, 27, 0.95);
}

.death-info {
    flex: 1;
    min-width: 0;
}

.death-deceased {
    font-weight: bold;
    color: var(--text-0);
}

.death-details {
    font-size: 0.9em;
    color: var(--text-1);
}

.death-points {
    background: #3e546a;
    color: #f5f9ff;
    padding: 5px 12px;
    border-radius: 5px;
    font-weight: bold;
}

.death-meta {
    display: flex;
    align-items: center;
    margin-left: 12px;
}

.delete-btn {
    background: var(--danger);
    color: #fff5f5;
    border: none;
    padding: 5px 10px;
    border-radius: 3px;
    cursor: pointer;
    margin-left: 10px;
    font-size: 0.9em;
}

.delete-btn:hover {
    background: var(--danger-hover);
}

.empty {
    color: var(--text-2);
    font-style: italic;
    text-align: center;
    padding: 20px;
}

.actions {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

@media (max-width: 600px) {
    .container {
        padding: 20px;
    }

    h1 {
        font-size: 1.8em;
    }

    .form-group {
        flex-direction: column;
    }

    .ranking-item {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }

    .ranking-chart {
        padding: 12px;
    }

    .chart-legend {
        gap: 8px;
    }

    .chart-legend-item {
        width: 100%;
        justify-content: flex-start;
    }

    .year-selector {
        flex-direction: column;
    }

    .death-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .death-main {
        width: 100%;
    }

    .death-meta {
        width: 100%;
        justify-content: space-between;
        margin-left: 0;
    }
}
