:root {
    --primary-color: #2cb696;
    --text-color: #333;
    --text-light: #666;
    --bg-color: #fff;
    --border-color: #e5e5e5;
    --sidebar-width: 280px;
    --header-height: 60px;
    --container-max-width: 1080px;
    --gap: 32px;
}

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

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

a {
    color: inherit;
    text-decoration: none;
    transition: opacity 0.2s;
}

a:hover {
    opacity: 0.7;
}

/* Header */
.site-header {
    height: var(--header-height);
    border-bottom: 1px solid #444;
    position: sticky;
    top: 0;
    background: #333;
    z-index: 100;
}

.header-container {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
}

.header-logo img {
    height: 32px;
    width: auto;
}

.header-nav ul {
    display: flex;
    list-style: none;
    gap: 20px;
    align-items: center;
}

.header-nav a {
    font-size: 0.9rem;
    font-weight: 500;
    color: #fff;
}

.nav-btn {
    padding: 6px 16px;
    border-radius: 4px;
    font-weight: bold;
}

.btn-signup {
    background-color: var(--primary-color);
    color: #fff !important;
}

.btn-login {
    border: 1px solid var(--border-color);
}

/* Layout */
.container {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 32px 16px;
}

.main-layout {
    display: flex;
    gap: 48px;
    align-items: flex-start;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    position: sticky;
    top: calc(var(--header-height) + 32px);
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 16px;
    border: 1px solid var(--border-color);
}

.profile-name a {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--text-color);
}

.profile-bio {
    margin: 16px 0;
    font-size: 0.9rem;
    color: var(--text-color);
}

.profile-features {
    list-style: none;
    margin-bottom: 16px;
    font-size: 0.9rem;
    color: var(--text-light);
}

.profile-message {
    font-weight: bold;
    margin-bottom: 16px;
    font-size: 0.95rem;
}

.profile-stats {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 24px;
    display: flex;
    gap: 16px;
}

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

.btn-follow-x {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 20px;
    background: #000;
    color: #fff !important;
    font-weight: bold;
    font-size: 0.9rem;
    text-align: center;
}

.btn-follow-x:hover {
    background: #333;
    opacity: 1;
}

.sidebar-nav ul {
    list-style: none;
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
}

.sidebar-nav li {
    margin-bottom: 12px;
}

.sidebar-nav a {
    color: var(--text-light);
    font-size: 0.9rem;
}

.sidebar-footer {
    margin-top: 32px;
    font-size: 0.8rem;
    color: #999;
}

/* Main Content */
.main-content {
    flex-grow: 1;
    min-width: 0; /* Prevent flex overflow */
}

/* Hero Banner */
.hero-banner {
    width: 100%;
    height: 280px;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 24px;
}

.hero-banner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Article Grid (Home) */
.article-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.grid-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: transform 0.2s, box-shadow 0.2s;
    display: block;
}

.grid-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
    opacity: 1;
}

.grid-card-img {
    width: 100%;
    height: 180px;
    overflow: hidden;
}

.grid-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.grid-card-body {
    padding: 16px;
}

.grid-card-title {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.5;
    margin-bottom: 12px;
    color: var(--text-color);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.grid-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-light);
}

.grid-card-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
}

.grid-card-date {
    margin-left: auto;
}

/* Article List (Card) */
.article-list {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.article-card {
    display: flex;
    gap: 24px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 32px;
    align-items: start;
}

.article-card:last-child {
    border-bottom: none;
}

.article-content {
    flex: 1;
}

.article-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 8px;
}

.article-author-img {
    width: 20px;
    height: 20px;
    border-radius: 50%;
}

.article-title {
    font-size: 1.4rem;
    font-weight: bold;
    line-height: 1.4;
    margin-bottom: 8px;
}

.article-snippet {
    font-size: 0.95rem;
    color: var(--text-light);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 12px;
}

.article-footer {
    display: flex;
    gap: 16px;
    font-size: 0.85rem;
    color: #999;
}

.article-thumbnail {
    width: 160px;
    height: 110px;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
}

.article-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Single Article */
.single-article {
    max-width: 720px;
    margin: 0 auto 0 0; /* Left align in main area */
}

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

.article-hero {
    width: 100%;
    height: auto;
    border-radius: 4px;
    margin-bottom: 24px;
}

.article-title-large {
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 16px;
    line-height: 1.4;
}

.article-body {
    font-size: 1.1rem;
    line-height: 1.9;
    color: var(--text-color);
}

.article-body h2 {
    font-size: 1.6rem;
    margin: 48px 0 24px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.article-body h3 {
    font-size: 1.4rem;
    margin: 32px 0 16px;
}

.article-body p {
    margin-bottom: 24px;
}

.article-body ol {
    margin: 2em 0;
    padding-left: 1.5em;
}

.article-body img {
    max-width: 100%;
    height: auto;
    margin: 24px 0;
    border-radius: 4px;
}

.article-tags {
    margin-top: 48px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.article-tag {
    background: #f4f4f4;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 0.9rem;
    color: var(--text-light);
}

/* Share Buttons */
.share-buttons {
    margin-top: 32px;
    padding: 16px 0;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.share-label {
    font-size: 0.9rem;
    color: var(--text-light);
}

.share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-weight: bold;
    font-size: 1rem;
}

.share-x {
    background: #000;
    color: #fff !important;
}

.share-hatena {
    background: #00A4DE;
    color: #fff !important;
}

.share-btn:hover {
    opacity: 0.8;
}

/* Author Box */
.author-box {
    margin-top: 32px;
    padding: 24px;
    background: #f8f8f8;
    border-radius: 12px;
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.author-box-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    flex-shrink: 0;
}

.author-box-info {
    flex: 1;
}

.author-box-name {
    font-weight: bold;
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.author-box-bio {
    font-size: 0.9rem;
    color: var(--text-light);
    line-height: 1.6;
    margin-bottom: 12px;
}

.author-box-follow {
    display: inline-block;
    padding: 8px 16px;
    background: #000;
    color: #fff !important;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: bold;
}

.author-box-follow:hover {
    background: #333;
    opacity: 1;
}

/* Reel View (Mobile 4-koma) - TikTok風 */
.reel-container {
    display: flex;
    flex-direction: column;
    gap: 0;
    max-width: 100%;
    height: 100vh;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
    background: #111;
}

.reel-item {
    width: 100%;
    min-height: 100vh;
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}

.reel-card {
    background: #1a1a1a;
    border-radius: 16px;
    overflow: hidden;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.reel-image {
    width: 100%;
    max-height: 70vh;
    object-fit: contain;
    display: block;
}

.reel-info {
    padding: 16px;
    background: linear-gradient(to bottom, #1a1a1a, #222);
}

.reel-link {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-decoration: none;
}

.reel-title {
    color: #fff;
    font-size: 0.95rem;
    font-weight: bold;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.reel-cta {
    color: var(--primary-color);
    font-size: 0.9rem;
    font-weight: 600;
}

/* 広告スペース */
.reel-ad-space {
    margin-top: 16px;
    background: #222;
    border-radius: 12px;
    padding: 16px;
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.ad-label {
    display: inline-block;
    background: #444;
    color: #999;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 4px;
    margin-bottom: 8px;
}

.ad-placeholder {
    color: #666;
    font-size: 0.85rem;
    padding: 40px 0;
    border: 1px dashed #444;
    border-radius: 8px;
}

/* リールビューではサイドバーとヘッダーを隠す */
body:has(.reel-container) .sidebar,
body:has(.reel-container) .site-header,
body:has(.reel-container) .site-footer {
    display: none;
}

body:has(.reel-container) .main-layout {
    padding: 0;
    gap: 0;
}

body:has(.reel-container) .main-content {
    width: 100%;
    max-width: 100%;
}

/* Site Footer */
.site-footer {
    border-top: 1px solid var(--border-color);
    margin-top: 48px;
    padding: 24px 0;
    background: #fafafa;
}

.footer-inner {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 16px;
    text-align: center;
}

.copyright {
    font-size: 0.85rem;
    color: #999;
}

/* Responsive */
@media (max-width: 768px) {
    .main-layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        position: static;
        border-bottom: 1px solid var(--border-color);
        padding-bottom: 32px;
        margin-bottom: 32px;
    }

    .article-card {
        flex-direction: column-reverse;
    }
    
    .article-thumbnail {
        width: 100%;
        height: 200px;
    }

    .header-nav {
        display: none; /* Simplify for mobile for now */
    }

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

    .hero-banner {
        height: 180px;
    }
}
