.storybook-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 1rem;
}

.storybook-modal.active {
    display: flex;
}

.storybook-modal .modal-content {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 1400px;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.storybook-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    background: #f8fafc;
}

.storybook-modal .modal-header h2 {
    margin: 0;
    font-size: 1.1rem;
}

.modal-controls {
    display: flex;
    gap: 0.5rem;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    background: white;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.icon-btn.hidden {
    display: none;
}

.icon-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.modal-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0.75rem;
    overflow: hidden;
}

.book-stage {
    flex: 1;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    min-height: 70vh;
    perspective: 1200px;
}

.book-stage.turning-next {
    animation: pageTurnNext 1.1s ease-in-out;
}

.book-stage.turning-prev {
    animation: pageTurnPrev 1.1s ease-in-out;
}

@keyframes pageTurnNext {
    0% { transform: rotateY(0) scale(1); }
    40% { transform: rotateY(-18deg) scale(0.995); }
    100% { transform: rotateY(0) scale(1); }
}

@keyframes pageTurnPrev {
    0% { transform: rotateY(0) scale(1); }
    40% { transform: rotateY(18deg) scale(0.995); }
    100% { transform: rotateY(0) scale(1); }
}

#storybookCanvas {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
}

.page-indicator {
    margin-top: 0.5rem;
    text-align: center;
    color: #6b7280;
    font-size: 0.85rem;
}

.voice-status {
    margin-top: 0.25rem;
    text-align: center;
    font-size: 0.8rem;
    color: #6b7280;
}

.storybook-page .card-title {
    color: #111827;
    background: rgba(255, 255, 255, 0.6);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
    padding: 0.4rem 0.6rem;
}

.storybook-page .colouring-card,
.storybook-page .card-preview,
.storybook-page .preview-image,
.storybook-page .card-image {
    height: 400px;
    min-height: 400px;
}

.storybook-page .card-image {
    object-fit: cover;
    object-position: center;
}

.storybook-page .new-badge {
    top: 8px;
    right: -42px;
    left: auto;
    width: 140px;
    text-align: center;
    border-radius: 0;
    transform: rotate(40deg);
    padding: 4px 10px;
}

.storybook-page .card-age {
    position: absolute;
    bottom: 12px;
    right: -42px;
    left: auto;
    width: 140px;
    text-align: center;
    font-size: 0.75rem;
    background: rgba(255, 255, 255, 0.6);
    color: #111827;
    padding: 4px 10px;
    border-radius: 0;
    transform: rotate(-40deg);
}

.storybooks-footer-note {
    margin-top: 1rem;
    text-align: center;
    font-size: 0.85rem;
    color: #6b7280;
}
