* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4a90e2;
    --secondary-color: #6c757d;
    --danger-color: #dc3545;
    --success-color: #28a745;
    --bg-color: #f5f5f5;
    --text-color: #333;
    --border-color: #ddd;
    --shadow: 0 2px 4px rgba(0,0,0,0.1);

    /* ジャンル色（パステル調） */
    --genre-anime: #B3D9FF;
    --genre-sports: #FFB3B3;
    --genre-entertainment: #B3FFB3;
    --genre-lifestyle: #FFF8B3;
    --genre-society: #FFD9B3;
    --genre-humanities: #D9B3FF;
    --genre-science: #FFB3E6;
    --genre-none: #F5F5F5;
}

body {
    font-family: 'Segoe UI', 'Yu Gothic', 'Meiryo', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100dvh;
}

.container {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 10px 12px;
    min-height: 100dvh;
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    grid-template-rows: auto auto minmax(0, 1fr);
    gap: 0 16px;
}

header {
    background: white;
    padding: 14px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    grid-column: 1;
}

h1 {
    font-size: 22px;
    color: var(--primary-color);
}

.header-controls {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    overflow-x: visible;
    white-space: normal;
}

.header-controls .btn {
    font-size: 12px;
    padding: 6px 10px;
}

.sync-summary {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 6px 10px;
    margin-bottom: 12px;
    font-size: 12px;
    color: #495057;
    grid-column: 1;
}

/* 閲覧モードバナー */
#viewModeBanner {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    padding: 10px 20px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
    color: #856404;
}

#viewModeBanner span::before {
    margin-right: 6px;
}

.view-mode-exit {
    font-size: 12px;
    color: #856404;
    text-decoration: underline;
    white-space: nowrap;
}

.view-mode-link {
    text-decoration: none;
    white-space: nowrap;
}

/* 問題移動タブ */
.move-panel {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 16px;
    align-items: start;
}

.move-collection-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.move-collection-header {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
    overflow-x: auto;
    white-space: nowrap;
}

.move-collection-header h3 {
    color: var(--primary-color);
    white-space: nowrap;
}

.move-collection-select {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
}

.move-count {
    font-size: 12px;
    color: var(--secondary-color);
    white-space: nowrap;
}

.move-filter input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
}

.move-quiz-list {
    max-height: 520px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    min-height: 100px;
}

.move-quiz-list .quiz-item {
    padding: 8px 12px;
    cursor: pointer;
    user-select: none;
}

.move-quiz-list .quiz-item.selected {
    background: #e3f2fd;
    border-left: 3px solid var(--primary-color);
}

.move-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    justify-content: center;
    padding-top: 48px;
}

.move-btn {
    width: 90px;
    white-space: nowrap;
}

.move-hint {
    margin-top: 12px;
    font-size: 12px;
    color: var(--secondary-color);
}

@media (max-width: 768px) {
    .move-panel {
        grid-template-columns: 1fr;
    }
    .move-actions {
        flex-direction: row;
        padding-top: 0;
    }
}

/* ボタン */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.btn:hover {
    opacity: 0.8;
    transform: translateY(-1px);
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-sync {
    background-color: #f8f9fa;
    color: #333;
    border: 2px solid #dee2e6;
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 500;
    min-width: 140px;
}

.btn-sync:hover {
    background-color: #e9ecef;
    border-color: var(--primary-color);
}

.btn-sync.active {
    background-color: #d4edda;
    border-color: var(--success-color);
    color: var(--success-color);
}

.btn-sync #syncIcon {
    font-size: 16px;
}

.btn-sync #syncStatus {
    font-size: 12px;
    white-space: nowrap;
}

.btn-small {
    padding: 4px 8px;
    font-size: 12px;
}

/* タブ */
.tabs {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 320px;
    margin-right: 0;
    margin-bottom: 0;
    grid-column: 1;
    grid-row: 3;
    min-height: 0;
    overflow-y: auto;
}

.tab-btn {
    padding: 12px 14px;
    border: none;
    background: white;
    cursor: pointer;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s;
    text-align: left;
}

.tab-btn:hover {
    background: #e9ecef;
}

.tab-btn.active {
    background: var(--primary-color);
    color: white;
}

.tab-content {
    display: none;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    min-height: 0;
    margin-left: 0;
    grid-column: 2;
    grid-row: 1 / 4;
    overflow: hidden;
}

.tab-content.active {
    display: block;
}

/* ツールバー */
.toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
    flex-wrap: nowrap;
    align-items: center;
    overflow-x: auto;
    white-space: nowrap;
}

.manage-toolbar {
    gap: 8px;
    align-items: stretch;
    padding-bottom: 10px;
}

.toolbar-group {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 6px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: #fafafa;
}

.toolbar-group-label {
    font-size: 11px;
    color: #6b7280;
    font-weight: 600;
    margin-right: 2px;
}

.manage-toolbar .btn {
    font-size: 12px;
    padding: 5px 8px;
    min-height: 28px;
}

.folder-move-select {
    min-width: 180px;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: white;
    font-size: 14px;
}

/* スプリットパネル */
.split-panel {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 20px;
    min-height: 0;
}

.panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.panel h3 {
    margin-bottom: 10px;
    color: var(--primary-color);
}

.panel select {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
}

#folderList {
    margin-bottom: 8px;
}

.folder-stats {
    font-size: 12px;
    color: var(--secondary-color);
    margin-bottom: 14px;
    padding: 8px;
    border: 1px dashed var(--border-color);
    border-radius: 4px;
    background: #fafafa;
}

/* フィルターコントロール */
.filter-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.filter-controls input,
.filter-controls select {
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
}

.filter-controls input {
    flex: 1;
}

/* 問題リスト */
.quiz-list {
    border: 1px solid var(--border-color);
    border-radius: 4px;
    max-height: 500px;
    overflow-y: auto;
}

#manage-tab.tab-content.active {
    display: flex;
    flex-direction: column;
    height: 100%;
}

#manage-tab .split-panel {
    flex: 1;
    grid-template-columns: 340px minmax(0, 1fr);
}

#manage-tab .panel:nth-child(1) {
    overflow-y: auto;
    padding-right: 4px;
}

#manage-tab .panel:nth-child(2) {
    min-height: 0;
}

#manage-tab #quizList {
    flex: 1;
    min-height: 0;
    max-height: none;
}

#manage-tab .manage-side-filters {
    flex-direction: column;
    align-items: stretch;
    margin-top: 6px;
}

#manage-tab .manage-side-filters input,
#manage-tab .manage-side-filters select {
    width: 100%;
}

#quiz-organize-tab.tab-content.active {
    display: flex;
    flex-direction: column;
    height: 100%;
}

#quiz-organize-tab #quizManageList {
    flex: 1;
    min-height: 0;
    max-height: none;
}

.quiz-item {
    padding: 12px;
    padding-right: 50px; /* 矢印ボタン分のスペース */
    border-bottom: 1px solid var(--border-color);
    cursor: move; /* ドラッグ可能なカーソル */
    transition: background 0.2s;
    position: relative;
}

.quiz-item:hover {
    background: #f8f9fa;
}

.quiz-item.selected {
    background: #e3f2fd;
    border-left: 4px solid var(--primary-color);
}

/* ドラッグ中のスタイル */
.quiz-item.dragging {
    opacity: 0.5;
    background: #e0e0e0;
    cursor: grabbing;
}

/* ドロップ先のスタイル */
.quiz-item.drag-over {
    border-top: 3px solid var(--primary-color);
    background: #f0f7ff;
}

.quiz-item-controls {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.quiz-item-controls button {
    width: 24px;
    height: 24px;
    padding: 0;
    border: 1px solid #ddd;
    background: white;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
    transition: all 0.2s;
}

.quiz-item-controls button:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.quiz-item-controls button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.quiz-item-controls button:disabled:hover {
    background: white;
    color: inherit;
    border-color: #ddd;
}

.quiz-item-question {
    font-weight: normal;
    font-size: 14px;
    line-height: 1.5;
}

.quiz-item-answer {
    display: none;
}

.quiz-item-tags {
    display: none;
}

.tag {
    display: inline-block;
    padding: 2px 8px;
    background: #e9ecef;
    border-radius: 12px;
    font-size: 12px;
}

.genre-tag {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: bold;
    color: black;
}

.difficulty-tag {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: bold;
    background: #e9ecef;
    color: black;
}

/* ジャンル別の背景色 */
.quiz-item[data-genre="アニメ&ゲーム"] {
    background-color: var(--genre-anime);
}

.quiz-item[data-genre="スポーツ"] {
    background-color: var(--genre-sports);
}

.quiz-item[data-genre="芸能"] {
    background-color: var(--genre-entertainment);
}

.quiz-item[data-genre="ライフスタイル"] {
    background-color: var(--genre-lifestyle);
}

.quiz-item[data-genre="社会"] {
    background-color: var(--genre-society);
}

.quiz-item[data-genre="文系学問"] {
    background-color: var(--genre-humanities);
}

.quiz-item[data-genre="理系学問"] {
    background-color: var(--genre-science);
}

.quiz-item[data-genre="ノンジャンル"] {
    background-color: var(--genre-none);
}

/* 編集フォーム */
.edit-form {
    max-width: 800px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
}

.form-group textarea {
    resize: vertical;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.text-controls {
    margin-top: 8px;
    display: flex;
    gap: 8px;
}

.form-actions {
    display: flex;
    gap: 20px;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
    flex-wrap: wrap;
}

.navigation-buttons {
    display: flex;
    gap: 10px;
}

.action-buttons {
    display: flex;
    gap: 10px;
}

/* 出題画面 */
.quiz-controls {
    text-align: center;
    margin-bottom: 20px;
}

.quiz-filters {
    max-width: 900px;
    margin: 20px auto;
}

.quiz-filters h3 {
    margin-bottom: 15px;
    color: var(--primary-color);
}

#quizCollectionCheckboxes {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

#quizFolderCheckboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    margin-bottom: 10px;
}

#quizFolderCheckboxes label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: white;
    border-radius: 4px;
    cursor: pointer;
}

#quizCollectionCheckboxes label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 8px;
    background: white;
    border-radius: 4px;
    transition: background 0.2s;
}

#quizCollectionCheckboxes label:hover {
    background: #e9ecef;
}

#quizCollectionCheckboxes input[type="checkbox"] {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

#quizCollectionCheckboxes label span {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.quiz-display {
    max-width: 1000px;
    margin: 0 auto;
}

.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 20px;
    gap: 20px;
}

.quiz-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    flex-wrap: wrap;
}

.quiz-controls {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.quiz-question-display {
    background: #f8f9fa;
    padding: 40px;
    border-radius: 8px;
    margin-bottom: 20px;
    min-height: 300px;
}

.quiz-question-display h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 20px;
}

.question-text {
    font-size: 20px;
    line-height: 2;
    white-space: pre-wrap;
}

.answer-display {
    background: #fff3cd;
    padding: 30px;
    border-radius: 8px;
    border: 2px solid #ffc107;
    margin-bottom: 15px;
}

.answer-display h3 {
    color: #856404;
    margin-bottom: 15px;
    font-size: 18px;
}

.answer-text {
    font-size: 26px;
    font-weight: bold;
    color: #856404;
    line-height: 1.6;
}

.memo-display {
    background: #d1ecf1;
    padding: 30px;
    border-radius: 8px;
    border: 2px solid #17a2b8;
}

.memo-display h3 {
    color: #0c5460;
    margin-bottom: 15px;
    font-size: 18px;
}

.memo-text {
    font-size: 17px;
    color: #0c5460;
    line-height: 1.8;
    white-space: pre-wrap;
}

/* ふりがな表示 */
.ruby {
    display: inline-block;
    position: relative;
    padding-top: 1.2em;
}

.ruby-text {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    font-size: 0.5em;
    text-align: center;
    color: #666;
}

/* 色付きテキスト */
.colored-text {
    color: #d9534f;
    font-weight: bold;
}

/* 候補リストタブ */
.candidates-panel {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.candidates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 10px;
    margin-top: 20px;
}

.candidate-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 12px 15px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    transition: all 0.2s;
    gap: 10px;
}

.candidate-item:hover {
    background: #e9ecef;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.candidate-content {
    flex: 1;
    min-width: 0;
}

.candidate-text {
    font-size: 14px;
    font-weight: bold;
    color: #333;
    word-wrap: break-word;
}

.candidate-memo {
    font-size: 12px;
    color: #666;
    margin-top: 4px;
    line-height: 1.4;
    word-wrap: break-word;
}

/* 候補リストサイドバー */
.candidates-sidebar {
    position: absolute;
    right: 20px;
    top: 70px;
    width: 300px;
    max-height: 500px;
    background: white;
    border: 2px solid #007bff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    overflow: hidden;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
    background: #007bff;
    color: white;
}

.sidebar-header h4 {
    margin: 0;
    font-size: 14px;
}

.candidates-list {
    max-height: 440px;
    overflow-y: auto;
    padding: 10px;
}

.candidate-sidebar-item {
    padding: 10px 15px;
    margin-bottom: 5px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.candidate-sidebar-text {
    font-size: 14px;
    font-weight: bold;
    color: #333;
    margin-bottom: 4px;
}

.candidate-sidebar-memo {
    font-size: 12px;
    color: #666;
    line-height: 1.3;
    margin-top: 4px;
}

.candidate-sidebar-item:hover {
    background: #007bff;
    transform: translateX(5px);
}

.candidate-sidebar-item:hover .candidate-sidebar-text,
.candidate-sidebar-item:hover .candidate-sidebar-memo {
    color: white;
}

/* 設定画面 */
.settings-panel {
    max-width: 600px;
    margin: 0 auto 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.settings-panel h3 {
    margin-bottom: 15px;
    color: var(--primary-color);
}

.settings-panel input[type="range"] {
    width: 100%;
}

.warning-text {
    color: var(--danger-color);
    font-size: 14px;
    margin-top: 10px;
}

/* レスポンシブ */
@media (max-width: 768px) {
    .container {
        padding: 8px;
        display: block;
        min-height: auto;
    }

    header {
        flex-direction: column;
        gap: 12px;
        padding: 12px;
        align-items: stretch;
        grid-column: auto;
    }

    h1 {
        font-size: 18px;
        text-align: center;
    }

    .header-controls {
        flex-wrap: wrap;
        justify-content: center;
        gap: 6px;
    }

    .header-controls .btn {
        font-size: 12px;
        padding: 6px 10px;
    }

    .split-panel {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .tabs {
        width: auto;
        margin-right: 0;
        margin-bottom: 10px;
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        gap: 3px;
        -webkit-overflow-scrolling: touch;
    }

    .tab-btn {
        padding: 10px 14px;
        font-size: 13px;
        white-space: nowrap;
        flex-shrink: 0;
    }

    .tab-content {
        margin-left: 0;
        padding: 12px;
        min-height: auto;
        overflow: visible;
    }

    #manage-tab.tab-content.active,
    #quiz-organize-tab.tab-content.active {
        height: auto;
    }

    #manage-tab #quizList,
    #quiz-organize-tab #quizManageList {
        max-height: 50vh;
    }

    #manage-tab .split-panel {
        grid-template-columns: 1fr;
    }

    .toolbar {
        flex-wrap: wrap;
        gap: 6px;
    }

    .toolbar .btn {
        font-size: 12px;
        padding: 6px 10px;
    }

    /* --- 出題画面のモバイル対応 --- */
    .quiz-display {
        max-width: 100%;
    }

    .quiz-header {
        flex-direction: column;
        gap: 10px;
        padding: 10px;
        margin-bottom: 12px;
    }

    .quiz-info {
        justify-content: center;
        font-size: 14px;
    }

    .quiz-controls {
        justify-content: center;
        flex-wrap: wrap;
        gap: 6px;
    }

    .quiz-controls .btn {
        padding: 10px 14px;
        font-size: 14px;
        min-height: 44px;
    }

    .quiz-question-display {
        padding: 16px;
        margin-bottom: 12px;
        min-height: 150px;
    }

    .quiz-question-display h2 {
        font-size: 16px;
        margin-bottom: 12px;
    }

    .question-text {
        line-height: 1.8;
    }

    .answer-display {
        padding: 16px;
        margin-bottom: 10px;
    }

    .answer-display h3 {
        font-size: 15px;
        margin-bottom: 10px;
    }

    .answer-text {
        font-size: 22px;
    }

    .memo-display {
        padding: 16px;
    }

    .memo-display h3 {
        font-size: 15px;
        margin-bottom: 10px;
    }

    .memo-text {
        font-size: 15px;
    }

    .quiz-filters h3 {
        font-size: 16px;
    }

    #quizCollectionCheckboxes label {
        font-size: 14px;
        padding: 6px 4px;
    }

    /* フィルターコントロール */
    .filter-controls {
        flex-direction: column;
        gap: 6px;
    }

    /* 設定画面 */
    .settings-panel {
        padding: 14px;
    }
}

/* スクロールバー */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}


/* 通知アニメーション */
@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

/* 同期オーバーレイ */
.sync-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 20000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s;
}

.sync-overlay-content {
    background: white;
    border-radius: 12px;
    padding: 40px 50px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    min-width: 280px;
}

.sync-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e0e0e0;
    border-top-color: var(--primary-color);
    border-radius: 50%;
    margin: 0 auto 20px;
    animation: spin 0.8s linear infinite;
}

.sync-overlay-message {
    font-size: 16px;
    font-weight: bold;
    color: var(--text-color);
    margin-bottom: 8px;
}

.sync-overlay-detail {
    font-size: 13px;
    color: #888;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.copy-notification {
    pointer-events: none;
}

/* ========== クラウド同期状態表示 ========== */

/* option 要素：ブラウザ制限のため、絵文字テキストで状態を表示 */
option {
    padding: 8px;
    line-height: 1.8;
}

/* 同期状態インジケーター用色分けクラス（参考） */
.sync-indicator {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 4px;
    vertical-align: middle;
}

.sync-indicator.synced {
    background-color: #4CAF50; /* 緑 */
}

.sync-indicator.syncing {
    background-color: #FFC107; /* 黄 */
}

.sync-indicator.error {
    background-color: #f44336; /* 赤 */
}

.sync-indicator.pending {
    background-color: #9E9E9E; /* 灰 */
}

/* Collection リストの同期状態表示補助 */
.collection-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.collection-item .sync-badge {
    font-size: 12px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 3px;
    min-width: 40px;
    text-align: center;
}

.collection-item .sync-badge.synced {
    background-color: #E8F5E9;
    color: #2E7D32;
}

.collection-item .sync-badge.syncing {
    background-color: #FFF9C4;
    color: #F57F17;
}

.collection-item .sync-badge.error {
    background-color: #FFEBEE;
    color: #C62828;
}

.collection-item .sync-badge.pending {
    background-color: #F5F5F5;
    color: #616161;
}

/* リストヘッダー＆ツールバー */
.list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    margin-top: 16px;
    gap: 10px;
}

.list-header h3 {
    flex: 1;
    margin: 0;
    font-size: 15px;
    color: var(--primary-color);
}

.list-toolbar {
    display: flex;
    gap: 4px;
}

/* 小型ボタン */
.btn-sm {
    padding: 6px 10px;
    font-size: 13px;
    min-height: 28px;
}

/* コンテキストメニュー */
.context-menu {
    position: fixed;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 10000;
    min-width: 150px;
}

.context-menu-item {
    padding: 10px 16px;
    cursor: pointer;
    font-size: 14px;
    user-select: none;
    transition: background 0.15s;
    border-bottom: 1px solid #f0f0f0;
}

.context-menu-item:last-child {
    border-bottom: none;
}

.context-menu-item:hover {
    background: #f0f7ff;
    color: var(--primary-color);
}

/* インライン編集入力欄 */
.inline-edit-input {
    width: 100%;
    padding: 8px;
    border: 2px solid var(--primary-color);
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
}

/* 同期状態凡例 */
.sync-legend {
    margin-top: 12px;
    padding: 10px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #fafbfc;
    font-size: 13px;
}

.legend-title {
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 6px;
    font-size: 12px;
}

.legend-item {
    padding: 3px 0;
    color: #4b5563;
    line-height: 1.4;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-item::before {
    content: '';
    display: inline-block;
}

.legend-item {
    white-space: nowrap;
}
