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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #1B263B 0%, #415A77 100%);
    min-height: 100vh;
}

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

header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    background: linear-gradient(45deg, #1B263B, #415A77);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

main {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.input-section {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.input-section label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #333;
}

#textInput {
    width: 100%;
    min-height: 120px;
    padding: 15px;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    font-size: 16px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    resize: vertical;
    transition: border-color 0.3s ease;
}

#textInput:focus {
    outline: none;
    border-color: #1B263B;
    box-shadow: 0 0 0 3px rgba(27, 38, 59, 0.1);
}

.input-info {
    margin-top: 10px;
    text-align: right;
    color: #666;
    font-size: 0.9rem;
}

.results-section, .analysis-section, .comparison-section, .tools-section {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.results-section h2, .analysis-section h2, .comparison-section h2, .tools-section h2 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.5rem;
}

.encoding-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.encoding-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 20px;
    border-radius: 12px;
    border-left: 4px solid #1B263B;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.encoding-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.15);
}

.encoding-card h3 {
    color: #333;
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.byte-count {
    font-size: 1.8rem;
    font-weight: bold;
    color: #1B263B;
    margin-bottom: 5px;
}

.description {
    color: #666;
    font-size: 0.9rem;
}

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

.analysis-card {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #e9ecef;
}

.analysis-card h4 {
    margin-bottom: 15px;
    color: #333;
    font-size: 1.1rem;
}

.stat-item, .estimate-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    padding: 8px 0;
    border-bottom: 1px solid #e9ecef;
}

.stat-item:last-child, .estimate-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.stat-label, .estimate-label {
    color: #666;
}

.stat-value, .estimate-value {
    font-weight: bold;
    color: #333;
}

.comparison-chart {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #e9ecef;
    min-height: 200px;
}

.chart-bar {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    padding: 10px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.chart-label {
    width: 100px;
    font-weight: 600;
    color: #333;
}

.chart-bar-fill {
    height: 25px;
    background: linear-gradient(90deg, #1B263B, #415A77);
    border-radius: 12px;
    margin: 0 15px;
    transition: width 0.8s ease;
    position: relative;
    min-width: 5px;
}

.chart-value {
    font-weight: bold;
    color: #333;
    min-width: 80px;
    text-align: right;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.tool-btn {
    padding: 12px 20px;
    background: linear-gradient(135deg, #1B263B 0%, #415A77 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.tool-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(27, 38, 59, 0.3);
}

.tool-btn:active {
    transform: translateY(0);
}

footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .encoding-grid {
        grid-template-columns: 1fr;
    }
    
    .analysis-grid {
        grid-template-columns: 1fr;
    }
    
    .tools-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.5rem;
    }
    
    .tools-grid {
        grid-template-columns: 1fr;
    }
    
    .byte-count {
        font-size: 1.5rem;
    }
}

/* アニメーション */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.encoding-card, .analysis-card {
    animation: fadeIn 0.6s ease forwards;
}

/* カスタムスクロールバー */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #1B263B, #415A77);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #0F1419, #1B263B);
}
