/* Ink & Inspire - Modern Design System */

:root {
    /* Color Palette — Vidya ribbon theme */
    --primary: #E73038;
    --primary-hover: #C41B28;
    --secondary: #5A1851;
    --accent: #5A1851;
    --purple: #5A1851;
    --yellow: #F4C01D;

    --bg-body: #FFFFFF;
    --bg-card: #FFFFFF;
    --bg-input: #F9FAFB;

    --text-main: #111827;
    --text-muted: #4B5563;
    --text-light: #9CA3AF;

    --border: #E8D9A8;
    --border-focus: #E73038;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

    /* Spacing & Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 1rem;

    /* Mobile app shell */
    --app-header-height: 56px;
    --nav-drawer-width: min(300px, 88vw);
}

/* Reset & Base */
* {
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
    max-width: 100%;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #E6242E;
    background-image: url("images/theme-bg.jpg");
    background-repeat: no-repeat;
    background-position: center bottom;
    background-size: cover;
    background-attachment: fixed;
    color: var(--text-main);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    -webkit-tap-highlight-color: rgba(231, 48, 56, 0.12);
    max-width: 100%;
}

/* App-like mobile: limit pinch/double-tap zoom + iOS focus zoom; pair with viewport meta on all HTML pages */
@media (max-width: 900px) {

    html,
    body {
        touch-action: manipulation;
        overscroll-behavior-x: none;
    }

    input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]),
    textarea,
    select {
        font-size: max(16px, 1rem);
    }

    input[type="file"] {
        font-size: max(14px, 0.9rem);
    }
}


body::before {
    display: none;
}

@keyframes subtleMove {

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

    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

/* Ensure content is above the background pattern */
body>* {
    position: relative;
    z-index: 1;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--primary-hover);
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    padding-bottom: max(20px, env(safe-area-inset-bottom, 0px));
    width: 100%;
}

main#app.container {
    min-width: 0;
    overflow-x: hidden;
}

/* Header */
header {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    padding: 0.65rem max(1rem, env(safe-area-inset-right, 0px)) 0.65rem max(1rem, env(safe-area-inset-left, 0px));
    padding-top: max(0.65rem, env(safe-area-inset-top, 0px));
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 50;
    border-bottom: 1px solid var(--border);
    min-height: var(--app-header-height);
    box-sizing: border-box;
}

.logo {
    display: flex;
    align-items: center;
    padding: 0;
    flex-shrink: 0;
}

.logo img {
    height: 45px;
    /* Balanced size */
    width: auto;
    object-fit: contain;
    border-radius: 6px;
    transition: transform 0.3s ease;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

.logo:hover img {
    transform: scale(1.05);
    /* subtle zoom on hover */
}

#nav-menu.site-nav,
#nav-menu {
    list-style: none;
    display: flex;
    gap: 1.5rem;
    margin: 0;
    padding: 0;
    align-items: center;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 0;
    margin: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.nav-toggle-bar {
    display: block;
    width: 20px;
    height: 2px;
    margin: 0 auto;
    background: var(--text-main);
    border-radius: 1px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-toggle.is-open .nav-toggle-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.nav-toggle.is-open .nav-toggle-bar:nth-child(2) {
    opacity: 0;
}

.nav-toggle.is-open .nav-toggle-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Mobile menu backdrop (app-style drawer) */
.nav-drawer-backdrop {
    display: none;
}

@media (max-width: 900px) {
    .nav-drawer-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1040;
        background: rgba(15, 23, 42, 0.45);
        backdrop-filter: blur(3px);
        -webkit-backdrop-filter: blur(3px);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity 0.22s ease, visibility 0.22s;
    }

    .nav-drawer-backdrop.is-visible {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    header {
        z-index: 1060;
    }
}

.composition-controls-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-top: 20px;
}

@media (min-width: 600px) {
    .composition-controls-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 900px) {
    .composition-controls-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.dashboard-stories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
    gap: 1.25rem;
}

.dashboard-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem 3rem;
    box-sizing: border-box;
}

.dashboard-page-head {
    margin-bottom: 1.5rem;
}

.dashboard-page-title {
    margin: 0 0 0.35rem;
    font-size: clamp(1.65rem, 4vw, 2rem);
    letter-spacing: -0.03em;
}

.dashboard-page-lead {
    margin: 0;
    font-size: 1rem;
    color: var(--text-muted);
    max-width: 42rem;
    line-height: 1.5;
}

.dashboard-stat-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.dashboard-stat-card {
    text-align: center;
    padding: 1.25rem 1rem !important;
}

.dashboard-stat-card__label {
    margin: 0 0 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.dashboard-stat-card__value {
    margin: 0;
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.1;
}

.dashboard-stat-card__value--muted {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-muted);
}

.dashboard-section-title {
    margin: 0 0 0.5rem;
    font-size: 1.25rem;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

#nav-menu li a {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.95rem;
}

#nav-menu li a:hover {
    color: var(--primary);
}

/* Cards & Containers */
.card,
.story-wizard,
.stat-card,
.story-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    transition: transform 0.2s, box-shadow 0.2s;
}

.story-wizard {
    max-width: 800px;
    width: 100%;
    margin: 40px auto;
    padding: 40px;
    box-sizing: border-box;
    position: relative;
}

.story-busy-overlay {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: #1a1218;
    text-align: center;
}

html.story-busy-lock,
body.story-busy-lock {
    overflow: hidden !important;
    overscroll-behavior: none;
    touch-action: none;
}

.story-wizard--busy {
    pointer-events: none;
}

.story-wizard--busy .story-busy-overlay {
    pointer-events: auto;
}

.story-busy-overlay[hidden] {
    display: none !important;
}

.story-busy-card {
    width: min(100%, 320px);
    padding: 28px 22px 22px;
    background: #fff;
    border-radius: 20px;
    border: 1px solid rgba(255, 211, 0, 0.55);
    box-shadow: 0 18px 40px rgba(107, 29, 36, 0.22);
}

.story-busy-spinner {
    position: relative;
    width: 58px;
    height: 58px;
    margin: 0 auto 14px;
}

.story-busy-spinner span {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 4px solid rgba(237, 48, 59, 0.16);
    border-top-color: #ed303b;
    animation: storyBusySpin 0.85s linear infinite;
}

.story-busy-spinner span:last-child {
    inset: 8px;
    border-width: 3px;
    border-color: rgba(255, 211, 0, 0.25);
    border-top-color: #ffd300;
    animation-duration: 1.15s;
    animation-direction: reverse;
}

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

.story-busy-overlay-title,
.story-modal-generating-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 800;
    color: #8b1e2d;
}

.story-busy-overlay-msg,
.story-modal-generating-msg {
    margin: 8px 0 0;
    max-width: none;
    color: #6b6b6b;
    font-weight: 600;
    line-height: 1.45;
    font-size: 0.92rem;
}

.story-busy-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 16px;
}

.story-busy-dots i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ed303b;
    animation: storyBusyDot 1s ease-in-out infinite;
}

.story-busy-dots i:nth-child(2) {
    background: #ffd300;
    animation-delay: 0.15s;
}

.story-busy-dots i:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes storyBusyDot {
    0%, 80%, 100% { transform: scale(0.7); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .story-busy-spinner span,
    .story-busy-dots i { animation: none; }
}

/* Story steps — layout fixes for mobile (see error img/ screenshots) */
.story-media-box {
    background: var(--bg-input);
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    border: 1px dashed var(--border);
    max-width: 100%;
    box-sizing: border-box;
}

.story-media-box-title {
    display: block;
    margin-bottom: 0.65rem;
    font-size: 0.95rem;
}

.story-media-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem;
}

.story-media-file {
    flex: 1 1 12rem;
    min-width: 0;
    font-size: 1rem;
    max-width: 100%;
}

.story-media-process-btn {
    flex: 0 0 auto;
}

.story-media-hint {
    display: block;
    margin-top: 0.5rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    line-height: 1.45;
}

.story-image-slot {
    width: 100%;
    max-width: 100%;
    margin-bottom: 10px;
    text-align: center;
    overflow: hidden;
    box-sizing: border-box;
    position: relative;
}
.story-image-slot.is-generating {
    min-height: 120px;
}
.story-image-generating {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.82);
    color: #9f1239;
    font-weight: 800;
    font-size: 0.92rem;
    z-index: 2;
    border-radius: var(--radius-md);
}
.story-image-generating-spin {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(237, 48, 59, 0.2);
    border-top-color: #ed303b;
    border-radius: 50%;
    animation: storyImgSpin 0.75s linear infinite;
}
@keyframes storyImgSpin {
    to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
    .story-image-generating-spin { animation: none; border-top-color: #ed303b; }
}

.story-generated-image {
    max-width: 100%;
    height: auto;
    display: block;
    margin-left: auto;
    margin-right: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.story-image-placeholder {
    min-height: 150px;
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    border-radius: var(--radius-md);
    border: 1px dashed var(--border);
}

.story-segment-card {
    margin-bottom: 1.25rem;
    padding: 12px;
    border-radius: var(--radius-md);
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

.story-segment-card--neutral {
    background: #f3f4f6;
}

.story-segment-card--cover {
    background: #e0f7fa;
    border: 1px solid #b2ebf2;
}

.story-field-block {
    margin-bottom: 10px;
    max-width: 100%;
}

.story-prompt-section-label {
    display: block;
    margin-bottom: 6px;
}

.story-prompt-toggle-btn {
    display: inline-block;
    margin: 0 0 10px;
    padding: 8px 14px;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary, #5b21b6);
    background: #fff;
    border: 1px solid var(--border, #d1d5db);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.story-prompt-toggle-btn:hover {
    background: #f9fafb;
    border-color: var(--primary, #7c3aed);
}

.story-prompt-reveal {
    margin-top: 4px;
}

.story-prompt-reveal[hidden] {
    display: none !important;
}

.story-page-block {
    margin-bottom: 20px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

.story-segment-input,
.story-segment-textarea {
    width: 100%;
    max-width: 100%;
    padding: 10px 12px;
    margin-top: 6px;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: #fff;
}

.story-segment-textarea {
    resize: vertical;
    line-height: 1.5;
}

.story-segment-textarea--short {
    min-height: 4rem;
}

.story-segment-primary-btn {
    width: 100%;
    margin-top: 0.35rem;
}
.story-segment-primary-btn.is-generating {
    opacity: 0.92;
    cursor: wait;
    pointer-events: none;
    filter: saturate(0.85);
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35);
}

.story-wizard h1 {
    color: #1e293b;
    font-size: 1.75rem;
    margin-bottom: 0.25rem;
}

.story-step-lead {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin: 0 0 1rem;
}

.story-textarea {
    width: 100%;
    padding: 12px 14px;
    min-height: 140px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-input);
    font-size: 1rem;
    line-height: 1.55;
    resize: vertical;
}

.story-page-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 1rem;
    color: var(--text-main);
}

.story-improvise-section {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.story-section-improvise-pill {
    display: inline-block;
    margin-bottom: 1rem;
    padding: 0.4rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--accent);
    border: 1px solid rgba(139, 92, 246, 0.35);
    border-radius: 999px;
    background: rgba(139, 92, 246, 0.08);
}

.story-lang-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 1.25rem;
}

.story-lang-select {
    min-width: 200px;
}

.story-improvise-field-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.story-improvise-prompt-box {
    margin-bottom: 1rem;
    min-height: 100px;
}

.story-improvise-submit-btn {
    width: 100%;
    max-width: 320px;
}

.story-improvise-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 1.75rem;
    align-items: stretch;
}

.story-improvise-nav .story-btn-outline,
.story-improvise-nav .story-btn-next-inline {
    flex: 1 1 160px;
    margin-top: 0;
    width: auto;
    min-height: 2.75rem;
}

.story-wizard-step-nav {
    margin-top: 1.5rem;
}

.story-improvise-nav .story-btn-finish {
    background: linear-gradient(135deg, #059669, #10b981) !important;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.35);
    color: #fff !important;
    border: none !important;
}

.story-improvise-nav .story-btn-finish:hover {
    box-shadow: 0 6px 22px rgba(16, 185, 129, 0.45);
}

.story-modal-backdrop {
    position: fixed;
    inset: 0;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    z-index: 1080;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    -webkit-overflow-scrolling: touch;
}

.story-modal-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 480px;
    max-height: min(90dvh, 640px);
    overflow: hidden;
    background: var(--bg-panel, #fff);
    border-radius: var(--radius-lg, 12px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    padding: 1.25rem 1.2rem 0;
    border: 1px solid var(--border);
}

.story-modal-panel--wide {
    max-width: min(920px, 96vw);
    max-height: min(94dvh, 780px);
}

.story-postcard-layout-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin: 4px 0 8px;
}

.story-postcard-layout-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
    padding: 14px 10px 12px;
    border: 2px solid #f0e4a8;
    border-radius: 18px;
    background: #fff;
    cursor: pointer;
    color: inherit;
    font: inherit;
    position: relative;
    min-height: 100%;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.story-postcard-layout-card:hover {
    border-color: #ed303b;
    transform: translateY(-2px);
}

.story-postcard-layout-card strong {
    font-size: 1rem;
    color: #8b1e2d;
    letter-spacing: -0.02em;
}

.story-postcard-layout-card > span {
    font-size: 0.78rem;
    color: #6b6b6b;
    line-height: 1.35;
}

.pc-pick-selected {
    display: none;
    font-style: normal;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #ed303b;
    background: #fff5f5;
    border: 1px solid rgba(237, 48, 59, 0.2);
    border-radius: 999px;
    padding: 3px 10px;
}

.story-postcard-layout-card--active {
    border-color: #ed303b;
    box-shadow: 0 10px 22px rgba(237, 48, 59, 0.16);
    background: linear-gradient(180deg, #fff8f8, #fff);
}

.story-postcard-layout-card--active .pc-pick-selected {
    display: inline-flex;
}

.pc-pick-visual {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 78px;
}

.pc-pick-count {
    position: absolute;
    top: -8px;
    right: -10px;
    min-width: 28px;
    height: 28px;
    padding: 0 7px;
    border-radius: 999px;
    background: #ffd300;
    color: #6b1d24;
    font-weight: 800;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 0 #c9a400;
    z-index: 1;
}

.pc-mini {
    display: flex;
    flex-direction: column;
    width: 78px;
    height: 110px;
    padding: 6px;
    border-radius: 8px;
    background: #fff8e8;
    border: 3px solid #6b1d24;
    outline: 1px solid #d4af37;
    outline-offset: -6px;
    box-shadow: 0 8px 16px rgba(107, 29, 36, 0.12);
}

.pc-mini-head {
    display: block;
    height: 8px;
    margin-bottom: 5px;
    border-radius: 2px;
    background: #6b1d24;
}

.pc-mini-grid {
    flex: 1;
    display: grid;
    gap: 3px;
    min-height: 0;
}

.pc-mini--1 .pc-mini-grid { grid-template-columns: 1fr; }
.pc-mini--4 .pc-mini-grid { grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(2, 1fr); }
.pc-mini--6 .pc-mini-grid { grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(3, 1fr); }
.pc-mini--8 .pc-mini-grid { grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(4, 1fr); }

.pc-mini-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #f3d37a, #e0b95a);
    border-radius: 2px;
    color: #6b1d24;
    font-size: 0.62rem;
    font-weight: 800;
}

.story-modal-generating {
    position: absolute;
    inset: 0;
    z-index: 6;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(18, 12, 16, 0.28);
    backdrop-filter: blur(6px);
    text-align: center;
}

.story-modal-generating[hidden] {
    display: none !important;
}

.story-postcard-generating {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 8px auto 18px;
    padding: 14px 18px;
    max-width: 640px;
    border-radius: 12px;
    background: #fff5f5;
    border: 1px solid #f0c4c8;
    color: #8b1e2d;
    font-weight: 600;
}

.pc-stage {
    display: flex;
    justify-content: center;
    width: 100%;
}

.pc-sheet {
    --pc-copy: 13px;
    --pc-title: 1.28em;
    --pc-gap: 8px;
    --pc-img-frac: 0.6fr;
    margin: 8px auto 18px;
    width: min(96vw, 1080px, calc((100dvh - 200px) * 297 / 210));
    max-width: 1100px;
    aspect-ratio: 297 / 210;
    background: #fbf6ea;
    border: 10px solid #6b1d24;
    outline: 2px solid #d4af37;
    outline-offset: -14px;
    color: #2b1a12;
    font-family: Georgia, 'Times New Roman', serif;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

.pc-sheet--comic {
    aspect-ratio: 210 / 297;
    width: min(96vw, 620px, calc((100dvh - 150px) * 210 / 297));
    background: #fff;
    border-width: 6px;
    outline: none;
    padding: 0;
    overflow: hidden;
}

.pc-sheet--comic .pc-sheet-head {
    display: none;
}

.pc-comic-page {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
    background: #fff;
}

.pc-sheet--comic .pc-sheet-by {
    display: none;
}

.pc-comic-placeholder {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    color: #8b1e2d;
    font-weight: 600;
    text-align: center;
}

.pc-sheet--comic .pc-partners {
    display: none;
    flex: 0 0 auto;
    padding: 6px 8px 8px;
    border-top: 1px solid #ececec;
    background: #fff;
}

.pc-sheet--comic .pc-partners .evidya-partners-inner {
    padding: 0 8px;
    gap: 8px;
}

.pc-sheet--comic .pc-partners .evidya-logo-vi {
    height: 28px;
}

.pc-sheet--comic .pc-partners .evidya-partner-credit {
    font-size: 0.58rem;
    line-height: 1.3;
    max-width: 100%;
}

.pc-sheet--comic .pc-partners .evidya-logo-moinee {
    height: 26px;
}

.pc-sheet--comic .pc-partners .evidya-logo-vois {
    font-size: 1.05rem;
}

.pc-sheet--comic .pc-partners .evidya-partner-kicker,
.pc-sheet--comic .pc-partners .evidya-partner-name {
    font-size: 0.52rem;
}

.pc-sheet-head {
    flex: 0 0 auto;
    background: #6b1d24;
    color: #f3d37a;
    text-align: center;
    padding: 8px 14px;
    font-size: clamp(0.85rem, 1.6vw, 1.15rem);
    letter-spacing: 0.04em;
}

.pc-sheet-head--row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.pc-head-title {
    flex: 1 1 auto;
    min-width: 0;
    text-align: center;
    color: #fff;
    font-weight: 700;
    font-size: 1.05em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pc-sheet-by {
    flex: 0 0 auto;
    margin: 0;
    padding: 4px 14px 0;
    font-style: italic;
    font-size: 0.78rem;
    color: #5c4336;
}

.pc-grid {
    flex: 1 1 auto;
    display: grid;
    gap: 8px;
    width: 100%;
    min-height: 0;
    height: 100%;
    padding: 8px 12px 12px;
    box-sizing: border-box;
}

.pc-grid--1 {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
}

.pc-grid--4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
}

.pc-grid--6 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
}

.pc-grid--8 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
}

.pc-cell {
    position: relative;
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: transparent;
}

.pc-num {
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 2;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    background: #6b1d24;
    color: #fff;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pc-cell .pc-slot,
.pc-hero .pc-slot {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    border-radius: 6px;
    background: #e8d7b5;
}

.pc-caption {
    flex: 0 0 30%;
    max-height: 30%;
    margin: 5px 2px 0;
    color: #2b1a12;
    text-align: left;
    font-size: var(--pc-caption, 13px);
    line-height: 1.28;
    overflow: hidden;
}

.pc-sheet--1 .pc-caption {
    flex-basis: 26%;
    max-height: 26%;
}

.pc-sheet--8 .pc-caption {
    flex-basis: 28%;
    max-height: 28%;
}

.pc-slot img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

.pc-slot--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b1d24;
    font-size: 0.85rem;
}

.pc-sheet-copy {
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    font-size: var(--pc-copy);
}

.pc-sheet-copy h2 {
    margin: 0 0 4px;
    color: #8b1e2d;
    font-size: var(--pc-title);
    line-height: 1.15;
    flex: 0 0 auto;
}

.pc-copy-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    flex: 0 0 auto;
}

.pc-queue {
    flex-shrink: 0;
    background: #8b1e2d;
    color: #fff;
    font-size: 0.7em;
    padding: 3px 7px;
    border-radius: 4px;
}

.pc-sheet-head .pc-queue {
    background: transparent;
    border: 1px solid #f3d37a;
    color: #f3d37a;
}

.pc-by {
    margin: 0 0 6px;
    font-style: italic;
    flex: 0 0 auto;
}

.pc-story-block {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.pc-sheet--tall {
    aspect-ratio: auto;
    height: auto;
    overflow: visible;
}

.pc-sheet--tall .pc-sheet-stack,
.pc-sheet--tall .pc-sheet-body,
.pc-sheet--tall .pc-sheet-copy,
.pc-sheet--tall .pc-story-block {
    overflow: visible;
    min-height: 0;
    height: auto;
    flex: none;
}

.pc-sheet-copy p {
    margin: 0 0 0.45em;
    font-size: 1em;
    line-height: 1.35;
}

.pc-moral {
    color: #8b1e2d;
}

.pc-qr {
    display: block;
    width: var(--pc-qr);
    height: var(--pc-qr);
    margin: 6px auto 0;
    background: #fff;
    padding: 3px;
    flex: 0 0 auto;
}

@media (max-width: 800px) {
    .story-postcard-layout-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .pc-sheet {
        width: min(100%, 100vw);
        aspect-ratio: 297 / 210;
    }

    .pc-sheet--comic {
        aspect-ratio: 210 / 297;
        width: min(96vw, calc((100dvh - 160px) * 210 / 297));
    }

    .pc-sheet-body {
        grid-template-columns: 1.05fr 0.95fr;
        grid-template-rows: none;
    }
}

.pc-print-root {
    display: none;
}

@media print {
    @page {
        size: A4 portrait;
        margin: 0;
    }

    body.printing-postcard > *:not(#pc-print-root) {
        display: none !important;
    }

    body.printing-postcard #pc-print-root {
        display: flex !important;
        flex-direction: column;
        position: fixed;
        inset: 0;
        width: 210mm;
        height: 297mm;
        margin: 0;
        padding: 0;
        background: #fff;
        overflow: hidden;
    }

    body.printing-postcard #pc-print-root img {
        width: 210mm;
        flex: 1 1 auto;
        height: auto;
        max-height: 297mm;
        object-fit: contain;
        object-position: center;
        display: block;
    }

    body.printing-postcard #pc-print-root:not(:has(.evidya-partners)) img {
        height: 297mm;
        max-height: 297mm;
    }

    body.printing-postcard #pc-print-root .evidya-partners {
        display: flex !important;
        flex: 0 0 auto;
        min-height: 0 !important;
        padding: 6mm 8mm;
        border-top: 1px solid #ececec;
        background: #fff;
    }

    .pc-sheet {
        max-height: none;
        width: 100% !important;
        height: auto;
        aspect-ratio: 297 / 210;
        margin: 0 auto;
        page-break-inside: avoid;
        break-inside: avoid;
        overflow: hidden;
    }

    body.printing-postcard header,
    body.printing-postcard #kiosk-author-bar,
    body.printing-postcard .nav-toggle,
    body.printing-postcard .story-page-title,
    body.printing-postcard .story-step-lead,
    body.printing-postcard .story-wizard-step-nav,
    body.printing-postcard .kiosk-share-card,
    body.printing-postcard .kiosk-share-done,
    body.printing-postcard .story-postcard-share,
    body.printing-postcard .story-postcard-next-nav,
    body.printing-postcard .kiosk-print-book,
    body.printing-postcard .ai-credit-bar,
    body.printing-postcard > footer.evidya-partners {
        display: none !important;
    }
}

.story-modal-handle {
    display: none;
}

.story-modal-body {
    min-width: 0;
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding-bottom: 4px;
}

.story-modal-footer {
    flex: 0 0 auto;
    margin-top: 0;
    padding: 10px 0 max(12px, env(safe-area-inset-bottom));
    background: var(--bg-panel, #fff);
    border-top: 1px solid var(--border);
    position: sticky;
    bottom: 0;
    z-index: 3;
}

.story-modal-title {
    margin: 0 0 0.35rem;
    font-size: 1.25rem;
    color: var(--text-main);
}

.story-modal-lead {
    margin: 0 0 1.25rem;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.story-format-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.story-format-card {
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 14px 12px;
    background: var(--bg-input);
    cursor: pointer;
    position: relative;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.story-format-card--active {
    border-color: #E73038;
    background: #fff8f8;
    box-shadow: 0 0 0 3px rgba(231, 48, 56, 0.18);
}

.story-format-card--active .story-format-badge {
    background: #E73038;
}

.story-format-selected {
    display: none;
    margin: 8px 0 0 40px;
    font-size: 0.78rem;
    font-weight: 800;
    color: #E73038;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.story-format-card--active .story-format-selected {
    display: block;
}

.story-format-card--disabled {
    opacity: 0.62;
    pointer-events: none;
    filter: grayscale(0.08);
}

.story-format-card-head {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.story-format-badge {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--accent), #A855F7);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.story-format-badge--muted {
    background: #94a3b8;
}

.story-format-desc {
    display: block;
    margin: 0.35rem 0 0;
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.story-format-soon {
    display: inline-block;
    margin-left: 8px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    vertical-align: middle;
}

.story-format-storybook-pages {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--border);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.story-format-modal-pages {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px dashed var(--border);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.story-output-modal-pages-step {
    margin-top: 0.25rem;
}

.story-modal-back-format-btn {
    margin-top: 0.35rem;
    width: auto;
    max-width: none;
    padding: 6px 0;
    border: 0;
    background: transparent;
    color: #8b1e2d;
    font-weight: 700;
    box-shadow: none;
}

.story-modal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 0;
    justify-content: stretch;
}

.story-modal-actions .story-btn-outline,
.story-modal-actions .story-btn-accent {
    flex: none;
    min-width: 0;
    min-height: 48px;
}

.story-modal-back-format-btn[hidden] {
    display: none !important;
}

.story-format-card[data-format] {
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.story-format-card[data-format]:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.story-audiobook-heading {
    margin: 0 0 1rem;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-main);
}

.story-audiobook-toolbar .story-audiobook-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
}

.story-audiobook-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    cursor: pointer;
}

.story-audiobook-chapter-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 8px;
}

.story-audiobook-player {
    width: 100%;
    max-width: 100%;
}

.story-audiobook-pending {
    font-size: 0.88rem;
    color: var(--text-muted);
}

.story-audiobook-hint {
    margin: 8px 0 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.story-audiobook-duration-block {
    margin-top: 0.5rem;
}

.story-audiobook-duration-heading {
    display: block;
    margin-bottom: 0.35rem;
}

.story-audiobook-duration-help {
    margin: 0 0 0.75rem;
    font-size: 0.86rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.story-audiobook-lang-hint {
    margin: 0.4rem 0 0;
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
    max-width: 36rem;
}

.story-audiobook-duration-fields {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 16px;
}

.story-audiobook-duration-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.9rem;
}

.story-audiobook-duration-input {
    max-width: 100px;
    min-height: 44px;
}

.story-audiobook-actions--secondary {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--border);
}

.dashboard-sub {
    margin: 0 0 1rem;
    font-size: 0.92rem;
    color: var(--text-muted);
}

.dashboard-load-error {
    margin: 0;
    padding: 1rem 1.25rem;
    border-radius: 10px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    font-size: 0.95rem;
    line-height: 1.5;
}

.dashboard-load-error a {
    color: #4f46e5;
    font-weight: 600;
}

.dashboard-stories-filter {
    margin-bottom: 1rem;
}

.dashboard-stories-filter__inner {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.35rem;
    border-radius: 12px;
    background: var(--bg-input, #f1f5f9);
    border: 1px solid var(--border, #e2e8f0);
}

.dashboard-stories-filter__btn {
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.55rem 1.1rem;
    border-radius: 10px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted, #64748b);
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.dashboard-stories-filter__btn:hover {
    color: var(--text-main, #1e293b);
    background: rgba(255, 255, 255, 0.7);
}

.dashboard-stories-filter__btn.is-active {
    color: #fff;
    background: linear-gradient(135deg, #5b21b6, #7c3aed);
    border-color: rgba(91, 33, 182, 0.35);
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.25);
}

@media (max-width: 900px) {
    .dashboard-stories-filter {
        display: block !important;
        width: 100%;
        margin-bottom: 0.85rem;
    }

    .dashboard-stories-filter__inner {
        display: flex !important;
        width: 100%;
        padding: 0.3rem;
        gap: 0.4rem;
    }

    .dashboard-stories-filter__btn {
        flex: 1 1 50%;
        min-height: 44px;
        padding: 0.5rem 0.65rem;
        font-size: 0.82rem;
        text-align: center;
    }

    .composition-mobile-help {
        margin: -0.5rem 0 1rem;
        font-size: 0.85rem;
        line-height: 1.35;
        color: var(--text-muted);
        text-align: center;
    }
}

.dashboard-story-card {
    display: flex;
    flex-direction: column;
    padding: 1.25rem 1.35rem;
    min-height: 14rem;
    box-sizing: border-box;
}

.dashboard-story-card__main {
    flex: 1 1 auto;
    min-height: 0;
}

.dashboard-story-card__header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.65rem;
}

.dashboard-story-card__thumb-wrap {
    flex: 0 0 auto;
}

.dashboard-story-card__thumb {
    width: 54px;
    height: 54px;
    border-radius: 10px;
    object-fit: cover;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: #e2e8f0;
    display: block;
}

.dashboard-story-card__thumb--placeholder {
    font-size: 0.64rem;
    font-weight: 700;
    color: #64748b;
    align-items: center;
    justify-content: center;
    display: flex;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.dashboard-story-card__title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: -0.02em;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    color: var(--text-main);
}

.dashboard-story-card__badges {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 0.75rem;
}

.dashboard-badge {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 5px 10px;
    border-radius: 999px;
    white-space: nowrap;
    line-height: 1.2;
}

.dashboard-badge--audiobook {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.14), rgba(99, 102, 241, 0.12));
    color: #5b21b6;
    border: 1px solid rgba(124, 58, 237, 0.22);
}

.dashboard-badge--storybook {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.14), rgba(5, 150, 105, 0.1));
    color: #047857;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.dashboard-badge--draft {
    background: rgba(100, 116, 139, 0.12);
    color: #475569;
    border: 1px solid rgba(100, 116, 139, 0.2);
}

.dashboard-badge--saved {
    background: rgba(22, 163, 74, 0.12);
    color: #15803d;
    border: 1px solid rgba(22, 163, 74, 0.22);
}

.dashboard-story-meta {
    margin: 0;
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.dashboard-story-meta__label {
    font-weight: 600;
    color: #94a3b8;
    margin-right: 0.25rem;
}

.dashboard-story-meta__muted {
    color: #94a3b8;
}

.dashboard-story-hint {
    grid-column: 1 / -1;
    display: block;
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.4;
    padding: 0.35rem 0;
}

.dashboard-story-card__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid rgba(148, 163, 184, 0.25);
}

.dashboard-btn {
    padding: 0.55rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 600;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-input);
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    box-sizing: border-box;
    transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

.dashboard-btn:hover {
    filter: brightness(1.03);
}

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

.dashboard-btn:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

.dashboard-btn--block {
    grid-column: 1 / -1;
}

.dashboard-btn--edit {
    background: #3b82f6;
    color: #fff;
    border-color: transparent;
}

.dashboard-btn--download {
    background: #0d9488;
    color: #fff;
    border-color: transparent;
}

.dashboard-btn--pdf {
    background: #16a34a;
    color: #fff;
    border-color: transparent;
}

.dashboard-btn--danger {
    background: #dc2626;
    color: #fff;
    border-color: transparent;
}

.story-improvise-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: stretch;
    margin-top: 14px;
}

.story-improvise-input {
    flex: 1 1 200px;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
}

.story-wizard .story-btn-accent {
    flex: 0 0 auto;
    background: linear-gradient(135deg, var(--accent), #A855F7);
    box-shadow: 0 4px 14px rgba(139, 92, 246, 0.35);
    white-space: nowrap;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
}

.story-wizard .story-btn-accent:hover {
    box-shadow: 0 6px 18px rgba(139, 92, 246, 0.45);
}

.story-page-count-row {
    margin-top: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.story-page-select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: #fff;
    font-size: 0.95rem;
    cursor: pointer;
}

.story-wizard .story-btn-next {
    margin-top: 1.5rem;
    width: 100%;
    background: linear-gradient(135deg, var(--accent), #A855F7);
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.35);
    padding-top: 0.9rem;
    padding-bottom: 0.9rem;
}

.story-wizard .story-btn-next:hover {
    box-shadow: 0 6px 22px rgba(139, 92, 246, 0.45);
}

.story-btn-outline {
    background: #fff !important;
    color: var(--text-main) !important;
    border: 1px solid var(--border) !important;
    box-shadow: var(--shadow-sm) !important;
}

.story-btn-outline:hover {
    border-color: var(--border-focus) !important;
    filter: none !important;
}

.story-elements-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin: 1rem 0 1.25rem;
}

.story-elements-hint {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0 0 1rem;
}

.story-elements-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 1rem;
}

.story-elements-empty {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin: 0;
    padding: 12px;
    background: var(--bg-input);
    border-radius: var(--radius-md);
    border: 1px dashed var(--border);
}

.story-element-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px;
    background: var(--bg-input);
}

.story-element-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.story-element-slot {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-main);
}

.story-element-remove {
    padding: 0.35rem 0.75rem !important;
    font-size: 0.85rem !important;
    background: #fff !important;
    color: var(--text-muted) !important;
    border: 1px solid var(--border) !important;
    box-shadow: none !important;
}

.story-element-remove:hover {
    color: #b91c1c !important;
    border-color: #fecaca !important;
}

.story-element-fields {
    display: grid;
    gap: 10px;
}

.story-element-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.story-element-visual {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-start;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.story-element-thumb {
    max-width: 180px;
    max-height: 120px;
    width: auto;
    height: auto;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.story-element-thumb-placeholder {
    width: 180px;
    height: 100px;
    background: #e5e7eb;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: var(--text-light);
}

.story-element-img-btn {
    align-self: center;
}

.stat-card:hover,
.story-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Typography */
h1,
h2,
h3,
h4 {
    color: var(--text-main);
    font-weight: 700;
    margin-top: 0;
    letter-spacing: -0.025em;
}

h1 {
    font-size: 2.25rem;
    margin-bottom: 1.5rem;
}

h2 {
    font-size: 1.875rem;
    margin-bottom: 1.25rem;
}

h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

p {
    color: var(--text-muted);
    margin-bottom: 1rem;
}

/* Forms */
label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-main);
    font-size: 0.9rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background-color: var(--bg-input);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.2s;
    margin-bottom: 1rem;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--border-focus);
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Buttons */
button {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

button:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    filter: brightness(110%);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    background: var(--text-light);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Specific Button Variants (using inline styles in JS, but overriding here for consistency if classes added) */
button.secondary {
    background: white;
    color: var(--text-main);
    border: 1px solid var(--border);
}

button.danger {
    background: #EF4444;
}

/* Composition Tool — fixed book width (matches pre-contest layout for PDF capture) */
body.composition-mode main.container {
    max-width: 1200px !important;
    width: 100%;
    padding: 20px !important;
    margin: 0 auto !important;
    box-sizing: border-box;
}

.composition-container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
}

.composition-auto-pdf-banner {
    margin: 0 auto 1rem;
    max-width: 36rem;
    padding: 0.75rem 1rem;
    text-align: center;
    font-size: 0.95rem;
    font-weight: 600;
    color: #1e40af;
    background: linear-gradient(135deg, #dbeafe, #e0e7ff);
    border: 1px solid #93c5fd;
    border-radius: 12px;
}

.book-page-container {
    border: none;
    background-color: #fff;
    box-shadow: var(--shadow-lg);
    position: relative;
    width: 100%;
    /* Default landscape ratio */
    padding-bottom: 70.92%;
    margin-bottom: 3rem;
    overflow: hidden;
    border-radius: 4px;
    /* Slight rounding for paper feel */
}

.page-content-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(#E5E7EB 1px, transparent 1px);
    background-size: 20px 20px;
    /* Subtle grid pattern */
}

.draggable {
    position: absolute;
    cursor: grab;
    /* overflow: hidden; Removed to allow handles outside if needed */
    border: 2px dashed transparent;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.draggable:hover {
    border-color: var(--primary);
    background-color: rgba(255, 255, 255, 0.5);
}

.draggable img {
    pointer-events: none;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
}

.resize-handle {
    position: absolute;
    bottom: -5px;
    right: -5px;
    width: 20px;
    height: 20px;
    background-color: var(--primary);
    border: 2px solid white;
    border-radius: 50%;
    cursor: nwse-resize;
    z-index: 30;
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
    box-shadow: var(--shadow-sm);
}

.draggable:hover .resize-handle {
    opacity: 1;
}

.resize-handle:hover {
    transform: scale(1.2);
}

.drag-handle-icon {
    border-radius: 0 0 4px 0;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    box-shadow: var(--shadow-sm);
}

.editable-text {
    cursor: text;
}

.editable-text p,
.editable-text h1 {
    outline: none;
}

.editable-text:focus-within {
    border-color: var(--border-focus);
    background: rgba(255, 255, 255, 0.8);
}

/* Story page: image paints above text if boxes ever overlap (safety net) */
.book-page-container.story-page .composition-page-image {
    z-index: 2;
}

.book-page-container.story-page .composition-page-text {
    z-index: 1;
}

/* Story page text under image (compose) */
.composition-page-text {
    box-sizing: border-box;
    padding: 2px;
}

.composition-story-body {
    margin: 0;
    width: 100%;
    height: 100%;
    min-height: 100%;
    max-height: 100%;
    box-sizing: border-box;
    border: 1px dashed #ccc;
    border-radius: var(--radius-sm);
    padding: 10px;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.45;
}

/* Desktop compose: fixed image + text stack (non-mobile-stack pages) */
@media (min-width: 901px) {
    .book-page-container.story-page:not(.story-page--mobile-stack) .composition-page-image {
        width: 100% !important;
        height: 650px !important;
        top: 0 !important;
        left: 0 !important;
    }

    .book-page-container.story-page:not(.story-page--mobile-stack) .composition-page-text {
        width: 100% !important;
        height: auto !important;
        min-height: 170px;
        top: 650px !important;
        left: 0 !important;
    }
}

.font-sans {
    font-family: 'Inter', sans-serif;
}

.font-serif {
    font-family: Georgia, serif;
}

.font-mono {
    font-family: monospace;
}

.text-small {
    font-size: 0.875rem;
}

.text-medium {
    font-size: 1.25rem;
}

.text-large {
    font-size: 2rem;
    font-weight: 700;
}

.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.text-justify {
    text-align: justify;
}

/* Layout & form utilities (templates use these; Tailwind is not bundled) */
.flex {
    display: flex;
}

.inline-flex {
    display: inline-flex;
}

.items-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-6 {
    gap: 1.5rem;
}

.gap-8 {
    gap: 2rem;
}

.flex-col {
    flex-direction: column;
}

.flex-wrap {
    flex-wrap: wrap;
}

.min-h-screen {
    min-height: 100vh;
}

.max-w-md {
    max-width: 28rem;
}

.max-w-4xl {
    max-width: 56rem;
}

.mx-auto {
    margin-left: auto;
    margin-right: auto;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.mb-6 {
    margin-bottom: 1.5rem;
}

.mb-8 {
    margin-bottom: 2rem;
}

.mb-10 {
    margin-bottom: 2.5rem;
}

.mt-4 {
    margin-top: 1rem;
}

.mt-6 {
    margin-top: 1.5rem;
}

.p-3 {
    padding: 0.75rem;
}

.p-4 {
    padding: 1rem;
}

.p-8 {
    padding: 2rem;
}

.px-3 {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

.px-4 {
    padding-left: 1rem;
    padding-right: 1rem;
}

.py-1 {
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
}

.py-2 {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.py-3 {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

.rounded-lg {
    border-radius: var(--radius-md);
}

.rounded-xl {
    border-radius: var(--radius-lg);
}

.rounded-full {
    border-radius: 9999px;
}

.rounded-l-lg {
    border-top-left-radius: var(--radius-md);
    border-bottom-left-radius: var(--radius-md);
}

.rounded-r-lg {
    border-top-right-radius: var(--radius-md);
    border-bottom-right-radius: var(--radius-md);
}

.shadow-md {
    box-shadow: var(--shadow-md);
}

.shadow-lg {
    box-shadow: var(--shadow-lg);
}

.shadow-sm {
    box-shadow: var(--shadow-sm);
}

.bg-white {
    background: var(--bg-card);
}

.bg-gray-50 {
    background: #f9fafb;
}

.bg-gray-100 {
    background: #f3f4f6;
}

.bg-blue-50 {
    background: #eff6ff;
}

.bg-blue-100 {
    background: #dbeafe;
}

.bg-purple-100 {
    background: #f3e8ff;
}

.border {
    border: 1px solid var(--border);
}

.border-2 {
    border-width: 2px;
    border-style: solid;
}

.border-gray-100 {
    border-color: #f3f4f6;
}

.border-primary {
    border-color: var(--primary);
}

.border-l-0 {
    border-left-width: 0;
}

.text-left {
    text-align: left;
}

.text-sm {
    font-size: 0.875rem;
}

.text-2xl {
    font-size: 1.5rem;
}

.text-3xl {
    font-size: 1.875rem;
}

.text-4xl {
    font-size: 2.25rem;
}

.text-gray-500 {
    color: #6b7280;
}

.text-gray-600 {
    color: var(--text-muted);
}

.text-gray-700 {
    color: var(--text-main);
}

.text-gray-800 {
    color: #1f2937;
}

.text-gray-900 {
    color: #111827;
}
body.has-partners > .container > .text-center h1,
body.has-partners > .container > .text-center > p,
body.has-partners > .container > .text-center.mt-8 p {
    color: #fff;
}
body.has-partners > .container > .text-center a {
    color: #F4C01D;
}

.text-primary {
    color: var(--primary);
}

.text-green-600 {
    color: #059669;
}

.text-yellow-600 {
    color: #d97706;
}

.text-blue-600 {
    color: #2563eb;
}

.text-blue-800 {
    color: #1e40af;
}

.uppercase {
    text-transform: uppercase;
}

.font-bold {
    font-weight: 700;
}

.font-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.block {
    display: block;
}

.w-full {
    width: 100%;
}

.bg-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: #fff;
}

.bg-purple-600 {
    background: #9333ea;
    color: #fff;
}

.hover\:bg-blue-50:hover {
    background: #eff6ff;
}

.hover\:bg-blue-700:hover {
    filter: brightness(0.95);
}

.hover\:bg-purple-700:hover {
    filter: brightness(0.95);
}

.hover\:text-primary:hover {
    color: var(--primary);
}

.hover\:text-blue-700:hover {
    color: #1d4ed8;
}

.hover\:bg-gray-50:hover {
    background: #f9fafb;
}

.transition {
    transition: color 0.2s, background 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.transition-shadow {
    transition: box-shadow 0.2s;
}

.hover\:shadow-xl:hover {
    box-shadow: var(--shadow-lg);
}

.hover\:underline:hover {
    text-decoration: underline;
}

.grid {
    display: grid;
}

.grid-cols-1 {
    grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 768px) {
    .md\:grid-cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

tbody.divide-y > tr + tr {
    border-top: 1px solid #f3f4f6;
}

/* Responsive — phone / small tablet (matches app.js MOBILE_NAV_MQ) */
@media (max-width: 900px) {
    header {
        flex-wrap: nowrap;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
    }

    .nav-toggle {
        display: inline-flex;
        flex-shrink: 0;
    }

    #nav-menu.site-nav,
    #nav-menu {
        display: flex !important;
        position: fixed;
        top: 0;
        right: 0;
        left: auto;
        width: var(--nav-drawer-width);
        height: 100vh;
        height: 100dvh;
        max-height: 100dvh;
        margin: 0;
        padding: calc(env(safe-area-inset-top, 0px) + 3.85rem) 1rem max(1rem, env(safe-area-inset-bottom, 0px));
        flex-direction: column;
        align-items: stretch;
        flex-wrap: nowrap;
        gap: 0.2rem;
        list-style: none;
        background: var(--bg-card);
        border-left: 1px solid var(--border);
        box-shadow: -12px 0 40px rgba(15, 23, 42, 0.15);
        z-index: 1050;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        transform: translateX(100%);
        visibility: hidden;
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.28s;
    }

    #nav-menu.site-nav.nav-open,
    #nav-menu.nav-open {
        transform: translateX(0);
        visibility: visible;
    }

    #nav-menu li {
        width: 100%;
    }

    #nav-menu li a {
        display: flex;
        align-items: center;
        min-height: 48px;
        padding: 0.65rem 0.85rem;
        border-radius: var(--radius-md);
        font-size: 1rem;
    }

    #nav-menu li a:active {
        background: rgba(79, 70, 229, 0.08);
    }

    #nav-menu li button {
        width: 100% !important;
        min-height: 48px;
        justify-content: flex-start !important;
        padding: 0.65rem 0.85rem !important;
        border-radius: var(--radius-md) !important;
        background: rgba(249, 250, 251, 0.95) !important;
        border: 1px solid var(--border) !important;
        box-shadow: none !important;
        color: var(--text-main) !important;
    }

    .container {
        padding: 15px;
        padding-bottom: max(15px, env(safe-area-inset-bottom, 0px));
    }

    .composition-actions {
        flex-direction: column !important;
        align-items: stretch !important;
        position: sticky;
        bottom: max(8px, env(safe-area-inset-bottom, 0px));
        z-index: 25;
        background: var(--bg-card);
        border: 1px solid var(--border);
        border-radius: 12px;
        padding: 10px;
    }

    .composition-actions>div {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
    }

    .composition-actions button {
        width: 100% !important;
        margin-right: 0 !important;
    }

    .story-wizard {
        padding: 20px;
        margin: 20px auto;
        max-width: 100%;
        border-radius: var(--radius-md);
    }

    .story-lang-select {
        min-width: 0;
        width: 100%;
    }

    .story-lang-row {
        flex-direction: column;
        align-items: stretch;
    }

    .story-media-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .story-media-file,
    .story-media-process-btn {
        width: 100%;
        flex: none;
        min-height: 48px;
    }

    #app .max-w-md {
        max-width: 100%;
        box-sizing: border-box;
    }

    .story-element-thumb,
    .story-element-thumb-placeholder {
        max-width: 100%;
    }

    /* Grid adjustments */
    .grid {
        grid-template-columns: 1fr !important;
    }

    /* Dashboard Stats */
    .stats-container {
        flex-direction: column;
    }

    /* Composition Controls */
    .composition-container .grid {
        gap: 1rem !important;
    }

    .book-page-container {
        margin-bottom: 1.25rem;
    }

    /* Compose story pages: stack image then text (avoid absolute % overlap on phones) */
    .book-page-container.story-page--mobile-stack {
        height: auto !important;
        padding-bottom: 0 !important;
        overflow: visible;
    }

    .book-page-container.story-page--mobile-stack .page-content-wrapper {
        position: relative !important;
        height: auto !important;
        min-height: 0;
        display: flex;
        flex-direction: column;
    }

    .book-page-container.story-page--mobile-stack .composition-page-image {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        width: 100% !important;
        height: auto !important;
        aspect-ratio: 16 / 10;
        max-height: min(52vw, 280px);
        flex: 0 0 auto;
        z-index: 1;
    }

    .book-page-container.story-page--mobile-stack .composition-page-image-fill {
        min-height: 180px;
    }

    .book-page-container.story-page--mobile-stack .composition-page-text {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        width: 100% !important;
        height: auto !important;
        min-height: 5.5rem;
        flex: 1 1 auto;
        z-index: 2;
        margin-top: 0.35rem;
    }

    .book-page-container.story-page--mobile-stack .composition-story-body {
        height: auto !important;
        max-height: none !important;
        min-height: 4.5rem;
        overflow-y: visible;
        -webkit-overflow-scrolling: touch;
    }

    /* Final compose: handles must stay inside overflow:hidden page (no clipped purple dots) */
    .book-page-container .resize-handle {
        opacity: 0.95;
        width: 26px;
        height: 26px;
        bottom: 6px;
        right: 6px;
        left: auto;
        touch-action: none;
    }

    .composition-hero-title {
        font-size: 1.45rem !important;
        line-height: 1.2 !important;
        margin-bottom: 1rem !important;
    }

    .composition-container .card.mb-8 {
        padding: 14px !important;
        margin-bottom: 1rem !important;
    }

    .composition-cover-title-text {
        font-size: clamp(0.95rem, 4.5vw, 1.4rem) !important;
        line-height: 1.2 !important;
    }

    .composition-cover-writer-text {
        font-size: clamp(0.78rem, 3.2vw, 0.95rem) !important;
    }

    .book-page-container .page-content-wrapper {
        background-size: 12px 12px;
    }

    .composition-story-body {
        padding: 8px 10px !important;
        font-size: max(15px, 0.95rem);
        line-height: 1.5 !important;
    }

    .book-page-container .draggable {
        cursor: grab;
    }

    .book-page-container .editable-text {
        cursor: text;
    }

    /* Make buttons full width on mobile */
    button {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    button.nav-toggle {
        width: 44px !important;
        min-width: 44px;
        margin-bottom: 0;
    }

    .story-card button {
        width: auto !important;
        display: inline-flex;
        margin-bottom: 0.35rem;
        margin-right: 0.35rem;
    }

    .story-wizard .story-improvise-row button.story-btn-accent {
        width: auto;
        min-width: min(100%, 200px);
    }

    .story-improvise-nav button {
        width: auto !important;
    }

    .story-improvise-submit-btn {
        max-width: none;
    }

    .flex.justify-between {
        flex-direction: column;
        gap: 1rem;
    }

    .flex.justify-between>div {
        width: 100%;
        display: flex;
        flex-direction: column;
    }

    /* Adjust text sizes */
    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.25rem;
    }

    .auth-container {
        margin: 24px auto;
        padding: 24px 20px;
    }

    .register-selection-container {
        margin: 24px auto;
        padding: 24px 16px;
    }
}

.subdomain-field-row {
    align-items: stretch;
    gap: 0;
}

.subdomain-input {
    flex: 1 1 140px;
    min-width: 0;
}

.subdomain-suffix {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
}

@media (max-width: 520px) {
    .subdomain-field-row {
        flex-direction: column;
    }

    .subdomain-input,
    .subdomain-suffix {
        border-radius: var(--radius-md) !important;
        width: 100%;
    }

    .subdomain-suffix {
        border-left-width: 1px !important;
        justify-content: center;
    }
}

@media (min-width: 901px) {

    #nav-menu.site-nav,
    #nav-menu {
        display: flex !important;
        flex-direction: row;
        flex-wrap: wrap;
        width: auto;
        margin-top: 0;
        padding-top: 0;
        border-top: none;
        order: unset;
        align-items: center;
        position: static;
        height: auto;
        max-height: none;
        transform: none !important;
        visibility: visible !important;
        box-shadow: none;
        border-left: none;
        background: transparent;
        overflow: visible;
        padding-left: 0;
        padding-right: 0;
        padding-bottom: 0;
    }

    .nav-toggle {
        display: none !important;
    }

    .nav-toggle.is-open .nav-toggle-bar:nth-child(1),
    .nav-toggle.is-open .nav-toggle-bar:nth-child(3) {
        transform: none;
    }

    .nav-toggle.is-open .nav-toggle-bar:nth-child(2) {
        opacity: 1;
    }
}

/* Prompt Scorer Styles */
.score-container {
    margin-top: 10px;
    padding: 15px;
    background: var(--bg-input);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.score-bar-bg {
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.score-bar-fill {
    height: 100%;
    width: 0%;
    background: var(--text-light);
    transition: width 0.3s ease, background-color 0.3s ease;
}

.score-bar-fill.low {
    background-color: #EF4444;
}

/* Red */
.score-bar-fill.medium {
    background-color: #F59E0B;
}

/* Yellow */
.score-bar-fill.high {
    background-color: #10B981;
}

/* Green */

.score-feedback {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.score-feedback ul {
    margin: 5px 0 0 0;
    padding-left: 20px;
}

/* Credit System Styles */
.credit-badge-container {
    display: flex;
    align-items: center;
    margin-right: 15px;
}

.credit-badge {
    cursor: pointer;
    transition: color 0.2s;
    color: var(--text-muted);
    font-weight: 500;
}

.credit-badge:hover {
    color: var(--primary);
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 400px;
    position: relative;
    animation: slideUp 0.3s ease-out;
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    cursor: pointer;
    color: #666;
}

.close-btn:hover {
    color: #000;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* PDF export: always use desktop book dimensions & typography (phone viewport overrides) */
body.composition-pdf-exporting main.container {
    max-width: 1200px !important;
    width: 1200px !important;
    overflow: visible !important;
}

body.composition-pdf-exporting .composition-container {
    max-width: 1200px !important;
    width: 1200px !important;
    margin: 0 auto;
    visibility: visible !important;
    opacity: 1 !important;
}

body.composition-pdf-exporting #book-container {
    width: 1200px !important;
    max-width: 1200px !important;
}

body.composition-pdf-exporting .book-page-container {
    width: 1200px !important;
    max-width: 1200px !important;
    padding-bottom: 70.92% !important;
    height: auto !important;
    overflow: visible !important;
}

body.composition-pdf-exporting .composition-cover-image,
body.composition-pdf-exporting #drag-cover-img {
    width: 1167px !important;
    height: 666px !important;
    top: 85px !important;
    left: 0 !important;
}

body.composition-pdf-exporting .composition-cover-title,
body.composition-pdf-exporting #drag-cover-title {
    width: 100% !important;
    height: 100px !important;
    top: 10px !important;
    left: 0 !important;
}

body.composition-pdf-exporting .composition-cover-writer,
body.composition-pdf-exporting #drag-cover-writer {
    width: 100% !important;
    height: 60px !important;
    top: auto !important;
    bottom: 0 !important;
    left: 0 !important;
}

body.composition-pdf-exporting .composition-cover-title-text {
    font-size: 2.25rem !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
}

body.composition-pdf-exporting .composition-cover-writer-text {
    font-size: 1.25rem !important;
    line-height: 1.3 !important;
}

body.composition-pdf-exporting .composition-page-image,
body.composition-pdf-exporting .book-page-container.story-page [id^="drag-img-"] {
    width: 100% !important;
    height: 650px !important;
    top: 0 !important;
    left: 0 !important;
    position: absolute !important;
}

body.composition-pdf-exporting .composition-page-text,
body.composition-pdf-exporting .book-page-container.story-page [id^="drag-text-"] {
    width: 100% !important;
    min-height: 170px !important;
    height: auto !important;
    top: 650px !important;
    left: 0 !important;
    position: absolute !important;
}

body.composition-pdf-exporting .composition-story-body {
    font-size: 1.25rem !important;
    padding: 10px !important;
    line-height: 1.45 !important;
}

body.composition-pdf-exporting .composition-story-body.text-small {
    font-size: 0.875rem !important;
    font-weight: 400 !important;
}

body.composition-pdf-exporting .composition-story-body.text-large {
    font-size: 2rem !important;
    font-weight: 700 !important;
}

body.composition-pdf-exporting #drag-cover-logo-left,
body.composition-pdf-exporting #drag-cover-logo-right {
    width: 150px !important;
    height: 80px !important;
    top: 10px !important;
}

body.composition-pdf-exporting #drag-cover-logo-left {
    left: 10px !important;
}

body.composition-pdf-exporting #drag-cover-logo-right {
    left: 1000px !important;
    right: auto !important;
}

body.composition-pdf-exporting .book-page-container.story-page--mobile-stack .page-content-wrapper {
    position: absolute !important;
    display: block !important;
    height: 100% !important;
}

.composition-pdf-busy-overlay {
    position: fixed;
    inset: 0;
    z-index: 300000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.94);
    font-size: 1.2rem;
    font-weight: 600;
    color: #1f2937;
    pointer-events: none;
}

/* Print/Download Mode - Clean "Finished Book" Style */
.printing .resize-handle {
    display: none !important;
}

.printing .draggable {
    border: none !important;
    background-color: transparent !important;
}

.printing .page-content-wrapper {
    background-image: none !important;
    /* Remove grid */
}

.printing .book-page-container {
    overflow: visible !important;
}

.printing .composition-story-body,
.printing .composition-page-text p {
    overflow: visible !important;
    overflow-y: visible !important;
    max-height: none !important;
}

/* Auth Container Styles */
.auth-container {
    max-width: 450px;
    margin: 80px auto;
    padding: 40px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

.auth-container h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--text-main);
}

.auth-container .form-group {
    margin-bottom: 1.5rem;
}

.auth-container button[type="submit"] {
    width: 100%;
    margin-top: 1rem;
}

.auth-container p {
    text-align: center;
    color: var(--text-muted);
}

.auth-container a {
    color: var(--primary);
    font-weight: 600;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 1.25rem 0;
    color: var(--text-muted, #6b7280);
    font-size: 0.875rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border, #e5e7eb);
}

.btn-google-signin {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 0.75rem 1rem;
    border: 1px solid #dadce0;
    border-radius: var(--radius-md, 8px);
    background: #fff;
    color: #3c4043;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
}

.btn-google-signin:hover {
    background: #f8f9fa;
    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.15);
}

.btn-google-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.contest-btn-google {
    margin-top: 0.25rem;
}

/* Register Selection Styles */
.register-selection-container {
    max-width: 1100px;
    margin: 60px auto;
    padding: 40px 20px;
    animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.register-header {
    text-align: center;
    margin-bottom: 3.5rem;
}

.register-header h1 {
    font-size: 2.75rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
}

.register-subtitle {
    font-size: 1.15rem;
    color: var(--text-muted);
    font-weight: 400;
}

.register-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
    gap: 2.5rem;
    margin-bottom: 3rem;
}

.register-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 3rem;
    border: 2px solid var(--border);
    box-shadow: var(--shadow-md);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    animation: slideUp 0.6s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.register-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.register-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    border-color: var(--primary);
}

.register-card:hover::before {
    opacity: 1;
}

.individual-card:hover {
    border-color: var(--primary);
}

.organization-card {
    animation-delay: 0.15s;
}

.organization-card:hover {
    border-color: var(--accent);
}

.featured-badge {
    position: absolute;
    top: 20px;
    right: -30px;
    background: linear-gradient(135deg, #6B7280, #4B5563);
    color: white;
    padding: 0.4rem 2.5rem;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transform: rotate(45deg);
    box-shadow: 0 4px 10px rgba(107, 114, 128, 0.3);
}

.card-icon-wrapper {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 2rem;
    position: relative;
    transition: transform 0.3s ease;
}

.register-card:hover .card-icon-wrapper {
    transform: scale(1.1) rotate(5deg);
}

.individual-gradient {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.1), rgba(99, 102, 241, 0.2));
    border: 2px solid rgba(79, 70, 229, 0.3);
}

.organization-gradient {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(168, 85, 247, 0.2));
    border: 2px solid rgba(139, 92, 246, 0.3);
}

.card-icon {
    width: 40px;
    height: 40px;
    color: var(--primary);
}

.organization-card .card-icon {
    color: var(--accent);
}

.card-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 1rem;
    text-align: center;
}

.card-description {
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    text-align: center;
}

.card-features {
    list-style: none;
    padding: 0;
    margin: 0 0 2rem 0;
    background: var(--bg-input);
    border-radius: var(--radius-md);
    padding: 1.5rem;
}

.card-features li {
    padding: 0.6rem 0;
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-features li:not(:last-child) {
    border-bottom: 1px solid var(--border);
}

.register-btn {
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1.05rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
}

.register-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.register-btn:hover::before {
    width: 300px;
    height: 300px;
}

.register-btn span {
    position: relative;
    z-index: 1;
}

.btn-arrow {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
    position: relative;
    z-index: 1;
}

.register-btn:hover .btn-arrow {
    transform: translateX(5px);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(79, 70, 229, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--accent), #A855F7);
    color: white;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.4);
}

.register-footer {
    text-align: center;
    margin-top: 3rem;
}

.register-footer p {
    color: var(--text-muted);
    font-size: 1rem;
}

.login-link {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    position: relative;
}

.login-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: width 0.3s ease;
}

.login-link:hover::after {
    width: 100%;
}

.login-link:hover {
    color: var(--primary-hover);
}

/* Responsive Registration Page */
@media (max-width: 900px) {
    .register-cards-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .register-header h1 {
        font-size: 2rem;
    }

    .register-subtitle {
        font-size: 1rem;
    }

    .register-card {
        padding: 2rem;
    }

    .card-icon-wrapper {
        width: 70px;
        height: 70px;
    }

    .card-icon {
        width: 35px;
        height: 35px;
    }

    .featured-badge {
        font-size: 0.7rem;
        padding: 0.3rem 2rem;
    }
}


/* Hero Section Styles */
.hero-section {
    min-height: calc(100vh - 80px);
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.95), rgba(139, 92, 246, 0.9), rgba(236, 72, 153, 0.85)),
        url('../images/Ink & Inspire Logo.jpeg');
    background-size: 120%;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    overflow: hidden;
    padding: 60px 20px;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 30% 50%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 70% 80%, rgba(236, 72, 153, 0.2) 0%, transparent 50%);
    animation: gradient-shift 8s ease infinite;
}

@keyframes gradient-shift {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

.hero-content {
    position: relative;
    z-index: 10;
    text-align: center;
    max-width: 900px;
    animation: fadeInUp 1s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-title {
    font-size: 4rem;
    font-weight: 800;
    color: white;
    margin-bottom: 1.5rem;
    letter-spacing: -0.03em;
    line-height: 1.1;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: fadeInUp 1s ease-out 0.2s both;
}

.hero-subtitle {
    font-size: 1.5rem;
    color: rgba(255, 255, 255, 0.95);
    margin-bottom: 3rem;
    font-weight: 400;
    line-height: 1.6;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    animation: fadeInUp 1s ease-out 0.4s both;
}

.hero-buttons {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    flex-wrap: wrap;
    animation: fadeInUp 1s ease-out 0.6s both;
}

.hero-btn {
    padding: 1rem 2.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.hero-btn-primary {
    background: white;
    color: var(--primary);
}

.hero-btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.95);
}

.hero-btn-secondary {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
}

.hero-btn-secondary:hover {
    transform: translateY(-3px);
    background: rgba(255, 255, 255, 0.25);
    border-color: white;
    box-shadow: 0 12px 30px rgba(255, 255, 255, 0.2);
}

/* Floating animation for decorative elements */
@keyframes float {

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

    50% {
        transform: translateY(-20px);
    }
}

.hero-sparkle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: white;
    border-radius: 50%;
    opacity: 0;
    animation: sparkle 3s infinite;
}

@keyframes sparkle {

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

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

/* Responsive Hero Section */
@media (max-width: 900px) {
    .hero-title {
        font-size: 2.5rem;
    }

    .hero-subtitle {
        font-size: 1.1rem;
        margin-bottom: 2rem;
    }

    .hero-buttons {
        flex-direction: column;
        gap: 1rem;
    }

    .hero-btn {
        width: 100%;
        justify-content: center;
        min-height: 48px;
    }

    .hero-section {
        min-height: calc(100dvh - 72px);
        padding: 32px max(16px, env(safe-area-inset-left)) 40px max(16px, env(safe-area-inset-right));
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }
}

.book-page-container {
    position: relative;
    width: 100%;
    height: 0; /* Let padding-bottom dictate the responsive scale */
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border-radius: 0.5rem;
}

/* Fluid responsive typography helpers */
.book-page-container text-small { font-size: clamp(0.75rem, 2vw, 0.875rem); }
.book-page-container text-medium { font-size: clamp(0.875rem, 2.5vw, 1.125rem); }
.book-page-container text-large { font-size: clamp(1.125rem, 3.5vw, 1.5rem); }

#kiosk-author-bar {
    background: linear-gradient(90deg, #5A1851 0%, #E73038 78%);
    color: #fff;
    border-bottom: 3px solid #F4C01D;
    padding: max(8px, env(safe-area-inset-top, 0px)) 12px 8px;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 50;
    line-height: 1.2;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px 10px;
}
#kiosk-author-bar .kiosk-bar-left {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-width: 0;
}
#kiosk-author-bar .kiosk-bar-center {
    min-width: 0;
    text-align: center;
}
#kiosk-author-bar .kiosk-bar-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-width: 0;
}
#kiosk-author-bar .kiosk-bar-logo {
    display: block;
    height: 44px;
    width: auto;
    max-width: 150px;
    margin: 0;
    object-fit: contain;
    border-radius: 6px;
}
#kiosk-author-bar .kiosk-bar-kicker {
    margin: 0;
    font-size: 0.55rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #F4C01D;
    font-weight: 800;
}
#kiosk-author-bar .kiosk-bar-name {
    margin: 1px 0 0;
    font-size: clamp(0.92rem, 2.8vw, 1.1rem);
    font-weight: 800;
    font-family: 'Plus Jakarta Sans', Inter, sans-serif;
    line-height: 1.15;
    color: #ffffff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#kiosk-author-bar .kiosk-bar-queue {
    margin: 0;
    font-size: 0.72rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.92);
}
.kiosk-story-timer {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    border: 2px solid #F4C01D;
    margin: 0;
    flex-shrink: 0;
}
@media (max-width: 520px) {
    #kiosk-author-bar {
        grid-template-columns: minmax(0, 1fr) auto;
        padding-left: 8px;
        padding-right: 8px;
        gap: 6px;
    }
    #kiosk-author-bar .kiosk-bar-logo {
        height: 36px;
        max-width: 110px;
    }
    .kiosk-story-timer {
        flex-direction: column;
        gap: 0;
        padding: 4px 8px;
        line-height: 1.1;
    }
    .kiosk-story-timer-label {
        font-size: 0.5rem;
    }
    .kiosk-story-timer-clock {
        font-size: 0.95rem;
        min-width: 0;
    }
}
.kiosk-story-timer-label {
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #F4C01D;
}
.kiosk-story-timer-clock {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 1.1rem;
    font-weight: 700;
    min-width: 2.8em;
    text-align: center;
    color: #fff;
}
.kiosk-story-timer.is-urgent {
    background: rgba(255, 211, 0, 0.24);
    border-color: #fff;
    animation: kioskTimerPulse 0.9s ease-in-out infinite;
}
.kiosk-story-timer.is-urgent .kiosk-story-timer-clock,
.kiosk-story-timer.is-urgent .kiosk-story-timer-label {
    color: #F4C01D;
}
.kiosk-story-timer.is-ended {
    background: rgba(0, 0, 0, 0.22);
    border-color: rgba(255, 255, 255, 0.55);
    animation: none;
}
@keyframes kioskTimerPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.04); }
}
.kiosk-hurry-modal {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(90, 24, 81, 0.55);
}
.kiosk-hurry-modal[hidden] { display: none !important; }
.kiosk-hurry-panel {
    width: min(420px, 100%);
    background: #fff;
    border: 3px solid #F4C01D;
    border-radius: 22px;
    padding: 22px 20px 18px;
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.28);
    text-align: center;
}
.kiosk-hurry-eyebrow {
    margin: 0 0 6px;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #E73038;
}
.kiosk-hurry-title {
    margin: 0 0 8px;
    font-family: 'Fraunces', Georgia, serif;
    font-size: clamp(1.4rem, 5vw, 1.8rem);
    font-weight: 700;
    color: #9f1239;
}
.kiosk-hurry-lead {
    margin: 0 0 16px;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.4;
    color: #1e293b;
}
.kiosk-hurry-ok {
    width: 100%;
    min-height: 48px;
    border: 0;
    border-radius: 14px;
    font-weight: 800;
    cursor: pointer;
}
body.kiosk-hurry-open {
    overflow: hidden;
}
html.event-kiosk-boot header,
html.event-kiosk-boot .nav-toggle,
html.event-kiosk-boot .nav-drawer-backdrop,
html.event-kiosk-boot body > footer.evidya-partners,
html.event-kiosk-boot body > .ai-credit-bar,
body.event-kiosk-create header,
body.event-kiosk-create .nav-toggle,
body.event-kiosk-create .nav-drawer-backdrop {
    display: none !important;
}

html.event-kiosk-boot body > footer.evidya-partners,
html.event-kiosk-boot body > .ai-credit-bar,
body.event-kiosk-create > footer.evidya-partners,
body.event-kiosk-create > .ai-credit-bar {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    min-height: 0 !important;
    overflow: hidden !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
}
body.event-kiosk-create {
    --primary: #E73038;
    --primary-hover: #C41B28;
    --secondary: #5A1851;
    --accent: #5A1851;
    --bg-body: #E6242E;
    --border-focus: #E73038;
    --border: #E8D9A8;
    background-color: #E6242E;
    background-image: url("images/theme-bg.jpg");
    background-repeat: no-repeat;
    background-position: center bottom;
    background-size: cover;
    background-attachment: fixed;
}
body.event-kiosk-create main.container {
    max-width: none;
    padding: 16px max(16px, env(safe-area-inset-right)) 16px max(16px, env(safe-area-inset-left));
    padding-bottom: max(16px, env(safe-area-inset-bottom));
}
body.event-kiosk-create.has-partners #app,
body.event-kiosk-create.has-partners main.container {
    flex: 1 1 auto;
    min-height: 0;
}
body.event-kiosk-create .story-wizard {
    background: #fff;
    border: 3px solid #F4C01D;
    border-radius: 28px;
    box-shadow: 0 24px 50px rgba(90, 24, 81, 0.16);
    max-width: 860px;
    margin-left: auto;
    margin-right: auto;
}
body.event-kiosk-create .story-wizard:has(.pc-sheet) {
    max-width: min(1120px, 96vw);
}
body.event-kiosk-create .story-wizard h1,
body.event-kiosk-create .story-page-title {
    color: #C41B28;
}
body.event-kiosk-create .story-step-lead,
body.event-kiosk-create .story-media-hint,
body.event-kiosk-create .story-elements-hint {
    color: #6B6B6B;
}
body.event-kiosk-create .story-textarea,
body.event-kiosk-create .story-segment-input,
body.event-kiosk-create .story-segment-textarea,
body.event-kiosk-create .story-improvise-input,
body.event-kiosk-create .story-page-select,
body.event-kiosk-create input,
body.event-kiosk-create textarea,
body.event-kiosk-create select {
    border: 2px solid #F0E4A8;
    background: #fff;
    border-radius: 12px;
}
body.event-kiosk-create .story-textarea:focus,
body.event-kiosk-create .story-segment-input:focus,
body.event-kiosk-create .story-segment-textarea:focus,
body.event-kiosk-create .story-improvise-input:focus,
body.event-kiosk-create input:focus,
body.event-kiosk-create textarea:focus,
body.event-kiosk-create select:focus {
    outline: none;
    border-color: #ED303B;
    box-shadow: 0 0 0 3px rgba(255, 211, 0, 0.4);
}
body.event-kiosk-create .story-media-box,
body.event-kiosk-create .story-image-placeholder {
    background: #FFF8D6;
    border-color: #E6BD00;
}
body.event-kiosk-create .story-segment-card--cover {
    background: #FFF8D6;
    border: 1px solid #E6BD00;
}
body.event-kiosk-create .story-segment-card--neutral {
    background: #FFFDF3;
}
body.event-kiosk-create .story-page-block {
    border-color: #F0E4A8;
}
body.event-kiosk-create .story-prompt-toggle-btn {
    color: #C41B28;
    border-color: #FFD300;
    background: #fff;
}
body.event-kiosk-create .story-prompt-toggle-btn:hover {
    background: #FFF8D6;
    border-color: #E6BD00;
}
body.event-kiosk-create .story-wizard .story-btn-next,
body.event-kiosk-create .story-wizard .story-btn-accent,
body.event-kiosk-create .btn-primary,
body.event-kiosk-create .btn-secondary,
body.event-kiosk-create #story-step-popup-ok,
body.event-kiosk-create .story-segment-primary-btn,
body.event-kiosk-create button[class*="story-btn-next"],
body.event-kiosk-create button[class*="story-btn-accent"] {
    background: #ED303B !important;
    color: #fff !important;
    border: 0 !important;
    box-shadow: 0 8px 18px rgba(237, 48, 59, 0.28) !important;
}
body.event-kiosk-create .story-wizard .story-btn-next:hover,
body.event-kiosk-create .story-wizard .story-btn-accent:hover,
body.event-kiosk-create .btn-primary:hover,
body.event-kiosk-create #story-step-popup-ok:hover {
    filter: brightness(1.06);
    box-shadow: 0 10px 22px rgba(237, 48, 59, 0.36) !important;
}
body.event-kiosk-create .story-improvise-nav .story-btn-finish {
    background: #FFD300 !important;
    color: #C41B28 !important;
    box-shadow: 0 8px 18px rgba(230, 189, 0, 0.35) !important;
}
body.event-kiosk-create .story-btn-outline {
    background: #fff !important;
    color: #C41B28 !important;
    border: 2px solid #FFD300 !important;
    box-shadow: none !important;
}
body.event-kiosk-create .story-modal-back-format-btn {
    background: transparent !important;
    border: 0 !important;
    color: #8b1e2d !important;
    box-shadow: none !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}
body.event-kiosk-create .story-btn-outline:hover {
    background: #FFF8D6 !important;
    border-color: #E6BD00 !important;
}
body.event-kiosk-create a,
body.event-kiosk-create .login-link {
    color: #C41B28;
}
body.event-kiosk-create .story-wizard-step-nav .story-btn-outline {
    display: none !important;
}

.story-speak-wrap {
    position: relative;
}
.story-speak-wrap .story-textarea {
    padding-right: 64px;
    padding-bottom: 58px;
}
.story-speak-btn {
    position: absolute;
    right: 10px;
    bottom: 10px;
    width: 46px;
    height: 46px;
    border: 2px solid #FFD300;
    border-radius: 50%;
    background: #ED303B;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 18px rgba(237, 48, 59, 0.28);
    padding: 0;
}
.story-speak-btn svg {
    width: 22px;
    height: 22px;
    display: block;
}
.story-speak-btn:hover {
    filter: brightness(1.06);
}
.story-speak-btn.is-listening {
    background: #FFD300;
    color: #C41B28;
    animation: story-speak-pulse 1.1s ease-in-out infinite;
}
@keyframes story-speak-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 211, 0, 0.55); }
    50% { box-shadow: 0 0 0 10px rgba(255, 211, 0, 0); }
}
body.event-kiosk-create.event-kiosk-quick .story-segment-card--cover > .story-segment-primary-btn,
body.event-kiosk-create.event-kiosk-quick .story-page-block > .story-segment-primary-btn {
    display: none !important;
}

.kiosk-share {
    max-width: 420px;
    margin: 18px auto 32px;
    padding: 0 12px 24px;
}
.kiosk-share-card {
    background: #fff;
    border: 3px solid #F4C01D;
    border-radius: 24px;
    padding: 22px 18px;
    margin-bottom: 16px;
    box-shadow: 0 18px 40px rgba(90, 24, 81, 0.14);
}
.kiosk-share-btn {
    width: 100%;
    border: 0;
    border-radius: 14px;
    min-height: 52px;
    font-weight: 800;
    font-size: 1rem;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.kiosk-share-btn-print {
    background: #1e293b;
    color: #fff;
}
.kiosk-share-btn-mail {
    background: #fff;
    color: #1e293b;
    border: 2px solid #dbe3ee;
    margin-top: 12px;
}
.kiosk-share-btn-ghost {
    background: #FFF8D6;
    color: #C41B28;
    margin-top: 10px;
}
.kiosk-share-digital {
    text-align: center;
}
.kiosk-share-digital h2 {
    margin: 0;
    color: #C41B28;
    font-size: 1.35rem;
}
.kiosk-share-digital p {
    margin: 6px 0 14px;
    color: #6B6B6B;
    font-weight: 600;
}
.kiosk-share-qr-wrap {
    width: min(240px, 100%);
    margin: 0 auto;
    padding: 16px;
    border: 1px solid #e8eef6;
    border-radius: 16px;
    background: #f8fbff;
}
.kiosk-share-qr-wrap img {
    width: 100%;
    height: auto;
    display: block;
}
.kiosk-share-link {
    margin: 12px 0 0;
    font-size: 0.72rem;
    word-break: break-all;
    color: #6B6B6B;
}
.kiosk-share-btn-copy {
    width: 100%;
    margin-top: 14px;
    background: #FFF8D6;
    color: #C41B28;
    border: 2px solid #FFD300;
}
.kiosk-share-done {
    width: 100%;
    border: 0;
    background: #ED303B;
    color: #fff;
    border-radius: 14px;
    min-height: 48px;
    font-weight: 800;
    font-family: inherit;
    cursor: pointer;
}
.kiosk-email-box label {
    display: block;
    font-weight: 800;
    color: #C41B28;
    margin-bottom: 8px;
}
.kiosk-email-input {
    width: 100%;
    border: 2px solid #F0E4A8;
    border-radius: 12px;
    padding: 12px;
    font-size: 1rem;
    font-family: inherit;
}
.kiosk-email-note {
    margin: 10px 0 0;
    font-weight: 700;
    color: #6B6B6B;
}
.kiosk-share-loading {
    text-align: center;
    color: #fff;
    font-weight: 700;
    padding: 24px;
}
.kiosk-print-book {
    display: none;
}
.kiosk-print-book--visible {
    display: block;
}
.kiosk-print-book--export {
    display: block !important;
    position: fixed;
    left: 0;
    top: 0;
    width: 720px;
    opacity: 0.02;
    z-index: -1;
    pointer-events: none;
}
.kiosk-pdf-export-host {
    position: fixed;
    left: 0;
    top: 0;
    width: 720px;
    max-height: 100vh;
    overflow: hidden;
    opacity: 0.02;
    z-index: -1;
    pointer-events: none;
    background: #fff;
}
.kiosk-pdf-export-host .kiosk-print-page {
    margin: 0 0 24px;
    max-width: 720px;
}
.kiosk-print-book--export .kiosk-print-page {
    margin: 0 0 24px;
    max-width: 720px;
}
.kiosk-print-page {
    background: #fff;
    border-radius: 16px;
    padding: 16px;
    margin: 16px 0;
    text-align: center;
}
.kiosk-print-page img {
    max-width: 100%;
    max-height: min(62vh, 520px);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 12px;
    display: block;
    margin: 0 auto;
}
.kiosk-print-page p {
    margin: 12px 0 6px;
    color: #111111;
    font-size: 1.02rem;
    font-weight: 600;
    line-height: 1.5;
    text-align: left;
    white-space: pre-wrap;
}
.kiosk-print-page h1 {
    color: #C41B28;
    margin: 12px 0 4px;
}
.kiosk-print-book--visible .kiosk-print-page {
    border: 3px solid #FFD300;
}
@media print {
    body.event-kiosk-create {
        background: #fff !important;
    }
    #kiosk-author-bar,
    .kiosk-share-card,
    .kiosk-share-done,
    .kiosk-share-digital,
    .pc-stage,
    header,
    .nav-toggle,
    body.event-kiosk-create > .ai-credit-bar,
    body.event-kiosk-create > footer.evidya-partners {
        display: none !important;
    }
    body.printing-storybook .kiosk-print-book,
    body.printing-storybook .kiosk-print-book--visible,
    body:not(.printing-postcard) .kiosk-print-book,
    body:not(.printing-postcard) .kiosk-print-book--visible {
        display: block !important;
    }
    body.printing-postcard .kiosk-print-book,
    body.printing-postcard .kiosk-print-book--visible {
        display: none !important;
    }
    .kiosk-print-page {
        page-break-after: always;
        border: 0;
        box-shadow: none;
        margin: 0;
        padding: 12px;
    }
    .evidya-partners {
        display: none !important;
    }
    body.printing-postcard #pc-print-root .evidya-partners {
        display: flex !important;
        min-height: 0 !important;
        page-break-after: auto;
        background: #fff;
    }
    body.kiosk-share-public:not(.printing-postcard) .pc-partners.evidya-partners,
    .kiosk-print-brand.evidya-partners {
        display: flex !important;
        page-break-after: auto;
        align-items: center;
        justify-content: center;
        min-height: 40vh;
        border-top: 0;
        background: #fff;
    }
}

body.has-partners {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
}
body.has-partners #app,
body.has-partners main.container {
    flex: 1 1 auto;
}
.ai-credit-bar {
    flex-shrink: 0;
    margin: 0;
    padding: 8px 16px;
    text-align: center;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.4;
    color: #5A1851;
    background: #faf7fb;
    border-top: 1px solid #ececec;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px 12px;
}
.ai-credit-gemini {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 800;
    color: #111;
}
.ai-credit-gemini-logo {
    width: 18px;
    height: 18px;
    display: block;
}
.ai-credit-bar strong {
    color: #C41B28;
}
.ai-busy-overlay {
    position: fixed;
    inset: 0;
    z-index: 1400;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(15, 23, 42, 0.48);
    backdrop-filter: blur(4px);
}
.ai-busy-card {
    width: min(420px, 100%);
    background: #fff;
    border: 3px solid #F4C01D;
    border-radius: 20px;
    padding: 22px 20px 18px;
    box-shadow: 0 22px 40px rgba(90, 24, 81, 0.22);
    text-align: left;
}
.ai-busy-kicker {
    margin: 0 0 6px;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #E73038;
}
.ai-busy-card h3 {
    margin: 0 0 8px;
    font-size: 1.35rem;
    color: #5A1851;
}
.ai-busy-lead {
    margin: 0 0 16px;
    color: #4b4b4b;
    font-size: 0.95rem;
    line-height: 1.45;
    font-weight: 600;
}
.ai-busy-actions {
    display: flex;
    gap: 10px;
}
.ai-busy-actions .story-btn-outline,
.ai-busy-actions .story-btn-accent {
    flex: 1;
    min-height: 48px;
    border-radius: 12px;
    font-weight: 800;
    cursor: pointer;
}
.evidya-partners {
    flex-shrink: 0;
    background: #fff;
    border-top: 1px solid #ececec;
    padding: 10px 16px 12px;
    padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
}
.evidya-partners-inner {
    width: 100%;
    max-width: none;
    margin: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    padding: 0 32px;
}
.evidya-partners-inner--vi-only {
    justify-content: center;
    align-items: center;
}
.evidya-partner {
    text-align: center;
    min-width: 0;
    flex: 1 1 0;
}
.evidya-partner--vi-only {
    flex: 0 1 auto;
    max-width: 720px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
.evidya-partner-credit {
    margin: 0;
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.4;
    color: #374151;
    text-align: center;
}
.evidya-partner-kicker {
    margin: 0 0 6px;
    font-size: 0.68rem;
    font-weight: 600;
    color: #6b7280;
    letter-spacing: 0.01em;
}
.evidya-logo {
    display: block;
    margin: 0 auto;
    width: auto;
    object-fit: contain;
}
.evidya-logo-vi {
    height: 52px;
}
.evidya-logo-vois {
    margin: 2px 0 0;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 1.85rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: #111;
    line-height: 1;
}
.evidya-logo-moinee {
    height: 44px;
}
.evidya-partner-name {
    margin: 4px 0 0;
    font-size: 0.72rem;
    font-weight: 700;
    color: #ed303b;
}
@media (max-width: 640px) {
    .story-modal-backdrop {
        align-items: flex-end;
        padding: 0;
    }
    .story-modal-panel,
    .story-modal-panel--wide {
        max-width: 100%;
        width: 100%;
        max-height: min(96dvh, 100%);
        border-radius: 18px 18px 0 0;
        padding: 12px 14px 0;
    }
    .story-modal-title {
        font-size: 1.08rem;
    }
    .story-modal-lead {
        font-size: 0.82rem;
        margin-bottom: 0.7rem;
        line-height: 1.35;
    }
    .story-postcard-layout-card {
        padding: 8px 6px 8px;
        gap: 4px;
        border-radius: 14px;
    }
    .story-postcard-layout-card strong {
        font-size: 0.88rem;
    }
    .story-postcard-layout-card > span {
        display: none;
    }
    .pc-pick-visual,
    .pc-mini {
        width: 62px;
        height: 86px;
    }
    .pc-mini-cell {
        font-size: 0;
    }
    .pc-pick-count {
        min-width: 24px;
        height: 24px;
        font-size: 0.78rem;
        top: -6px;
        right: -8px;
    }
    .story-modal-actions .story-btn-outline,
    .story-modal-actions .story-btn-accent {
        min-height: 48px;
        font-size: 0.95rem;
    }
}

@media (max-width: 380px), (max-height: 620px) {
    .story-modal-lead {
        display: none;
    }
    .pc-pick-visual,
    .pc-mini {
        width: 54px;
        height: 74px;
    }
    .story-postcard-layout-card {
        padding: 6px 4px 6px;
    }
}

@media (max-width: 640px) {
    .ai-credit-bar { font-size: 0.68rem; padding: 6px 10px; }
    .evidya-partners-inner { gap: 12px; padding: 0 12px; }
    .evidya-logo-vi { height: 42px; }
    .evidya-logo-vois { font-size: 1.35rem; }
    .evidya-logo-moinee { height: 34px; }
    .evidya-partner-kicker { font-size: 0.58rem; }
}

