/* 固定ツールバー */
/* 固定ヘッダー */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    padding: 0 2rem;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
    transition: transform 0.3s ease;
}

.app-header.hidden {
    transform: translateY(-100%);
}

/* 固定フッター */
/* Android環境でキーボードが表示された時に移動せずbody要素の下部に固定しキーボードに隠れる */
.app-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    padding: 0 2rem;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.04);
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
    transition: transform 0.3s ease;
}

.app-footer.hidden {
    transform: translateY(100%);
}

.app-header::-webkit-scrollbar,
.app-footer::-webkit-scrollbar {
    display: none;
}

.app-header-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    pointer-events: none;
    flex-shrink: 0;
}

.app-title-wrapper {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    line-height: 1;
    pointer-events: auto;
    gap: 4px;
}

.app-title-display {
    font-size: 1.5625rem;
    font-weight: 800;
    color: #b39ddb;
    user-select: none;
    letter-spacing: -0.02em;
    pointer-events: auto;
    line-height: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.app-title-progress-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    color: #ffffff;
    pointer-events: none;
    overflow: hidden;
    transition: clip-path 0.3s ease;
    /* 初期状態は非表示（100%カット = 紫が見える） */
    clip-path: inset(0 0 100% 0);
}

.location-status {
    width: 32px;
    height: 32px;
    padding: 4px;
    border-radius: 8px;
    box-sizing: border-box;
    color: rgba(44, 44, 53, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    pointer-events: auto;
    cursor: pointer;
}

.location-status:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary, #1d1d1f);
}

.location-status svg {
    width: 100%;
    height: 100%;
}

.location-status.active {
    color: #b39ddb;
}

.location-status.active:hover {
    color: #9575cd;
}

.location-status.error {
    color: #ff3b30;
}

.location-status.error:hover {
    color: #d32f2f;
}

.location-status.loading {
    color: rgba(44, 44, 53, 0.4);
}

.location-status.inactive {
    color: rgba(44, 44, 53, 0.2);
}

.location-status.inactive:hover {
    color: var(--text-primary, #1d1d1f);
}

.location-status.loading .spinning {
    transform-origin: center;
    animation: location-spin 1s linear infinite;
}

@keyframes location-spin {
    100% {
        transform: rotate(360deg);
    }
}

.db-status-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    align-self: center;
}

.db-status-icon {
    width: 32px;
    height: 32px;
    padding: 4px;
    border-radius: 8px;
    box-sizing: border-box;
    color: rgba(44, 44, 53, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    pointer-events: auto;
    cursor: pointer;
}

.db-status-icon:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary, #1d1d1f);
}

.db-status-icon.processing {
    color: var(--accent-color, #007aff);
    animation: db-pulse 1.5s ease-in-out infinite;
}

@keyframes db-pulse {
    0% {
        opacity: 0.4;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.4;
    }
}

.db-status-icon svg {
    width: 100%;
    height: 100%;
}

.db-status-text {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 2px;
    font-size: 0.55rem;
    font-weight: 500;
    color: rgba(44, 44, 53, 0.35);
    user-select: none;
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    line-height: 1;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: 1px;
    white-space: normal;
}

.app-version-display {
    font-size: 0.625rem;
    font-weight: 600;
    color: rgba(44, 44, 53, 0.2);
    user-select: none;
    letter-spacing: 0.05em;
    font-feature-settings: "tnum";
    pointer-events: auto;
    margin-left: 2px;
}

.app-header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.footer-section {
    flex: 1;
    display: flex;
    align-items: center;
}

.footer-section.left {
    justify-content: flex-start;
}

.footer-section.center {
    justify-content: center;
}

.footer-section.right {
    justify-content: flex-end;
}

.view-toggle-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: rgba(44, 44, 53, 0.4);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 4px;
}

.view-toggle-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary, #1d1d1f);
}

.view-toggle-btn svg {
    width: 100%;
    height: 100%;
}

/* フィルタトグルボタン */
.filter-toggle-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: rgba(44, 44, 53, 0.4);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 4px;
}

.filter-toggle-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary, #1d1d1f);
}

.filter-toggle-btn svg {
    width: 100%;
    height: 100%;
}

/* フィルタがアクティブな場合のハイライト */
/* フィルタがアクティブな場合のハイライト */
.filter-toggle-btn.filter-active {
    background: transparent;
    color: #b39ddb;
    /* 薄い紫色 */
}

.filter-toggle-btn.filter-active:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #9575cd;
}

/* ソートトグルボタン */
.sort-toggle-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: rgba(44, 44, 53, 0.4);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 4px;
}

.sort-toggle-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary, #1d1d1f);
}

.sort-toggle-btn svg {
    width: 100%;
    height: 100%;
    transition: transform 0.3s ease;
}

/* 昇順（逆順）の場合は上下反転 */
.sort-toggle-btn.sort-asc svg {
    transform: scaleY(-1);
}

/* ランダムカード選択ボタン */
.random-card-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: rgba(44, 44, 53, 0.4);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 4px;
}

.random-card-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary, #1d1d1f);
}

.random-card-btn svg {
    width: 100%;
    height: 100%;
}

/* ランダム表示アクティブ */
.random-card-btn.active-random {
    color: #b39ddb;
}

.random-card-btn.active-random:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #9575cd;
}

/* ヘッダーのカード/セル総数表示 */
.header-card-count {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0px;
    margin-left: 0.5rem;
    pointer-events: none;
    user-select: none;
    line-height: 1;
}

.count-label-card {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
    font-feature-settings: "tnum";
}

.count-label-cell {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
    font-feature-settings: "tnum";
    opacity: 0.8;
}