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

:root {
    --red: #d32f2f;
    --red-dark: #b71c1c;
    --gold: #f9a825;
    --bg: #f5f5f5;
    --white: #ffffff;
    --text: #1a1a1a;
    --text-light: #666666;
    --border: #e0e0e0;
    --nav-bg: #1a1a1a;
}

body {
    font-family: 'Noto Sans JP', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.8;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ============ HEADER ============ */
.header-top {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    font-size: 12px;
}

.header-top-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 6px;
    padding-bottom: 6px;
}

.header-link {
    color: var(--text-light);
    margin-right: 16px;
    transition: color 0.2s;
}

.header-link:hover {
    color: var(--red);
}

.app-badge {
    background: var(--red);
    color: white !important;
    padding: 3px 10px;
    border-radius: 3px;
    font-weight: 500;
    cursor: pointer;
}

.header-main {
    background: var(--white);
    border-bottom: 1px solid var(--border);
}

.header-main-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 16px;
    padding-bottom: 16px;
}

.logo {
    font-family: 'Noto Serif JP', serif;
    font-size: 36px;
    font-weight: 900;
    color: var(--red);
    letter-spacing: -1px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-img {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: cover;
}

.logo span {
    color: var(--text);
}

.search-box {
    display: flex;
    gap: 0;
}

.search-box input {
    padding: 8px 14px;
    border: 2px solid var(--border);
    border-right: none;
    border-radius: 4px 0 0 4px;
    font-size: 14px;
    font-family: inherit;
    width: 240px;
    outline: none;
    transition: border-color 0.2s;
}

.search-box input:focus {
    border-color: var(--red);
}

.search-box button {
    padding: 8px 18px;
    background: var(--red);
    color: white;
    border: 2px solid var(--red);
    border-radius: 0 4px 4px 0;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.search-box button:hover {
    background: var(--red-dark);
    border-color: var(--red-dark);
}

/* ============ NAV ============ */
.main-nav {
    background: var(--nav-bg);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-list {
    display: flex;
    list-style: none;
    gap: 0;
}

.nav-list li a {
    display: block;
    padding: 12px 20px;
    color: #ccc;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    user-select: none;
    text-transform: capitalize;
}

.nav-list li a:hover,
.nav-list li a.active {
    color: white;
    background: rgba(255, 255, 255, 0.05);
    border-bottom-color: var(--red);
}

/* ============ MAIN CONTENT ============ */
.main-content {
    padding-top: 30px;
    padding-bottom: 60px;
}

.content-grid {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 40px;
    align-items: start;
}

/* ============ ARTICLE ============ */
.article-main {
    background: var(--white);
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    padding: 36px 40px;
}

.article-breadcrumb {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 20px;
}

.article-breadcrumb a {
    color: var(--red);
}

.article-breadcrumb a:hover {
    text-decoration: underline;
}

.article-title {
    font-family: 'Noto Serif JP', serif;
    font-size: 32px;
    font-weight: 900;
    line-height: 1.4;
    margin-bottom: 16px;
    letter-spacing: -0.5px;
}

.article-subtitle {
    font-size: 17px;
    color: var(--text-light);
    margin-bottom: 16px;
    line-height: 1.7;
}

.article-meta {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 10px;
}

.article-meta a {
    color: var(--red);
    font-weight: 500;
}

.separator {
    margin: 0 6px;
}

.comment-count {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.comment-count strong {
    color: var(--red);
}

.article-hero {
    margin: 0 -40px 28px;
}

.article-hero img {
    width: 100%;
    height: 480px;
    object-fit: cover;
    display: block;
}

.article-hero figcaption,
.article-inline-image figcaption {
    font-size: 12px;
    color: var(--text-light);
    padding: 10px 40px;
    line-height: 1.6;
    background: #fafafa;
}

.article-body {
    font-size: 16px;
    line-height: 2;
}

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

.article-body h2 {
    font-family: 'Noto Serif JP', serif;
    font-size: 22px;
    font-weight: 700;
    margin: 36px 0 16px;
    padding-left: 14px;
    border-left: 4px solid var(--red);
    line-height: 1.4;
}

.article-inline-image {
    margin: 32px 0;
}

.article-inline-image img {
    width: 100%;
    height: 360px;
    object-fit: cover;
    border-radius: 4px 4px 0 0;
    display: block;
}

.article-inline-image figcaption {
    padding: 10px 16px;
    border-radius: 0 0 4px 4px;
}

blockquote {
    margin: 32px 0;
    padding: 24px 28px;
    background: #fef8f0;
    border-left: 4px solid var(--gold);
    border-radius: 0 6px 6px 0;
    font-size: 17px;
    font-style: italic;
    line-height: 1.8;
}

blockquote cite {
    display: block;
    margin-top: 12px;
    font-size: 13px;
    font-style: normal;
    color: var(--text-light);
}

.article-info-box {
    margin: 32px 0;
    padding: 24px;
    background: #f0f4ff;
    border-radius: 6px;
    border: 1px solid #d0daf0;
}

.article-info-box h3 {
    font-size: 16px;
    margin-bottom: 8px;
    color: #1a3a7a;
}

.article-info-box p {
    font-size: 14px;
    margin-bottom: 0;
    color: #333;
}

.article-tags {
    margin-top: 36px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    background: var(--bg);
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 13px;
    color: var(--text-light);
    border: 1px solid var(--border);
    transition: all 0.2s;
    cursor: pointer;
}

.tag:hover {
    background: var(--red);
    color: white;
    border-color: var(--red);
}

/* ============ SHARE ============ */
.article-share {
    margin-top: 28px;
    padding: 20px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: var(--text-light);
}

.share-btn {
    padding: 6px 16px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    color: white !important;
    transition: opacity 0.2s;
}

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

.share-twitter { background: #1a1a1a; }
.share-line { background: #06c755; }
.share-facebook { background: #1877f2; }
.share-copy { background: #666; }

/* ============ COMMENTS ============ */
.comments-section {
    margin-top: 36px;
}

.comments-section h3 {
    font-size: 18px;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--text);
}

.comment {
    padding: 20px 0;
    border-bottom: 1px solid var(--border);
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 13px;
}

.comment-header strong {
    color: var(--text);
}

.comment-header span {
    color: var(--text-light);
}

.comment p {
    font-size: 15px;
    line-height: 1.8;
}

.comment-actions {
    margin-top: 10px;
    display: flex;
    gap: 16px;
    font-size: 13px;
}

.comment-actions a {
    color: var(--text-light);
    transition: color 0.2s;
}

.comment-actions a:hover {
    color: var(--red);
}

/* ============ SIDEBAR ============ */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.sidebar-section {
    background: var(--white);
    border-radius: 6px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.sidebar-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 3px solid var(--red);
}

/* Ranking */
.ranking-list {
    list-style: none;
    counter-reset: ranking;
}

.ranking-list li {
    border-bottom: 1px solid var(--border);
}

.ranking-list li:last-child {
    border-bottom: none;
}

.ranking-list li a {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    font-size: 14px;
    line-height: 1.5;
    transition: color 0.2s;
}

.ranking-list li a:hover {
    color: var(--red);
}

.rank {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 700;
    color: white;
    background: #999;
}

.ranking-list li:nth-child(1) .rank { background: var(--gold); color: #333; }
.ranking-list li:nth-child(2) .rank { background: #aaa; }
.ranking-list li:nth-child(3) .rank { background: #cd7f32; }

/* Sidebar articles */
.sidebar-article {
    display: flex;
    gap: 14px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.sidebar-article:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.sidebar-article img {
    width: 90px;
    height: 64px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}

.sidebar-article-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-article-text a {
    font-size: 13px;
    line-height: 1.5;
    font-weight: 500;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.2s;
}

.sidebar-article-text a:hover {
    color: var(--red);
}

.sidebar-date {
    font-size: 12px;
    color: var(--text-light);
}

/* Ad */
.sidebar-ad {
    background: linear-gradient(135deg, #fff8e1, #fff3c4);
    text-align: center;
    border: 1px solid #ffe082;
}

.ad-label {
    font-size: 11px;
    color: #999;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.ad-placeholder {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ad-placeholder span:first-child {
    font-size: 13px;
    color: var(--text-light);
}

.ad-placeholder span:nth-child(2) {
    font-size: 24px;
    font-weight: 700;
    color: #d84315;
}

.ad-placeholder small {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 8px;
    line-height: 1.6;
}

/* Category list */
.category-list {
    list-style: none;
}

.category-list li {
    border-bottom: 1px solid var(--border);
}

.category-list li:last-child {
    border-bottom: none;
}

.category-list li a {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    font-size: 14px;
    transition: color 0.2s;
}

.category-list li a:hover {
    color: var(--red);
}

.category-list li a span {
    color: var(--text-light);
    font-size: 12px;
}

/* ============ FOOTER ============ */
.site-footer {
    background: var(--nav-bg);
    color: #999;
    padding: 48px 0 24px;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 32px;
    margin-bottom: 40px;
}

.footer-col h4 {
    color: white;
    font-size: 14px;
    margin-bottom: 16px;
    font-weight: 700;
}

.footer-col ul {
    list-style: none;
}

.footer-col li {
    margin-bottom: 8px;
}

.footer-col a {
    font-size: 13px;
    color: #999;
    transition: color 0.2s;
}

.footer-col a:hover {
    color: white;
}

.footer-bottom {
    border-top: 1px solid #333;
    padding-top: 24px;
    text-align: center;
    font-size: 12px;
}

.footer-logo {
    font-family: 'Noto Serif JP', serif;
    font-size: 20px;
    font-weight: 900;
    color: var(--red);
    margin-bottom: 8px;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 960px) {
    .content-grid {
        grid-template-columns: 1fr;
    }

    .article-title {
        font-size: 24px;
    }

    .article-main {
        padding: 24px;
    }

    .article-hero {
        margin: 0 -24px 24px;
    }

    .article-hero figcaption {
        padding: 10px 24px;
    }

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

@media (max-width: 640px) {
    .header-main-inner {
        flex-direction: column;
        gap: 12px;
    }

    .search-box input {
        width: 100%;
    }

    .nav-list {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .nav-list li a {
        white-space: nowrap;
        padding: 10px 14px;
        font-size: 13px;
    }

    .article-title {
        font-size: 20px;
    }

    .article-hero img {
        height: 240px;
    }

    .article-share {
        flex-wrap: wrap;
    }

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

/* ============ CATEGORY PAGES ============ */
.category-header {
    margin-bottom: 32px;
}

.category-header h1 {
    font-family: 'Noto Serif JP', serif;
    font-size: 28px;
    font-weight: 900;
    padding-bottom: 12px;
    border-bottom: 3px solid var(--red);
    display: inline-block;
}

.category-header p {
    margin-top: 10px;
    color: var(--text-light);
    font-size: 15px;
}

.article-card {
    background: var(--white);
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    display: flex;
    gap: 24px;
    padding: 24px;
    margin-bottom: 20px;
    transition: box-shadow 0.2s;
}

.article-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.article-card-image {
    flex-shrink: 0;
    width: 240px;
    height: 160px;
    border-radius: 4px;
    overflow: hidden;
}

.article-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s;
}

.article-card:hover .article-card-image img {
    transform: scale(1.05);
}

.article-card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.article-card-body h2 {
    font-family: 'Noto Serif JP', serif;
    font-size: 19px;
    font-weight: 700;
    line-height: 1.5;
    margin-bottom: 10px;
}

.article-card-body h2 a {
    transition: color 0.2s;
}

.article-card-body h2 a:hover {
    color: var(--red);
}

.article-card-body .card-excerpt {
    font-size: 14px;
    color: var(--text-light);
    line-height: 1.7;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 12px;
}

.article-card-body .card-meta {
    font-size: 12px;
    color: #999;
    display: flex;
    gap: 12px;
    align-items: center;
}

.card-meta .card-category {
    background: var(--red);
    color: white;
    padding: 2px 8px;
    border-radius: 3px;
    font-weight: 500;
    font-size: 11px;
}

.article-card-featured {
    flex-direction: column;
    gap: 0;
    padding: 0;
}

.article-card-featured .article-card-image {
    width: 100%;
    height: 300px;
}

.article-card-featured .article-card-body {
    padding: 24px;
}

.article-card-featured .article-card-body h2 {
    font-size: 24px;
}

@media (max-width: 640px) {
    .article-card {
        flex-direction: column;
        gap: 0;
        padding: 0;
    }

    .article-card-image {
        width: 100%;
        height: 200px;
    }

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