/* ============================================
   Denmori
   ============================================ */

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

[x-cloak] {
    display: none !important;
}

/* --- Light tokens (default) --- */
:root {
    --bg: #FAFAF8;
    --text: #1E1E1E;
    --text-muted: #8A877E;
    --green: #627D5B;
    --green-hover: #4E6549;
    --green-focus: rgba(98, 125, 91, 0.2);
    --gold: #C19750;
    --coral: #DF7356;
    --pink: #D96C8E;

    --field-bg: #FFFFFF;
    --field-border: #E0DED8;

    --code-bg: #141414;
    --code-color: #F0F0F0;

    --drop-bg: #F8F7F3;
    --drop-border: #D8D6CD;
    --drop-hover-bg: #F0EEE9;
    --drop-dragover-bg: #F2FAF6;

    --card-bg: #FFFFFF;
    --card-border: #E8E6E0;

    --radius: 0.75rem;
    --radius-sm: 0.5rem;

    --font-sans: "DM Sans", system-ui, sans-serif;
    --font-serif: "Crimson Pro", Georgia, serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}





/* --- Dark tokens via data-theme attribute --- */
[data-theme="dark"] {
    --bg: #121214;
    --text: #E2E1DD;
    --text-muted: #A8A59C;
    --green: #4A826B;
    --green-hover: #5DA387;
    --green-focus: rgba(74, 130, 107, 0.25);
    --gold: #D4B06A;
    --coral: #E88C74;
    --pink: #E387A5;

    --field-bg: #1A1A1C;
    --field-border: #3A3A3F;

    --code-bg: #0A0A0B;
    --code-color: #E0E0E0;

    --drop-bg: #1A1A1C;
    --drop-border: #3A3A3F;
    --drop-hover-bg: #222225;
    --drop-dragover-bg: #1C2621;

    --card-bg: #1A1A1C;
    --card-border: #2A2A2E;
}

[data-theme="dark"] .code-input {
    border-color: var(--field-border);
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background 0.3s, color 0.3s;
}


/* ============================================
   Nav
   ============================================ */
.top-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 3rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.brand-icon {
    width: 28px;
    height: 28px;
    background: var(--green);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand-icon svg {
    stroke: #fff;
}

.brand-name {
    color: var(--text);
    font-family: 'Crimson Pro', serif;
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: -0.01em;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.badge {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 500;
}

.badge-icon {
    font-size: 0.95rem;
}


/* Credit hint below access code field */
.credit-hint {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--green);
    margin-top: 0.25rem;
    position: absolute;
}

/* Credit badge in nav */
.credit-badge {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--gold);
    background: var(--field-bg);
    border: 1px solid var(--field-border);
    border-radius: 2rem;
    padding: 0.25rem 0.65rem;
}

.credit-badge-icon {
    font-size: 0.95rem;
}


.product-hint {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    position: absolute;
}

.product-link {
    color: var(--green);
    text-decoration: none;
    cursor: pointer;
}

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

/* --- Theme toggle --- */
.theme-toggle {
    background: none;
    border: 1px solid var(--field-border);
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.theme-toggle:hover {
    color: var(--text);
    border-color: var(--text-muted);
    background: var(--field-bg);
}

.theme-toggle .material-symbols-outlined {
    font-size: 1.1rem;
}


/* ============================================
   Main
   ============================================ */
main {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    max-width: 1080px;
    width: 100%;
    margin: 0 auto;
    padding: 0 3rem 2rem;
}


/* ============================================
   Headline
   ============================================ */
.headline-block {
    margin-bottom: 1.75rem;
}

.headline-block h1 {
    font-family: var(--font-serif);
    font-size: clamp(2rem, 4vw, 3.25rem);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.gold {
    color: var(--gold);
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    line-height: 1.5;
}


/* ============================================
   Workspace
   ============================================ */
.workspace {
    display: flex;
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

.code-col {
    flex: 3;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.drop-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.col-label {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

.code-input {
    flex: 1;
    min-height: 420px;
    width: 100%;
    resize: none;
    background: var(--code-bg);
    color: var(--code-color);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.6;
    border: 2px solid transparent;
    border-radius: var(--radius);
    padding: 1.25rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.code-input:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px var(--green-focus);
    outline: none;
}

.code-input::placeholder {
    color: var(--code-color);
    opacity: 0.6;
}


/* ============================================
   Dropzone with phone frame
   ============================================ */
.dropzone {
    flex: 1;
    border: 2px dashed var(--drop-border);
    background: var(--drop-bg);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    min-height: 420px;
    position: relative;
    overflow: hidden;
}

.phone-frame {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    height: 95%;
    width: auto;
    color: var(--drop-border);
    opacity: 0.5;
    pointer-events: none;
    transition: opacity 0.3s, color 0.3s;
}

.dropzone:hover .phone-frame {
    opacity: 0.7;
    color: var(--green);
}

.dropzone.has-files .phone-frame {
    opacity: 0.3;
}

.dropzone:hover {
    background: var(--drop-hover-bg);
    border-color: var(--green);
}

.dropzone.drag-over {
    background: var(--drop-dragover-bg);
    border-color: var(--green);
    border-style: solid;
}

.dropzone-content {
    padding: 1.5rem;
    position: relative;
    z-index: 1;
}

.upload-icon {
    font-size: 2.25rem;
    color: var(--coral);
    opacity: 0.55;
    display: block;
    margin-bottom: 0.5rem;
    transition: transform 0.2s, color 0.2s;
}

.dropzone:hover .upload-icon {
    transform: translateY(-2px);
    color: var(--pink);
}

.drop-label {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.2rem;
}

.drop-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.check-icon {
    font-size: 2.25rem;
    color: var(--green);
    display: block;
    margin-bottom: 0.5rem;
}

.file-list {
    list-style: none;
    margin: 0.5rem 0;
}

.file-name {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
    margin: 0 auto;
}

.clear-btn {
    background: none;
    border: none;
    color: var(--coral);
    font-size: 0.8rem;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
    margin-top: 0.25rem;
}

.clear-btn:hover {
    color: var(--pink);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}


/* ============================================
   Bottom row
   ============================================ */
.bottom-row {
    display: flex;
    gap: 1.25rem;
    align-items: flex-end;
}

.fields-group {
    flex: 3;
    display: flex;
    gap: 0.75rem;
    min-width: 0;
}

.button-group {
    flex: 1;
    display: flex;
    align-items: flex-end;
    min-width: 0;
}

.field {
    flex: 1;
    min-width: 0;
    position: relative;
}

.field label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
}

.field input {
    width: 100%;
    background: var(--field-bg);
    border: 1px solid var(--field-border);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.75rem;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    color: var(--text);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.field input:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px var(--green-focus);
    outline: none;
}

.field input::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

.field input:-webkit-autofill,
.field input:-webkit-autofill:hover,
.field input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px var(--field-bg) inset;
    -webkit-text-fill-color: var(--text);
    transition: background-color 5000s ease-in-out 0s;
}


/* ============================================
   Generate button
   ============================================ */
.generate-btn {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.5rem;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
    background: var(--green);
    border: none;
    border-radius: 3rem;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s, opacity 0.2s;
    min-height: 42px;
}

.generate-btn .btn-icon {
    font-size: 1.1rem;
}

.generate-btn:hover:not(:disabled) {
    background: var(--green-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px -2px rgba(98, 125, 91, 0.35);
}

.generate-btn:active:not(:disabled) {
    transform: translateY(0);
}

.generate-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.generate-btn.is-generating {
    background: var(--gold);
}

.generate-btn.is-done {
    background: var(--green);
}

.generate-btn.is-error {
    background: var(--coral);
}


/* ============================================
   Results section
   ============================================ */
.results-section {
    width: 100%;
    padding-top: 2.5rem;
    padding-bottom: 3rem;
    border-top: 1px solid var(--card-border);
    margin-top: 1.5rem;
}

.results-inner {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 3rem;
}

.results-header {
    margin-bottom: 2rem;
}

.results-status {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    margin-bottom: 0.75rem;
}

.results-status-icon {
    color: var(--gold);
    font-size: 1.3rem;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.results-text {
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text);
}

.results-email-note {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-left: 1.9rem;
}

.countdown {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: 1.9rem;
    margin-bottom: 0.5rem;
    padding: 0.4rem 0.75rem;
    background: var(--field-bg);
    border: 1px solid var(--field-border);
    border-radius: var(--radius-sm);
}

.countdown-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.countdown-value {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gold);
}


/* ============================================
   Strategy card
   ============================================ */
.strategy-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 1.75rem;
    margin-bottom: 2rem;
}

.strategy-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.25rem;
}

.strategy-title {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--text);
}

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

/* Edit strategy button (placeholder) */
.edit-strategy-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.75rem;
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--field-bg);
    border: 1px solid var(--field-border);
    border-radius: var(--radius-sm);
    cursor: not-allowed;
    opacity: 0.5;
    transition: opacity 0.2s;
    white-space: nowrap;
}

.edit-strategy-btn .material-symbols-outlined {
    font-size: 0.95rem;
}

.strategy-field {
    display: flex;
    gap: 1rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--card-border);
}

.strategy-field:last-child {
    border-bottom: none;
}

.strategy-label {
    flex-shrink: 0;
    width: 130px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding-top: 0.15rem;
}

.strategy-value {
    font-size: 0.92rem;
    line-height: 1.5;
    color: var(--text);
}


/* ============================================
   Personas
   ============================================ */
.personas-section {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--card-border);
}

.personas-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.add-persona-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.6rem;
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--field-bg);
    border: 1px solid var(--field-border);
    border-radius: var(--radius-sm);
    cursor: not-allowed;
    opacity: 0.5;
    white-space: nowrap;
}

.add-persona-btn .material-symbols-outlined {
    font-size: 0.9rem;
}

.persona-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
}

.persona-card {
    background: var(--bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    padding: 0.85rem;
}

.persona-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.3rem;
}

.persona-desc {
    font-size: 0.8rem;
    line-height: 1.45;
    color: var(--text-muted);
}


/* ============================================
   Panels
   ============================================ */
p.panels-intro {
    max-width: 1080px;
    margin: 4rem auto 1.5rem auto;
    padding: 0 3rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
    text-align: center;
}

.panels-flush {
    display: flex;
    width: 100vw;
    max-width: 100%;
    margin: r0em auto 2.5rem auto;
    gap: 3rem;
    padding: 3.5rem 6.5rem;
    border-top: 1px solid var(--card-border);
    background: var(--drop-bg);
}

.panel-slot {
    flex: 1;
    aspect-ratio: 1284 / 2778;
    position: relative;
    overflow: hidden;
}



.panel-number {
    display: block;
    text-align: center;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 0.5rem 0;
    background: var(--bg);
}

.placeholder-slot {
    background: var(--drop-bg);
    border-right: 1px solid var(--card-border);
}

.placeholder-slot:last-child {
    border-right: none;
}

.placeholder-shimmer {
    position: absolute;
    inset: 0;
    bottom: 2rem;
    background: linear-gradient(110deg, var(--drop-bg) 30%, var(--field-bg) 50%, var(--drop-bg) 70%);
    background-size: 200% 100%;
    animation: shimmer 2s ease-in-out infinite;
}

[data-theme="dark"] .placeholder-shimmer {
    background: linear-gradient(110deg, var(--drop-bg) 30%, #2A2A2E 50%, var(--drop-bg) 70%);
    background-size: 200% 100%;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.placeholder-slot:nth-child(2) .placeholder-shimmer {
    animation-delay: 0.25s;
}

.placeholder-slot:nth-child(3) .placeholder-shimmer {
    animation-delay: 0.5s;
}

.placeholder-slot:nth-child(4) .placeholder-shimmer {
    animation-delay: 0.75s;
}

.result-slot {
    background: var(--text);
}

.panel-link {
    display: block;
    width: 100%;
    height: 100%;
}

.panel-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    cursor: pointer;
    transition: opacity 0.2s;
}

.panel-img:hover {
    opacity: 0.92;
}


/* ============================================
   Regenerate button row
   ============================================ */
.regen-row {
    text-align: center;
    padding: 0 3rem;
    margin-bottom: 3.5rem;
}

.regen-btn {
    width: auto;
    min-width: 220px;
}

.regen-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    text-align: center;
}


/* ============================================
   Generation album (placeholder)
   ============================================ */
.album-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
    margin-top: 5rem;
}

.album-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.album-title {
    font-family: var(--font-serif);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.15rem;
}

.album-intro {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.coming-soon-tag {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--gold);
    background: var(--field-bg);
    border: 1px solid var(--field-border);
    border-radius: 2rem;
    padding: 0.25rem 0.65rem;
    white-space: nowrap;
}

.album-placeholder {
    display: flex;
    gap: 0.75rem;
}

.album-thumb {
    flex: 1;
    aspect-ratio: 16 / 9;
    background: var(--drop-bg);
    border: 1px dashed var(--drop-border);
    border-radius: var(--radius-sm);
}


/* ============================================
   Lightbox
   ============================================ */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.lightbox-img {
    max-height: 90vh;
    max-width: 90vw;
    object-fit: contain;
    cursor: default;
    border-radius: 4px;
}

.lightbox-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.lightbox-download {
    position: absolute;
    bottom: 1.5rem;
    right: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 2rem;
    color: #fff;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s;
}

.lightbox-download:hover {
    background: rgba(255, 255, 255, 0.3);
}

.lightbox-download .material-symbols-outlined {
    font-size: 1.1rem;
}


/* ============================================
   Animations
   ============================================ */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.spinning {
    animation: spin 1.5s linear infinite;
}


/* ============================================
   Responsive
   ============================================ */
@media (max-width: 700px) {
    .top-nav {
        padding: 1rem 1.5rem;
    }

    main {
        padding: 0 1.5rem 2rem;
    }

    .results-inner {
        padding: 0 1.5rem;
    }

    .workspace {
        flex-direction: column;
    }

    .code-input {
        min-height: 280px;
    }

    .dropzone {
        min-height: 200px;
    }

    .bottom-row {
        flex-direction: column;
        gap: 1rem;
    }

    .fields-group {
        flex-direction: column;
        gap: 0.75rem;
    }

    .panels-flush {
        width: 95vw;
        flex-wrap: wrap;
    }

    .panel-slot {
        flex: 0 0 50%;
    }

    .strategy-header {
        flex-direction: column;
        gap: 0.75rem;
    }

    .strategy-field {
        flex-direction: column;
        gap: 0.2rem;
    }

    .strategy-label {
        width: auto;
    }

    .persona-cards {
        grid-template-columns: 1fr;
    }

    .regen-row {
        padding: 0 1.5rem;
    }
}