/*
Theme Name: oyasumi.baby
Theme URI: https://oyasumi.baby
Description: A minimal bedtime story theme designed for sleep. Features distraction-free reading with starry night backgrounds and wake lock support.
Version: 1.0.0
Author: oyasumi.baby
Author URI: https://oyasumi.baby
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: oyasumi-baby
*/

/* ========================================
   Reset & Base Styles
   ======================================== */

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

html {
    height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

body {
    min-height: 100%;
    background-color: #0a0e1a;
    color: #e8e4dc;
    font-family: 'BIZ UDPGothic', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    touch-action: pan-y;
    position: relative;
}

/* ========================================
   Fixed Background Layer
   ======================================== */

/* Works on all devices including mobile */
.ob-fixed-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('visual/bg2-optimized.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: -1;
}

/* ========================================
   Wake Lock Indicator
   ======================================== */

#ob-wake-indicator {
    position: fixed;
    top: 16px;
    right: 16px;
    font-size: 12px;
    opacity: 0;
    color: #c8c4bc;
    z-index: 9998;
    transition: opacity 0.3s;
}

#ob-wake-indicator.active {
    opacity: 0.5;
}

/* ========================================
   Main Container
   ======================================== */

.ob-reader-mode {
    max-width: 500px;
    margin: 0 auto;
    padding: 60px 40px 0;
}

.ob-story-content {
    background: linear-gradient(to bottom,
        transparent 0%,
        transparent 20%,
        rgba(10, 14, 26, 0.6) 35%,
        rgba(10, 14, 26, 0.9) 85%,
        transparent 100%
    );
    margin: 0 -40px;
    padding: 0 40px 80px 40px;
}

@media (max-width: 640px) {
    html, body {
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        touch-action: pan-y !important;
    }

    .ob-reader-mode {
        padding: 40px 30px 0;
    }

    .ob-story-content {
        background: linear-gradient(to bottom,
            transparent 0%,
            transparent 20%,
            rgba(10, 14, 26, 0.6) 35%,
            rgba(10, 14, 26, 0.9) 85%,
            transparent 100%
        );
        margin: 0 -30px;
        padding: 0 30px 60px 30px;
    }

    .ob-custom-player {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
}

/* ========================================
   Story Header
   ======================================== */

.ob-story-header {
    margin-bottom: 0;
    text-align: center;
    position: relative;
    padding-top: 40px;
}

.ob-logo-story {
    width: 165px;
    height: auto;
    margin: 0 auto 2em;
    display: block;
}

.ob-meta {
    display: block;
    font-size: 12px;
    color: #b8b4ac;
    margin-bottom: 1.5em;
    letter-spacing: 0.15em;
    font-weight: 400;
    opacity: 0.85;
}

.ob-story-header h1 {
    font-size: 28px;
    font-weight: 300;
    color: #e8e4dc;
    letter-spacing: 0.12em;
    line-height: 1.7;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

/* ========================================
   Divider
   ======================================== */

.ob-divider {
    text-align: center;
    margin: 0.8em 0 3em 0;
}

.ob-divider img {
    height: 10px !important;
    width: auto;
    opacity: 0.5;
}

/* ========================================
   Audio Player (Custom Design)
   ======================================== */

.ob-audio-player-wrapper {
    margin: 2em 0 3em 0;
}

.ob-audio-element {
    display: none;
}

.ob-audio-label {
    font-size: 12px;
    color: #b8b4ac;
    letter-spacing: 0.1em;
    margin-bottom: 1em;
    opacity: 0.7;
    text-align: center;
}

.ob-custom-player.redesigned {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08); /* Fainter border */
    border-radius: 20px;
    padding: 1.5em;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    gap: 1em;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

/* Top Row: Play button + Seek Bar */
.ob-player-main-row {
    display: flex;
    align-items: center;
    gap: 1.2em;
}

/* Play Button */
.ob-play-button {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1); /* Subtle glass background */
    color: #e8e4dc;
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 0; /* Hide text fallback */
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    padding: 0;
    margin: 0;
}

.ob-play-button:hover {
    transform: scale(1.05);
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
}

.ob-play-button.playing {
    background: #e8e4dc; /* Active state light */
    color: #0a0e1a; /* Dark icon */
    border-color: #e8e4dc;
    box-shadow: 0 0 15px rgba(232, 228, 220, 0.4);
}

/* Seek Bar Container */
.ob-seek-container {
    flex: 1;
    display: flex;
    align-items: center;
}

/* Seek Bar */
.ob-progress-bar {
    width: 100%;
    height: 4px; /* Refined thickness */
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    outline: none;
    cursor: pointer;
    background-image: linear-gradient(#e8e4dc, #e8e4dc);
    background-size: 0% 100%;
    background-repeat: no-repeat;
    transition: height 0.2s ease;
}

.ob-progress-bar:hover {
    height: 6px; /* Grow on hover */
}

.ob-progress-bar::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    background: #e8e4dc;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    border: none; /* No border for clean look */
    transition: transform 0.2s ease;
}

.ob-progress-bar:hover::-webkit-slider-thumb {
    transform: scale(1.2);
}

.ob-progress-bar::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: #e8e4dc;
    border-radius: 50%;
    cursor: pointer;
    border: none; /* No border */
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* Bottom Row: Balanced Layout */
.ob-player-sub-row {
    display: flex;
    justify-content: space-between; /* Balance left and right */
    align-items: center;
    padding: 0 0.5em; /* Align slightly with UI */
}

.ob-time-display {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #b8b4ac;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.05em;
    opacity: 0.8;
}

.ob-volume-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ob-volume-icon-btn {
    background: none;
    border: none;
    color: #b8b4ac;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    transition: opacity 0.2s;
    width: 32px; /* Ensure ample tap target */
    height: 32px;
    flex-shrink: 0;
    overflow: visible; /* Prevent clipping */
}

.ob-volume-icon-btn svg {
    width: 24px; /* Full size to match viewBox */
    height: 24px;
    display: block;
    overflow: visible;
}

.ob-volume-icon-btn:hover {
    opacity: 1;
    color: #e8e4dc;
}

.ob-volume-icon-btn.muted {
    opacity: 0.5;
}

.ob-volume-slider {
    width: 100%; /* Default to full width (for BGM player) */
    height: 3px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    outline: none;
    cursor: pointer;
}

/* Specific override for Story Player (Discreet) */
.ob-custom-player .ob-volume-slider {
    width: 60px;
}

.ob-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px; /* Standard thumb size */
    height: 12px;
    background: #b8b4ac; /* Match BGM player style by default */
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* Override thumb for Story Player if needed (currently same style) */
.ob-custom-player .ob-volume-slider::-webkit-slider-thumb {
    width: 8px; /* Tiny thumb for story player */
    height: 8px;
}

.ob-volume-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: #b8b4ac;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* Specific target for BGM player thumb to ensure it is standard size */
.ob-bgm-menu .ob-volume-slider::-webkit-slider-thumb {
    width: 12px;
    height: 12px;
}

.ob-custom-player .ob-volume-slider::-moz-range-thumb {
    width: 8px;
    height: 8px;
}

/* ========================================
   Story Content
   ======================================== */

.ob-entry-content {
    font-size: 17px;
    line-height: 1.9;
    letter-spacing: 0.05em;
}

.ob-entry-content p {
    margin-bottom: 1.6em;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8);
}

/* ========================================
   固定ページ（読みもの。page.php）
   お話は声に出して読むので大きめの文字。読みものは親がひとりで読むので、少し小さくする
   ======================================== */

/* 読みものの題名は長いので、左にそろえる。折れる場所は、本文と同じように成り行きにまかせる */
.ob-page-content .ob-story-header h1 {
    font-size: 20px;
    letter-spacing: 0.06em;
    line-height: 1.8;
    text-align: left;
}

.ob-page-body {
    font-size: 16px;
}

/* 見出しとリンクは、「このサイトについて」のページと同じ見た目にそろえる
   （page-about.php の .ob-about-section-title と .ob-about-link と同じ値） */
.ob-page-body h2 {
    margin: 4.5em 0 1.8em;
    padding-bottom: 0.8em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 13px;
    font-weight: 400;
    color: #b8b4ac;
    letter-spacing: 0.2em;
    line-height: normal;
    opacity: 0.8;
}

.ob-page-body a {
    color: #c8c4bc;
    text-decoration: none;
    border-bottom: 1px solid rgba(200, 196, 188, 0.25);
    transition: all 0.3s ease;
}

.ob-page-body a:hover {
    color: #e8e4dc;
    border-bottom-color: rgba(232, 228, 220, 0.5);
}

.ob-page-nav {
    margin-top: 8vh;
}

/* ========================================
   Story Footer
   ======================================== */

.ob-story-footer {
    margin-top: 10vh;
    background: transparent;
}

.ob-the-end {
    text-align: center;
    margin-top: 10vh;
    margin-bottom: 15vh;
    font-size: 1.5em;
    opacity: 0.5;
    font-weight: 300;
    letter-spacing: 0.3em;
}

.ob-back-button-container {
    text-align: center;
    margin-bottom: 15vh;
}

.ob-back-button {
    display: inline-block;
    padding: 0.5em 1.2em;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    color: #e8e4dc;
    font-size: 13px;
    text-decoration: none;
    letter-spacing: 0.05em;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.ob-back-button:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

/* ========================================
   SNS Share Buttons
   ======================================== */

.ob-share-container {
    text-align: center;
    margin-bottom: 8vh;
}

.ob-share-label {
    font-size: 11px;
    color: #b8b4ac;
    letter-spacing: 0.1em;
    margin-bottom: 1.2em;
    opacity: 0.6;
}

.ob-share-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.8em;
    margin-bottom: 0.8em;
}

.ob-share-button {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    color: #e8e4dc;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.ob-share-button:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.ob-share-button:active {
    transform: translateY(0);
}

.ob-share-button svg {
    opacity: 0.85;
}

.ob-share-message {
    font-size: 11px;
    color: #e8e4dc;
    opacity: 0;
    transition: opacity 0.3s ease;
    min-height: 1.5em;
}

.ob-share-message.show {
    opacity: 0.7;
}

/* ========================================
   Favorite Button
   ======================================== */

.ob-favorite-button {
    position: absolute;
    top: -8px;
    right: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    color: #e8e4dc;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.ob-favorite-button:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.ob-favorite-button svg {
    opacity: 0.7;
    transition: all 0.3s ease;
}

.ob-favorite-button.favorited svg {
    fill: #f2b948;
    stroke: #f2b948;
    opacity: 1;
}

.ob-favorite-button.favorited {
    background: rgba(242, 185, 72, 0.15);
    border-color: rgba(242, 185, 72, 0.3);
}

/* Small favorite button for cards */
.ob-favorite-button-small {
    width: 32px;
    height: 32px;
    position: static;
}

.ob-favorite-button-small svg {
    width: 14px;
    height: 14px;
}

/* ========================================
   Ambient BGM Player
   ======================================== */

.ob-bgm-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
}

.ob-bgm-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #e8e4dc;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.ob-bgm-toggle:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

.ob-bgm-toggle.playing {
    background: rgba(147, 197, 253, 0.15);
    border-color: rgba(147, 197, 253, 0.3);
    animation: ob-pulse 2s ease-in-out infinite;
}

@keyframes ob-pulse {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), 0 0 0 0 rgba(147, 197, 253, 0.4);
    }
    50% {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), 0 0 0 8px rgba(147, 197, 253, 0);
    }
}

.ob-bgm-menu {
    position: absolute;
    bottom: 70px;
    right: 0;
    background: rgba(10, 14, 26, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    padding: 1.2em;
    min-width: 200px;
    /* 音の数がふえても、小さい画面で上が切れないように、入りきらない分はスクロールさせる */
    max-height: calc(100vh - 110px);
    max-height: calc(100dvh - 110px);
    overflow-y: auto;
    overscroll-behavior: contain;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.ob-bgm-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}


/* ========================================
   Load More Button & Pagination
   ======================================== */
.ob-load-more-container {
    text-align: center;
    padding: 20px 0 20px;
    clear: both;
}

#ob-load-more-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #e8e4dc;
    padding: 12px 32px;
    border-radius: 30px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 0.1em;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

#ob-load-more-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

#ob-load-more-btn.loading {
    opacity: 0.7;
    cursor: wait;
}

/* Loading Spinner (Hidden by default, can be used if we hide button text) */
.ob-loading-spinner {
    display: none;
    width: 24px;
    height: 24px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-top-color: #e8e4dc;
    border-radius: 50%;
    animation: ob-spin 1s linear infinite;
    margin: 10px auto;
}

@keyframes ob-spin {
    to { transform: rotate(360deg); }
}
.ob-bgm-menu-title {
    font-size: 11px;
    color: #b8b4ac;
    letter-spacing: 0.12em;
    margin-bottom: 1em;
    opacity: 0.7;
    text-align: center;
}

.ob-bgm-sounds {
    display: flex;
    flex-direction: column;
    gap: 0.5em;
    margin-bottom: 0.8em;
}

.ob-bgm-sound-button {
    display: flex;
    align-items: center;
    gap: 0.8em;
    padding: 0.7em 1em;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #e8e4dc;
    font-family: 'BIZ UDPGothic', sans-serif;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.ob-bgm-sound-button:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateX(2px);
}

.ob-bgm-sound-button.active {
    background: rgba(147, 197, 253, 0.15);
    border-color: rgba(147, 197, 253, 0.3);
}

.ob-bgm-sound-button.ob-bgm-off {
    border-color: rgba(255, 107, 107, 0.2);
}

.ob-bgm-sound-button.ob-bgm-off:hover {
    background: rgba(255, 107, 107, 0.1);
    border-color: rgba(255, 107, 107, 0.3);
}

.ob-bgm-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ob-bgm-icon img {
    width: 20px;
    height: 20px;
    opacity: 0.85;
}

.ob-bgm-name {
    flex: 1;
    letter-spacing: 0.05em;
    white-space: nowrap; /* 長い名前（アメイジング・グレイス）が2行に折れないように */
}

/* Mobile adjustments */
@media (max-width: 640px) {
    .ob-bgm-container {
        bottom: 16px;
        right: 16px;
    }

    .ob-bgm-toggle {
        width: 48px;
        height: 48px;
        font-size: 20px;
    }

    .ob-bgm-menu {
        right: 0;
        min-width: 180px;
    }
}

/* ========================================
   BGM Resume Banner
   ======================================== */

.ob-bgm-resume-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px 20px;
    background: rgba(10, 14, 26, 0.92);
    border-bottom: 1px solid rgba(147, 197, 253, 0.2);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transform: translateY(-100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.ob-bgm-resume-banner.show {
    transform: translateY(0);
}

.ob-resume-text {
    color: #e8e4dc;
    font-size: 13px;
    letter-spacing: 0.08em;
    cursor: pointer;
    padding: 6px 16px;
    background: rgba(147, 197, 253, 0.12);
    border: 1px solid rgba(147, 197, 253, 0.25);
    border-radius: 20px;
    transition: all 0.3s ease;
}

.ob-resume-text:hover {
    background: rgba(147, 197, 253, 0.2);
    border-color: rgba(147, 197, 253, 0.4);
}

.ob-resume-close {
    background: none;
    border: none;
    color: #b8b4ac;
    font-size: 14px;
    cursor: pointer;
    padding: 4px 8px;
    opacity: 0.5;
    transition: opacity 0.2s ease;
}

.ob-resume-close:hover {
    opacity: 1;
}

/* ========================================
   Sleep Timer (BGM Menu内)
   ======================================== */

.ob-sleep-timer-section {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 0.2em;
}

.ob-sleep-timer-buttons {
    display: flex;
    gap: 0.5em;
}

.ob-sleep-timer-btn {
    flex: 1;
    padding: 0.55em 0.5em;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #e8e4dc;
    font-family: 'BIZ UDPGothic', sans-serif;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    letter-spacing: 0.05em;
}

.ob-sleep-timer-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.ob-sleep-timer-btn.active {
    background: rgba(147, 197, 253, 0.15);
    border-color: rgba(147, 197, 253, 0.3);
}

.ob-sleep-timer-btn.ob-sleep-timer-off {
    flex: 0.6;
    border-color: rgba(255, 107, 107, 0.2);
}

.ob-sleep-timer-btn.ob-sleep-timer-off:hover {
    background: rgba(255, 107, 107, 0.1);
    border-color: rgba(255, 107, 107, 0.3);
}

/* タイマー残り時間ラベル（トグルボタン内） */
.ob-sleep-timer-label {
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 8px;
    color: rgba(147, 197, 253, 0.9);
    letter-spacing: 0.05em;
    white-space: nowrap;
}

/* タイマー作動中のトグルボタン */
.ob-bgm-toggle.timer-active {
    border-color: rgba(147, 197, 253, 0.4);
}

/* ========================================
   Scrollbar
   ======================================== */

::-webkit-scrollbar {
    width: 0px;
    background: transparent;
}

/* ========================================
   WordPress Core Overrides
   ======================================== */

/* Remove default WordPress styles that might interfere */
.ob-reader-mode .alignleft,
.ob-reader-mode .alignright,
.ob-reader-mode .aligncenter {
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.ob-reader-mode img {
    max-width: 100%;
    height: auto;
}

/* ========================================
   UI Animations
   ======================================== */

.ob-fade-in-up {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1.2s ease-out, transform 1.2s ease-out;
    will-change: opacity, transform;
}

.ob-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Ensure content is visible if JS fails or for SEO/Accessibility */
@media (prefers-reduced-motion: reduce) {
    .ob-fade-in-up {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

/* ========================================
   Custom Category Dropdown
   ======================================== */

.ob-dropdown-wrapper {
    position: relative;
    width: 100%;
    max-width: 100%; /* Full width on mobile */
}

@media (min-width: 640px) {
    .ob-dropdown-wrapper {
        max-width: 300px; /* Limit width on desktop */
    }
}

.ob-custom-select {
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 22px; /* Match pill radius */
    padding: 0.6em 2.5em 0.6em 1.2em; /* Compact padding matching pills + arrow interface */
    color: #e8e4dc;
    font-size: 14px; /* Match pill font size */
    font-family: inherit;
    cursor: pointer;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: background 0.2s ease, border-color 0.2s ease;
    will-change: auto;
}

.ob-custom-select:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.25); /* Less bright border */
    background: rgba(255, 255, 255, 0.1); /* Less bright background */
}

.ob-select-arrow {
    position: absolute;
    top: 50%;
    right: 16px;
    transform: translateY(-50%);
    pointer-events: none;
    font-size: 10px;
    color: #b8b4ac;
}

/* ========================================
   Site Footer
   ======================================== */

.ob-site-footer {
    margin-top: 60px;
    padding: 40px 20px 60px;
    background: linear-gradient(to top, rgba(10, 14, 26, 0.8), transparent);
    text-align: center;
}

.ob-footer-content {
    max-width: 600px;
    margin: 0 auto;
}

.ob-sns-section {
    margin-bottom: 40px;
}

.ob-sns-message {
    font-size: 13px;
    line-height: 1.8;
    color: #b8b4ac;
    margin-bottom: 24px;
    opacity: 0.8;
}

.ob-footer-sns-links {
    display: flex;
    justify-content: center;
    gap: 16px;
}

.ob-footer-sns-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    min-width: 140px;
    border-radius: 30px;
    text-decoration: none;
    color: #e8e4dc;
    font-size: 13px;
    letter-spacing: 0.05em;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.ob-footer-sns-link:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

/* .ob-footer-sns-link.instagram { } */
/* .ob-footer-sns-link.threads { } */

.ob-copyright {
    font-size: 11px;
    color: #b8b4ac;
    opacity: 0.5;
    letter-spacing: 0.1em;
    font-family: sans-serif; /* コピーライト用のクリーンなフォント */
}

/* ========================================
   Goodnight Message & Story Navigation
   ======================================== */

.ob-goodnight {
    text-align: center;
    font-size: 1.2em;
    opacity: 0.4;
    font-weight: 300;
    letter-spacing: 0.2em;
    margin-bottom: 12vh;
}

.ob-story-nav {
    display: flex;
    justify-content: center;
    gap: 1em;
    margin-bottom: 12vh;
}

.ob-story-nav-button {
    display: inline-block;
    padding: 0.7em 1.5em;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 22px;
    color: #e8e4dc;
    font-size: 13px;
    text-decoration: none;
    letter-spacing: 0.08em;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.ob-story-nav-button:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

/* ========================================
   Tonight's Story (今夜のおはなし)
   ======================================== */

.ob-tonight-story {
    display: block;
    margin: 2em 0 2.5em;
    padding: 1.5em;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    text-align: center;
    text-decoration: none;
    transition: all 0.3s ease;
}

.ob-tonight-story:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.15);
}

.ob-tonight-label {
    font-size: 11px;
    color: #b8b4ac;
    letter-spacing: 0.15em;
    margin-bottom: 0.8em;
    opacity: 0.7;
}

.ob-tonight-title {
    font-size: 20px;
    font-weight: 300;
    color: #e8e4dc;
    letter-spacing: 0.1em;
    margin-bottom: 0.5em;
    line-height: 1.6;
}

.ob-tonight-meta {
    font-size: 12px;
    color: #b8b4ac;
    opacity: 0.6;
    margin-bottom: 1em;
}

.ob-tonight-link {
    display: inline-block;
    padding: 0.6em 1.5em;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    color: #e8e4dc;
    font-size: 13px;
    text-decoration: none;
    letter-spacing: 0.08em;
    transition: all 0.3s ease;
}

.ob-tonight-link:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

/* ========================================
   トップページの入口の帯（クリスマス・英語版）
   主役は「今夜のおはなし」なので、細い帯で小さく出す
   ======================================== */

.ob-entry-links {
    /* 上の「今夜のおはなし」の下の余白（2.5em）をつめて、ひとかたまりに見せる */
    margin: -1.2em 0 2.2em;
}

.ob-entry-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.9em 1.2em;
    margin-bottom: 0.5em;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    color: #e8e4dc;
    font-size: 14px;
    letter-spacing: 0.08em;
    text-decoration: none;
    transition: all 0.3s ease;
}

.ob-entry-link::after {
    content: "→";
    opacity: 0.6;
}

.ob-entry-link:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

/* 一覧の見出し（あたらしいおはなし） */
.ob-list-heading {
    margin: 0 0 0.9em;
    padding-left: 0.3em;
    font-size: 13px;
    font-weight: 400;
    color: #b8b4ac;
    letter-spacing: 0.15em;
}

/* ========================================
   Collapsible Filter
   入口の帯とは役割がちがう（その場で開く道具）ので、検索の窓の形にしている
   ======================================== */

.ob-filter-toggle {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.7em;
    width: 100%;
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    color: #b8b4ac;
    font-size: 13px;
    letter-spacing: 0.08em;
    cursor: pointer;
    padding: 0.75em 1.3em;
    transition: all 0.3s ease;
    font-family: inherit;
    margin-bottom: 0.5em;
}

.ob-filter-toggle svg {
    flex: none;
    opacity: 0.8;
}

.ob-filter-toggle .ob-filter-toggle-arrow {
    margin-left: auto;
}

.ob-filter-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.ob-filter-toggle-arrow {
    transition: transform 0.3s ease;
    font-size: 10px;
}

.ob-filter-toggle.open .ob-filter-toggle-arrow {
    transform: rotate(180deg);
}

.ob-filter-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
}

.ob-filter-body.open {
    max-height: 500px;
}

/* ========================================
   Audio Badge (Enhanced)
   ======================================== */

.ob-audio-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3em;
    background: rgba(147, 197, 253, 0.12);
    border: 1px solid rgba(147, 197, 253, 0.25);
    color: #93c5fd;
    padding: 0.2em 0.6em;
    border-radius: 12px;
    font-size: 11px;
    letter-spacing: 0.05em;
}

/* ========================================
   PWA Onboarding
   ======================================== */

.ob-pwa-hint {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(10, 14, 26, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 1em 1.5em;
    color: #b8b4ac;
    font-size: 12px;
    line-height: 1.6;
    text-align: center;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.5s ease;
    z-index: 999;
    max-width: 280px;
    letter-spacing: 0.05em;
}

.ob-pwa-hint.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.ob-pwa-hint-close {
    position: absolute;
    top: 8px;
    right: 12px;
    background: none;
    border: none;
    color: #b8b4ac;
    font-size: 14px;
    cursor: pointer;
    opacity: 0.5;
    padding: 0;
    line-height: 1;
}

/* ========================================
   404 Error Page
   ======================================== */

.ob-404-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
    padding: 40px 20px;
    text-align: center;
}

.ob-404-logo {
    width: 180px;
    opacity: 0.7;
    margin-bottom: 48px;
}

.ob-404-content {
    margin-bottom: 48px;
}

.ob-404-emoji {
    font-size: 48px;
    margin-bottom: 24px;
    animation: ob-float 3s ease-in-out infinite;
}

@keyframes ob-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.ob-404-title {
    font-size: min(5vw, 20px);
    font-weight: 300;
    color: #e8e4dc;
    letter-spacing: 0.15em;
    margin-bottom: 16px;
    line-height: 1.8;
}

.ob-404-message {
    font-size: 14px;
    color: #b8b4ac;
    line-height: 2;
    opacity: 0.7;
}

.ob-404-actions {
    display: flex;
    gap: 1em;
    flex-wrap: wrap;
    justify-content: center;
}

/* ========================================
   Next Stories (読後の関連ストーリー)
   ======================================== */

/* 読み聞かせメモ（SEO 実験3）。大人に向けた覚え書きなので、お話より小さく、控えめに出す */
.ob-reading-note {
    margin: 8vh 0 6vh;
    padding: 1.4em 1.5em;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    color: #b8b4ac;
    font-size: 13px;
    line-height: 1.9;
    text-align: left;
}

.ob-reading-note-title {
    margin: 0 0 0.8em;
    font-size: 13px;
    font-weight: 400;
    color: #e8e4dc;
    letter-spacing: 0.15em;
}

.ob-reading-note-lead {
    margin: 0;
}

.ob-reading-note-list {
    margin: 0;
}

/* 項目の名前は、本文より小さく・うすくして、本文とのちがいをはっきりさせる */
.ob-reading-note-list dt {
    margin-top: 1.4em;
    margin-bottom: 0.2em;
    font-size: 10px;
    letter-spacing: 0.15em;
    opacity: 0.6;
}

.ob-reading-note-list dd {
    margin: 0;
}

.ob-next-stories {
    margin-top: 0;
    text-align: center;
}

.ob-next-stories-label {
    font-size: 12px;
    color: #b8b4ac;
    letter-spacing: 0.15em;
    margin-bottom: 20px;
    opacity: 0.7;
}

.ob-next-stories-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 400px;
    margin: 0 auto 16px;
}

.ob-story-nav {
    text-align: center;
    margin-bottom: 10vh;
    margin-top: 32px;
}

.ob-next-story-card {
    display: block;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    text-decoration: none;
    transition: all 0.3s ease;
    text-align: left;
}

.ob-next-story-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.ob-next-story-title {
    font-size: 15px;
    font-weight: 300;
    color: #e8e4dc;
    letter-spacing: 0.08em;
    line-height: 1.6;
    margin-bottom: 4px;
}

.ob-next-story-meta {
    font-size: 11px;
    color: #b8b4ac;
    opacity: 0.6;
    letter-spacing: 0.05em;
}

/* ========================================
   フッター「このサイトについて」リンク
   ======================================== */

.ob-footer-about {
    text-align: center;
    margin-bottom: 0.6em;
}

.ob-footer-about-link {
    font-size: 11px;
    color: #7a7670;
    text-decoration: none;
    letter-spacing: 0.12em;
    transition: color 0.3s ease;
}

.ob-footer-about-link:hover {
    color: #b8b4ac;
}

/* ========================================
   Archive / Front Page Styles
   ======================================== */

.ob-archive-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px 180px;
    background: linear-gradient(to bottom,
            rgba(10, 14, 26, 0.3) 0%,
            rgba(10, 14, 26, 0.2) 70%,
            transparent 100%);
}

.ob-archive-header {
    text-align: center;
    margin-bottom: 2em;
}

.ob-archive-title {
    font-size: 32px;
    font-weight: 300;
    color: #e8e4dc;
    letter-spacing: 0.15em;
    margin-bottom: 0.5em;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

.ob-archive-subtitle {
    font-size: 14px;
    color: #b8b4ac;
    letter-spacing: 0.1em;
    opacity: 0.8;
    margin-bottom: 24px;
}

.ob-site-intro {
    font-size: 13px;
    color: #9e9a91;
    letter-spacing: 0.08em;
    line-height: 1.8;
    max-width: 400px;
    margin: 0 auto;
    opacity: 0.9;
}

/* Filter UI */
.ob-filter-container {
    position: sticky;
    top: 0;
    z-index: 100;
    margin: 0 -20px 3em;
    padding: 1.5em 20px;
}

.ob-filter-section {
    margin-bottom: 1.5em;
}

.ob-filter-section:last-child {
    margin-bottom: 0;
}

.ob-filter-label {
    font-size: 12px;
    color: #b8b4ac;
    letter-spacing: 0.12em;
    margin-bottom: 0.8em;
    opacity: 0.7;
    display: block;
    padding-left: 4px;
    text-align: left;
}

/* Horizontal scroll wrapper with fade indicators */
.ob-filter-pills-wrapper {
    position: relative;
}

.ob-filter-pills-wrapper::before,
.ob-filter-pills-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 30px;
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.ob-filter-pills-wrapper::before {
    left: 0;
    background: linear-gradient(to right, rgba(10, 14, 26, 0.3), transparent);
}

.ob-filter-pills-wrapper::after {
    right: 0;
    background: linear-gradient(to left, rgba(10, 14, 26, 0.3), transparent);
}

.ob-filter-pills-wrapper.show-left-fade::before {
    opacity: 1;
}

.ob-filter-pills-wrapper.show-right-fade::after {
    opacity: 1;
}

.ob-filter-pills {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.6em;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 2px 4px;
}

.ob-filter-pills::-webkit-scrollbar {
    display: none;
}

.ob-filter-pill {
    display: inline-block;
    padding: 0.55em 1.3em;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 22px;
    color: #e8e4dc;
    font-size: 14px;
    text-decoration: none;
    letter-spacing: 0.05em;
    transition: all 0.3s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.ob-filter-pill:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.ob-filter-pill.active {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 2px 8px rgba(255, 255, 255, 0.1);
}

/* Story List - Card style */
.ob-story-list {
    display: grid;
    gap: 0.6em;
}

.ob-story-card {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1em 1.2em;
    text-decoration: none;
    display: block;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: relative;
}

.ob-story-card:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.ob-story-card-meta {
    font-size: 10px;
    color: #b8b4ac;
    letter-spacing: 0.1em;
    opacity: 0.6;
    margin-bottom: 0.4em;
    display: flex;
    align-items: center;
    gap: 0.8em;
}

.ob-story-card .ob-audio-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3em;
    font-size: 9px;
    color: #d4c9b8;
    opacity: 0.75;
    letter-spacing: 0.08em;
    background: transparent;
    border: none;
    padding: 0;
}

.ob-story-card .ob-favorite-button-small {
    position: absolute;
    top: 50%;
    right: 0.8em;
    transform: translateY(-50%);
}

.ob-story-card-title {
    font-size: 16px;
    font-weight: 400;
    color: #e8e4dc;
    letter-spacing: 0.08em;
    line-height: 1.5;
    padding-right: 40px;
}

.ob-story-card-excerpt {
    font-size: 12px;
    color: #b8b4ac;
    opacity: 0.6;
    margin-top: 0.3em;
    line-height: 1.5;
    padding-right: 40px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Logo styling */
.ob-logo-main {
    width: 250px;
    height: auto;
    margin: 1.5em auto 1em;
    display: block;
}

/* Archive / Front Page Mobile */
@media (max-width: 640px) {
    .ob-archive-container {
        padding: 30px 15px 60px;
    }

    .ob-archive-title {
        font-size: 26px;
    }

    .ob-filter-container {
        margin: 0 -15px 2em;
        padding: 1.2em 15px;
    }

    .ob-filter-section {
        margin-bottom: 1.2em;
    }

    .ob-filter-label {
        font-size: 11px;
    }

    .ob-filter-pill {
        padding: 0.5em 1.1em;
        font-size: 14px;
    }

    .ob-logo-main {
        width: 225px;
        margin-top: 2em;
    }
}
