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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f5f5f5;
    min-height: 100vh;
}

/* ヘッダー */
.feed-header {
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.header-logo:hover {
    opacity: 0.7;
}

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

.header-logo h1 {
    font-family: "BIZ UDGothic", sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: #2c3e50;
}

.header-nav {
    display: flex;
    gap: 1rem;
}

.nav-link {
    padding: 0.5rem 1rem;
    background-color: #ff4130;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 500;
    transition: background-color 0.2s;
}

.nav-link:hover {
    background-color: #e62e1e;
}

/* メインコンテンツ */
.feed-main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* 検索ボックス */
.search-container {
    margin-bottom: 2rem;
}

.search-box {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    gap: 0.5rem;
}

.search-input {
    flex: 1;
    padding: 1rem 3rem 1rem 1.5rem;
    font-size: 1rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s;
}

.search-input:focus {
    border-color: #ff4130;
}

.search-btn {
    padding: 1rem 2rem;
    background-color: #ff4130;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
    white-space: nowrap;
}

.search-btn:hover {
    background-color: #e6351f;
}

.search-btn:active {
    background-color: #cc2e1a;
}

.clear-btn {
    position: absolute;
    right: 8rem;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: #999;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    line-height: 1;
}

.clear-btn:hover {
    color: #333;
}

.search-status {
    text-align: center;
    margin-top: 0.5rem;
    color: #666;
    font-size: 0.9rem;
}

/* グリッドレイアウト */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
    opacity: 1;
    transition: opacity 0.3s ease-in-out;
}

.articles-grid.fade-out {
    opacity: 0;
}

/* 記事カード */
.article-card {
    background-color: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.4s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.article-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.card-image {
    width: 100%;
    height: 250px;
    background-color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.card-share-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background-color: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.2s;
    z-index: 10;
}

.card-share-btn:hover {
    background-color: #ff4130;
    transform: scale(1.1);
}

.card-share-btn:hover svg {
    stroke: white;
}

.card-share-btn svg {
    transition: stroke 0.2s;
}

.card-image img {
    max-width: 100%;
    max-height: 100%;
    min-width: 80%;
    min-height: 80%;
    width: auto;
    height: auto;
    object-fit: contain;
    background-color: #ffffff;
}

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

.card-title {
    font-family: "BIZ UDGothic", sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: #2c3e50;
    margin-left: 0.5rem;
    margin-bottom: 0.75rem;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-title-underline {
    height: 3px;
    background-color: #ff4130;
    width: 100%;
    margin-bottom: 1rem;
}

.card-text {
    font-family: "BIZ UDGothic", sans-serif;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.6;
    color: #333;
    margin-left: 0.5rem;
    margin-bottom: 1rem;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-left: 0.5rem;
    margin-bottom: 1rem;
}

.tag-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background-color: #e3f2fd;
    color: #1976d2;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.card-meta {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex: 1;
}

.card-date {
    font-size: 0.9rem;
    color: #666;
}

.card-author {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.author-name {
    font-weight: 600;
    color: #333;
}

.author-type-badge {
    display: none;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.author-type-badge.badge-child {
    background-color: #e3f2fd;
    color: #1976d2;
    border: 1px solid #90caf9;
}

.author-type-badge.badge-adult {
    background-color: #f3e5f5;
    color: #7b1fa2;
    border: 1px solid #ce93d8;
}

.card-logo {
    display: none;
}

.card-logo img {
    height: 40px;
    width: auto;
    object-fit: contain;
}

/* 状態メッセージ */
.loading, .error, .no-results {
    text-align: center;
    padding: 3rem 2rem;
    color: #666;
    font-size: 1.1rem;
    grid-column: 1 / -1;
}

.error {
    color: #e74c3c;
}

.no-results {
    color: #999;
    font-size: 1rem;
}

/* タブレット対応 */
@media (max-width: 1024px) {
    .header-container {
        padding: 1rem;
    }

    .header-logo h1 {
        font-size: 1.25rem;
    }

    .feed-main {
        padding: 1.5rem;
    }

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

/* スマートフォン対応 */
@media (max-width: 768px) {
    .header-container {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 0.5rem;
        padding: 0.75rem 1rem;
    }

    .header-logo {
        flex-direction: row;
        gap: 0.5rem;
        flex: 1;
        min-width: 0;
    }

    .header-logo img {
        height: 35px;
        flex-shrink: 0;
    }

    .header-logo h1 {
        font-size: 1.1rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: "...";
    }

    .header-nav {
        flex-shrink: 0;
    }

    .feed-main {
        padding: 1rem;
    }

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

    .card-image {
        height: 180px;
    }

    .card-content {
        padding: 1rem;
    }

    .card-title {
        font-size: 1.1rem;
    }

    .card-text {
        font-size: 0.95rem;
    }

    .search-box {
        max-width: 100%;
        flex-direction: column;
    }
    
    .search-input {
        padding: 0.875rem 3rem 0.875rem 1rem;
    }
    
    .search-btn {
        width: 100%;
    }
    
    .clear-btn {
        right: 0.75rem;
        top: 0.5rem;
        transform: translateY(0);
    }
}

@media (max-width: 480px) {
    .header-logo img {
        height: 30px;
    }

    .header-logo h1 {
        font-size: 1rem;
    }

    .nav-link {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
    }

    .card-image {
        height: 150px;
    }

    .card-title {
        font-size: 1rem;
    }

    .card-text {
        font-size: 0.9rem;
    }

    .card-footer {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .card-meta {
        flex-direction: row;
        width: 100%;
    }
}

/* モーダル */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0);
    z-index: 1000;
    overflow-y: auto;
    padding: 2rem;
    opacity: 0;
    transition: opacity 0.3s ease-in-out, background-color 0.3s ease-in-out;
}

.modal-overlay.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay.show {
    opacity: 1;
    background-color: rgba(0, 0, 0, 0.8);
}

.modal-content {
    position: relative;
    background-color: #f5f5f5;
    width: 100%;
    max-width: 1400px;
    max-height: 90vh;
    border-radius: 8px;
    overflow: hidden;
    transform: translateY(30px);
    opacity: 0;
    transition: transform 0.3s ease-out, opacity 0.3s ease-out;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.modal-content::-webkit-scrollbar {
    display: none;
}

.modal-overlay.show .modal-content {
    transform: translateY(0);
    opacity: 1;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    background-color: rgba(255, 255, 255, 0.95);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.2s;
}

.modal-close:hover {
    background-color: #fff;
    transform: scale(1.1);
}

.modal-share-btn {
    position: absolute;
    top: 1rem;
    right: 5rem;
    background-color: rgba(255, 255, 255, 0.95);
    border: 2px solid #ff4130;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.2s;
}

.modal-share-btn:hover {
    background-color: #ff4130;
    transform: scale(1.1);
}

.modal-share-btn:hover svg {
    stroke: white;
}

.modal-share-btn svg {
    stroke: #ff4130;
    transition: stroke 0.2s;
}

/* 元のUIスタイルをモーダル内で再現 */
.modal-article {
    display: flex;
    height: 80vh;
    max-height: 90vh;
    background-color: #fff;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

.modal-article::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.modal-article .article-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #fff;
    overflow: hidden;
}

.modal-article .article-title {
    padding: 0.5rem 0;
    background-color: #fff;
    margin: 1rem 5vw 0 5vw;
}

.modal-article .article-title h1 {
    font-family: "BIZ UDGothic", sans-serif;
    font-size: 2rem;
    font-weight: 700;
    color: #2c3e50;
    line-height: 1.4;
    text-align: center;
}

.modal-article .title-underline {
    height: 4px;
    background-color: #ff4130;
    margin: 0 0 1rem 5vw;
}

.modal-article .article-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.modal-article .article-image {
    flex: 1;
    background-color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin: 1rem 2rem 2rem 2rem;
    position: relative;
}

.modal-article .article-image img {
    max-width: 100%;
    max-height: 100%;
    min-width: 70%;
    min-height: 70%;
    width: auto;
    height: auto;
    object-fit: contain;
    background-color: #ffffff;
}

.modal-article .article-text {
    flex: 1;
    margin-top: 1rem;
    padding: 0 1rem 0 0;
    overflow-y: auto;
    background-color: #fff;
}

.modal-article .article-right {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.modal-article .content-text {
    font-family: "BIZ UDGothic", sans-serif;
    font-size: 1.5rem;
    font-weight: bold;
    line-height: 1.5;
    color: #333;
    margin: 0 0 1.5rem 0;
}

.modal-article .article-bottom {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding: 0.5rem 1rem 1rem 0;
    margin-top: auto;
}

.modal-article .article-bottom-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.modal-article .article-date {
    font-size: 1.25rem;
    color: #666;
    font-weight: 500;
}

.modal-article .article-logo {
    display: flex;
    align-items: center;
}

.modal-article .article-logo img {
    height: 3rem;
    width: auto;
    object-fit: contain;
}

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

.modal-article .article-author {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
}

.modal-article .author-name {
    font-weight: 600;
    color: #333;
}

.modal-article .article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.modal-article .article-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background-color: #e3f2fd;
    color: #1976d2;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 500;
}

@media (max-width: 1024px) {
    .modal-overlay {
        padding: 1rem;
    }

    .modal-article {
        height: auto;
        min-height: 70vh;
    }

    .modal-article .article-body {
        flex-direction: column;
    }

    .modal-article .article-title h1 {
        font-size: 1.5rem;
    }

    .modal-article .content-text {
        font-size: 1.2rem;
    }
}

@media (max-width: 768px) {
    .modal-overlay {
        padding: 0.5rem;
    }

    .modal-close {
        position: fixed;
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
        top: 0.5rem;
        right: 0.5rem;
    }

    .modal-share-btn {
        position: fixed;
        width: 40px;
        height: 40px;
        top: 0.5rem;
        right: 3.5rem;
    }

    .modal-article .article-title {
        margin: 0.5rem 2rem 0 2rem;
        padding-top: 3rem;
    }

    .modal-article .title-underline {
        margin: 0 0 0.5rem 2rem;
    }

    .modal-article .article-title h1 {
        font-size: 1.25rem;
    }

    .modal-article .content-text {
        font-size: 1rem;
    }

    .modal-article .article-image {
        margin: 0.5rem 1rem;
    }

    .modal-article .article-right {
        padding: 0 1rem;
    }

    .modal-article .article-text {
        padding: 0;
    }

    .modal-article .article-bottom {
        padding-right: 0;
    }
}
