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

body {
    font-family: 'Noto Sans', sans-serif;
    background: #f8f9fa;
    color: #212529;
    line-height: 1.6;
}

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

header {
    text-align: center;
    margin-bottom: 40px;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: #2c3e50;
}

header p {
    font-size: 1.1rem;
    color: #6c757d;
}

main {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 30px;
    margin-bottom: 40px;
}

.control-panel {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    height: fit-content;
}

.parameter-group {
    margin-bottom: 25px;
}

.parameter-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #495057;
}

.parameter-group input[type="range"] {
    width: 100%;
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    outline: none;
    margin-bottom: 8px;
}

.parameter-group input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    background: #007bff;
    border-radius: 50%;
    cursor: pointer;
}

.value {
    display: inline-block;
    font-weight: 600;
    color: #007bff;
    font-size: 1.1rem;
}

.generate-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(220, 53, 69, 0.4);
}

.auto-generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
}

.results-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.intensity-display,
.tsunami-display,
.pga-display {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.intensity-display h3,
.tsunami-display h3,
.pga-display h3 {
    margin-bottom: 20px;
    color: #2c3e50;
    font-weight: 600;
}

.intensity-meter {
    position: relative;
    height: 60px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 20px;
    overflow: hidden;
}

.intensity-bar {
    height: 100%;
    background: linear-gradient(90deg, 
        #28a745 0%, 
        #ffc107 20%, 
        #fd7e14 40%, 
        #dc3545 60%, 
        #6f42c1 80%, 
        #343a40 100%);
    width: 0%;
    transition: width 1s ease, box-shadow 0.3s ease;
    border-radius: 8px;
}

.intensity-labels {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    font-weight: 600;
    color: #495057;
}

.intensity-info {
    text-align: center;
}

.current-intensity {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: #dc3545;
}

.intensity-description {
    font-size: 1.1rem;
    color: #6c757d;
}

.tsunami-status {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.status-indicator {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #28a745;
    transition: all 0.3s ease;
}

.status-text {
    font-size: 1.2rem;
    font-weight: 600;
}

.tsunami-info {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    font-weight: 500;
}

.pga-value {
    font-size: 2rem;
    font-weight: 700;
    color: #007bff;
    text-align: center;
    margin-bottom: 15px;
}

.pga-bar {
    height: 20px;
    background: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
}

.pga-fill {
    height: 100%;
    background: linear-gradient(90deg, #28a745, #ffc107, #dc3545);
    width: 0%;
    transition: width 1s ease;
}

.earthquake-log {
    grid-column: 1 / -1;
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.earthquake-log h3 {
    margin-bottom: 20px;
    color: #2c3e50;
    font-weight: 600;
}

.log-entries {
    max-height: 300px;
    overflow-y: auto;
}

.log-entry {
    padding: 15px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 10px;
    transition: all 0.3s ease;
}

.log-entry:hover {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.log-entry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.log-entry-time {
    font-weight: 600;
    color: #495057;
}

.log-entry-magnitude {
    font-weight: 700;
    color: #dc3545;
}

.log-entry-details {
    font-size: 0.9rem;
    color: #6c757d;
}

.aftershock-entry {
    border-left: 4px solid #ffc107;
    background: rgba(255, 193, 7, 0.05);
}

.aftershock-entry .log-entry-magnitude {
    color: #e67e22;
}

.shaking {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

@keyframes strongShake {
    0%, 100% { transform: translateX(0); }
    10% { transform: translateX(-10px) rotate(-1deg); }
    20% { transform: translateX(10px) rotate(1deg); }
    30% { transform: translateX(-8px) rotate(-0.8deg); }
    40% { transform: translateX(8px) rotate(0.8deg); }
    50% { transform: translateX(-6px) rotate(-0.6deg); }
    60% { transform: translateX(6px) rotate(0.6deg); }
    70% { transform: translateX(-4px) rotate(-0.4deg); }
    80% { transform: translateX(4px) rotate(0.4deg); }
    90% { transform: translateX(-2px) rotate(-0.2deg); }
}

@keyframes mediumShake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-6px); }
    20%, 40%, 60%, 80% { transform: translateX(6px); }
}

@keyframes lightShake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-3px); }
    20%, 40%, 60%, 80% { transform: translateX(3px); }
}

.tsunami-warning {
    background: #fff3cd !important;
    border-color: #ffeaa7 !important;
}

.tsunami-advisory {
    background: #d1ecf1 !important;
    border-color: #bee5eb !important;
}

.tsunami-watch {
    background: #f8d7da !important;
    border-color: #f5c6cb !important;
}

.map-display {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.map-container {
    position: relative;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    border-radius: 8px;
    overflow: hidden;
}

.japan-map {
    width: 100%;
    height: auto;
    display: block;
    filter: brightness(0.95);
}

.wave-circles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.p-wave-circle,
.s-wave-circle {
    position: absolute;
    border-radius: 50%;
    opacity: 0;
    transform: translate(-50%, -50%);
}

.p-wave-circle {
    border: 3px solid #007bff;
    background: radial-gradient(circle, rgba(0, 123, 255, 0.1) 0%, transparent 70%);
}

.s-wave-circle {
    border: 3px solid #dc3545;
    background: radial-gradient(circle, rgba(220, 53, 69, 0.15) 0%, transparent 70%);
}

.epicenter {
    position: absolute;
    width: 16px;
    height: 16px;
    background: radial-gradient(circle, #ff6b35 0%, #ff4757 50%, #c44569 100%);
    border: 3px solid white;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    box-shadow: 0 0 20px rgba(255, 107, 53, 0.8);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.2); }
}

.intensity-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-template-rows: repeat(16, 1fr);
    gap: 1px;
    pointer-events: none;
}

.intensity-square {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    opacity: 0.7;
}

.intensity-0 { background: rgba(34, 139, 34, 0.3); }
.intensity-1 { background: rgba(124, 252, 0, 0.4); }
.intensity-2 { background: rgba(255, 255, 0, 0.5); }
.intensity-3 { background: rgba(255, 165, 0, 0.6); }
.intensity-4 { background: rgba(255, 69, 0, 0.7); }
.intensity-5- { background: rgba(255, 20, 147, 0.7); }
.intensity-5+ { background: rgba(138, 43, 226, 0.8); }
.intensity-6- { background: rgba(75, 0, 130, 0.8); }
.intensity-6+ { background: rgba(25, 25, 112, 0.9); }
.intensity-7 { background: rgba(0, 0, 0, 0.9); }

.wave-info {
    margin-top: 15px;
}

.wave-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 500;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
}

.p-wave-color {
    background: #007bff;
}

.s-wave-color {
    background: #dc3545;
}

.wave-active {
    animation: waveExpand 8s ease-out forwards;
}

@keyframes waveExpand {
    0% {
        width: 0;
        height: 0;
        opacity: 0.8;
    }
    50% {
        opacity: 0.6;
    }
    100% {
        width: 800px;
        height: 800px;
        opacity: 0;
    }
}

.eew-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #dc3545;
    color: white;
    padding: 12px 0;
    text-align: center;
    font-weight: bold;
    font-size: 1.2rem;
    z-index: 1000;
    transform: translateY(-100%);
    transition: transform 0.5s ease-in-out;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.eew-banner.active {
    transform: translateY(0);
}

.eew-text {
    font-family: 'Noto Sans', sans-serif;
    font-weight: 700;
    letter-spacing: 2px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.tv-mode-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #6f42c1, #5a2d91);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 15px;
}

.tv-mode-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(111, 66, 193, 0.4);
}

.tv-mode-btn.active {
    background: linear-gradient(135deg, #28a745, #20c997);
}

@media (max-width: 768px) {
    main {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .container {
        padding: 15px;
    }

    .auto-generate-btn,
    .aftershock-indicator {
        font-size: 0.9rem;
        padding: 10px;
    }
}