/* Story Page Styles */

/* ============================================
   UNIFIED STORY HEADER AND CONTROLS
   ============================================ */

.story-unified-header {
    background: white;
    border: 2px solid #d0d0d0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    margin-bottom: 20px;
}

.story-header-top {
    padding: 20px 32px;
    display: flex;
    align-items: center;
    gap: 24px;
}

.story-logo-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    gap: 6px;
}

.story-logo-container img {
    height: 90px;
    width: auto;
}

.story-header-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.story-header-description {
    font-size: 0.85em;
    color: #333;
    line-height: 1.7;
}

.mobile-text {
    display: none;
}

.desktop-text {
    display: inline;
}

.second-line {
    display: block;
    margin-top: 12px;
}

.story-header-description .badge {
    padding: 4px 12px;
    font-size: 0.95em;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid;
    border-radius: 3px;
    font-family: monospace;
    display: inline-block;
    vertical-align: middle;
    margin: 0 2px;
}

.story-header-description .badge.lore {
    background: #e0f0ff;
    color: #1e40af;
    border-color: #3b82f6;
}

.story-header-description .badge.canon {
    background: #f3ebff;
    color: #5a3a7a;
    border-color: var(--user-color);
}

.lore-link {
    color: var(--user-color);
    text-decoration: none;
    font-weight: 600;
}

.lore-link:hover {
    text-decoration: underline;
}

.inline-tag {
    display: inline-block;
    background: #e0f0ff;
    border: 1px solid #3b82f6;
    padding: 4px 12px;
    font-family: monospace;
    font-size: 0.95em;
    font-weight: 600;
    color: #1e40af;
    border-radius: 3px;
    margin: 0 2px;
}

.canon-inline {
    background: #f3ebff;
    border-color: var(--user-color);
    color: #5a3a7a;
}

.learn-more-btn {
    flex-shrink: 0;
    padding: 6px 16px;
    background: white;
    border: 1.5px solid #d0c7f0;
    color: #5a4a7a;
    font-size: 0.7em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: monospace;
    align-self: center;
}

.learn-more-btn:hover {
    background: #f0ebff;
    border-color: var(--user-color);
    color: #372e42;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px var(--user-color-light);
}

.story-header-divider {
    height: 1px;
    background: #e0e0e0;
    margin: 0;
}

@media (max-width: 768px) {
    .story-header-top {
        flex-direction: column;
        padding: 14px 16px 12px 16px;
        gap: 8px;
        align-items: center;
    }
    
    .story-logo-container {
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 4px;
    }
    
    .story-logo-container img {
        height: 72px;
    }
    
    .story-header-info {
        align-items: center;
        text-align: center;
    }
    
    .story-header-description {
        font-size: 0.72em;
        line-height: 1.55;
        color: #555;
    }
    
    .story-header-description br {
        display: none;
    }
    
    .story-header-description .second-line {
        display: block;
        margin-top: 4px;
    }
    
    .desktop-text {
        display: none;
    }
    
    .mobile-text {
        display: inline;
    }
    
    .learn-more-btn {
        align-self: center;
        margin-top: 2px;
        padding: 4px 14px;
        font-size: 0.6em;
        border-color: #e0d8f0;
    }
}

/* ============================================
   FULLSCREEN BACKGROUND
   ============================================ */

/* Fullscreen background system (managed by background.js) */
.fullscreen-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    overflow: hidden;
}

.scene-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.background-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 1;
    transition: opacity 0.8s ease-in-out;
    animation: subtle-breathing 6s ease-in-out infinite;
}

@keyframes subtle-breathing {
    0%, 100% { 
        transform: scale(1); 
    }
    50% { 
        transform: scale(1.02); 
    }
}

.background-layer.active {
    opacity: 1;
}

/* Ensure body has proper positioning */
body.story-page {
    position: relative;
    margin: 0;
    padding: 0;
    background: transparent;
}

.share-story-btn {
    padding: 10px 24px;
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    color: white;
    border: none;
    font-weight: 600;
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.3s;
    letter-spacing: 0.03em;
    box-shadow: 0 3px 10px rgba(217, 119, 6, 0.3);
    white-space: nowrap;
    position: relative;
    overflow: hidden;
    animation: buttonPulse 3s ease-in-out infinite;
}

.share-story-btn::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        120deg,
        transparent 0%,
        transparent 40%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 60%,
        transparent 100%
    );
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%) translateY(-100%) rotate(45deg);
    }
    100% {
        transform: translateX(100%) translateY(100%) rotate(45deg);
    }
}

@keyframes buttonPulse {
    0%, 100% {
        transform: translateY(0) scale(1);
        box-shadow: 0 3px 10px rgba(217, 119, 6, 0.3);
    }
    50% {
        transform: translateY(-1px) scale(1.01);
        box-shadow: 0 5px 15px rgba(217, 119, 6, 0.4);
    }
}

.share-story-btn:hover {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 6px 20px rgba(217, 119, 6, 0.5);
    animation: none;
}

.share-story-btn:hover::before {
    animation: shimmer 1.2s infinite;
}

.share-story-btn .rotating-word {
    display: inline-block;
    position: relative;
    width: 58px;
    text-align: left;
}

.share-story-btn .rotating-word::after {
    content: 'Dreams';
    animation: rotateWords 8s infinite;
    display: inline-block;
}

@keyframes rotateWords {
    0%, 22% {
        content: 'Dreams';
        opacity: 1;
        transform: translateY(0);
    }
    25%, 47% {
        content: 'Stories';
        opacity: 1;
        transform: translateY(0);
    }
    50%, 72% {
        content: 'Fables';
        opacity: 1;
        transform: translateY(0);
    }
    75%, 97% {
        content: 'Tales';
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        content: 'Dreams';
        opacity: 1;
        transform: translateY(0);
    }
}

/* Share Story Modal — styles now in /css/widgets/sharelore.css */

/* Explanation Modal */
.explanation-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 10650; /* stacked above share-modal-overlay (10600) */
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
}

.explanation-modal-overlay.active {
    display: flex;
}

.explanation-modal {
    background: white;
    border: 2px solid var(--user-color);
    padding: 32px;
    max-width: 500px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

@media (max-width: 768px) {
    .explanation-modal {
        padding: 24px 16px;
        width: 95%;
        max-height: 90vh;
    }
}

.explanation-modal h2 {
    margin: 0 0 16px 0;
    color: var(--user-color);
    font-size: 1.6em;
}

@media (max-width: 768px) {
    .explanation-modal h2 {
        font-size: 1.3em;
    }
}

.explanation-modal h3 {
    margin: 20px 0 12px 0;
    color: #5a3a7a;
    font-size: 1.1em;
}

@media (max-width: 768px) {
    .explanation-modal h3 {
        font-size: 1em;
        margin: 16px 0 10px 0;
    }
}

.explanation-modal p {
    line-height: 1.6;
    margin-bottom: 12px;
    color: #444;
    font-size: 0.95em;
}

.explanation-modal ul {
    margin: 12px 0 16px 20px;
    line-height: 1.8;
}

.explanation-modal li {
    margin-bottom: 8px;
    color: #555;
}

.explanation-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 35px;
    height: 35px;
    display: none; /* Hidden - use overlay click to close */
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.explanation-modal-close:hover {
    color: #333;
}

.loremasters-list {
    background: #f8f6ff;
    border: 1px solid #d0c7f0;
    padding: 12px 16px;
    margin: 8px 0 16px 0;
    border-radius: 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    max-width: 450px;
    margin-left: auto;
    margin-right: auto;
}

@media (max-width: 768px) {
    .loremasters-list {
        max-width: 100%;
        padding: 10px 12px;
        gap: 10px;
    }
}

.loremaster-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95em;
    color: #666;
}

.loremaster-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

.loremaster-item a {
    color: #666;
    text-decoration: none;
    font-weight: 400;
}

.loremaster-item a:hover {
    color: var(--user-color);
    text-decoration: underline;
}

.badge-tag {
    display: inline-block;
    padding: 4px 12px;
    border: 1px solid;
    font-size: 0.95em;
    font-weight: 600;
    border-radius: 3px;
    margin: 0 4px;
    font-family: monospace;
}

.canon-tag {
    background: #f3ebff;
    color: var(--user-color);
    border-color: var(--user-color);
}

.lore-tag {
    background: #e0f0ff;
    color: #1e40af;
    border-color: #3b82f6;
}

.main-content {
    background: transparent;
    min-height: 100vh;
    padding-bottom: 80px;
    position: relative;
    z-index: 10; /* Above background (1) but below header and drawer */
    padding-top: var(--content-top-spacing); /* Standard spacing below header */
}

@media (max-width: 768px) {
    .main-content {
        padding-bottom: 70px;
        padding-top: 62px; /* Tight to header */
    }
}

.story-container {
    max-width: 750px;
    margin: 0 auto;
    padding: 20px 20px 40px 20px; /* Reduced top padding since main-content handles spacing */
}

@media (max-width: 768px) {
    .story-container {
        padding: 10px 12px 20px 12px;
    }
}

.controls {
    background: white;
    padding: 16px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

@media (max-width: 768px) {
    .controls {
        padding: 12px 16px;
    }
}

.controls-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

#stories-container {
    min-height: 200px;
}

.filter-buttons {
    display: flex;
    gap: 0.5rem;
}

.filter-btn {
    padding: 10px 20px;
    border: 2px solid;
    background: white;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    position: relative;
}

.filter-btn[data-filter="canon"] {
    border-color: var(--user-color);
    color: var(--user-color);
}

.filter-btn[data-filter="canon"]:hover {
    background: var(--user-color);
    color: white;
}

.filter-btn[data-filter="canon"].active {
    background: var(--user-color);
    color: white;
    border-color: var(--user-color);
}

.filter-btn[data-filter="all"] {
    border-color: #1e40af;
    color: #1e40af;
}

.filter-btn[data-filter="all"]:hover {
    background: #1e40af;
    color: white;
}

.filter-btn[data-filter="all"].active {
    background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
    color: white;
    border-color: #1e40af;
}

.stats {
    font-size: 14px;
    color: #333366;
}

.stats strong {
    color: var(--primary-color);
}

.loading {
    text-align: center;
    padding: 30px;
    background-color: var(--internal-background-color);
    border: 1px solid var(--primary-color);
    color: #333366;
    font-size: 16px;
}

.story-card {
    /* Author color variations - base and derived */
    --author-color: #734ba1; /* Default, overridden per-card by JS */
    --author-color-muted: color-mix(in srgb, var(--author-color) 22%, white);
    --author-color-border: color-mix(in srgb, var(--author-color) 48%, white);
    /* desaturate canon by blending with neutral gray to keep hue but reduce saturation */
    --author-color-canon-bg: color-mix(in srgb, var(--author-color) 62%, #808080 38%);
    --author-color-canon-overlay: linear-gradient(180deg, rgba(0,0,0,0.04), rgba(255,255,255,0.02));
    --author-color-text-dark: color-mix(in srgb, var(--author-color) 80%, black);
    --author-color-text-light: #ffffff;
    /* slightly darker story text for improved legibility */
    --story-text-color: color-mix(in srgb, var(--author-color-text-dark) 95%, black 5%);

    /* Lore posts use a subtle muted tint */
    background-color: var(--author-color-muted);
    border: 1px solid var(--author-color-border);
    /* default readable text color for card contents */
    color: var(--author-color-text-dark);
    padding: 20px;
    margin-bottom: 20px;
    min-height: 100px;
    border-radius: 0;
    box-shadow: 0 2px 8px color-mix(in srgb, var(--author-color) 4%, rgba(0,0,0,0.03));
}

.story-card.story-targeted {
    border-color: color-mix(in srgb, var(--author-color) 45%, var(--author-color-border));
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--author-color) 28%, transparent), 0 10px 24px rgba(17, 24, 39, 0.08);
    animation: storyTargetPulse 1.2s ease-out 1;
}

@keyframes storyTargetPulse {
    0% { transform: translateY(0) scale(1); }
    35% { transform: translateY(-2px) scale(1.004); }
    100% { transform: translateY(0) scale(1); }
}

@media (max-width: 768px) {
    .story-card {
        padding: 15px 12px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .story-card-header {
        gap: 0.6rem;
        margin-bottom: 0.75rem;
        padding-bottom: 0.75rem;
    }
    
    .author-avatar {
        width: 32px;
        height: 32px;
    }
    
    .author-name {
        font-size: 13px;
    }
    
    .author-handle {
        font-size: 11px;
    }
}

.story-card.canon {
    /* Stronger, darker background so text needs to be light */
    border: 2px solid color-mix(in srgb, var(--author-color) 10%, black);
    background: var(--author-color-canon-bg);
    background-image: var(--author-color-canon-overlay);
    color: var(--author-color-text-light);
}

.story-card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--author-color-border);
}

.story-card.canon .story-card-header {
    border-bottom: 1px solid var(--author-color);
}

.author-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--author-color-border);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.story-card.canon .author-avatar {
    border: 2px solid var(--author-color);
}

.author-avatar:hover {
    transform: scale(1.1);
}

.author-info {
    flex: 1;
    cursor: pointer;
}

.author-info:hover .author-name {
    text-decoration: underline;
}

.author-name {
    font-weight: 700;
    color: var(--author-color);
    font-size: 16px;
}

.story-card.canon .author-name {
    color: var(--author-color-text-light);
}

.author-handle {
    color: color-mix(in srgb, var(--author-color) 45%, black);
    font-size: 14px;
    opacity: 0.95;
}

.story-card.canon .author-handle {
    color: var(--author-color-text-light);
    opacity: 0.95;
}

.badges {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.badge {
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid;
    border-radius: 0;
    font-family: monospace;
}

/* Story text inline/link/bold styling to reflect author color
   The .story-text box always has a white background, so links and bold
   should ALWAYS use the dynamic author color, even on canon posts */
.story-card .story-text a.story-link,
.story-card.canon .story-text a.story-link {
    color: var(--author-color);
    text-decoration: none;
    font-weight: 600;
}

.story-card .story-text a.story-link:hover,
.story-card.canon .story-text a.story-link:hover {
    text-decoration: underline;
}

.story-card .story-text strong,
.story-card .story-text b,
.story-card.canon .story-text strong,
.story-card.canon .story-text b {
    color: var(--author-color);
}

.story-card .story-text em,
.story-card .story-text i,
.story-card.canon .story-text em,
.story-card.canon .story-text i {
    color: color-mix(in srgb, var(--author-color) 82%, black);
    font-style: italic;
}

/* Slight tint / subtle background for any inline colored spans to help distinguish them */
.story-card .story-text span[style*="color"] {
    background: color-mix(in srgb, var(--author-color) 6%, transparent);
    padding: 0 2px;
    border-radius: 2px;
}

.badge.lore {
    background: white;
    color: var(--author-color);
    border-color: var(--author-color);
    box-shadow: 0 1px 0 rgba(0,0,0,0.03);
    border-radius: 0;
}

.badge.canon {
    background: var(--author-color);
    color: white;
    border-color: color-mix(in srgb, var(--author-color) 20%, black);
    box-shadow: 0 1px 4px color-mix(in srgb, var(--author-color) 12%, rgba(0,0,0,0.08));
    border-radius: 0;
}

.badge.record-type {
    background: #ece7f5;
    color: #4e3b70;
    border-color: #c8b9df;
    text-transform: lowercase;
}

.story-content {
    margin: 15px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.story-copy-box {
    width: 100%;
    max-width: 88%;
    margin: 0 auto;
    padding: 18px 22px 20px 22px;
    background: linear-gradient(180deg, #ffffff 0%, color-mix(in srgb, var(--author-color) 6%, #fffaf2) 100%);
    border: 1px solid var(--author-color-border);
    box-shadow: 0 12px 24px rgba(17, 24, 39, 0.07);
}

.story-copy-box-longform {
    max-width: 92%;
}

.story-title {
    margin: 0 0 14px 0;
    padding: 0 0 12px 0;
    border-bottom: 1px solid color-mix(in srgb, var(--author-color) 22%, white);
    font-family: Arial, sans-serif;
    font-weight: 700;
    font-size: 1.5rem;
    line-height: 1.08;
    letter-spacing: 0.01em;
    color: color-mix(in srgb, var(--author-color) 82%, black);
    text-align: left;
}

@media (max-width: 768px) {
    .story-copy-box,
    .story-copy-box-longform {
        max-width: 100%;
        width: 100%;
        padding: 14px 14px 16px 14px;
        box-sizing: border-box;
    }

    .story-title {
        font-size: 1.2rem;
        padding-bottom: 10px;
    }
}

@media (max-width: 768px) {
    .story-content {
        width: 100%;
        max-width: 100%;
    }
}

.story-text {
    font-size: 16px;
    line-height: 1.62;
    color: var(--story-text-color);
    word-wrap: break-word;
    text-align: left;
    width: 100%;
    max-width: 100%;
    margin: 0;
    font-weight: 400;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
}

.story-text-longform {
    text-align: left;
    line-height: 1.72;
    font-size: 1rem;
    max-width: 100%;
}

.story-text-bsky {
    white-space: pre-wrap;
    text-align: center;
    line-height: 1.22;
    max-width: 80%;
    margin: 0 auto;
    padding: 20px 24px;
    background: #ffffff;
    border: 1px solid var(--author-color-border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.story-text p {
    margin: 0;
}

.story-text p + p {
    margin-top: 1.1rem;
}

.story-expand-btn {
    align-self: flex-start;
    margin: -2px auto 0 auto;
    padding: 10px 16px;
    border: 1px solid color-mix(in srgb, var(--author-color) 42%, white);
    background: linear-gradient(135deg, color-mix(in srgb, var(--author-color) 14%, white) 0%, color-mix(in srgb, var(--author-color) 7%, #f7f1ff) 100%);
    color: color-mix(in srgb, var(--author-color) 84%, black);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-radius: 999px;
    box-shadow: 0 8px 18px rgba(17, 24, 39, 0.08);
    cursor: pointer;
    transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.story-expand-btn:hover {
    background: linear-gradient(135deg, color-mix(in srgb, var(--author-color) 20%, white) 0%, color-mix(in srgb, var(--author-color) 10%, #fff6ed) 100%);
    border-color: color-mix(in srgb, var(--author-color) 56%, white);
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(17, 24, 39, 0.12);
}

@media (max-width: 768px) {
    .story-text {
        line-height: 1.45;
        max-width: 100%;
        width: 100%;
        box-sizing: border-box;
        font-size: 14.5px;
    }

    .story-text-longform {
        max-width: 100%;
        font-size: 0.97rem;
        line-height: 1.66;
    }

    .story-text-bsky {
        max-width: 100%;
        width: 100%;
        padding: 10px 12px;
        box-sizing: border-box;
        line-height: 1.45;
    }

    .story-expand-btn {
        width: 100%;
        justify-content: center;
        text-align: center;
    }
}

.story-image {
    margin: 20px auto;
    max-width: 600px;
    width: 100%;
    border: 1px solid var(--author-color-border);
    display: block;
    cursor: pointer;
    transition: transform 0.2s ease;
}

@media (max-width: 768px) {
    .story-image {
        max-width: 100%;
        width: 100%;
        margin: 10px auto 8px auto;
        box-sizing: border-box;
    }
}

.story-card.canon .story-image {
    border: 2px solid var(--author-color);
}

.story-image:hover {
    transform: scale(1.02);
}

.story-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--author-color-border);
    font-size: 14px;
    color: var(--author-color-text);
}

.story-card.canon .story-meta {
    border-top: 1px solid var(--author-color);
    color: var(--author-color-text-light);
}

.story-meta-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.post-date {
    font-style: italic;
}

.post-link {
    color: var(--author-color-text);
    text-decoration: none;
    font-weight: 600;
}

.story-meta-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.raw-link {
    font-size: 0.75rem;
    font-family: monospace;
    color: var(--author-color-text);
    opacity: 0.5;
    text-decoration: none;
    padding: 2px 6px;
    border: 1px solid color-mix(in srgb, var(--author-color) 30%, transparent);
    border-radius: 3px;
    transition: opacity 0.2s, border-color 0.2s;
}

.raw-link:hover {
    opacity: 1;
    border-color: var(--author-color);
    text-decoration: none;
}

.raw-link.raw-canon {
    color: var(--author-color);
    opacity: 0.6;
}

.story-card.canon .post-link {
    color: var(--author-color-text-light);
}

.post-link:hover {
    text-decoration: underline;
}

/* Story Actions Bar - inline with meta */
.story-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    padding-left: 12px;
    margin-left: 12px;
    border-left: 1px solid color-mix(in srgb, var(--author-color) 25%, transparent);
}

.story-card.canon .story-actions {
    border-left: 1px solid color-mix(in srgb, var(--author-color) 40%, transparent);
}

.story-action-btn {
    padding: 4px 10px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
    color: inherit; /* Inherit from parent (story-meta) */
}

.story-action-btn:hover {
    opacity: 0.7;
}

.story-action-btn.like-btn.liked {
    color: #dc2626;
    opacity: 0.8;
}

.story-action-btn.repost-btn.reposted {
    color: #059669;
    opacity: 0.8;
}

.action-count {
    font-size: 11px;
    font-weight: 600;
    opacity: 0.8;
}

.empty-state {
    text-align: center;
    padding: 30px;
    background-color: var(--internal-background-color);
    border: 1px solid var(--primary-color);
    color: #333366;
}

/* Shadowbox styles */
.image-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.92);
    z-index: 9998;
    opacity: 0;
    transition: opacity 0.3s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-overlay img {
    max-width: 85vw;
    max-height: 85vh;
    border: 1px solid rgba(255, 255, 255, 0.3);
    opacity: 0;
    transform: scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    z-index: 10000;
}

/* Dreamer Hover Card */
.dreamer-link {
    transition: text-decoration 0.2s ease;
}

.dreamer-link:hover {
    text-decoration: underline;
}

.dreamer-hover-card {
    position: fixed;
    background: rgba(250, 247, 252, 0.98);
    border: 2px solid var(--primary-color);
    padding: 16px;
    border-radius: 0;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    z-index: 10001;
    min-width: 280px;
    max-width: 320px;
    pointer-events: none;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.dreamer-hover-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.dreamer-hover-header {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 12px;
}

.dreamer-hover-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 2px solid var(--primary-color);
    object-fit: cover;
}

.dreamer-hover-info {
    flex: 1;
    min-width: 0;
}

.dreamer-hover-name {
    font-weight: 700;
    font-size: 15px;
    color: var(--primary-color);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dreamer-hover-handle {
    font-size: 13px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dreamer-hover-description {
    font-size: 13px;
    color: #444;
    line-height: 1.4;
    margin-bottom: 12px;
    max-height: 60px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
}

.dreamer-hover-stats {
    display: flex;
    gap: 16px;
    align-items: center;
    font-size: 12px;
    color: #666;
    padding-top: 8px;
    border-top: 1px solid rgba(135, 64, 141, 0.2);
}

.dreamer-hover-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dreamer-hover-souvenirs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    flex: 1;
    justify-content: flex-end;
}

.dreamer-hover-souvenir-icon {
    width: 28px;
    height: 28px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.dreamer-hover-stat-value {
    font-weight: 700;
    color: var(--primary-color);
}

.dreamer-hover-stat-label {
    font-size: 11px;
    text-transform: uppercase;
    opacity: 0.7;
}

@media (max-width: 768px) {
    .controls {
        flex-direction: column;
        align-items: stretch;
        padding: 12px;
        gap: 0.75rem;
    }
    
    .controls-left {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .share-story-btn {
        font-size: 0.9em;
        padding: 12px 16px;
        width: 100%;
        text-align: center;
        justify-content: center;
    }

    .filter-buttons {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
        width: 100%;
    }

    .filter-btn {
        font-size: 0.8em;
        padding: 10px 12px;
        text-align: center;
        white-space: nowrap;
    }

    .stats {
        text-align: center;
        font-size: 13px;
        padding-top: 4px;
        border-top: 1px solid #e0e0e0;
    }
    
    .story-meta {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        flex-wrap: nowrap;
    }
    
    .story-meta-left {
        flex-direction: row;
        align-items: center;
        gap: 6px;
        flex-wrap: nowrap;
        flex: 1;
        min-width: 0;
    }
    
    .post-date {
        font-size: 11px;
        white-space: nowrap;
    }
    
    .story-actions {
        padding-left: 6px;
        margin-left: 6px;
        border-left: 1px solid color-mix(in srgb, var(--author-color) 25%, transparent);
        display: flex;
        gap: 4px;
        flex-wrap: nowrap;
    }
    
    .story-card.canon .story-actions {
        border-left: 1px solid color-mix(in srgb, var(--author-color) 40%, transparent);
    }
    
    .story-action-btn {
        font-size: 10px;
        padding: 2px 6px;
        white-space: nowrap;
    }
    
    .action-count {
        font-size: 9px;
    }
    
    .post-link {
        font-size: 11px;
        white-space: nowrap;
        flex-shrink: 0;
    }
}

/* Extra small screens (< 480px) */
@media (max-width: 480px) {
    .story-unified-header {
        border-width: 1px;
        margin-bottom: 12px;
    }
    
    .story-header-top {
        padding: 12px;
        gap: 8px;
    }
    
    .story-logo-container {
        gap: 3px;
    }
    
    .story-logo-container img {
        height: 56px;
    }
    
    .story-header-description {
        font-size: 0.65em;
        line-height: 1.5;
    }
    
    .learn-more-btn {
        font-size: 0.55em;
        padding: 3px 10px;
    }
    
    .story-container {
        padding: 8px 10px 16px 10px;
    }
    
    .controls {
        padding: 10px;
        gap: 0.6rem;
    }
    
    .share-story-btn {
        font-size: 0.85em;
        padding: 10px 14px;
    }
    
    .share-story-btn .rotating-word {
        width: 50px;
    }
    
    .filter-btn {
        font-size: 0.75em;
        padding: 8px 10px;
    }
    
    .story-card {
        padding: 12px 10px;
        margin-bottom: 12px;
    }
    
    .story-card-header {
        gap: 0.5rem;
        margin-bottom: 0.6rem;
        padding-bottom: 0.6rem;
    }
    
    .author-avatar {
        width: 28px;
        height: 28px;
    }
    
    .author-name {
        font-size: 12px;
    }
    
    .author-handle {
        font-size: 10px;
    }
    
    .badge {
        font-size: 10px;
        padding: 3px 8px;
    }
    
    .story-text {
        padding: 6px 8px;
        font-size: 12.5px;
        line-height: 1.45;
    }
    
    .story-image {
        margin: 8px auto 6px auto;
    }
    
    .story-meta {
        gap: 6px;
    }
    
    .post-date {
        font-size: 10px;
    }
    
    .post-link {
        font-size: 10px;
    }
    
    .story-action-btn {
        font-size: 9px;
        padding: 2px 4px;
    }
    
    .action-count {
        font-size: 8px;
    }
    
    .loading {
        padding: 20px;
        font-size: 14px;
    }
    
    .stats {
        font-size: 12px;
    }
}

/* Hide button styling */
.story-action-btn.hide-btn {
    color: #888;
}

.story-action-btn.hide-btn:hover {
    color: #666;
}

/* Delete button styling - same as hide for consistency */
.story-action-btn.delete-btn {
    color: #888;
}

.story-action-btn.delete-btn:hover {
    color: #666;
}

/* Hide confirmation popup */
.hide-confirm-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.hide-confirm-popup.show {
    opacity: 1;
    pointer-events: auto;
}

.hide-confirm-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
}

.hide-confirm-dialog {
    position: relative;
    background: var(--internal-background-color, #fefefe);
    border: 2px solid var(--user-color, var(--primary-color, #734ba1));
    border-radius: 0;
    padding: 16px 20px;
    max-width: 320px;
    width: 85%;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    transform: scale(0.95);
    transition: transform 0.2s ease;
}

.hide-confirm-popup.show .hide-confirm-dialog {
    transform: scale(1);
}

.hide-confirm-dialog h3 {
    margin: 0 0 8px 0;
    font-size: 1rem;
    color: var(--user-color, var(--primary-color, #734ba1));
}

.hide-confirm-dialog p {
    margin: 0 0 8px 0;
    font-size: 0.85rem;
    color: #444;
    line-height: 1.3;
}

.hide-confirm-dialog .hide-note {
    font-size: 0.8rem;
    color: #888;
    font-style: italic;
}

.hide-confirm-actions {
    display: flex;
    gap: 10px;
    margin-top: 14px;
    justify-content: flex-end;
}

.hide-cancel-btn,
.hide-confirm-btn {
    padding: 6px 12px;
    border-radius: 0;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.hide-cancel-btn {
    background: #eee;
    border: 1px solid #ccc;
    color: #666;
}

.hide-cancel-btn:hover {
    background: #ddd;
}

.hide-confirm-btn {
    background: var(--user-color, var(--primary-color, #734ba1));
    border: 1px solid var(--user-color, var(--primary-color, #734ba1));
    color: white;
}

.hide-confirm-btn:hover {
    opacity: 0.9;
}

.hide-confirm-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
/* Delete confirmation popup */
.delete-confirm-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10600;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.delete-confirm-popup.show {
    opacity: 1;
    pointer-events: auto;
}

.delete-confirm-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.delete-confirm-dialog {
    position: relative;
    background: #ffffff;
    border: 1.5px solid color-mix(in srgb, var(--reverie-core-color, #734ba1) 40%, white);
    border-radius: 0;
    max-width: 430px;
    width: min(90%, 430px);
    overflow: hidden;
    box-shadow:
        0 4px 6px rgba(0, 0, 0, 0.07),
        0 10px 20px rgba(0, 0, 0, 0.1),
        0 20px 40px rgba(115, 75, 161, 0.16);
    transform: translateY(-16px) scale(0.97);
    transition: transform 0.3s ease;
}

.delete-confirm-popup.show .delete-confirm-dialog {
    transform: translateY(0) scale(1);
}

.delete-confirm-header {
    padding: 22px 28px 18px;
    text-align: center;
    border-bottom: 1px solid color-mix(in srgb, var(--reverie-core-color, #734ba1) 22%, white);
    background:
        radial-gradient(100% 140% at 0% 0%, color-mix(in srgb, var(--reverie-core-color, #734ba1) 14%, white) 0%, transparent 70%),
        radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--reverie-core-color, #734ba1) 10%, white) 0%, transparent 72%),
        linear-gradient(180deg, #ffffff 0%, #faf9fc 100%);
}

.delete-confirm-icon {
    width: 28px;
    height: 28px;
    color: #b42318;
    margin: 0 auto 10px;
    display: block;
}

.delete-confirm-dialog h3 {
    margin: 0;
    font-size: 1.18rem;
    color: #2d2d2d;
    font-weight: 700;
}

.delete-confirm-dialog p {
    margin: 0;
    padding: 0 28px;
    font-size: 0.92rem;
    color: #555;
    line-height: 1.5;
    text-align: center;
}

.delete-confirm-dialog .delete-warning {
    margin-top: 10px;
    color: #b42318;
    font-weight: 600;
}

.delete-confirm-actions {
    display: flex;
    gap: 12px;
    margin-top: 18px;
    padding: 18px 28px 22px;
    justify-content: center;
    border-top: 1px solid #efecf7;
    background: linear-gradient(180deg, #ffffff 0%, #faf9fc 100%);
}

.delete-cancel-btn,
.delete-confirm-btn {
    min-width: 118px;
    padding: 10px 18px;
    border-radius: 0;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid;
}

.delete-cancel-btn {
    background: #ffffff;
    border-color: #d5cee6;
    color: #5f4b82;
}

.delete-cancel-btn:hover {
    border-color: var(--reverie-core-color, #734ba1);
    color: #4f3c72;
    background: color-mix(in srgb, var(--reverie-core-color, #734ba1) 8%, white);
}

.delete-confirm-btn {
    background: #b42318;
    border-color: #b42318;
    color: white;
}

.delete-confirm-btn:hover {
    background: #991b1b;
    border-color: #991b1b;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(180, 35, 24, 0.25);
}

.delete-confirm-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}