/* エビちゃんねる ナビゲーター — ebisuda.net ポータルデザインベース */

:root {
    --bg: #f8fafc;
    --bg-card: #fff;
    --bg-input: #fff;
    --bg-hover: #f1f5f9;
    --text: #1e293b;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --border: #e2e8f0;
    --accent: #3a7bd5;
    --accent-light: #5a9bef;
    --highlight: #fef3c7;
    --danger: #e81123;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 20px rgba(0,0,0,0.08);
    --shadow-hover: 0 12px 32px rgba(58,123,213,0.2);
    --transition: all 0.3s ease;
}

html.dark {
    --bg: #0f172a;
    --bg-card: #1e293b;
    --bg-input: #1e293b;
    --bg-hover: #334155;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --text-light: #64748b;
    --border: #334155;
    --shadow: 0 4px 20px rgba(0,0,0,0.3);
    --shadow-hover: 0 12px 32px rgba(0,0,0,0.5);
    --highlight: #78350f;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1rem 2rem;
}

.hidden { display: none !important; }

/* Header */
.header {
    text-align: center;
    padding: 2rem 0 1rem;
    position: relative;
}

.header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text);
}

.subtitle {
    color: var(--text-muted);
    font-size: 1rem;
    margin-top: 0.25rem;
}

.theme-toggle {
    position: absolute;
    top: 2rem;
    right: 0;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    border-color: var(--accent);
    transform: scale(1.1);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border);
}

.tab {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
}

.tab:hover { color: var(--accent); }

.tab.active {
    color: var(--accent);
}

.tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent);
    border-radius: 2px 2px 0 0;
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* Search Area */
.search-area { margin-bottom: 1.5rem; }

.search-area input[type="text"] {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-input);
    color: var(--text);
    outline: none;
    transition: border-color 0.3s;
}

.search-area input:focus { border-color: var(--accent); }

.filters {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

.filters select {
    padding: 0.5rem 0.75rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    background: var(--bg-input);
    color: var(--text);
    cursor: pointer;
    outline: none;
}

.filters select:focus { border-color: var(--accent); }

.result-count {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.search-hint {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-light);
}

/* Persona Section */
.section-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0 0 1rem;
    color: var(--text);
}

.persona-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
    margin-bottom: 2.5rem;
}

.persona-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 2px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
}

.persona-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(58,123,213,0.15);
}

.persona-icon { font-size: 2rem; flex-shrink: 0; }
.persona-title { font-weight: 600; color: var(--text); margin-bottom: 0.25rem; }
.persona-desc { font-size: 0.85rem; color: var(--text-muted); }

/* Category Grid */
.cat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
    margin-bottom: 2.5rem;
}

.cat-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border-radius: 10px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
}

.cat-card:hover {
    background: var(--bg-hover);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transform: translateY(-1px);
}

.cat-icon { font-size: 1.5rem; flex-shrink: 0; }
.cat-name { font-weight: 600; font-size: 0.9rem; color: var(--text); }
.cat-count { font-size: 0.8rem; color: var(--text-muted); }

/* Card Grid */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Video Card */
.video-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border-radius: 16px;
    overflow: hidden;
    border: 2px solid var(--border);
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    color: inherit;
}

.video-card:hover {
    transform: translateY(-6px);
    border-color: var(--accent);
    box-shadow: var(--shadow-hover);
}

.card-thumbnail {
    position: relative;
    width: 100%;
    height: 160px;
    background: linear-gradient(135deg, var(--border) 0%, var(--bg-hover) 100%);
    overflow: hidden;
}

.card-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.video-card:hover .card-thumbnail img {
    transform: scale(1.05);
}

.card-duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0,0,0,0.8);
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.card-content {
    padding: 1rem 1.25rem 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card-badges {
    display: flex;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.4;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-summary {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

.card-meta {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-light);
}

.card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.btn {
    padding: 0.4rem 0.75rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
    border: none;
    color: #fff;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(58,123,213,0.3);
    color: #fff;
}

/* Load More */
.load-more-area { text-align: center; margin: 1.5rem 0; }

.load-more-btn {
    padding: 0.75rem 2rem;
    font-size: 1rem;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
    color: #fff;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: var(--transition);
}

.load-more-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(58,123,213,0.4);
}

.shown-info {
    margin-top: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-light);
}

/* Transcript Search Results */
.transcript-result-card {
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    transition: var(--transition);
}

.transcript-result-card:hover {
    border-color: var(--accent);
}

.transcript-result-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.transcript-result-thumb {
    width: 120px;
    height: 68px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    flex-shrink: 0;
}

.transcript-result-title {
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
}

.transcript-result-title:hover { color: var(--accent); }

.transcript-result-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.transcript-match-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.2s;
}

.transcript-match-item:hover { background: var(--bg-hover); }

.match-timestamp {
    color: var(--accent);
    font-weight: 600;
    font-size: 0.85rem;
    min-width: 50px;
    flex-shrink: 0;
}

.match-text {
    font-size: 0.9rem;
    color: var(--text);
    line-height: 1.5;
}

.highlight {
    background: var(--highlight);
    font-weight: 600;
    padding: 0 2px;
    border-radius: 2px;
}

/* Loading */
.loading {
    text-align: center;
    padding: 3rem 0;
    color: var(--text-muted);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin { to { transform: rotate(360deg); } }

.error-msg {
    background: #fef2f2;
    border: 2px solid #fca5a5;
    color: #991b1b;
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

html.dark .error-msg {
    background: #450a0a;
    border-color: #7f1d1d;
    color: #fca5a5;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal {
    background: var(--bg-card);
    border-radius: 16px;
    width: 100%;
    max-width: 700px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    margin-right: 1rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
}

.modal-close:hover { color: var(--text); }

.modal-video-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
}

.modal-video-thumb {
    width: 120px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.modal-video-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.modal-search-bar {
    padding: 0 1.5rem 0.75rem;
}

.modal-search-bar input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    background: var(--bg-input);
    color: var(--text);
    outline: none;
}

.modal-search-bar input:focus { border-color: var(--accent); }

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 0 1.5rem 1rem;
}

.modal-transcript-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.2s;
}

.modal-transcript-item:hover { background: var(--bg-hover); }

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
}

.modal-filter-info {
    padding: 0.5rem 0;
    font-size: 0.85rem;
    color: var(--accent);
}

.no-results-msg {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

/* Footer */
.footer {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--text-light);
    font-size: 0.85rem;
}

.footer-stats { margin-bottom: 0.75rem; }

.footer-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 0.75rem;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.footer-links a:hover { color: var(--accent); }

.footer-copyright { font-size: 0.8rem; }

/* Responsive */
@media (max-width: 719px) {
    .header h1 { font-size: 1.4rem; }

    .card-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .card-thumbnail { height: 140px; }

    .persona-grid { grid-template-columns: 1fr; }

    .cat-grid { grid-template-columns: repeat(2, 1fr); }

    .filters {
        flex-direction: column;
    }

    .filters select { width: 100%; }

    .tab { padding: 0.6rem 1rem; font-size: 0.9rem; }

    .transcript-result-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .transcript-result-thumb { width: 100%; height: auto; }

    .modal { max-height: 95vh; }
}

/* ===========================================
   学習コース
   =========================================== */

/* コース一覧 */
.course-list-header {
    text-align: center;
    margin-bottom: 1.5rem;
}
.course-list-header h2 { margin: 0 0 0.5rem; font-size: 1.5rem; }
.course-list-header p { color: var(--text-muted); margin: 0; }

.course-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.course-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.25rem;
    border-left: 5px solid var(--accent);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow);
}
.course-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.course-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}
.course-card-icon { font-size: 2rem; }
.course-card-title { font-size: 1.1rem; font-weight: 700; }

.course-card-desc {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.course-card-stats {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.course-stat {
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    border-radius: 99px;
    background: var(--bg-hover);
    color: var(--text-muted);
    white-space: nowrap;
}
.course-stat-gap {
    background: #fef3c7;
    color: #92400e;
}
html.dark .course-stat-gap {
    background: #451a03;
    color: #fbbf24;
}

/* コース詳細 */
.course-detail-back {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: none;
    border: none;
    color: var(--accent);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0.5rem 0;
    margin-bottom: 1rem;
}
.course-detail-back:hover { text-decoration: underline; }

.course-detail-hero {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border-left: 5px solid var(--accent);
    box-shadow: var(--shadow);
}
.course-detail-hero h2 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 0.5rem;
    font-size: 1.4rem;
}
.course-detail-hero p {
    color: var(--text-muted);
    margin: 0 0 0.75rem;
    line-height: 1.6;
}
.course-detail-meta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}
.course-detail-meta .course-stat { font-size: 0.8rem; }

/* セクション */
.course-section {
    margin-bottom: 1.5rem;
}
.course-section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border);
}
.section-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}
.section-title-text { font-weight: 700; font-size: 1.05rem; }
.section-desc {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-left: auto;
}

/* コース内動画リスト */
.course-video-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.course-video-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid var(--border);
}
.course-video-item:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
}

.course-video-order {
    color: var(--text-light);
    font-size: 0.75rem;
    font-weight: 700;
    width: 1.5rem;
    text-align: center;
    flex-shrink: 0;
}

.course-video-thumb {
    width: 80px;
    height: 45px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
}

.course-video-info {
    flex: 1;
    min-width: 0;
}
.course-video-title {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.course-video-meta {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.15rem;
}
.course-video-meta span {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.course-video-badges {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}
.course-video-badges .badge {
    font-size: 0.65rem;
    padding: 0.1rem 0.4rem;
}

.badge-paid {
    background: #fbbf24 !important;
    color: #451a03 !important;
}
.badge-temp-free {
    background: #34d399 !important;
    color: #064e3b !important;
}
.badge-free {
    background: var(--bg-hover);
    color: var(--text-muted);
}

/* ギャップカード */
.course-gaps {
    margin-top: 2rem;
}
.course-gaps h3 {
    font-size: 1.1rem;
    margin: 0 0 0.75rem;
}

.gap-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 2px dashed var(--border);
    margin-bottom: 0.5rem;
    transition: var(--transition);
}
.gap-card:hover {
    border-color: var(--accent);
}

.gap-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.gap-info {
    flex: 1;
    min-width: 0;
}
.gap-title {
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 0.15rem;
}
.gap-desc {
    color: var(--text-muted);
    font-size: 0.75rem;
    line-height: 1.4;
}

.gap-vote-area {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.gap-vote-btn {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.4rem 0.8rem;
    border-radius: 99px;
    border: 2px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: var(--transition);
    white-space: nowrap;
}
.gap-vote-btn:hover {
    border-color: var(--accent);
    background: var(--bg-hover);
}
.gap-vote-btn.voted {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
}
.gap-vote-count {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* コース進捗バー */
.course-progress {
    margin-top: 0.75rem;
}
.progress-bar-bg {
    height: 6px;
    border-radius: 3px;
    background: var(--border);
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    border-radius: 3px;
    background: var(--accent);
    transition: width 0.3s ease;
}
.progress-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* レスポンシブ */
@media (max-width: 719px) {
    .course-grid {
        grid-template-columns: 1fr;
    }

    .course-video-thumb {
        width: 60px;
        height: 34px;
    }

    .course-video-title {
        font-size: 0.8rem;
    }

    .gap-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .gap-vote-area {
        width: 100%;
        justify-content: flex-end;
    }

    .section-desc {
        display: none;
    }
}

/* ===========================================
   Curriculum Map Styles
   =========================================== */

.curriculum-level-tabs {
    display: flex;
    gap: 0;
    margin: 1.5rem 0 1rem;
    border-bottom: 2px solid var(--border);
}

.curriculum-level-tab {
    padding: 0.6rem 1.8rem;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
}

.curriculum-level-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.curriculum-level-tab:hover {
    color: var(--text);
}

.curriculum-level-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 0.5rem 0.8rem 0.6rem;
    border-left: 3px solid var(--accent);
    background: color-mix(in srgb, var(--accent) 6%, transparent);
    border-radius: 0 6px 6px 0;
    margin-bottom: 0.8rem;
    line-height: 1.4;
}

.curriculum-level-content {
    margin-top: 0.5rem;
}

.curriculum-section {
    margin-bottom: 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.curriculum-section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg-hover);
    cursor: pointer;
    user-select: none;
}

.curriculum-section-header:hover {
    filter: brightness(0.96);
}

html.dark .curriculum-section-header:hover {
    filter: brightness(1.08);
}

.curriculum-section-arrow {
    font-size: 0.65rem;
    color: var(--text-muted);
    width: 1rem;
    text-align: center;
    flex-shrink: 0;
}

.curriculum-section-title {
    flex: 1;
    font-weight: 600;
    font-size: 0.9rem;
}

.curriculum-section-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg-card);
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    border: 1px solid var(--border);
}

.curriculum-section-items {
    background: var(--bg-card);
}

.curriculum-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 1rem 0.55rem 1.25rem;
    border-bottom: 1px solid var(--border);
    transition: background 0.1s;
}

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

.curriculum-item:hover {
    background: var(--bg-hover);
}

.curriculum-item-number {
    min-width: 1.6rem;
    height: 1.6rem;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 700;
    flex-shrink: 0;
}

.curriculum-item-title {
    flex: 1;
    font-size: 0.875rem;
    line-height: 1.4;
}

/* 動画マッピングバッジ */
.curriculum-item.has-videos {
    cursor: pointer;
    flex-wrap: wrap;
}

.curriculum-item-video-badge {
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    background: color-mix(in srgb, var(--accent) 15%, transparent);
    color: var(--accent);
    border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
    border-radius: 999px;
    cursor: pointer;
    flex-shrink: 0;
    white-space: nowrap;
    transition: background 0.15s;
}

.curriculum-item-video-badge:hover {
    background: color-mix(in srgb, var(--accent) 25%, transparent);
}

/* 動画リスト（クリックで展開） */
.curriculum-item-videolist {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.6rem 0.5rem 0.4rem 2.8rem;
    background: color-mix(in srgb, var(--accent) 4%, transparent);
    border-top: 1px solid color-mix(in srgb, var(--accent) 20%, transparent);
}

.curriculum-video-link {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    text-decoration: none;
    color: var(--text);
    border-radius: 6px;
    padding: 0.3rem;
    transition: background 0.12s;
}

.curriculum-video-link:hover {
    background: var(--bg-hover);
}

.curriculum-video-thumb {
    width: 80px;
    min-width: 80px;
    height: 45px;
    object-fit: cover;
    border-radius: 4px;
    background: var(--bg-hover);
}

.curriculum-video-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.curriculum-video-title {
    font-size: 0.78rem;
    line-height: 1.35;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.curriculum-video-ts {
    font-size: 0.7rem;
    color: var(--accent);
    font-weight: 600;
}

.curriculum-video-badge {
    font-size: 0.65rem;
    padding: 0.1rem 0.35rem;
    align-self: flex-start;
}

.curriculum-video-more {
    padding: 0.4rem 0.5rem;
}

.curriculum-video-more-link {
    font-size: 0.75rem;
    color: var(--accent);
    text-decoration: underline;
    opacity: 0.8;
}

.curriculum-video-more-link:hover {
    opacity: 1;
}

/* ビュー切り替え（レベル別 / サービス別） */
.curriculum-view-area {
    margin-top: 1rem;
}

.curriculum-view-switcher {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.view-switch-btn {
    padding: 0.45rem 1.2rem;
    border: 2px solid var(--border);
    border-radius: 999px;
    background: var(--bg-card);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.15s;
}

.view-switch-btn.active {
    border-color: var(--accent);
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.view-switch-btn:hover:not(.active) {
    border-color: var(--text-muted);
    color: var(--text);
}

/* サービスタブ */
.curriculum-service-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.curriculum-service-tab {
    padding: 0.4rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.15s;
}

.curriculum-service-tab.active {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 8%, transparent);
    color: var(--accent);
}

.curriculum-service-tab:hover:not(.active) {
    border-color: var(--text-muted);
    color: var(--text);
}

/* サービス別ビュー内のレベルタブ（少し小さめ） */
.curriculum-level-tabs--inner .curriculum-level-tab {
    padding: 0.5rem 1.2rem;
    font-size: 0.85rem;
}

/* ===========================
   管理者UI
   =========================== */

/* ヘッダーの管理者ログインボタン */
#admin-auth-area {
    position: absolute;
    top: 2rem;
    right: 3rem; /* theme-toggle の左 */
}

.admin-login-btn {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.35rem 0.7rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

.admin-login-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.admin-login-btn.hidden {
    display: none;
}

/* 管理者バー */
.admin-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    background: color-mix(in srgb, #f59e0b 12%, var(--bg));
    border: 1px solid #f59e0b;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    margin-bottom: 0.75rem;
    font-size: 0.82rem;
}

.admin-bar-label {
    font-weight: 700;
    color: #b45309;
}

.admin-bar-user {
    color: var(--text-muted);
    font-size: 0.78rem;
}

.admin-bar-hint {
    color: var(--text-muted);
    font-size: 0.78rem;
    flex: 1;
}

.admin-bar-actions {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
}

.admin-pat-btn,
.admin-logout-btn {
    background: transparent;
    border: 1px solid #f59e0b;
    border-radius: 5px;
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
    cursor: pointer;
    color: #b45309;
    transition: var(--transition);
}

.admin-pat-btn:hover,
.admin-logout-btn:hover {
    background: #f59e0b;
    color: #fff;
}

/* 動画カードのラッパー（✕ボタン・ドラッグ用） */
.curriculum-video-wrap {
    position: relative;
    border-radius: 6px;
    transition: opacity 0.3s, transform 0.3s;
}

.curriculum-video-wrap.admin-hiding {
    opacity: 0;
    transform: scale(0.95);
}

/* 管理者ドラッグ可能カード */
.curriculum-video-wrap.admin-draggable {
    padding-left: 1.4rem;
    cursor: default;
}

/* ドラッグ中のカード */
.curriculum-video-wrap.admin-dragging {
    opacity: 0.35;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* ドロップターゲットのハイライト */
.curriculum-video-wrap.admin-drag-over {
    outline: 2px dashed var(--accent);
    outline-offset: 2px;
    background: color-mix(in srgb, var(--accent) 5%, transparent);
}

/* ドラッグハンドルアイコン */
.admin-drag-handle {
    position: absolute;
    left: 3px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1rem;
    cursor: grab;
    opacity: 0;
    transition: opacity 0.15s;
    user-select: none;
    padding: 4px 1px;
    z-index: 2;
    line-height: 1;
}

.curriculum-video-wrap.admin-draggable:hover .admin-drag-handle {
    opacity: 0.5;
}

.admin-drag-handle:active {
    cursor: grabbing;
    opacity: 0.8;
}

/* 管理者の非表示ボタン */
.admin-hide-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: rgba(239, 68, 68, 0.85);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 2;
    line-height: 1;
}

.curriculum-video-wrap:hover .admin-hide-btn {
    opacity: 1;
}

.admin-hide-btn:hover {
    background: #dc2626;
    transform: scale(1.1);
}

.admin-hide-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
}

/* PAT 設定モーダル */
.pat-modal {
    max-width: 480px;
}

.admin-pat-guide {
    background: var(--bg-hover);
    border-radius: 6px;
    padding: 0.6rem 0.8rem;
    font-size: 0.82rem;
    margin-bottom: 0.75rem;
}

.admin-pat-guide a {
    color: var(--accent);
    font-weight: 600;
}

.admin-pat-input {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text);
    font-family: monospace;
    font-size: 0.85rem;
    box-sizing: border-box;
}

.admin-pat-note {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* トースト通知 */
.admin-toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: #1e293b;
    color: #f8fafc;
    padding: 0.65rem 1.2rem;
    border-radius: 8px;
    font-size: 0.85rem;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.25s, transform 0.25s;
    white-space: nowrap;
    max-width: 90vw;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.admin-toast.admin-toast-show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.admin-toast.admin-toast-error {
    background: #7f1d1d;
    border: 1px solid #ef4444;
}

/* ===========================================
   Admin: 動画追加ボタン（各カリキュラムアイテム）
   =========================================== */
.admin-add-video-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 8px 0 4px 0;
    padding: 6px 14px;
    background: transparent;
    border: 1.5px dashed var(--accent);
    border-radius: 6px;
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    width: 100%;
    justify-content: center;
}
.admin-add-video-btn:hover {
    background: var(--accent);
    color: #fff;
}

/* ===========================================
   動画追加モーダル
   =========================================== */
.add-video-modal {
    max-width: 680px;
    width: 96vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.add-video-modal-title-area {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.add-video-modal-title-area h3 {
    margin: 0;
    font-size: 1rem;
}
.add-video-modal-subtitle {
    font-size: 0.78rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 400px;
}

.add-video-modal-body {
    overflow-y: auto;
    padding: 0 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex: 1;
}

.add-video-search-area {
    position: sticky;
    top: 0;
    background: var(--bg-card);
    padding: 12px 0 4px;
    z-index: 1;
}
.add-video-search-area input {
    width: 100%;
    padding: 9px 14px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    font-size: 0.9rem;
    box-sizing: border-box;
}
.add-video-search-area input:focus {
    outline: none;
    border-color: var(--accent);
}

.add-video-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.add-video-section-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border);
}

.add-video-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* 各動画行 */
.add-video-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    transition: background 0.12s;
}
.add-video-row:hover {
    background: var(--bg-hover);
}
.add-video-row.add-video-row-added {
    opacity: 0.55;
}

.add-video-thumb {
    width: 80px;
    height: 45px;
    object-fit: cover;
    border-radius: 5px;
    flex-shrink: 0;
    background: var(--border);
}

.add-video-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.add-video-title {
    font-size: 0.82rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.add-video-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}
.add-video-level-badge {
    font-size: 0.68rem;
    padding: 1px 7px;
    border-radius: 4px;
    background: var(--border);
    color: var(--text-muted);
}
.add-video-from-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-style: italic;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
}

.add-video-no-results {
    font-size: 0.84rem;
    color: var(--text-muted);
    text-align: center;
    padding: 12px;
    margin: 0;
}

/* 追加ボタン */
.admin-add-confirm-btn {
    flex-shrink: 0;
    padding: 5px 12px;
    border-radius: 6px;
    border: 1.5px solid var(--accent);
    background: transparent;
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}
.admin-add-confirm-btn:hover:not(:disabled) {
    background: var(--accent);
    color: #fff;
}
.admin-add-confirm-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.admin-add-confirm-btn-done {
    border-color: var(--border);
    color: var(--text-muted);
    cursor: default;
}
.admin-add-confirm-btn-done:hover {
    background: transparent !important;
    color: var(--text-muted) !important;
}

/* ─── 学習進捗 ─── */
.watch-check-btn {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    padding: 0;
}
.watch-check-btn:hover {
    border-color: #22c55e;
    color: #22c55e;
}
.watch-check-btn.watched {
    border-color: #22c55e;
    background: #22c55e;
    color: #fff;
}
.video-watched .curriculum-video-link {
    opacity: 0.5;
}
.video-watched .curriculum-video-title {
    text-decoration: line-through;
    color: var(--text-muted);
}
.curriculum-item-video-badge.badge-all-watched {
    background: #22c55e22;
    color: #16a34a;
    border-color: #22c55e44;
}
html.dark .curriculum-item-video-badge.badge-all-watched {
    background: #16a34a33;
    color: #4ade80;
    border-color: #22c55e55;
}

/* ─── コースgap投票セクション ─── */
.course-gap-section {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}
.course-gap-heading {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 0.4rem;
}
.course-gap-desc {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 0 0 1rem;
}
.course-gap-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.course-gap-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 2px dashed var(--border);
    transition: border-color 0.2s, background 0.2s;
}
.course-gap-card:hover {
    border-color: var(--accent);
}
.course-gap-card.voted {
    border-color: var(--accent);
    border-style: solid;
    background: color-mix(in srgb, var(--accent) 6%, var(--bg-card));
}
.course-gap-info {
    flex: 1;
    min-width: 0;
}
.course-gap-title {
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 0.2rem;
}
.course-gap-description {
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.4;
}
.course-gap-vote-btn {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.9rem;
    border-radius: 99px;
    border: 2px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, color 0.2s;
    flex-shrink: 0;
    white-space: nowrap;
}
.course-gap-vote-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.course-gap-vote-btn.voted {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
}
.course-gap-count {
    min-width: 1ch;
    text-align: center;
}
.course-gap-footer {
    margin-top: 0.75rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}
@media (max-width: 719px) {
    .course-gap-card {
        flex-direction: column;
        align-items: flex-start;
    }
    .course-gap-vote-btn {
        align-self: flex-end;
    }
}
