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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #FFF8F0 0%, #FFE8D6 100%);
    color: #000;
    overflow: hidden;
    height: 100vh;
    height: 100dvh; /* Use dynamic viewport height to account for browser UI */
    width: 100vw;
    padding-bottom: env(safe-area-inset-bottom);
}

.storybook-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh; /* Use dynamic viewport height to account for browser UI */
    width: 100vw;
    position: relative;
    background: linear-gradient(135deg, #FFF8F0 0%, #FFE8D6 100%);
    padding-bottom: env(safe-area-inset-bottom);
}

/* Logo Header */
.logo-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 16px 16px;
    background: transparent;
    z-index: 85;
}

.logo-title {
    font-size: 32px;
    font-weight: 700;
    color: #FF6B22;
    margin: 0;
    text-align: center;
    letter-spacing: -0.5px;
}

.logo-subtitle {
    font-size: 16px;
    font-weight: 400;
    color: #E08B5D;
    margin: 8px 0 0;
    text-align: center;
}

/* Navigation Header */
.nav-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background-color: rgba(255, 248, 240, 0.9);
    z-index: 90;
}

.icon-button {
    background: none;
    border: none;
    color: #000;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.icon-button:hover {
    opacity: 0.7;
}

.icon-button:active {
    opacity: 0.5;
}

.icon-button svg {
    width: 24px;
    height: 24px;
}

.close-button {
    background: none;
    border: none;
    color: #000;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.close-button:hover {
    opacity: 0.7;
}

.close-button svg {
    width: 24px;
    height: 24px;
}

.page-indicator {
    flex: 1;
    text-align: center;
    font-size: 16px;
    font-weight: 500;
    color: #000;
    margin-left: -40px; /* Center by offsetting close button */
    margin-right: -40px; /* Center by offsetting play button */
}

/* Story Content Area */
.story-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    min-height: 0; /* Allow flex item to shrink below content size */
}

.story-text-container {
    padding: 20px 24px;
    background-color: rgba(255, 248, 240, 0.9);
    z-index: 10;
}

.story-text-container.hidden {
    display: none;
}

.story-text {
    font-size: 18px;
    line-height: 1.6;
    color: #000;
    text-align: left;
}

.story-image-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: linear-gradient(135deg, #FFF8F0 0%, #FFE8D6 100%);
    position: relative;
    padding: 16px;
}

.story-image-container img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Bottom Navigation */
.bottom-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 24px;
    padding-bottom: calc(4px + env(safe-area-inset-bottom) + 10px); /* Minimal extra space for browser toolbar */
    background-color: rgba(255, 248, 240, 0.9);
    z-index: 100;
    min-height: 20px;
    margin-bottom: 0;
    position: relative;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1); /* Add shadow to make it stand out from browser UI */
}

.nav-button {
    background: none;
    border: none;
    color: #000;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
    min-width: 44px;
    min-height: 44px;
}

.nav-button:hover:not(:disabled) {
    opacity: 0.7;
}

.nav-button:active:not(:disabled) {
    opacity: 0.5;
}

.nav-button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.nav-button svg {
    width: 24px;
    height: 24px;
}

.page-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 1;
}

.page-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.3);
    transition: background-color 0.3s, transform 0.3s;
}

.page-dot.active {
    background-color: #ff9500;
    transform: scale(1.2);
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 248, 240, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    gap: 16px;
}

.loading-overlay.hidden {
    display: none;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 0, 0, 0.3);
    border-top-color: #000;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-overlay p {
    color: #000;
    font-size: 16px;
}

/* Error Message */
.error-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(255, 59, 48, 0.9);
    color: #fff;
    padding: 20px 24px;
    border-radius: 12px;
    z-index: 1001;
    text-align: center;
    max-width: 80%;
    font-size: 16px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .logo-title {
        font-size: 28px;
    }

    .logo-subtitle {
        font-size: 14px;
    }

    .logo-header {
        padding: 16px 12px 12px;
    }

    .story-text {
        font-size: 16px;
    }

    .story-text-container {
        padding: 16px 20px;
    }
}


