/* 機種データベース - スタイル */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #0a0b10;
    color: #e0e0e8;
    min-height: 100vh;
}

#app {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem;
}

/* フィルターバー */
.filter-bar {
    background: rgba(30, 32, 48, 0.8);
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.filter-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.filter-group label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #8b8fa0;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.filter-group select,
.filter-group input {
    background: #12131a;
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 8px;
    padding: 0.55rem 0.75rem;
    color: #e0e0e8;
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.filter-group select:focus,
.filter-group input:focus {
    border-color: #7c7ff2;
    box-shadow: 0 0 0 3px rgba(124, 127, 242, 0.1);
}

.search-group {
    flex: 1;
    min-width: 220px;
}

.search-group input {
    width: 100%;
}

/* アクティブフィルタタグ */
.filter-tags {
    margin-top: 0.5rem;
    gap: 0.5rem;
}

.filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.7rem;
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: 20px;
    font-size: 0.75rem;
    color: #a78bfa;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-tag:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.4);
}

.filter-tag .tag-close {
    font-size: 0.65rem;
    opacity: 0.6;
}

.hidden {
    display: none !important;
}

.col-hidden {
    display: none !important;
}

/* 列設定ボタン */
.col-toggle-btn {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 6px;
    padding: 0.25rem 0.6rem;
    color: #8b8fa0;
    font-size: 0.72rem;
    cursor: pointer;
    transition: all 0.2s;
}

.col-toggle-btn:hover {
    background: rgba(99, 102, 241, 0.2);
    color: #a78bfa;
}

/* リセットボタン */
.col-reset-btn {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 6px;
    padding: 0.25rem 0.6rem;
    color: #8b8fa0;
    font-size: 0.72rem;
    cursor: pointer;
    transition: all 0.2s;
}

.col-reset-btn:hover {
    background: rgba(239, 68, 68, 0.18);
    color: #f87171;
}

/* 列設定パネル */
.col-settings {
    background: rgba(30, 32, 48, 0.95);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
}

.col-settings-inner {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.5rem;
}

.col-settings label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.78rem;
    color: #a0a4b8;
    cursor: pointer;
    white-space: nowrap;
}

.col-settings input[type="checkbox"] {
    accent-color: #7c7ff2;
}

/* ドラッグハンドル */
.drag-handle {
    cursor: grab;
    color: #4a4d5e;
    font-size: 0.9rem;
    margin-right: 0.2rem;
    transition: color 0.2s;
}

.col-settings label:hover .drag-handle {
    color: #7c7ff2;
}

.col-settings label.dragging {
    opacity: 0.4;
}

.col-settings label.drag-over {
    border-top: 2px solid #7c7ff2;
    padding-top: 0.15rem;
}

/* 突入率バッジ */
.entry-value {
    white-space: nowrap;
}

.entry-badge {
    display: inline-block;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    background: rgba(234, 179, 8, 0.12);
    color: #facc15;
    border: 1px solid rgba(234, 179, 8, 0.2);
}

.entry-badge.entry-full {
    background: rgba(34, 197, 94, 0.08);
    color: #86efac;
    border: 1px solid rgba(34, 197, 94, 0.15);
    font-size: 0.68rem;
}

/* 統計バー */
.stats-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.25rem;
    font-size: 0.8rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.stats-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.stats-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-badge {
    background: rgba(99, 102, 241, 0.12);
    color: #a78bfa;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.8rem;
}

.stat-info {
    color: #6b6f80;
}

.stat-date {
    color: #4a4d5e;
    font-size: 0.75rem;
}

.stat-credit {
    color: #4a4d5e;
    font-size: 0.72rem;
}

.stat-credit a {
    color: #7c7ff2;
    text-decoration: none;
    transition: color 0.2s;
}

.stat-credit a:hover {
    color: #a78bfa;
}

/* テーブルコンテナ */
.table-container {
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: 12px;
    overflow: hidden;
    background: rgba(18, 19, 26, 0.9);
    position: relative;
}

/* 内部スクロールエリア */
.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(99, 102, 241, 0.3) transparent;
}

.table-scroll::-webkit-scrollbar {
    height: 6px;
}

.table-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.table-scroll::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.3);
    border-radius: 3px;
}

.table-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.5);
}

/* スクロールインジケーター（右グラデーション） */
.scroll-indicator {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 6px;
    width: 40px;
    pointer-events: none;
    background: linear-gradient(to right, transparent, rgba(18, 19, 26, 0.95));
    z-index: 5;
    transition: opacity 0.3s;
}

.scroll-indicator.hidden-fade {
    opacity: 0;
}

/* テーブル */
table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    background: rgba(30, 32, 48, 0.95);
    padding: 0.75rem 0.8rem;
    text-align: left;
    font-size: 0.73rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #8b8fa0;
    border-bottom: 2px solid rgba(99, 102, 241, 0.15);
    position: sticky;
    top: 0;
    z-index: 10;
    -webkit-user-select: none;
    user-select: none;
    white-space: nowrap;
}

/* 機種名カラム固定（ヘッダー） */
thead th:first-child {
    position: sticky;
    left: 0;
    z-index: 20;
    background: rgba(30, 32, 48, 0.98);
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.3);
    overflow: visible;
}

/* リサイズハンドル */
.resize-handle {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    cursor: col-resize;
    background: transparent;
    transition: background 0.2s;
    z-index: 25;
}

.resize-handle:hover,
.resize-handle.active {
    background: rgba(124, 127, 242, 0.6);
}

thead th.sortable {
    cursor: pointer;
    transition: color 0.2s;
}

thead th.sortable:hover {
    color: #7c7ff2;
}

thead th.active-sort {
    color: #7c7ff2;
}

.sort-icon {
    font-size: 0.65rem;
    opacity: 0.5;
}

thead th.active-sort .sort-icon {
    opacity: 1;
}

tbody tr {
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    transition: background 0.15s;
    cursor: pointer;
}

tbody tr:hover {
    background: rgba(99, 102, 241, 0.06);
}

tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.015);
}

tbody tr:nth-child(even):hover {
    background: rgba(99, 102, 241, 0.06);
}

tbody td {
    padding: 0.65rem 0.8rem;
    font-size: 0.88rem;
}

/* 機種名カラム */
.machine-name {
    font-weight: 600;
    color: #e8e8f0;
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    /* 機種名カラム固定 */
    position: sticky;
    left: 0;
    z-index: 5;
    background: rgba(18, 19, 26, 0.98);
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.2);
}

tbody tr:nth-child(even) .machine-name {
    background: rgba(20, 21, 30, 0.98);
}

tbody tr:hover .machine-name {
    background: rgba(30, 32, 55, 0.98);
}

/* タイプバッジ */
.type-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}

.type-highmid {
    background: rgba(239, 68, 68, 0.12);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.type-mid {
    background: rgba(234, 179, 8, 0.12);
    color: #facc15;
    border: 1px solid rgba(234, 179, 8, 0.2);
}

.type-lightmid {
    background: rgba(34, 197, 94, 0.12);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.type-ama {
    background: rgba(96, 165, 250, 0.12);
    color: #93c5fd;
    border: 1px solid rgba(96, 165, 250, 0.2);
}

.type-other {
    background: rgba(148, 163, 184, 0.12);
    color: #94a3b8;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

/* 数値表示 */
.prob-value,
.border-value,
.rb-value,
.avg-value {
    font-family: 'SF Mono', 'Consolas', 'Menlo', monospace;
}

.prob-value {
    color: #a0a4b8;
}

.border-value {
    font-weight: 700;
    font-size: 0.95rem;
}

.border-easy {
    color: #22c55e;
}

.border-normal {
    color: #eab308;
}

.border-hard {
    color: #ef4444;
}

.rb-value,
.avg-value {
    color: #a0a4b8;
}

.chain-value {
    font-family: 'SF Mono', 'Consolas', 'Menlo', monospace;
    color: #c084fc;
    font-weight: 600;
}

.cont-value {
    white-space: nowrap;
}

.cont-badge {
    display: inline-block;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    background: rgba(34, 197, 94, 0.12);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.cont-total {
    color: #86efac;
    font-size: 0.68rem;
    opacity: 0.8;
}

.release-value {
    font-family: 'SF Mono', 'Consolas', 'Menlo', monospace;
    color: #8b8fa0;
    font-size: 0.82rem;
    white-space: nowrap;
}

/* 遊タイムバッジ */
.yutime-badge {
    display: inline-block;
    padding: 0.15rem 0.45rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.yutime-yes {
    background: rgba(99, 102, 241, 0.15);
    color: #a78bfa;
    border: 1px solid rgba(99, 102, 241, 0.25);
}

.yutime-no {
    color: #3a3d4e;
}

/* ノーリザルト・ローディング */
#no-results {
    text-align: center;
    padding: 3rem;
    color: #6b6f80;
    font-size: 0.9rem;
}

#loading {
    text-align: center;
    padding: 3rem;
    color: #7c7ff2;
    font-size: 0.9rem;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* ページングバー */
.paging-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1rem 0;
}

.page-btn {
    background: rgba(30, 32, 48, 0.8);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 8px;
    padding: 0.5rem 1rem;
    color: #a78bfa;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.page-btn:hover:not(:disabled) {
    background: rgba(99, 102, 241, 0.15);
    border-color: #7c7ff2;
}

.page-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.page-info {
    color: #8b8fa0;
    font-size: 0.8rem;
    font-weight: 600;
}

.per-page-select {
    background: #12131a;
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 8px;
    padding: 0.4rem 0.6rem;
    color: #e0e0e8;
    font-size: 0.8rem;
    outline: none;
}

/* モーダル */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: #1a1b2e;
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 16px;
    padding: 2rem;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: modalSlide 0.25s ease-out;
}

@keyframes modalSlide {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: #8b8fa0;
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.2s;
    padding: 0.25rem;
}

.modal-close:hover {
    color: #e0e0e8;
}

.modal-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: #e8e8f0;
    margin-bottom: 0.5rem;
}

.modal-type {
    margin-bottom: 1.5rem;
}

.modal-specs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.spec-card {
    background: rgba(30, 32, 48, 0.8);
    border: 1px solid rgba(99, 102, 241, 0.1);
    border-radius: 10px;
    padding: 0.75rem;
}

.spec-label {
    font-size: 0.7rem;
    color: #6b6f80;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.3rem;
}

.spec-value {
    font-size: 1.15rem;
    font-weight: 700;
    font-family: 'SF Mono', 'Consolas', monospace;
    color: #e0e0e8;
}

.modal-link {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 8px;
    color: #a78bfa;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.modal-link:hover {
    background: rgba(99, 102, 241, 0.25);
    border-color: #7c7ff2;
}

/* レスポンシブ */
@media (max-width: 768px) {
    .filter-row {
        flex-direction: column;
    }

    .filter-group {
        width: 100%;
    }

    .filter-group select,
    .filter-group input {
        width: 100%;
    }

    .table-container {
        overflow-x: auto;
    }

    table {
        min-width: 700px;
    }

    tbody td,
    thead th {
        padding: 0.5rem 0.6rem;
        font-size: 0.78rem;
    }

    .machine-name {
        max-width: 160px;
        font-size: 0.78rem;
    }

    .modal-specs {
        grid-template-columns: 1fr;
    }

    .paging-bar {
        flex-wrap: wrap;
    }
}