/* Version: 4.2 - デバッグ版 - フォントサイズ修正確認用 */
/* Critical CSS - 基本レイアウトは index.html で先読み込み済み */

/* PC表示用の詳細設定 */
@media (min-width: 768px) {

    /* position:fixedをabsoluteに変更してmain-container内に制限 */
    .sort-controls,
    .sort-controls-right,
    .mini-dot-indicator,
    .read-more-container {
        position: absolute !important;
    }

    /* 下部メニューはfixedのまま、375px幅に制限 */
    .emotion-nav {
        position: fixed !important;
        left: calc(50% - 1px) !important;
        /* 1px左にずらす */
        transform: translateX(-50%) !important;
        width: 375px !important;
        bottom: 0 !important;
        padding: 6px 8px 12px !important;
        box-sizing: border-box !important;
    }

    /* TikTokインジケーターを20px上に */
    .mini-dot-indicator {
        bottom: calc(155px + 20px) !important;
        /* 20px上に */
    }

    /* 下端の光るラインの横幅をさらに半分に */
    .bottom-edge-line {
        left: 43.75% !important;
        /* さらに半分に縮小 */
        right: 43.75% !important;
        width: auto !important;
    }

    /* 並び順ボタンの位置とサイズ調整 */
    .sort-controls {
        bottom: calc(150px + 40px) !important;
        /* 40px上に */
        left: calc(0px + 20px) !important;
        /* 左へ20px */
    }

    .sort-controls-right {
        bottom: calc(150px + 40px) !important;
        /* 40px上に */
        right: calc(0px + 20px) !important;
        /* 右へ20px */
    }

    /* PC表示用の並び順ボタンサイズ調整 */
    .sort-btn {
        font-size: 13px !important;
        padding: 7px 15px !important;
        min-width: 90px !important;
    }

    .sort-label {
        font-size: 10px !important;
    }

    /* カテゴリボックスのアイコンと文字サイズ調整 */
    .emotion-icon {
        font-size: 19px !important;
        /* 16px × 1.2 ≈ 19px */
    }

    .emotion-label {
        font-size: 11px !important;
        /* 8px × 1.35 ≈ 11px */
    }
}

/* 固定ヘッダー */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: radial-gradient(ellipse at center, rgba(80, 50, 120, 0.95) 0%, rgba(50, 20, 80, 0.95) 40%, rgba(20, 5, 30, 0.95) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
    position: relative;
    overflow: hidden;
    pointer-events: auto;
}

.site-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(4px 4px at 15px 25px, rgba(255, 107, 107, 0.8), transparent),
        radial-gradient(5px 5px at 45px 15px, rgba(255, 217, 61, 0.9), transparent),
        radial-gradient(3px 3px at 75px 35px, rgba(78, 205, 196, 0.7), transparent),
        radial-gradient(4px 4px at 105px 10px, rgba(69, 183, 209, 0.8), transparent),
        radial-gradient(5px 5px at 135px 30px, rgba(150, 206, 180, 0.9), transparent),
        radial-gradient(3px 3px at 165px 20px, rgba(254, 202, 87, 0.7), transparent),
        radial-gradient(4px 4px at 195px 35px, rgba(255, 107, 107, 0.6), transparent),
        radial-gradient(3px 3px at 225px 15px, rgba(150, 111, 214, 0.8), transparent),
        radial-gradient(5px 5px at 255px 25px, rgba(255, 159, 67, 0.9), transparent),
        radial-gradient(4px 4px at 285px 30px, rgba(99, 205, 255, 0.7), transparent),
        radial-gradient(3px 3px at 315px 20px, rgba(255, 107, 107, 0.8), transparent),
        radial-gradient(5px 5px at 345px 35px, rgba(255, 217, 61, 0.9), transparent),
        radial-gradient(4px 4px at 375px 15px, rgba(78, 205, 196, 0.7), transparent),
        radial-gradient(3px 3px at 405px 30px, rgba(150, 111, 214, 0.8), transparent);
    opacity: 0.8;
    animation: twinkle 2.5s ease-in-out 2;
}

.site-header::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(6px 6px at 25px 35px, rgba(255, 107, 107, 0.4), transparent),
        radial-gradient(7px 7px at 65px 20px, rgba(255, 217, 61, 0.5), transparent),
        radial-gradient(5px 5px at 95px 40px, rgba(78, 205, 196, 0.3), transparent),
        radial-gradient(6px 6px at 125px 15px, rgba(69, 183, 209, 0.4), transparent),
        radial-gradient(8px 8px at 155px 35px, rgba(150, 206, 180, 0.5), transparent),
        radial-gradient(5px 5px at 185px 25px, rgba(254, 202, 87, 0.3), transparent),
        radial-gradient(6px 6px at 215px 40px, rgba(255, 107, 107, 0.4), transparent),
        radial-gradient(7px 7px at 245px 20px, rgba(99, 205, 255, 0.5), transparent),
        radial-gradient(5px 5px at 275px 35px, rgba(255, 159, 67, 0.3), transparent),
        radial-gradient(6px 6px at 305px 15px, rgba(150, 206, 180, 0.4), transparent),
        radial-gradient(8px 8px at 335px 30px, rgba(254, 202, 87, 0.5), transparent),
        radial-gradient(5px 5px at 365px 25px, rgba(150, 111, 214, 0.3), transparent);
    opacity: 0.6;
    animation: twinkle 2.5s ease-in-out 2 reverse;
}

@keyframes twinkle {

    0%,
    100% {
        opacity: 0.6;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.1);
    }
}

.site-title {
    display: flex;
    align-items: center;
    gap: 20px;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    padding: 10px;
    margin: -10px;
    border-radius: 10px;
    position: relative;
    z-index: 10;
}

.site-title:hover {
    opacity: 0.8;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.02);
}

.site-title:active {
    opacity: 0.6;
    transform: scale(0.98);
}

.main-title {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 0.8px;
    white-space: nowrap;
}

.sub-title {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sub-line1 {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.3px;
    opacity: 0.9;
}

.sub-line2 {
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.3px;
    opacity: 0.8;
}

/* ストーリーフィード */
.story-feed {
    height: 100vh;
    width: 100%;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.story-feed::-webkit-scrollbar {
    display: none;
}

/* ストーリーカード */
.story-preview {
    min-height: 100vh;
    width: 100%;
    padding: 40px 20px 70px;
    display: flex;
    flex-direction: column;
    position: relative;
    scroll-snap-align: start;
    background: linear-gradient(180deg, #0a0a0a 0%, #1a1a1a 100%);
    opacity: 1;
    transition: opacity 0.3s ease;
    z-index: 200;
}

.story-preview.hidden {
    display: none;
}

/* 感情別の背景色 */
.story-preview.fear {
    background: linear-gradient(180deg, #2a0a0a 0%, #4a1515 30%, #3a0505 100%);
}

.story-preview.mystery {
    background: linear-gradient(180deg, #0a2a1a 0%, #152a20 30%, #0f251a 100%);
}

.story-preview.sukatto {
    background: linear-gradient(180deg, #0a3a35 0%, #158a75 30%, #107a65 100%);
}

.story-preview.funny {
    background: linear-gradient(180deg, #4a2d0f 0%, #7a4f25 30%, #6a4220 100%);
}

.story-preview.touching {
    background: linear-gradient(180deg, #5d2e0a 0%, #8b5a2b 30%, #9a7015 100%);
}

.story-preview.setsunai {
    background: linear-gradient(180deg, #2a1a3a 0%, #4a3a5a 30%, #3a2a4a 100%);
}

.story-preview.love {
    background: linear-gradient(180deg, #3a1a2a 0%, #5a3a4a 30%, #4a2a3a 100%);
}

.story-preview.work_school {
    background: linear-gradient(180deg, #2a4a3a 0%, #4a6a5a 30%, #3d5a4a 100%);
}

.story-preview.shuraba {
    background: linear-gradient(180deg, #4a0a0a 0%, #5a1515 30%, #4a1010 100%);
}

.story-preview.long_story {
    background: linear-gradient(180deg, #2a2a0a 0%, #3a3a15 30%, #2a2a10 100%);
}

/* 旧カテゴリーとの互換性 */
.story-preview.happy {
    background: linear-gradient(180deg, #3a2a0a 0%, #4a3515 30%, #3a2a05 100%);
}

.story-preview.cry {
    background: linear-gradient(180deg, #5d2e0a 0%, #8b5a2b 30%, #9a7015 100%);
}

.story-preview.creepy {
    background: linear-gradient(180deg, #2a0a0a 0%, #4a1515 30%, #3a0505 100%);
}

/* カテゴリーヘッダー */
.preview-header {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    z-index: 10;
}

.category-tag {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 15px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}





/* プレビューコンテンツ */
.preview-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    max-width: 500px;
    margin: 0 auto;
    width: 100%;
    padding-top: 45px;
    box-sizing: border-box !important;
    overflow-wrap: break-word !important;
}

.story-title {
    font-size: 34px !important;
    font-weight: 800;
    margin-bottom: 0;
    line-height: 1.4;
    letter-spacing: -0.3px;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
    min-height: auto;
    height: auto;
}






.story-teaser {
    font-size: 19px;
    line-height: 1.9;
    opacity: 0.9;
    margin-bottom: 20px;
    margin-top: 0px;
    position: relative;
    max-height: calc(100vh - 380px);
    overflow: hidden;
    white-space: normal;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    width: 100%;
    letter-spacing: 0.3px;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    text-shadow: none !important;
    filter: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

.story-teaser * {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    text-shadow: none !important;
    filter: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

/* フェードアウト効果を削除 */
.story-teaser::after {
    display: none;
}

/* カテゴリ別フェードアウト効果 */
.story-preview.fear .story-teaser::after {
    background: linear-gradient(transparent, rgba(58, 5, 5, 0.9));
}

.story-preview.mystery .story-teaser::after {
    background: linear-gradient(transparent, rgba(15, 37, 26, 0.9));
}

.story-preview.sukatto .story-teaser::after {
    background: linear-gradient(transparent, rgba(21, 32, 56, 0.9));
}

.story-preview.funny .story-teaser::after {
    background: linear-gradient(transparent, rgba(58, 42, 5, 0.9));
}

.story-preview.touching .story-teaser::after {
    background: linear-gradient(transparent, rgba(139, 69, 19, 0.9));
}

.story-preview.love .story-teaser::after {
    background: linear-gradient(transparent, rgba(74, 42, 58, 0.9));
}

.story-preview.work_school .story-teaser::after {
    background: linear-gradient(transparent, rgba(10, 32, 56, 0.9));
}

.story-preview.shuraba .story-teaser::after {
    background: linear-gradient(transparent, rgba(58, 16, 16, 0.9));
}

.story-preview.long_story .story-teaser::after {
    background: linear-gradient(transparent, rgba(42, 42, 16, 0.9));
}

/* 旧カテゴリーとの互換性 */
.story-preview.happy .story-teaser::after {
    background: linear-gradient(transparent, rgba(58, 42, 5, 0.9));
}

.story-preview.cry .story-teaser::after {
    background: linear-gradient(transparent, rgba(139, 69, 19, 0.9));
}

.story-preview.creepy .story-teaser::after {
    background: linear-gradient(transparent, rgba(58, 5, 5, 0.9));
}

/* 続きを読むボタン */
.read-more-container {
    display: flex;
    justify-content: center;
    position: fixed;
    bottom: 200px;
    left: 50%;
    transform: translateX(-50%) scale(0.9);
    z-index: 9999;
    pointer-events: none;
}

.read-more-container.visible {
    pointer-events: auto;
}

.read-more-btn {
    background: #fff;
    color: #000;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: fit-content;
}

.read-more-btn:active {
    transform: scale(0.95);
}

/* ストーリー情報 */
.story-info {
    display: flex;
    gap: 20px;
    margin-top: 18px;
    margin-bottom: 20px;
    font-size: 15px;
    opacity: 0.6;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* エンゲージメント */
.engagement-stats {
    position: absolute;
    top: 10px;
    right: 0px;
    display: flex;
    flex-direction: row;
    gap: 18px;
    align-items: flex-start;
    z-index: 100;
}

/* 特定のボタンを非表示 */
.engagement-stats .stat-item:nth-child(1),
.engagement-stats .stat-item:nth-child(2),
.engagement-stats .stat-item:nth-child(3) {
    display: none;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    min-width: 45px;
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.8) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s;
    color: #333 !important;
}

.stat-icon:active {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.2);
}

.stat-icon.liked {
    background: rgba(255, 100, 100, 0.2) !important;
    animation: likeAnimation 0.5s ease;
}

.stat-icon.saved {
    background: rgba(255, 215, 0, 0.9) !important;
    color: #333 !important;
    animation: saveAnimation 0.5s ease;
}

@keyframes likeAnimation {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.3);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes saveAnimation {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.3);
    }

    100% {
        transform: scale(1);
    }
}

.stat-count {
    font-size: 13px;
    opacity: 1;
    font-weight: 400;
    color: #fff !important;
    text-align: center;
    line-height: 1.2;
    white-space: nowrap;
    display: block;
    width: 100%;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

/* 感情フィルターナビ */
.emotion-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 6px 8px 12px;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 3px;
    z-index: 300;
    min-height: 80px;
}

.emotion-nav::before {
    content: '';
    position: absolute;
    left: 50%;
    top: -30px;
    transform: translateX(-50%);
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-top: none;
    border-left: none;
    transform: translateX(-50%) rotate(45deg);
    z-index: 250;
    opacity: 0;
    transition: opacity 0.3s ease;
    animation: bounceArrow1 2s ease-in-out infinite;
}

.emotion-nav.show-arrow::before {
    opacity: 1;
}

.emotion-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s;
    padding: 4px 2px;
    border-radius: 8px;
    position: relative;
    width: 100%;
    height: 100%;
}

.emotion-btn:active {
    transform: scale(0.95);
}

.emotion-btn.active {
    background: rgba(255, 255, 255, 0.35);
}

.emotion-icon {
    font-size: 16px;
    display: block;
    transition: all 0.2s;
}

.emotion-btn.active .emotion-icon {
    transform: scale(1.1);
}

/* 保存カテゴリーの★を黄色に */
.emotion-btn[data-emotion="bookmark"] .emotion-icon {
    color: #ffd700;
}

/* 星屑アニメーション */
.star-particle {
    position: fixed;
    pointer-events: none;
    font-size: 12px;
    color: #ffd700;
    z-index: 9999;
    animation: starFall 1.5s ease-out forwards;
    text-shadow: 0 0 6px #ffd700;
}

@keyframes starFall {
    0% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }

    50% {
        opacity: 0.8;
        transform: scale(1.2) rotate(180deg);
    }

    100% {
        opacity: 0;
        transform: scale(0.3) rotate(360deg);
    }
}

/* 保存カテゴリーボタンのキラキラ効果 */
.emotion-btn[data-emotion="bookmark"].sparkle {
    animation: sparkleEffect 1s ease-out;
}

@keyframes sparkleEffect {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 rgba(255, 215, 0, 0);
    }

    25% {
        transform: scale(1.1);
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 0 30px rgba(255, 215, 0, 0.6);
    }

    75% {
        transform: scale(1.1);
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.4);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 rgba(255, 215, 0, 0);
    }
}

/* キラキラパーティクル */
.sparkle-particle {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    font-size: 8px;
    color: #ffd700;
    animation: sparkleParticle 1.2s ease-out forwards;
}

@keyframes sparkleParticle {
    0% {
        opacity: 1;
        transform: scale(0) rotate(0deg);
    }

    30% {
        opacity: 1;
        transform: scale(1.5) rotate(120deg);
    }

    100% {
        opacity: 0;
        transform: scale(0.2) rotate(360deg);
    }
}

/* 割れるアニメーション用のスタイル */
.shatter-fragment {
    position: fixed;
    pointer-events: none;
    font-size: 16px;
    color: #ffd700;
    z-index: 9999;
    text-shadow: 0 0 6px #ffd700;
    font-weight: bold;
}

@keyframes shatterShake {

    0%,
    100% {
        transform: translate(0, 0) rotate(0deg) scale(1);
    }

    10% {
        transform: translate(-2px, -1px) rotate(-2deg) scale(1.05);
    }

    20% {
        transform: translate(2px, 1px) rotate(1deg) scale(0.95);
    }

    30% {
        transform: translate(-1px, 2px) rotate(-1deg) scale(1.02);
    }

    40% {
        transform: translate(1px, -2px) rotate(2deg) scale(0.98);
    }

    50% {
        transform: translate(-2px, 1px) rotate(-2deg) scale(1.03);
    }

    60% {
        transform: translate(2px, -1px) rotate(1deg) scale(0.97);
    }

    70% {
        transform: translate(-1px, -2px) rotate(-1deg) scale(1.01);
    }

    80% {
        transform: translate(1px, 2px) rotate(2deg) scale(0.99);
    }

    90% {
        transform: translate(-2px, -1px) rotate(-1deg) scale(1.02);
    }
}

.emotion-label {
    font-size: 8px;
    opacity: 0.8;
    font-weight: 400;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
    white-space: nowrap;
}

.emotion-btn.active .emotion-label {
    opacity: 1;
}

/* フルストーリービュー */
.full-story {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #000;
    z-index: 300;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.full-story.active {
    transform: translateY(0);
}

.full-story-header {
    position: sticky;
    top: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    z-index: 10;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.back-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    color: #fff;
}

.full-story-content {
    padding: 30px 20px 60px;
    max-width: 700px;
    margin: 0 auto;
}

.full-story-title {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 30px;
    line-height: 1.4;
}

.full-story-text {
    font-size: 18px;
    line-height: 1.9;
    opacity: 0.9;
}

.full-story-text p {
    margin-bottom: 20px;
}

/* 読み込み中 */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100vh;
    background: linear-gradient(180deg, #0a0a0a 0%, #1a1a1a 100%);
    z-index: 10000;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 0 20px 0;
}

.loading-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
}

.loading p {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    letter-spacing: 0.5px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* エラー表示 */
.error-message {
    text-align: center;
    padding: 50px 20px;
    color: #ff6b6b;
}

/* フィルター時のメッセージ */
.no-stories-message {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    opacity: 0.6;
}

.no-stories-message.visible {
    display: block;
}

/* タグのスタイル */
.story-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 18px 0;
    min-height: 30px;
}

.story-tag {
    display: inline-block;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 14px;
    margin-right: 8px;
    margin-bottom: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.auto-tag {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 12px;
    opacity: 0.7;
    transition: all 0.2s;
}

.auto-tag:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.15);
}

/* タグ読み込み中の表示 */
.tags-loading {
    font-size: 11px;
    opacity: 0.5;
    font-style: italic;
}

/* スワイプ誘導UI - 改良版（非表示） */
.swipe-indicator {
    position: fixed;
    bottom: 160px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 250;
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    pointer-events: none;
    transition: all 0.3s ease;
}

/* シンプルな吹き出し */
.swipe-bubble {
    display: none;
}

/* 吹き出しの尻尾 */
.swipe-bubble::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid rgba(255, 255, 255, 0.4);
    filter: none;
    box-shadow: none;
}





/* 下向き矢印（初回） */
.swipe-indicator.down .swipe-arrows {
    display: flex;
    flex-direction: column;
    gap: -8px;
}

.swipe-indicator.down .swipe-arrow {
    width: 35px;
    height: 35px;
    border: 3px solid rgba(255, 255, 255, 0.9);
    border-top: none;
    border-left: none;
    transform: rotate(45deg);
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.5));
}



/* 両方向小さい矢印（3回目以降） */
.swipe-indicator.both {
    display: none;
}

/* TikTok風の小さいドットインジケーター */
.mini-dot-indicator {
    position: fixed;
    right: 5px;
    bottom: 155px;
    width: 4px;
    height: 50px;
    z-index: 350;
    opacity: 1;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.mini-dot-indicator.visible {
    opacity: 1;
}

/* 小さいドット（single-story.phpと同じサイズに統一） */
.mini-dot {
    position: absolute;
    right: 0;
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
}

.mini-dot:nth-child(1) {
    top: 0;
    animation: miniDotFlow 2.5s ease-in-out infinite;
}

.mini-dot:nth-child(2) {
    top: 10px;
    animation: miniDotFlow 2.5s ease-in-out infinite 0.3s;
}

.mini-dot:nth-child(3) {
    top: 20px;
    animation: miniDotFlow 2.5s ease-in-out infinite 0.6s;
}

.mini-dot:nth-child(4) {
    top: 30px;
    animation: miniDotFlow 2.5s ease-in-out infinite 0.9s;
}

.mini-dot:nth-child(5) {
    top: 40px;
    animation: miniDotFlow 2.5s ease-in-out infinite 1.2s;
}

@keyframes miniDotFlow {

    0%,
    80%,
    100% {
        opacity: 0.4;
        transform: scale(1);
        background: rgba(255, 255, 255, 0.4);
    }

    40% {
        opacity: 1;
        transform: scale(1.5);
        background: rgba(255, 255, 255, 0.9);
    }
}

/* 画面下端のエッジライン */
.bottom-edge-line {
    position: fixed;
    bottom: 0px;
    left: 20%;
    right: 20%;
    height: 5px;
    background: rgba(255, 255, 255, 0.3);
    opacity: 1;
    z-index: 9999;
    pointer-events: none;
    border-radius: 2.5px;
}

.bottom-edge-line {
    animation: edgePulse 3s ease-in-out infinite;
}

.bottom-edge-line.visible {
    animation: edgePulse 3s ease-in-out infinite;
}

@keyframes edgePulse {

    0%,
    70%,
    100% {
        opacity: 0;
        transform: scaleX(0.6);
    }

    35% {
        opacity: 0.8;
        transform: scaleX(1);
        box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    }
}

/* スワイプヒント（初回のみ表示） */
.swipe-hint {
    position: fixed;
    bottom: 0px;
    /* JavaScriptで動的に調整 */
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10001;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.swipe-hint.show {
    opacity: 1;
}

.swipe-chevron {
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid rgba(255, 255, 255, 0.7);
    animation: chevronBounce 1.5s ease-in-out infinite;
}

.swipe-chevron:nth-child(1) {
    animation-delay: 0s;
    opacity: 0.5;
}

.swipe-chevron:nth-child(2) {
    animation-delay: 0.2s;
    opacity: 0.7;
}

.swipe-chevron:nth-child(3) {
    animation-delay: 0.4s;
    opacity: 1;
}

@keyframes chevronBounce {

    0%,
    100% {
        transform: translateY(0);
        opacity: 0.3;
    }

    50% {
        transform: translateY(5px);
        opacity: 1;
    }
}

/* アニメーション */
.swipe-arrow:nth-child(1) {
    animation: bounceArrow1 2s ease-in-out infinite;
    opacity: 0.4;
}

.swipe-arrow:nth-child(2) {
    animation: bounceArrow2 2s ease-in-out infinite;
    opacity: 0.7;
}

.swipe-arrow:nth-child(3) {
    animation: bounceArrow3 2s ease-in-out infinite;
    opacity: 1;
}

@keyframes bounceArrow1 {

    0%,
    100% {
        transform: rotate(45deg) translateY(0);
    }

    50% {
        transform: rotate(45deg) translateY(8px);
    }
}

@keyframes bounceArrow2 {

    0%,
    100% {
        transform: rotate(45deg) translateY(0);
    }

    50% {
        transform: rotate(45deg) translateY(8px);
    }
}

@keyframes bounceArrow3 {

    0%,
    100% {
        transform: rotate(45deg) translateY(0);
    }

    50% {
        transform: rotate(45deg) translateY(8px);
    }
}



/* 時間差アニメーション */
.swipe-arrow:nth-child(1) {
    animation-delay: 0s;
}

.swipe-arrow:nth-child(2) {
    animation-delay: 0.15s;
}

.swipe-arrow:nth-child(3) {
    animation-delay: 0.3s;
}

/* フェード効果 */
.swipe-indicator.fade-out {
    opacity: 0;
}

.swipe-indicator.hidden {
    display: none;
}

/* パルスエフェクト背景 */
.swipe-indicator::before {
    content: '';
    position: absolute;
    width: 80px;
    height: 80px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.2) 0%, transparent 70%);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
    z-index: -1;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.5;
    }

    50% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* ストーリー間の区切り線（オプション） */
.story-preview::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20%;
    right: 20%;
    height: 1px;
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(255, 255, 255, 0.2) 50%,
            transparent 100%);
}

/* 実機スマホ（ビューポート制限あり）対応 */
@media (max-height: 680px) and (max-width: 400px),
screen and (max-width: 400px) and (-webkit-min-device-pixel-ratio: 2) {

    .read-more-container {
        bottom: 150px;
    }

    .story-title {
        font-size: 30px !important;
        line-height: 1.3 !important;
    }

    .story-teaser {
        font-size: 19px !important;
        max-height: calc(100vh - 150px) !important;
        min-height: 250px !important;
        line-height: 1.8 !important;
        letter-spacing: 0.2px !important;
    }

    .read-more-btn {
        font-size: 16px !important;
        padding: 12px 20px !important;
    }

    .category-tag {
        font-size: 16px !important;
    }

    .story-info {
        font-size: 14px !important;
    }

    .stat-icon {
        width: 36px !important;
        height: 36px !important;
        font-size: 16px !important;
    }

    .stat-count {
        font-size: 12px !important;
        font-weight: 400 !important;
        text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9) !important;
    }

    .stat-item {
        min-width: 38px !important;
        gap: 3px !important;
    }

    .engagement-stats {
        right: 20px !important;
        gap: 12px !important;
    }

    .emotion-icon {
        font-size: 26px !important;
    }

    .emotion-label {
        font-size: 11px !important;
    }


}

/* 小さい画面（iPhone SE等）対応 */
@media (max-height: 750px) and (max-width: 450px),
(max-height: 700px) {



    .story-preview {
        padding: 15px 15px 40px;
    }

    .preview-content {
        padding-top: 55px;
    }

    .story-title {
        font-size: 26px;
        margin-bottom: 0px;
        line-height: 1.3;
    }

    .story-teaser {
        font-size: 17px;
        line-height: 1.7;
        max-height: calc(100vh - 180px);
        margin-bottom: 12px;
    }

    .story-teaser::after {
        height: 50px;
    }

    .story-tags {
        margin: 5px 0;
        min-height: 20px;
    }

    .auto-tag {
        padding: 3px 8px;
        font-size: 13px;
    }

    .read-more-btn {
        padding: 8px 16px;
        font-size: 14px;
    }



    .story-info {
        margin-top: 8px;
        margin-bottom: 8px;
        font-size: 13px;
    }



    .stat-icon {
        width: 34px;
        height: 34px;
        font-size: 16px;
    }

    .stat-count {
        font-size: 12px !important;
        font-weight: 400 !important;
        text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9) !important;
    }

    .stat-item {
        min-width: 40px;
        gap: 4px;
    }

    .engagement-stats {
        gap: 12px;
        right: 20px;
    }

    .emotion-nav {
        padding: 4px 6px 8px;
        grid-template-columns: repeat(6, 1fr);
        min-height: 70px;
    }

    .emotion-icon {
        font-size: 20px;
    }

    .emotion-label {
        font-size: 9px;
    }

    .swipe-indicator {
        bottom: 155px;
    }






}

/* 中サイズ画面対応（iPhone 12/13/14 Pro Max等） */
@media (min-height: 671px) and (max-height: 950px) {
    .story-preview {
        padding: 30px 20px 90px;
    }

    .preview-content {
        padding-top: 60px;
    }

    .story-title {
        font-size: 30px;
        margin-bottom: 18px;
    }

    .story-teaser {
        font-size: 18px;
        line-height: 1.7;
        max-height: calc(100vh - 370px);
        margin-bottom: 18px;
    }

    .story-teaser::after {
        height: 90px;
    }

    .story-tags {
        margin: 12px 0;
    }



    .story-info {
        margin-top: 20px;
        margin-bottom: 18px;
    }


}

/* 大きい画面対応 */
@media (min-height: 951px) {
    .story-preview {
        padding: 40px 20px 100px;
    }

    .preview-content {
        padding-top: 65px;
    }

    .story-title {
        font-size: 34px;
        margin-bottom: 22px;
    }

    .story-teaser {
        font-size: 20px;
        line-height: 1.8;
        max-height: calc(100vh - 400px);
        margin-bottom: 22px;
    }

    .story-teaser::after {
        height: 110px;
    }

    .story-tags {
        margin: 15px 0;
    }



    .story-info {
        margin-top: 25px;
        margin-bottom: 22px;
    }


}

/* タブレット・PC対応 */
@media (min-width: 768px) {
    .story-teaser {
        font-size: 21px;
        line-height: 1.9;
        max-height: calc(100vh - 300px);
        min-height: 600px;
    }

    .story-teaser::after {
        height: 180px;
    }

    .story-title {
        font-size: 38px;
        margin-bottom: 26px;
    }

    .preview-content {
        max-width: 650px;
    }
}

/* 大型デスクトップ対応 */
@media (min-width: 1024px) {
    .story-teaser {
        font-size: 22px;
        max-height: calc(100vh - 250px);
        min-height: 700px;
    }

    .story-title {
        font-size: 44px;
    }

    .preview-content {
        max-width: 800px;
    }
}

/* 並び順コントロール */
.sort-controls {
    position: fixed;
    bottom: 160px;
    left: 20px;
    display: none;
    /* 初期状態は非表示 */
    flex-direction: column;
    gap: 8px;
    z-index: 290;
    pointer-events: auto;
}

/* シャッフルボタン（右寄せ） */
.sort-controls-right {
    position: fixed;
    bottom: 160px;
    right: 20px;
    display: none;
    /* 初期状態は非表示 */
    flex-direction: column;
    gap: 8px;
    z-index: 290;
    pointer-events: auto;
}

.sort-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 25px;
    padding: 10px 20px;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
    min-width: 120px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.sort-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.02);
}

.sort-btn:active {
    transform: scale(0.98);
}

.sort-btn.active {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 6px 20px rgba(255, 255, 255, 0.1);
}

.sort-icon {
    font-size: 16px;
    display: block;
}

.sort-label {
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.3px;
}

/* レスポンシブ対応 */
@media (max-width: 480px) {
    .sort-controls {
        bottom: 160px;
        left: 15px;
        gap: 6px;
    }

    .sort-controls-right {
        bottom: 160px;
        right: 15px;
        gap: 6px;
    }

    .sort-btn {
        padding: 8px 16px;
        min-width: 100px;
        font-size: 13px;
    }

    .sort-label {
        font-size: 12px;
    }
}

/* iPhone SE等の小さい画面対応 */
@media (max-width: 375px) and (max-height: 667px) {
    .sort-controls {
        bottom: 180px;
        left: 10px;
    }

    .sort-controls-right {
        bottom: 180px;
        right: 10px;
    }

    .sort-btn {
        padding: 6px 12px;
        min-width: 80px;
        font-size: 12px;
    }

    .sort-label {
        font-size: 11px;
    }
}

@media (max-height: 700px) {
    .sort-controls {
        bottom: 140px;
    }

    .sort-controls-right {
        bottom: 140px;
    }
}

/* iPhone SE専用（より厳密な条件） */
@media (max-width: 375px) and (max-height: 667px) {
    .sort-controls {
        bottom: 150px !important;
    }

    .sort-controls-right {
        bottom: 150px !important;
    }
}

/* さらに小さい画面やSE第1世代対応 */
@media (max-width: 320px) {
    .sort-controls {
        bottom: 200px !important;
        left: 5px;
    }

    .sort-controls-right {
        bottom: 200px !important;
        right: 5px;
    }

    .sort-btn {
        padding: 5px 10px;
        min-width: 70px;
        font-size: 11px;
    }
}

/* フルストーリービュー */
</style>