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

body {
    font-family: 'Hiragino Kaku Gothic ProN', 'メイリオ', Meiryo, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    padding: 40px;
    flex: 1;
}

.top-link {
    text-align: right;
    margin-bottom: 10px;
}

.reset-link {
    display: inline-block;
    color: #667eea;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 20px;
    background: #f0f4ff;
    transition: all 0.3s ease;
}

.reset-link:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

h1 {
    color: #2c3e50;
    text-align: center;
    margin-bottom: 40px;
    font-size: 32px;
    border-bottom: 3px solid #667eea;
    padding-bottom: 15px;
}

.notice-box {
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.2);
}

.notice-box p {
    margin: 0;
    color: #856404;
    line-height: 1.6;
}

.notice-box p:first-child {
    margin-bottom: 10px;
    font-size: 16px;
}

.notice-box p:last-child {
    font-size: 14px;
}

h2 {
    color: #34495e;
    font-size: 24px;
    margin-bottom: 20px;
    padding-left: 10px;
    border-left: 5px solid #667eea;
}

h3 {
    color: #546e7a;
    font-size: 18px;
    margin-bottom: 15px;
}

.selection-section {
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

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

.selection-item label {
    display: block;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 16px;
}

.toggle-buttons {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    justify-content: center;
}

.toggle-btn {
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.toggle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

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

select {
    width: 100%;
    padding: 12px 15px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

select:hover {
    border-color: #667eea;
}

select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.results-section {
    margin-bottom: 30px;
    padding: 25px;
    background: #ffffff;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.percentage-item {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.percentage-item .label {
    display: block;
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 8px;
}

.percentage-item .value {
    display: block;
    font-size: 28px;
    font-weight: bold;
}

.ranking-list {
    margin-top: 20px;
}

.ranking-item {
    display: flex;
    align-items: center;
    padding: 15px;
    margin-bottom: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #667eea;
    transition: all 0.3s ease;
}

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

.ranking-item .rank {
    font-weight: bold;
    color: #667eea;
    min-width: 50px;
    font-size: 18px;
}

.ranking-item .country {
    flex: 1;
    font-size: 16px;
    color: #2c3e50;
}

.ranking-item .count {
    font-weight: bold;
    color: #34495e;
    font-size: 18px;
}

.country-selection {
    margin-top: 25px;
    padding: 20px;
    background: #f0f4ff;
    border-radius: 8px;
}

.country-selection label {
    display: block;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 10px;
}

.details-container {
    display: grid;
    gap: 25px;
}

.detail-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
}

.detail-section ul {
    list-style: none;
    padding: 0;
}

.detail-section li {
    padding: 10px 15px;
    margin-bottom: 8px;
    background: white;
    border-radius: 5px;
    border-left: 3px solid #667eea;
}

.stats {
    display: grid;
    gap: 15px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 15px;
    background: white;
    border-radius: 6px;
    border-left: 4px solid #764ba2;
}

.stat-label {
    color: #546e7a;
    font-weight: 500;
}

.stat-value {
    font-weight: bold;
    color: #2c3e50;
    font-size: 18px;
}

.prefecture-list {
    display: grid;
    gap: 10px;
}

.prefecture-item {
    display: flex;
    align-items: center;
    padding: 15px;
    background: white;
    border-radius: 6px;
    border-left: 4px solid #667eea;
}

.prefecture-rank {
    font-weight: bold;
    color: #667eea;
    min-width: 50px;
}

.prefecture-name {
    flex: 1;
    color: #2c3e50;
    font-size: 16px;
}

.prefecture-count {
    font-weight: bold;
    color: #34495e;
    font-size: 16px;
}

.no-data {
    color: #95a5a6;
    font-style: italic;
    padding: 20px;
    text-align: center;
}

.error {
    color: #e74c3c;
    padding: 20px;
    text-align: center;
    background: #ffebee;
    border-radius: 6px;
}

.overall-container {
    display: grid;
    gap: 25px;
}

.top-countries-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
}

.field-table-container {
    margin-top: 20px;
    overflow-x: auto;
}

.field-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
}

.field-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.field-table th {
    padding: 15px 12px;
    text-align: left;
    font-weight: bold;
    font-size: 14px;
}

.field-table tbody tr {
    border-bottom: 1px solid #e0e0e0;
    transition: all 0.2s ease;
}

.field-table tbody tr:hover {
    background: #f8f9fa;
}

.field-table tbody tr:last-child {
    border-bottom: none;
}

.field-table td {
    padding: 15px 12px;
    color: #2c3e50;
}

.field-table .field-name {
    font-weight: 500;
    color: #34495e;
}

.field-table .number {
    text-align: right;
    font-family: 'Arial', sans-serif;
}

.field-table .percentage {
    text-align: right;
    font-weight: bold;
    color: #667eea;
}

@media (max-width: 768px) {
    .container {
        padding: 20px;
    }
    
    h1 {
        font-size: 24px;
    }
    
    h2 {
        font-size: 20px;
    }
    
    .percentages {
        grid-template-columns: 1fr;
    }
    
    .ranking-item {
        flex-wrap: wrap;
    }
}

.footer {
    margin-top: auto;
    padding: 20px;
    text-align: center;
    color: white;
    font-size: 14px;
}

.footer p {
    margin: 0;
}

.footer a {
    color: white;
    text-decoration: none;
    font-weight: bold;
    transition: opacity 0.3s ease;
}

.footer a:hover {
    opacity: 0.8;
    text-decoration: underline;
}

.tasks-section {
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.tasks-section h3 {
    color: #2c3e50;
    font-size: 20px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #667eea;
}

.tasks-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.task-item {
    padding: 12px 0;
    border-bottom: 1px solid #e0e0e0;
    line-height: 1.8;
}

.task-item:last-child {
    border-bottom: none;
}

.task-category {
    font-weight: bold;
    color: #667eea;
    font-size: 15px;
    margin-right: 8px;
}

.task-description {
    color: #2c3e50;
    font-size: 14px;
    display: inline;
}

.task-remarks {
    color: #7f8c8d;
    font-size: 13px;
    font-style: italic;
    margin-left: 8px;
    display: inline;
}

.task-category-group {
    margin-bottom: 25px;
}

.task-category-group:last-child {
    margin-bottom: 0;
}

.task-category-title {
    color: #667eea;
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e0e0e0;
}

.task-group-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.task-item-compact {
    padding: 8px 0 8px 20px;
    position: relative;
    color: #2c3e50;
    font-size: 14px;
    line-height: 1.6;
}

.task-item-compact::before {
    content: "•";
    position: absolute;
    left: 0;
    color: #667eea;
    font-weight: bold;
}

.task-remarks-inline {
    color: #7f8c8d;
    font-size: 13px;
    font-style: italic;
    margin-left: 5px;
}

.task-group-list.related-tasks {
    background: #f0f4ff;
    padding: 15px;
    border-radius: 6px;
    margin-top: 5px;
}

.task-group-list.related-tasks .task-item-compact {
    font-size: 13px;
    opacity: 0.9;
}

.exam-countries-section {
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.exam-countries-section h3 {
    color: #2c3e50;
    font-size: 20px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #667eea;
}

.exam-link {
    margin-bottom: 15px;
}

.exam-link a {
    display: inline-block;
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.exam-link a:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.exam-countries-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.country-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.country-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}
