:root {
    --bg: #14120f;
    --panel: #1c1915;
    --panel-raised: #23201a;
    --text: #f3ecdd;
    --text-muted: #a79a82;
    --brass: #6b5a3e;
    --amber: #e6a23c;
    --amber-soft: rgba(230, 162, 60, 0.18);
    --teal: #2f4a44;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    height: 100%;
    font-family: 'Hind Siliguri', sans-serif;
}

body {
    display: flex;
    min-height: 100vh;
}

/* sidebar, styled like a director's board of scene slugs */
.sidebar {
    width: 270px;
    flex-shrink: 0;
    background: var(--panel);
    border-right: 1px solid rgba(107, 90, 62, 0.4);
    padding: 28px 20px;
    display: flex;
    flex-direction: column;
}

.brand {
    font-family: 'Cormorant Garamond', serif;
    font-size: 30px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--amber);
    margin-bottom: 4px;
}

.brand-sub {
    font-family: 'Courier Prime', monospace;
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 0.08em;
    margin-bottom: 32px;
    text-transform: uppercase;
}

.venture-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.venture-item {
    background: none;
    border: none;
    text-align: left;
    padding: 12px 14px;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-muted);
    transition: background 0.2s ease, color 0.2s ease;
}

.venture-item .slug {
    display: block;
    font-family: 'Courier Prime', monospace;
    font-size: 10px;
    letter-spacing: 0.06em;
    color: var(--brass);
    margin-bottom: 3px;
}

.venture-item .label {
    display: block;
    font-family: 'Cormorant Garamond', serif;
    font-size: 19px;
    font-weight: 600;
}

.venture-item:hover {
    background: var(--panel-raised);
}

.venture-item.active {
    background: var(--amber-soft);
    color: var(--text);
}

.venture-item.active .slug {
    color: var(--amber);
}

.sidebar-footer {
    margin-top: auto;
    font-family: 'Courier Prime', monospace;
    font-size: 10px;
    color: var(--brass);
    letter-spacing: 0.04em;
    line-height: 1.6;
}

/* main script page area */
.stage {
    flex: 1;
    display: flex;
    justify-content: center;
    padding: 40px 24px;
    overflow: hidden;
}

.page {
    width: 100%;
    max-width: 760px;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 80px);
}

.page-header {
    margin-bottom: 18px;
}

.page-header .slug {
    font-family: 'Courier Prime', monospace;
    font-size: 11px;
    letter-spacing: 0.08em;
    color: var(--amber);
    text-transform: uppercase;
}

.page-header h1 {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: 26px;
    margin: 4px 0 0 0;
}

.messages {
    flex: 1;
    overflow-y: auto;
    background: var(--panel);
    border: 1px solid rgba(107, 90, 62, 0.35);
    border-radius: 14px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.msg {
    max-width: 82%;
    line-height: 1.65;
    font-size: 15.5px;
    white-space: pre-wrap;
}

.msg.user {
    align-self: flex-end;
    background: var(--teal);
    color: var(--text);
    padding: 12px 16px;
    border-radius: 14px 14px 3px 14px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

.msg.assistant {
    align-self: flex-start;
    color: var(--text);
}

.msg.assistant .tag {
    display: block;
    font-family: 'Courier Prime', monospace;
    font-size: 10px;
    color: var(--brass);
    margin-bottom: 6px;
    letter-spacing: 0.06em;
}

.msg.error {
    align-self: flex-start;
    color: #d98c6b;
    font-family: 'Courier Prime', monospace;
    font-size: 13px;
}

/* the lamp: glows while the assistant is thinking */
.lamp-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 2px 0 2px;
    height: 16px;
}

.lamp {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--brass);
    transition: box-shadow 0.4s ease, background 0.4s ease;
}

.lamp.on {
    background: var(--amber);
    box-shadow: 0 0 12px 4px var(--amber-soft), 0 0 2px 1px var(--amber);
    animation: breathe 1.6s ease-in-out infinite;
}

@keyframes breathe {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

.lamp-label {
    font-family: 'Courier Prime', monospace;
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 0.04em;
}

/* input area */
.composer {
    margin-top: 16px;
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.composer textarea {
    flex: 1;
    resize: none;
    background: var(--panel);
    border: 1px solid rgba(107, 90, 62, 0.5);
    border-radius: 8px;
    color: var(--text);
    font-family: 'Hind Siliguri', sans-serif;
    font-size: 15px;
    padding: 12px 14px;
    min-height: 48px;
    max-height: 160px;
    outline: none;
}

.composer textarea:focus {
    border-color: var(--amber);
    box-shadow: 0 0 0 3px var(--amber-soft);
}

.composer button {
    background: var(--amber);
    color: #201a10;
    border: none;
    border-radius: 8px;
    padding: 0 22px;
    height: 48px;
    font-family: 'Hind Siliguri', sans-serif;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: filter 0.2s ease;
}

.composer button:hover {
    filter: brightness(1.08);
}

.composer button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* scrollbar, kept quiet */
.messages::-webkit-scrollbar {
    width: 8px;
}
.messages::-webkit-scrollbar-thumb {
    background: var(--brass);
    border-radius: 4px;
}

@media (max-width: 720px) {
    body {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid rgba(107, 90, 62, 0.4);
        padding: 14px 14px 12px;
        position: sticky;
        top: 0;
        z-index: 20;
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
    }    .brand {
        font-size: 22px;
        margin-bottom: 0;
        display: inline-block;
    }
    .brand-sub {
        display: none;
    }
    .venture-list {
        flex-direction: row;
        overflow-x: auto;
        gap: 8px;
        margin-top: 10px;
        padding-bottom: 2px;
        scroll-snap-type: x proximity;
        -webkit-overflow-scrolling: touch;
    }
    .venture-list::-webkit-scrollbar {
        display: none;
    }
    .venture-item {
        flex-shrink: 0;
        scroll-snap-align: start;
        padding: 9px 14px;
        border-radius: 20px;
        border: 1px solid rgba(107, 90, 62, 0.4);
    }
    .venture-item .slug {
        display: none;
    }
    .venture-item .label {
        font-size: 14.5px;
        white-space: nowrap;
    }
    .venture-item.active {
        border-color: var(--amber);
    }
    .sidebar-footer {
        position: absolute;
        top: 16px;
        right: 14px;
        line-height: 1;
    }
    .sidebar-footer br {
        display: none;
    }
    .stage {
        padding: 14px 12px calc(14px + env(safe-area-inset-bottom));
    }
    .page {
        height: calc(100vh - 96px);
    }
    .page-header {
        margin-bottom: 12px;
    }
    .page-header h1 {
        font-size: 21px;
    }
    .messages {
        padding: 16px;
        border-radius: 12px;
    }
    .msg {
        max-width: 90%;
        font-size: 15px;
    }
    .composer textarea {
        font-size: 16px; /* iOS তে জুম হয়ে যাওয়া ঠেকাতে */
    }
    .composer button {
        padding: 0 18px;
    }
}

@media (max-width: 420px) {
    .venture-item .label {
        font-size: 13.5px;
    }
    .page-header h1 {
        font-size: 19px;
    }
}
