:root {
    --primary-color: #FF6B9D;
    --primary-hover: #F9508A;

    --bg-color: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-sidebar: #ffffff;
    --bg-overlay: rgba(15, 23, 42, 0.3);

    --text-color: #0f172a;
    --sub-text: #64748b;

    --border-color: #f1f5f9;
    --hover-color: #f1f5f9;
    --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
    --sidebar-width: 280px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #0b0f19;
        --bg-secondary: #1e293b;
        --bg-sidebar: #0f172a;
        --bg-overlay: rgba(0, 0, 0, 0.6);

        --text-color: #f8fafc;
        --sub-text: #94a3b8;

        --border-color: #1e293b;
        --hover-color: #334155;
        --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    }
}

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

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

.app-container {
    display: flex;
    min-height: 100vh;
    max-width: 1200px;
    margin: 0 auto;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    padding: 32px 24px;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 200;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header { margin-bottom: 32px; }

.brand-text h1 {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    margin-bottom: 4px;
}

.brand-text p {
    font-size: 0.85rem;
    color: var(--sub-text);
    font-weight: 500;
}

.category-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 32px;
}

.nav-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    background: transparent;
    color: var(--text-color);
    transition: all 0.2s ease;
}

.nav-item:hover { background: var(--hover-color); }
.nav-item.active { background: var(--primary-color); color: #ffffff; }
.nav-item--empty { opacity: 0.35; cursor: default; pointer-events: none; }

.nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 20px;
    padding: 0 6px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    background: var(--bg-secondary);
    color: var(--sub-text);
}
.nav-item.active .nav-badge { background: rgba(255, 255, 255, 0.25); color: #ffffff; }

.sidebar-footer {
    margin-top: auto;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.seo-description { color: var(--sub-text); line-height: 1.6; font-size: 0.85rem; }
.seo-description h2 { color: var(--text-color); font-size: 0.95rem; margin-bottom: 12px; font-weight: 700; }
.seo-description p { margin-bottom: 12px; }

.main-layout {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-width: 0;
    background: var(--bg-color);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 32px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 20px;
}

@media (prefers-color-scheme: dark) {
    .topbar { background: rgba(11, 15, 25, 0.8); }
}

.topbar-title-mobile { display: none; }
.header-right { display: flex; align-items: center; gap: 16px; }

.controls select {
    border: 1px solid var(--border-color);
    background: var(--bg-color);
    color: var(--text-color);
    border-radius: 10px;
    padding: 8px 16px;
    font-size: 0.9rem;
    font-weight: 500;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
}
.controls select:focus { border-color: var(--primary-color); }

.sns-links { display: flex; align-items: center; gap: 8px; }

.sns-icon-link {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    background: var(--bg-secondary);
    color: var(--text-color);
    font-weight: 700;
    font-size: 1rem;
    transition: all 0.2s ease;
}
.sns-icon-link:hover { background: var(--hover-color); transform: translateY(-2px); }

.content-body {
    padding: 32px;
    max-width: 700px;
    margin: 0 auto;
}

/* SPOTIFY EMBED CONTAINER */
.spotify-wrapper {
    margin-bottom: 24px;
    display: none;
    
    /* 追従（固定）させるための設定 */
    position: sticky;
    top: 86px; /* ヘッダーの高さ＋余白分 */
    z-index: 90;
    
    /* ツイートが裏を通過する際に見栄えを良くするための背景とパディング */
    background: var(--bg-color);
    padding-top: 4px;
    padding-bottom: 12px;
    margin-top: -4px;
}

.spotify-embed-card {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 8px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
}

.tweets-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.tweet-card {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 4px;
    box-shadow: var(--card-shadow);
    display: flex;
    justify-content: center;
    position: relative;
    touch-action: pan-y;
}

body.is-scrolling .tweet-card iframe { pointer-events: none !important; }

@keyframes skeleton-shimmer {
    0%   { background-position: -400px 0; }
    100% { background-position:  400px 0; }
}
.tweet-skeleton { width: 100%; padding: 20px; }
.tweet-skeleton__header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.tweet-skeleton__avatar {
    width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
    background: var(--skeleton-base, #e2e8f0);
    background-image: linear-gradient(90deg, var(--skeleton-base, #e2e8f0) 0px, var(--skeleton-shine, #f1f5f9) 80px, var(--skeleton-base, #e2e8f0) 160px);
    background-size: 400px 100%; animation: skeleton-shimmer 1.4s infinite linear;
}
.tweet-skeleton__meta { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.tweet-skeleton__line {
    height: 12px; border-radius: 6px;
    background: var(--skeleton-base, #e2e8f0);
    background-image: linear-gradient(90deg, var(--skeleton-base, #e2e8f0) 0px, var(--skeleton-shine, #f1f5f9) 80px, var(--skeleton-base, #e2e8f0) 160px);
    background-size: 400px 100%; animation: skeleton-shimmer 1.4s infinite linear;
}
.tweet-skeleton__line--name   { width: 35%; }
.tweet-skeleton__line--handle { width: 22%; height: 10px; }
.tweet-skeleton__line--text   { width: 95%; margin-top: 8px; }
.tweet-skeleton__line--short  { width: 60%; }

@media (prefers-color-scheme: dark) {
    .tweet-skeleton__avatar, .tweet-skeleton__line { --skeleton-base:  #1e293b; --skeleton-shine: #334155; }
}

.tweet-error, .tweet-empty { padding: 40px 20px; font-size: 0.9rem; color: var(--sub-text); text-align: center; font-weight: 500; }
.tweet-error { color: var(--primary-color); }

.load-more-container { padding: 32px 0; text-align: center; }
#scroll-sentinel { height: 1px; visibility: hidden; }

.btn-primary {
    border: none; background: var(--primary-color); color: #ffffff;
    border-radius: 12px; padding: 12px 28px; font-weight: 700; font-size: 0.95rem;
    cursor: pointer; box-shadow: 0 4px 12px rgba(255, 107, 157, 0.2); transition: all 0.2s ease;
}
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: 0 6px 16px rgba(255, 107, 157, 0.3); }

.drawer-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: var(--bg-overlay); z-index: 150; opacity: 0; pointer-events: none;
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); transition: opacity 0.3s ease;
}
.drawer-overlay.active { opacity: 1; pointer-events: auto; }

@media (max-width: 992px) {
    .sidebar { transform: translateX(-100%); box-shadow: 4px 0 24px rgba(0, 0, 0, 0.1); }
    .sidebar.open { transform: translateX(0); }
    .main-layout { margin-left: 0; }
    .topbar { justify-content: space-between; padding: 12px 20px; }
    
    .spotify-wrapper {
        top: 60px; /* スマホ時のヘッダー高さに追従させる */
    }

    .topbar-title-mobile { display: block; flex: 1; margin-left: 16px; min-width: 0; }
    .topbar-title-mobile h1 { font-size: 1rem; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

    .drawer-toggle-btn {
        display: flex; flex-direction: column; justify-content: space-between;
        width: 24px; height: 18px; background: transparent; border: none; cursor: pointer; z-index: 210;
    }
    .drawer-toggle-btn .bar { width: 100%; height: 2px; background-color: var(--text-color); border-radius: 2px; transition: all 0.3s ease; }
    .drawer-toggle-btn.active .bar:nth-child(1) { transform: translateY(8px) rotate(45deg); }
    .drawer-toggle-btn.active .bar:nth-child(2) { opacity: 0; }
    .drawer-toggle-btn.active .bar:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }
    .content-body { padding: 20px 16px; }
}

@media (min-width: 993px) {
    .drawer-toggle-btn { display: none; }
}
