* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 98%;
    width: 98%;
    margin: 0 auto;
    padding: 10px;
    flex: 1;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

/* header-topは削除（検索ボタンが固定位置になったため） */

header h1 {
    color: #2c3e50;
    font-size: 2.5rem;
    margin-bottom: 10px;
}

/* header-nav内のh1は中央揃え */
.header-nav h1 {
    color: #2c3e50;
    font-size: 2.5rem;
    text-align: center;
    margin: 0;
}

/* 右上固定の検索ボタン */
.search-btn-fixed {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #3498db;
    border: none;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
    box-shadow: 0 4px 16px rgba(52, 152, 219, 0.3);
    z-index: 999;
}

.search-btn-fixed:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
}

.search-btn-fixed:active {
    transform: translateY(0);
}

/* 旧スタイル（削除予定） */
.search-btn {
    background: #3498db;
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}

.search-btn:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
}

.search-btn:active {
    transform: translateY(0);
}

.header-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    position: relative;
}

.header-nav .back-link {
    position: absolute;
    left: 0;
}

.header-nav h1 {
    text-align: center;
    margin: 0;
}

.back-link {
    color: #3498db;
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    padding: 8px 16px;
    border: 1px solid #3498db;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.back-link:hover {
    background-color: #3498db;
    color: white;
}

.upload-section {
    margin-bottom: 30px;
}

.controls-section {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.control-group {
    margin-bottom: 20px;
}

.control-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
}

.control-group select,
.control-group input {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.control-group select:focus,
.control-group input:focus {
    outline: none;
    border-color: #3498db;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.checkbox-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
    padding: 12px 0;
    border-bottom: 1px solid #e9ecef;
}

.checkbox-items-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
    justify-content: flex-start;
    align-items: flex-start;
}

.checkbox-buttons-row {
    display: flex;
    flex-direction: row;
    gap: 10px;
    margin-bottom: 8px;
}

.checkbox-buttons::after {
    content: "";
    display: block;
    width: 100%;
    height: 0;
    clear: both;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 150px;
    flex: 0 0 auto;
}

.checkbox-item input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.date-range {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.date-range input,
.date-range select {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.monthday-selector {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    min-width: 190px;
    flex: 0 0 auto;
}

.monthday-selector label {
    font-size: 12px;
    font-weight: 500;
    color: #666;
    white-space: nowrap;
    margin-right: 4px;
}

.monthday-selector .month-select {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    min-width: 75px;
    max-width: 75px;
}

.monthday-selector .day-select {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    min-width: 75px;
    max-width: 75px;
}

.monthonly-selector {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    min-width: 120px;
    flex: 0 0 auto;
}

.monthonly-selector label {
    font-size: 12px;
    font-weight: 500;
    color: #666;
    white-space: nowrap;
    margin-right: 4px;
}

.monthonly-selector .month-only-select {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    min-width: 90px;
    max-width: 90px;
}

.date-range span {
    color: #666;
    font-weight: 500;
    padding: 0 8px;
    flex-shrink: 0;
}

.btn-primary {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

/* チェックボックス制御ボタンの共通スタイル */
.btn-checkbox-control {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 6px;
    border: 1px solid;
    cursor: pointer;
    transition: all 0.2s ease;
    writing-mode: horizontal-tb;
    text-orientation: mixed;
    white-space: nowrap;
    min-width: 70px;
    text-align: center;
}

/* 全選択・全解除ボタン（統一デザイン） */
.btn-select-all,
.btn-deselect-all {
    background-color: #3498db;
    color: white;
    border-color: #3498db;
}

.btn-select-all:hover,
.btn-deselect-all:hover {
    background-color: #2980b9;
    border-color: #2980b9;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(52, 152, 219, 0.3);
}

.btn-select-all:active,
.btn-deselect-all:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(52, 152, 219, 0.3);
}

.chart-section {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.chart-header h2 {
    color: #2c3e50;
}

.chart-container {
    position: relative;
    height: 600px;
    width: 100%;
}

.info-section {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

.info-section h3 {
    color: #2c3e50;
    margin-bottom: 15px;
}

#dataInfo,
#functionInfo,
.data-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

@media (max-width: 768px) {

    #dataInfo,
    #functionInfo,
    .data-info {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .info-section {
        padding: 15px;
        margin-bottom: 20px;
    }

    #dataInfo,
    #functionInfo,
    .data-info {
        grid-template-columns: 1fr;
        gap: 8px;
    }
}

.info-item {
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 5px;
    border-left: 4px solid #3498db;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    min-width: 0;
    overflow: hidden;
}

.info-item strong {
    display: block;
    color: #2c3e50;
    margin-bottom: 5px;
}

.existing-files {
    min-height: 200px;
    background: white;
    border-radius: 10px;
    padding: 25px;
    width: 100%;
    display: flex;
    flex-direction: column;
}

.files-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    width: 100%;
    flex-shrink: 0;
}

.files-header h3 {
    margin: 0;
    color: #2c3e50;
}

.files-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 12px 20px;
    width: 100%;
    box-sizing: border-box;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.file-item:hover {
    border-color: #3498db;
    background-color: #f8f9fa;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.15);
}

.file-info {
    flex: 1;
}

.file-name {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 4px;
}

.file-details {
    font-size: 12px;
    color: #666;
}

.file-icon {
    font-size: 24px;
    margin-right: 15px;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: #666;
}

.empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.category-section {
    margin-bottom: 15px;
    width: 100%;
    display: block;
}

.category-header {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 12px;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    transition: background-color 0.3s ease;
    width: 100%;
    box-sizing: border-box;
}

.category-header:hover {
    background-color: #e9ecef;
}

.category-icon {
    font-size: 12px;
    margin-right: 10px;
    color: #666;
    transition: transform 0.3s ease;
}

.category-title {
    color: #2c3e50;
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.category-files {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(450px, 1fr));
    gap: 10px;
    margin-top: 10px;
    padding-left: 20px;
    width: 100%;
}

/* category-files内のfile-itemを横並びレイアウトに */
.category-files .file-item {
    padding: 8px 10px;
    margin-bottom: 4px;
    background: #f8f9fa;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 3px solid #3498db;
    min-height: 36px;
    display: flex;
    align-items: center;
}

.category-files .file-item:hover {
    background: #e3f2fd;
    transform: translateX(5px);
}

.category-files .file-icon {
    font-size: 1.2em;
    margin-right: 10px;
    min-width: 24px;
    flex-shrink: 0;
}

.category-files .file-info {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
}

.category-files .file-name {
    font-weight: 500;
    color: #2c3e50;
    margin-bottom: 0;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.9em;
    line-height: 1.2;
}

.category-files .file-details {
    font-size: 0.7em;
    color: #7f8c8d;
    white-space: nowrap;
    flex-shrink: 0;
    line-height: 1.2;
}

.category-list-section {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid #e9ecef;
    background: white;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    width: 100%;
    display: flex;
    flex-direction: column;
}

.footer {
    background-color: #2c3e50;
    color: white;
    padding: 30px 0;
    text-align: center;
    margin-top: auto;
}

.footer-content {
    max-width: 98%;
    width: 98%;
    margin: 0 auto;
    padding: 0 10px;
}

.footer-content p {
    margin: 8px 0;
    line-height: 1.6;
}

.footer-content p:first-child {
    font-weight: 600;
    font-size: 16px;
}

.footer-content p:last-child {
    font-size: 14px;
    color: #bdc3c7;
}

/* レスポンシブ対応 */
@media (max-width: 1024px) {
    .container {
        max-width: 95%;
        padding: 15px;
    }

    .chart-container {
        height: 500px;
    }

    .header-nav {
        flex-direction: column;
        gap: 15px;
        text-align: center;
        position: static;
    }

    .header-nav .back-link {
        position: static;
        order: -1;
    }

    .header-nav h1 {
        font-size: 2.2rem;
        text-align: center;
    }

    .category-files {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 10px;
        padding: 10px 15px;
    }

    .category-files-list {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        padding: 10px 12px;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
        box-sizing: border-box;
    }

    .files-list {
        gap: 12px;
        padding: 10px 15px;
    }
}

@media (max-width: 768px) {
    .container {
        max-width: 100%;
        padding: 10px;
    }

    header h1 {
        font-size: 1.8rem;
        margin-bottom: 15px;
    }

    .header-nav {
        flex-direction: column;
        gap: 10px;
        text-align: center;
        position: static;
    }

    .header-nav .back-link {
        position: static;
        order: -1;
    }

    .back-link {
        font-size: 14px;
        padding: 6px 12px;
    }

    .chart-container {
        height: 70vh;
        min-height: 450px;
        max-height: 600px;
    }

    .date-range {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .monthday-selector {
        min-width: auto;
        gap: 6px;
        justify-content: flex-start;
    }

    .monthday-selector .month-select {
        min-width: 65px;
        max-width: 75px;
    }

    .monthday-selector .day-select {
        min-width: 65px;
        max-width: 75px;
    }

    .monthonly-selector {
        min-width: auto;
        gap: 6px;
    }

    .monthonly-selector .month-only-select {
        min-width: 80px;
        max-width: 90px;
    }

    .checkbox-group {
        flex-direction: column;
        gap: 10px;
    }

    .chart-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .file-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 12px;
    }

    .category-files {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 8px;
        padding: 8px 10px;
    }

    .category-files-list {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        padding: 8px 10px;
    }

    .files-list {
        gap: 10px;
        padding: 8px 10px;
    }

    .btn-primary {
        width: 100%;
        padding: 12px;
        font-size: 16px;
    }

    #dataInfo,
    #functionInfo,
    .data-info {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 8px;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .chart-container {
        height: 350px;
    }

    .category-files {
        grid-template-columns: 1fr;
        gap: 6px;
        padding: 6px 5px;
    }

    .category-files-list {
        display: block !important;
        grid-template-columns: none !important;
        gap: 0;
        padding: 6px 8px;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
        box-sizing: border-box;
    }

    .category-files-list .file-item {
        padding: 5px 6px !important;
        margin-bottom: 2px !important;
        min-height: 28px !important;
        flex-direction: row !important;
    }

    .category-files-list .file-icon {
        font-size: 1em !important;
        margin-right: 6px !important;
        min-width: 18px !important;
        flex-shrink: 0 !important;
    }

    .category-files-list .file-info {
        gap: 4px !important;
        flex: 1 !important;
        min-width: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
    }

    .category-files-list .file-name {
        font-size: 0.75em !important;
        line-height: 1.2 !important;
        margin-bottom: 0 !important;
        flex: 1 !important;
        min-width: 0 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        text-align: left !important;
    }

    .category-files-list .file-details {
        font-size: 0.65em !important;
        color: #7f8c8d !important;
        flex-shrink: 0 !important;
        display: block !important;
    }

    .files-list {
        gap: 8px;
        padding: 6px 5px;
    }
}

.subtitle {
    color: #7f8c8d;
    margin: 0.5rem 0 0 0;
    font-size: 1.1rem;
    font-weight: 400;
}

.description {
    color: #7f8c8d;
    margin: 0.5rem 0;
    font-size: 0.9rem;
}

.static-badge {
    background-color: #27ae60;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.file-item-warning {
    opacity: 0.7;
    border-left: 3px solid #f39c12 !important;
}

.file-item-warning:hover {
    background-color: #fff3cd !important;
}

.file-item-full {
    border-left: 3px solid #27ae60 !important;
}

.file-item-full:hover {
    background-color: #d5f4e6 !important;
}



/* カテゴリーファイ
ル表示用のスタイル */
.category-files-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 12px 15px;
    max-height: 400px;
    overflow-y: auto;
    box-sizing: border-box;
}

.category-files-list .file-item {
    padding: 8px 10px;
    margin-bottom: 0;
    background: #f8f9fa;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 3px solid #3498db;
    min-height: 36px;
    display: flex;
    align-items: center;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
}

.category-files-list .file-item:hover {
    background: #e3f2fd;
    transform: translateX(5px);
}

.category-files-list .file-icon {
    font-size: 1.2em;
    margin-right: 10px;
    min-width: 24px;
    flex-shrink: 0;
}

.category-files-list .file-info {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
}

.category-files-list .file-name {
    font-weight: 500;
    color: #2c3e50;
    margin-bottom: 0;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.9em;
    line-height: 1.2;
    max-width: 100%;
    text-align: left;
}

.category-files-list .file-details {
    font-size: 0.7em;
    color: #7f8c8d;
    white-space: nowrap;
    flex-shrink: 0;
    line-height: 1.2;
}

/* 空の状態のスタイル */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #7f8c8d;
}

.empty-icon {
    font-size: 3em;
    margin-bottom: 15px;
}

/* controls-section内のh3スタイル */
.controls-section h3 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.3em;
    font-weight: 600;
    border-bottom: 2px solid #3498db;
    padding-bottom: 8px;
}

/* グ
ラフタイトル用のスタイル */
.graph-title {
    color: #2c3e50;
    font-size: 1.8em;
    font-weight: 600;
    text-align: center;
    margin: 0;
    padding: 0;
    line-height: 1.2;
}

/* レスポ
ンシブ対応 */
@media (max-width: 768px) {
    .container {
        max-width: 100%;
        width: 100%;
        padding: 5px;
    }

    header h1 {
        font-size: 1.8rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .header-nav {
        flex-direction: column;
        gap: 10px;
        text-align: center;
        position: static;
    }

    .header-nav .back-link {
        position: static;
        order: -1;
    }

    .header-nav h1 {
        font-size: 1.5rem;
        margin: 0;
        text-align: center;
    }

    .controls-section {
        padding: 15px;
        margin-bottom: 20px;
    }

    .control-group {
        margin-bottom: 15px;
    }

    .checkbox-group {
        max-height: 200px;
        overflow-y: auto;
    }

    .date-range {
        flex-direction: column;
        gap: 10px;
    }

    .date-range input {
        width: 100%;
    }

    .date-range span {
        display: none;
    }

    .monthday-selector {
        flex-direction: column;
        gap: 4px;
        min-width: auto;
    }

    .monthday-selector label {
        margin-right: 0;
        margin-bottom: 2px;
    }

    .monthday-selector .month-select,
    .monthday-selector .day-select {
        width: 100%;
        min-width: auto;
        max-width: none;
    }

    .monthonly-selector {
        flex-direction: column;
        gap: 4px;
        min-width: auto;
    }

    .monthonly-selector label {
        margin-right: 0;
        margin-bottom: 2px;
    }

    .monthonly-selector .month-only-select {
        width: 100%;
        min-width: auto;
        max-width: none;
    }

    .chart-container {
        height: 65vh;
        min-height: 400px;
        max-height: 550px;
    }

    .file-item {
        padding: 10px;
        margin-bottom: 6px;
    }

    .file-icon {
        font-size: 1.2em;
        margin-right: 8px;
        min-width: 25px;
    }

    .file-name {
        font-size: 0.9em;
        line-height: 1.3;
    }

    .file-details {
        font-size: 0.75em;
    }

    .category-header {
        padding: 12px;
    }

    .category-title {
        font-size: 1em;
    }

    .category-files {
        gap: 8px;
    }

    .category-files .file-item {
        padding: 6px 8px;
        margin-bottom: 3px;
        align-items: center;
        min-height: 32px;
        display: flex;
        flex-direction: row;
    }

    .category-files .file-icon {
        font-size: 1.1em;
        margin-right: 8px;
        min-width: 22px;
        flex-shrink: 0;
    }

    .category-files .file-info {
        flex: 1;
        min-width: 0;
        gap: 6px;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .category-files .file-name {
        font-size: 0.8em;
        line-height: 1.2;
        margin-bottom: 0;
        flex: 1;
        min-width: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .category-files .file-details {
        font-size: 0.65em;
        line-height: 1.2;
        white-space: nowrap;
        flex-shrink: 0;
    }

    .category-files-list {
        max-height: 300px;
    }



    .graph-title {
        font-size: 1.3em;
    }

    .back-link {
        font-size: 14px;
        padding: 6px 12px;
    }

    .static-badge {
        font-size: 0.7rem;
        padding: 3px 8px;
    }

    .btn-primary {
        width: 100%;
        padding: 12px;
        font-size: 1em;
    }

    .checkbox-buttons {
        gap: 8px;
        padding: 8px 0;
    }

    .checkbox-buttons-row {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }

    .checkbox-items-grid {
        gap: 8px;
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .checkbox-item {
        min-width: 110px;
        flex: 0 0 auto;
        max-width: calc(50% - 4px);
    }

    .btn-checkbox-control {
        flex: 1;
        min-width: 80px;
        max-width: 120px;
    }

    .btn-small {
        width: 100%;
        margin: 2px 0;
    }

    #dataInfo,
    #functionInfo,
    .data-info {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .info-item {
        padding: 12px;
        margin-bottom: 0;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 3px;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .controls-section {
        padding: 10px;
        margin-bottom: 15px;
    }

    .chart-container {
        height: 60vh;
        min-height: 350px;
        max-height: 500px;
    }

    .checkbox-items-grid {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 6px;
        justify-content: flex-start;
    }

    .checkbox-item {
        min-width: 100px;
        flex: 0 0 auto;
        width: auto;
    }

    .file-item {
        padding: 8px;
        flex-direction: column;
        text-align: center;
    }

    .file-icon {
        margin-right: 0;
        margin-bottom: 5px;
    }



    .category-files .file-item {
        padding: 5px 6px;
        margin-bottom: 2px;
        flex-direction: row;
        text-align: left;
        align-items: center;
        min-height: 28px;
        display: flex;
    }

    .category-files .file-icon {
        font-size: 1em;
        margin-right: 6px;
        margin-bottom: 0;
        min-width: 18px;
        flex-shrink: 0;
    }

    .category-files .file-info {
        gap: 4px;
        flex: 1;
        min-width: 0;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .category-files .file-name {
        font-size: 0.75em;
        line-height: 1.1;
        margin-bottom: 0;
        flex: 1;
        min-width: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .category-files .file-details {
        font-size: 0.6em;
        line-height: 1.1;
        white-space: nowrap;
        flex-shrink: 0;
    }

    #dataInfo,
    #functionInfo,
    .data-info {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .info-item {
        padding: 10px;
        margin-bottom: 0;
    }
}

/* 超小型画面用（360px以下） */
@media (max-width: 360px) {


    .category-files .file-item {
        padding: 4px 5px;
        margin-bottom: 1px;
        min-height: 26px;
        display: flex;
        flex-direction: row;
        align-items: center;
    }

    .category-files .file-icon {
        font-size: 0.9em;
        margin-right: 5px;
        min-width: 16px;
        flex-shrink: 0;
    }

    .category-files .file-info {
        gap: 3px;
        flex: 1;
        min-width: 0;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .category-files .file-name {
        font-size: 0.7em;
        line-height: 1.1;
        margin-bottom: 0;
        flex: 1;
        min-width: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .category-files .file-details {
        display: none;
        /* 超小型画面では日付を非表示してスペース確保 */
    }

    .graph-title {
        font-size: 1.1em;
        line-height: 1.3;
    }

    .category-header {
        padding: 10px;
    }

    .category-title {
        font-size: 0.9em;
    }

    .checkbox-items-grid {
        gap: 4px;
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .checkbox-item {
        min-width: 90px;
        flex: 0 0 auto;
        max-width: calc(50% - 2px);
        font-size: 0.9em;
    }

    #dataInfo,
    #functionInfo,
    .data-info {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .info-item {
        padding: 8px;
        margin-bottom: 0;
        font-size: 0.9em;
        max-width: 100%;
        overflow-wrap: break-word;
        word-break: break-all;
    }

    .info-item strong {
        margin-bottom: 3px;
    }
}

/* 極小画面用（320px以下） */
@media (max-width: 320px) {
    .category-files {
        gap: 4px;
        padding: 4px 3px;
    }

    .category-files-list {
        display: block !important;
        grid-template-columns: none !important;
        gap: 0;
        padding: 4px 5px;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
        box-sizing: border-box;
    }

    .category-files-list .file-item {
        padding: 4px 5px !important;
        margin-bottom: 1px !important;
        min-height: 26px !important;
        flex-direction: row !important;
    }

    .category-files-list .file-icon {
        font-size: 0.9em !important;
        margin-right: 5px !important;
        min-width: 16px !important;
        flex-shrink: 0 !important;
    }

    .category-files-list .file-info {
        gap: 3px !important;
        flex: 1 !important;
        min-width: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
    }

    .category-files-list .file-name {
        font-size: 0.7em !important;
        line-height: 1.1 !important;
        margin-bottom: 0 !important;
        flex: 1 !important;
        min-width: 0 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        text-align: left !important;
    }

    .category-files-list .file-details {
        display: none !important;
    }

    .files-list {
        gap: 6px;
        padding: 4px 3px;
    }

    .checkbox-items-grid {
        gap: 3px;
    }

    .checkbox-item {
        min-width: 80px;
        max-width: calc(50% - 1.5px);
        font-size: 0.85em;
    }

    .checkbox-item input[type="checkbox"] {
        transform: scale(0.9);
    }
}

/* グラフサイズ調整コントロール */
.chart-size-control {
    display: none;
}

.chart-size-buttons {
    display: flex;
    gap: 8px;
}

.btn-size {
    padding: 6px 12px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.2s ease;
}

.btn-size:hover {
    background: #f0f0f0;
}

.btn-size.active {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

/* 動的グラフサイズクラス */
.chart-container.size-small {
    height: 40vh !important;
    min-height: 250px !important;
    max-height: 350px !important;
}

.chart-container.size-medium {
    /* デフォルトサイズ（既存のvh設定を使用） */
}

.chart-container.size-large {
    height: 70vh !important;
    min-height: 400px !important;
    max-height: 600px !important;
}

/* カスタム凡例 */
.custom-legend {
    max-height: 120px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px;
    margin-bottom: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    margin: 4px 8px 4px 0;
    padding: 4px 8px;
    background: white;
    border-radius: 4px;
    border: 1px solid #ddd;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85em;
}

.legend-item:hover {
    background: #e3f2fd;
    border-color: #3498db;
}

.legend-item.hidden {
    opacity: 0.5;
    text-decoration: line-through;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    margin-right: 6px;
    flex-shrink: 0;
}

.legend-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

/* モバイル用のカスタム凡例 */
@media (max-width: 768px) {
    .custom-legend {
        max-height: 100px;
        padding: 8px;
    }

    .legend-item {
        margin: 2px 4px 2px 0;
        padding: 3px 6px;
        font-size: 0.8em;
    }

    .legend-color {
        width: 10px;
        height: 10px;
        margin-right: 4px;
    }

    .legend-text {
        max-width: 120px;
    }
}

@media (max-width: 480px) {
    .custom-legend {
        max-height: 80px;
        padding: 6px;
    }

    .legend-item {
        margin: 2px 3px 2px 0;
        padding: 2px 5px;
        font-size: 0.75em;
    }

    .legend-text {
        max-width: 100px;
    }
}

/* モバイル用のグラフサイズ調整表示 */
@media (max-width: 768px) {
    .chart-size-control {
        display: block;
    }
}

/* 横向きスマホ・タブレット用（ランドスケープモード） */
@media (max-width: 1024px) and (orientation: landscape) {
    .chart-container {
        height: 70vh;
        min-height: 300px;
        max-height: 450px;
    }
}

@media (max-width: 768px) and (orientation: landscape) {
    .chart-container {
        height: 65vh;
        min-height: 280px;
        max-height: 400px;
    }
}

@media (max-width: 480px) and (orientation: landscape) {
    .chart-container {
        height: 60vh;
        min-height: 250px;
        max-height: 350px;
    }
}

/* Google AdSense広告用のスタイル */
/* 広告は枠なしで直接配置されます */
/* 広告設置方法についてはREADME.mdを参照してください */

/* 基本的な広告コンテナ */
.adsense-container {
    width: 100%;
    text-align: center;
    margin: 20px 0;
    overflow: hidden;
    /* 広告がはみ出さないように */
}

/* レスポンシブ広告用の基本スタイル */
.adsense-responsive {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
}

/* AdSense広告の基本スタイル */
.adsbygoogle {
    display: block;
    margin: 0 auto;
}

/* 広告位置別の調整 */
.ad-header-position {
    margin: 20px 0 30px 0;
}

.ad-middle-position {
    margin: 30px 0;
}

.ad-footer-position {
    margin: 30px 0 20px 0;
}

/* デスクトップ・大画面タブレット（1024px以上） */
@media (min-width: 1024px) {
    .adsense-container {
        margin: 25px 0;
    }

    .ad-header-position {
        margin: 25px 0 35px 0;
    }

    .ad-middle-position {
        margin: 35px 0;
    }

    .ad-footer-position {
        margin: 35px 0 25px 0;
    }

    /* 大画面用の広告サイズ最適化 */
    .adsbygoogle {
        max-width: 970px;
        /* 大型バナー対応 */
    }
}

/* タブレット（768px - 1023px） */
@media (min-width: 768px) and (max-width: 1023px) {
    .adsense-container {
        margin: 20px 0;
    }

    .ad-header-position {
        margin: 20px 0 25px 0;
    }

    .ad-middle-position {
        margin: 25px 0;
    }

    .ad-footer-position {
        margin: 25px 0 20px 0;
    }

    /* タブレット用の広告サイズ最適化 */
    .adsbygoogle {
        max-width: 728px;
        /* リーダーボード対応 */
    }
}

/* スマートフォン（480px - 767px） */
@media (min-width: 480px) and (max-width: 767px) {
    .adsense-container {
        margin: 15px 0;
        padding: 0 10px;
        /* 左右に少し余白 */
    }

    .ad-header-position {
        margin: 15px 0 20px 0;
    }

    .ad-middle-position {
        margin: 20px 0;
    }

    .ad-footer-position {
        margin: 20px 0 15px 0;
    }

    /* スマートフォン用の広告サイズ最適化 */
    .adsbygoogle {
        max-width: 320px;
        /* モバイルバナー対応 */
    }
}

/* 小型スマートフォン（479px以下） */
@media (max-width: 479px) {
    .adsense-container {
        margin: 10px 0;
        padding: 0 5px;
        /* 最小限の余白 */
    }

    .ad-header-position {
        margin: 10px 0 15px 0;
    }

    .ad-middle-position {
        margin: 15px 0;
    }

    .ad-footer-position {
        margin: 15px 0 10px 0;
    }

    /* 小型スマートフォン用の広告サイズ最適化 */
    .adsbygoogle {
        max-width: 300px;
        /* 小型モバイルバナー対応 */
    }
}

/* 横向きスマートフォン・小型タブレット */
@media (max-width: 768px) and (orientation: landscape) {
    .adsense-container {
        margin: 8px 0;
        /* 縦幅が狭いので余白を縮小 */
    }

    .ad-header-position {
        margin: 8px 0 12px 0;
    }

    .ad-middle-position {
        margin: 12px 0;
    }

    .ad-footer-position {
        margin: 12px 0 8px 0;
    }
}

/* 高解像度ディスプレイ対応 */
@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {
    .adsbygoogle {
        /* 高解像度での広告表示最適化 */
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* ダークモード対応（将来的な拡張用） */
@media (prefers-color-scheme: dark) {
    .adsense-container {
        /* ダークモード時の広告コンテナ調整 */
        background-color: transparent;
    }
}

/* 計算グラ
フ用スタイル */
.parameters-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin: 20px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.parameter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.parameter-group label {
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.9em;
}

.parameter-group input,
.parameter-group select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9em;
    transition: border-color 0.3s ease;
    background-color: white;
    width: 100%;
}

.parameter-group input:focus,
.parameter-group select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.parameter-group small {
    color: #666;
    font-size: 0.8em;
    font-style: italic;
}

.range-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
}

.range-inputs input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9em;
}

.range-inputs span {
    color: #666;
    font-weight: 500;
    flex-shrink: 0;
}

/* 関数選択のoptgroup */
#functionType optgroup {
    font-weight: bold;
    color: #2c3e50;
}

#functionType option {
    font-weight: normal;
    padding: 5px;
}

/* モバイル対応 */
@media (max-width: 768px) {
    .parameters-container {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 15px;
        margin: 15px 0;
    }

    .parameter-group {
        gap: 3px;
    }

    .parameter-group label {
        font-size: 0.85em;
    }

    .parameter-group input,
    .parameter-group select {
        padding: 6px 10px;
        font-size: 0.85em;
    }

    .range-inputs {
        flex-direction: column;
        gap: 5px;
        align-items: stretch;
    }

    .range-inputs span {
        text-align: center;
        order: 1;
    }

    .range-inputs input:first-child {
        order: 0;
    }

    .range-inputs input:last-child {
        order: 2;
    }
}

@media (max-width: 480px) {
    .parameters-container {
        padding: 10px;
        margin: 10px 0;
    }

    .parameter-group input,
    .parameter-group select {
        padding: 5px 8px;
        font-size: 0.8em;
    }

    .parameter-group small {
        font-size: 0.75em;
    }
}

/* 計算カテゴ
リーの折りたたみ機能 */
.category-files.collapsed {
    display: none;
}

.category-header {
    cursor: pointer;
    user-select: none;
}

.category-icon {
    transition: transform 0.3s ease;
}

.category-section:has(.category-files.collapsed) .category-icon {
    transform: rotate(-90deg);
}

/* PC表示用（1025px以上） - file-itemの横幅を拡張 */
@media (min-width: 1025px) {

    .category-files .file-item {
        width: 100%;
        /* 幅を100%に設定 */
        min-width: 450px;
        /* 最小幅を拡張 */
        max-width: 700px;
        /* 最大幅を制限 */
        box-sizing: border-box;
        /* ボックスサイズを含める */
        margin-bottom: 8px;
        /* 下マージンを増加 */
        display: block;
        /* ブロック要素として表示 */
        position: static;
        /* 位置を静的に */
        float: none;
        /* フロートを無効化 */
    }

    /* category-files-listのfile-itemは縦並び用の設定 */
    .category-files-list .file-item {
        width: 100%;
        min-width: 0;
        max-width: 100%;
        box-sizing: border-box;
        margin-bottom: 8px;
        display: block;
        position: static;
        float: none;
    }

    /* files-listのfile-itemは縦並び用の設定 */
    .files-list .file-item {
        width: 100%;
        min-width: 450px;
        max-width: 700px;
        box-sizing: border-box;
        margin-bottom: 8px;
        display: block;
        position: static;
        float: none;
    }

    /* コンテナのレイアウト設定 */
    .category-files {
        display: block;
        /* ブロック要素として表示 */
        width: 100%;
        /* 幅を100%に設定 */
    }

    /* category-files-listはグリッドレイアウトを維持 */
    .category-files-list {
        width: 100%;
        /* 幅を100%に設定 */
    }

    /* files-listは縦並びレイアウトを維持 */
    .files-list {
        width: 100%;
        /* 幅を100%に設定 */
    }

    /* file-item内部のレイアウトを維持 */
    .category-files .file-item {
        display: flex;
        /* 内部はflexレイアウトを維持 */
        align-items: center;
        /* 中央揃え */
    }

    /* category-files-listのfile-itemは縦並び用のflexレイアウト */
    .category-files-list .file-item {
        display: flex !important;
        align-items: center;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        margin-bottom: 8px !important;
        box-sizing: border-box;
    }

    /* files-listのfile-itemは縦並び用のflexレイアウト */
    .files-list .file-item {
        display: flex;
        align-items: center;
    }
}

/* 
検索モーダルのスタイル */
.search-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.search-modal-content {
    background-color: white;
    margin: 5% auto;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.search-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
    border-radius: 12px 12px 0 0;
}

.search-modal-header h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.4rem;
    font-weight: 600;
}

.search-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    font-weight: bold;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.search-modal-close:hover {
    background: #e9ecef;
    color: #333;
}

.search-modal-body {
    padding: 25px;
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.search-input-container {
    position: relative;
    margin-bottom: 20px;
}

.search-input-container input {
    width: 100%;
    padding: 15px 50px 15px 20px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.search-input-container input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.search-clear-btn {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: none;
}

.search-clear-btn:hover {
    background: #f0f0f0;
    color: #333;
}

.search-clear-btn.show {
    display: block;
}

.search-results {
    flex: 1;
    overflow-y: auto;
    max-height: 400px;
}

.search-placeholder {
    text-align: center;
    padding: 60px 20px;
    color: #7f8c8d;
}

.search-placeholder svg {
    margin-bottom: 20px;
    opacity: 0.5;
}

.search-placeholder p {
    font-size: 1.1rem;
    margin: 0;
}

.search-result-item {
    padding: 15px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
}

.search-result-item:hover {
    border-color: #3498db;
    background: #f8f9fa;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.15);
}

.search-result-title {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 5px;
    font-size: 1.1rem;
}

.search-result-category {
    display: inline-block;
    background: #3498db;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    margin-bottom: 8px;
}

.search-result-description {
    color: #666;
    font-size: 0.9rem;
    line-height: 1.4;
    margin-bottom: 8px;
}

.search-result-details {
    font-size: 0.8rem;
    color: #7f8c8d;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.search-result-detail {
    display: flex;
    align-items: center;
    gap: 5px;
}

.search-no-results {
    text-align: center;
    padding: 40px 20px;
    color: #7f8c8d;
}

.search-no-results svg {
    margin-bottom: 15px;
    opacity: 0.5;
}

.search-no-results p {
    font-size: 1.1rem;
    margin: 0;
}

.search-highlight {
    background: #fff3cd;
    padding: 1px 3px;
    border-radius: 3px;
    font-weight: 600;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .search-btn-fixed {
        top: 15px;
        right: 15px;
        width: 48px;
        height: 48px;
    }



    .search-btn {
        width: 40px;
        height: 40px;
    }

    .search-modal-content {
        margin: 10% auto;
        width: 95%;
        max-height: 85vh;
    }

    .search-modal-header {
        padding: 15px 20px;
    }

    .search-modal-header h3 {
        font-size: 1.2rem;
    }

    .search-modal-body {
        padding: 20px;
    }

    .search-input-container input {
        padding: 12px 45px 12px 15px;
        font-size: 16px;
    }

    .search-result-item {
        padding: 12px;
    }

    .search-result-details {
        flex-direction: column;
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .search-btn-fixed {
        top: 10px;
        right: 10px;
        width: 44px;
        height: 44px;
    }



    header h1 {
        font-size: 1.8rem;
    }

    .search-btn {
        width: 36px;
        height: 36px;
    }

    .search-modal-content {
        margin: 5% auto;
        width: 98%;
        max-height: 90vh;
    }

    .search-modal-header {
        padding: 12px 15px;
    }

    .search-modal-header h3 {
        font-size: 1.1rem;
    }

    .search-modal-body {
        padding: 15px;
    }

    .search-input-container input {
        padding: 10px 40px 10px 12px;
        font-size: 16px;
    }

    .search-result-item {
        padding: 10px;
    }

    .search-result-title {
        font-size: 1rem;
    }
}