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

:root {
    --chaos: #ff0000;
    --danger: #ff6b00;
    --uncertain: #ffd700;
    --stable: #00ff00;
    --bg-dark: #0a0e27;
    --bg-card: #1a1f3a;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --border: #2a2f4a;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--bg-dark) 0%, #1a1a2e 100%);
    color: var(--text-primary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    touch-action: manipulation;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.main-nav {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 20px;
}

.main-nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95em;
}

.main-nav a:hover {
    color: #00aaff;
}

header {
    text-align: center;
    padding: 50px 0;
    border-bottom: 2px solid rgba(0, 170, 255, 0.2);
    margin-bottom: 50px;
    position: relative;
}

header::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #00aaff, transparent);
    filter: blur(2px);
}

header h1 {
    font-size: 3.5em;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #00ff88, #00aaff, #00ddff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 40px rgba(0, 170, 255, 0.3);
    font-weight: 800;
}

.tagline {
    color: var(--text-secondary);
    font-size: 1.2em;
}

.doomsday-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 50px;
    margin-bottom: 40px;
    padding: 45px;
    background: linear-gradient(135deg, rgba(26, 31, 58, 0.9), rgba(15, 20, 40, 0.9));
    border-radius: 25px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.clock-container {
    position: relative;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    padding: 25px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.clock-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    width: 200px;
}

.status-text {
    font-size: 1.5em;
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 10px;
    text-shadow: 0 0 20px currentColor;
}

.index-value {
    font-size: 3.5em;
    font-weight: 800;
    text-shadow: 0 0 30px currentColor;
    letter-spacing: -2px;
}

.info-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.15), rgba(0, 170, 255, 0.15));
    border: 1.5px solid rgba(0, 170, 255, 0.3);
    color: #00ddff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 170, 255, 0.1);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.info-btn:hover {
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.25), rgba(0, 170, 255, 0.25));
    border-color: #00aaff;
    color: #00ff88;
    transform: scale(1.15);
    box-shadow: 0 4px 16px rgba(0, 170, 255, 0.3);
}

.info-btn-small {
    position: static;
    width: 20px;
    height: 20px;
    font-size: 11px;
    flex-shrink: 0;
    border-width: 1.5px;
}

.info-btn[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 12px);
    right: 0;
    background: linear-gradient(135deg, #1a1f3a 0%, #0f1428 100%);
    border: 1.5px solid rgba(0, 170, 255, 0.5);
    padding: 14px 18px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: normal;
    white-space: pre-line;
    z-index: 1000;
    min-width: 200px;
    max-width: 320px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 16px rgba(0, 170, 255, 0.2);
    color: var(--text-primary);
    line-height: 1.6;
    backdrop-filter: blur(10px);
}

.info-btn[data-tooltip]:hover::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 6px);
    right: 8px;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid rgba(0, 170, 255, 0.5);
    z-index: 999;
}

.info-btn-small[data-tooltip]:hover::after {
    bottom: auto;
    top: calc(100% + 12px);
    right: auto;
    left: 0;
}

.info-btn-small[data-tooltip]:hover::before {
    bottom: auto;
    top: calc(100% + 6px);
    right: auto;
    left: 8px;
    border-top: none;
    border-bottom: 6px solid rgba(0, 170, 255, 0.5);
}

.card-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.card-title-row h3,
.card-title-row h2 {
    margin-bottom: 0;
}

.indicators {
    display: flex;
    flex-direction: column;
    gap: 30px;
    justify-content: center;
}

.indicator {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
    padding: 20px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.3s ease;
}

.indicator:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
    border-color: rgba(0, 170, 255, 0.3);
    transform: translateY(-2px);
}

.indicator-label {
    font-size: 1.2em;
    margin-bottom: 10px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.indicator-value {
    font-size: 2em;
    font-weight: bold;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #00ff88, #00aaff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.indicator-bar {
    width: 100%;
    height: 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.indicator-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff0055, #ff6b00, #ffd700, #00ff88);
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 12px rgba(0, 255, 136, 0.4);
    border-radius: 20px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: linear-gradient(135deg, rgba(26, 31, 58, 0.9), rgba(15, 20, 40, 0.9));
    padding: 30px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.stat-card:hover {
    border-color: rgba(0, 170, 255, 0.3);
    box-shadow: 0 6px 28px rgba(0, 0, 0, 0.3);
    transform: translateY(-4px);
}

.stat-card canvas {
    min-height: 200px;
    max-height: 400px;
    touch-action: pan-x pan-y;
}

.stat-card h3 {
    margin-bottom: 20px;
    font-size: 1.3em;
    color: var(--text-secondary);
}

.trends-card {
    width: 100%;
}

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

.card-header h3 {
    margin-bottom: 0;
}

.card-header .card-title-row {
    margin-bottom: 0;
}

.timeframe-selector {
    display: flex;
    gap: 8px;
}

.timeframe-btn {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border: 1.5px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    font-size: 0.85em;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.timeframe-btn:hover,
.timeframe-btn:active {
    background: rgba(0, 170, 255, 0.15);
    border-color: rgba(0, 170, 255, 0.5);
    color: #00ddff;
}

.timeframe-btn:hover {
    transform: translateY(-2px);
}

@media (hover: none) {
    .timeframe-btn:hover {
        transform: none;
    }
    
    .timeframe-btn:active {
        transform: scale(0.95);
    }
}

.timeframe-btn.active {
    background: linear-gradient(135deg, #00ff88, #00aaff);
    border-color: transparent;
    color: #0a0e27;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 170, 255, 0.3);
}

.countries-list {
    max-height: 300px;
    overflow-y: auto;
}

.country-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    margin-bottom: 8px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
    border-radius: 8px;
    border-left: 3px solid transparent;
    transition: all 0.3s ease;
}

.country-item:hover {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04));
    transform: translateX(5px);
}

.country-item.positive {
    border-left-color: var(--stable);
}

.country-item.negative {
    border-left-color: var(--chaos);
}

.country-name {
    font-weight: bold;
}

.country-stats {
    display: flex;
    gap: 15px;
    font-size: 0.9em;
    color: var(--text-secondary);
}

.top-impact {
    background: linear-gradient(135deg, rgba(26, 31, 58, 0.9), rgba(15, 20, 40, 0.9));
    padding: 35px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.top-impact h2 {
    margin-bottom: 20px;
    font-size: 1.5em;
}

.top-impact .card-title-row {
    align-items: start;
}

.impact-list {
    display: grid;
    gap: 15px;
}

.impact-item {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
    padding: 22px;
    border-radius: 12px;
    border-left: 3px solid transparent;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}

.impact-item:hover,
.impact-item:active {
    transform: translateX(8px);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
    border-color: rgba(0, 170, 255, 0.3);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

@media (hover: none) {
    .impact-item:hover {
        transform: none;
    }
    
    .impact-item:active {
        transform: scale(0.98);
    }
}

.impact-item.impact-positive {
    border-left-color: var(--stable);
}

.impact-item.impact-negative {
    border-left-color: var(--chaos);
}

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

.impact-title {
    font-size: 1.1em;
    font-weight: bold;
    flex: 1;
    margin-right: 15px;
}

.impact-score {
    font-size: 1.5em;
    font-weight: bold;
    min-width: 80px;
    text-align: right;
}

.impact-meta {
    display: flex;
    gap: 15px;
    color: var(--text-secondary);
    font-size: 0.9em;
    margin-bottom: 10px;
}

.impact-indices {
    display: flex;
    gap: 10px;
    font-size: 0.9em;
}

.impact-index {
    padding: 4px 10px;
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.15), rgba(0, 170, 255, 0.15));
    border-radius: 6px;
    border: 1px solid rgba(0, 170, 255, 0.3);
    font-size: 0.95em;
    transition: all 0.2s ease;
}

.impact-item:hover .impact-index {
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.25), rgba(0, 170, 255, 0.25));
    border-color: rgba(0, 170, 255, 0.5);
}

.impact-similar {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.similar-link {
    color: #00aaff;
    text-decoration: none;
    font-size: 0.9em;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.similar-link:hover {
    color: #00ff88;
    text-decoration: underline;
}

footer {
    text-align: center;
    padding: 40px 0;
    color: var(--text-secondary);
    border-top: 1px solid var(--border);
    margin-top: 40px;
}

@media (max-width: 1024px) {
    .container {
        padding: 15px;
    }
    
    .doomsday-section {
        grid-template-columns: 1fr;
        gap: 30px;
        padding: 30px 20px;
    }
    
    .clock-container {
        max-width: 350px;
    }
}

@media (max-width: 768px) {
    header {
        padding: 30px 0;
        margin-bottom: 30px;
    }
    
    header h1 {
        font-size: 2.5em;
    }
    
    .tagline {
        font-size: 1em;
    }
    
    .doomsday-section {
        grid-template-columns: 1fr;
        padding: 25px 15px;
        gap: 25px;
    }
    
    .clock-container {
        max-width: 300px;
        padding: 20px 15px;
    }
    
    .clock-center {
        width: 150px;
    }
    
    .status-text {
        font-size: 1.2em;
    }
    
    .index-value {
        font-size: 2.5em;
    }
    
    .indicator {
        padding: 15px;
    }
    
    .indicator-value {
        font-size: 1.5em;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-card {
        padding: 20px;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .timeframe-selector {
        width: 100%;
        flex-wrap: wrap;
    }
    
    .timeframe-btn {
        flex: 1;
        min-width: 100px;
        padding: 10px 12px;
        font-size: 0.8em;
    }
    
    .top-impact {
        padding: 20px 15px;
    }
    
    .impact-item {
        padding: 15px;
    }
    
    .impact-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .impact-title {
        margin-right: 0;
        font-size: 1em;
    }
    
    .impact-score {
        font-size: 1.3em;
        min-width: auto;
        text-align: left;
    }
    
    .impact-meta {
        flex-wrap: wrap;
        gap: 10px;
        font-size: 0.85em;
    }
    
    .impact-indices {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .impact-index {
        font-size: 0.85em;
        padding: 3px 8px;
    }
    
    .info-btn {
        width: 26px;
        height: 26px;
        font-size: 13px;
    }
    
    .info-btn-small {
        width: 18px;
        height: 18px;
        font-size: 10px;
    }
    
    .info-btn[data-tooltip]:hover::after {
        max-width: 280px;
        font-size: 12px;
        padding: 12px 14px;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 2em;
    }
    
    .container {
        padding: 10px;
    }
    
    .doomsday-section {
        padding: 20px 12px;
        gap: 20px;
    }
    
    .clock-container {
        max-width: 280px;
        padding: 15px 10px;
    }
    
    .clock-center {
        width: 120px;
    }
    
    .status-text {
        font-size: 1em;
    }
    
    .index-value {
        font-size: 2em;
    }
    
    .indicator {
        padding: 12px;
    }
    
    .indicator-label {
        font-size: 1em;
        gap: 6px;
    }
    
    .indicator-value {
        font-size: 1.3em;
    }
    
    .stat-card {
        padding: 15px;
        border-radius: 15px;
    }
    
    .stat-card h3 {
        font-size: 1.1em;
    }
    
    .card-title-row {
        gap: 8px;
    }
    
    .timeframe-btn {
        padding: 8px 10px;
        font-size: 0.75em;
        min-width: 90px;
    }
    
    .top-impact {
        padding: 15px 10px;
    }
    
    .top-impact h2 {
        font-size: 1.3em;
    }
    
    .impact-item {
        padding: 12px;
    }
    
    .impact-title {
        font-size: 0.95em;
    }
    
    .impact-score {
        font-size: 1.2em;
    }
    
    .impact-meta {
        font-size: 0.8em;
    }
    
    .impact-index {
        font-size: 0.8em;
        padding: 2px 6px;
    }
    
    .info-btn[data-tooltip]:hover::after,
    .info-btn[data-tooltip]:focus::after {
        max-width: 240px;
        font-size: 11px;
        padding: 10px 12px;
        right: auto;
        left: 0;
    }
    
    .info-btn[data-tooltip]:hover::before,
    .info-btn[data-tooltip]:focus::before {
        right: auto;
        left: 12px;
    }
    
    footer {
        padding: 30px 10px;
        font-size: 0.9em;
    }
}

@media (hover: none) and (pointer: coarse) {
    .info-btn[data-tooltip]::after {
        display: none;
    }
    
    .info-btn[data-tooltip]:active::after {
        display: block;
    }
}

::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.3), rgba(0, 170, 255, 0.3));
    border-radius: 10px;
    border: 2px solid rgba(0, 0, 0, 0.2);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.5), rgba(0, 170, 255, 0.5));
}
