:root {
    color-scheme: dark;
    --bg: #0b1020;
    --panel: #11182b;
    --panel-soft: #18213a;
    --border: #2a365c;
    --text: #f5f7ff;
    --muted: #9aa7c7;
    --accent: #7c8cff;
    --accent-2: #9f6bff;
    --success: #28b487;
    --danger: #ff6b7a;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: linear-gradient(180deg, #0b1020 0%, #090d18 100%);
    color: var(--text);
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

button,
input,
textarea,
select {
    font: inherit;
}

.container {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
}

.site-header {
    border-bottom: 1px solid var(--border);
    background: rgba(11, 16, 32, 0.94);
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(10px);
}

.site-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 72px;
    gap: 16px;
}

.site-nav nav {
    display: flex;
    gap: 16px;
    align-items: center;
}

.brand {
    font-size: 1.3rem;
    font-weight: 700;
}

.page-shell {
    padding: 32px 0 56px;
}

.hero,
.panel,
.card,
.chat-layout,
.auth-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 18px;
}

.hero,
.panel,
.auth-card {
    padding: 24px;
}

.hero {
    display: grid;
    gap: 20px;
    margin-bottom: 28px;
}

.grid {
    display: grid;
    gap: 20px;
}

.creator-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.card {
    overflow: hidden;
}

.card-body {
    padding: 20px;
}

.creator-card-banner,
.creator-banner,
.creator-banner-preview {
    width: 100%;
    aspect-ratio: 16 / 6;
    object-fit: cover;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: #09101f;
}

.creator-card-banner {
    border-radius: 0;
    border: 0;
    aspect-ratio: 16 / 7;
}

.creator-card-avatar,
.creator-avatar,
.creator-avatar-preview,
.creator-card-avatar-fallback,
.creator-avatar-fallback {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255, 255, 255, 0.12);
    background: var(--panel-soft);
}

.creator-avatar,
.creator-avatar-fallback,
.creator-avatar-preview {
    width: 112px;
    height: 112px;
}

.creator-card-avatar-fallback,
.creator-avatar-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--text);
}

.creator-identity {
    display: flex;
    gap: 18px;
    align-items: center;
    flex-wrap: wrap;
}

.muted {
    color: var(--muted);
}

.pill {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 0.9rem;
    color: var(--muted);
}

.btn,
button {
    border: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: white;
    padding: 11px 16px;
    cursor: pointer;
    font-weight: 600;
}

.btn-secondary {
    background: var(--panel-soft);
    border: 1px solid var(--border);
}

.btn-danger {
    background: var(--danger);
}

.stack {
    display: grid;
    gap: 14px;
}

.split {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.auth-card {
    width: min(420px, 100%);
    margin: 0 auto;
}

.field {
    display: grid;
    gap: 6px;
}

.field label {
    color: var(--muted);
}

.field input,
.field textarea,
.field select {
    background: #09101f;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
}

.flash {
    padding: 14px 16px;
    border-radius: 12px;
    margin-bottom: 18px;
}

.flash-success {
    background: rgba(40, 180, 135, 0.15);
    border: 1px solid rgba(40, 180, 135, 0.35);
}

.flash-error {
    background: rgba(255, 107, 122, 0.15);
    border: 1px solid rgba(255, 107, 122, 0.35);
}

.creator-header {
    display: grid;
    gap: 18px;
    grid-template-columns: 1.4fr 1fr;
}

.feed-list,
.dashboard-grid,
.message-list,
.conversations-list {
    display: grid;
    gap: 16px;
}

.feed-item,
.message,
.conversation-item {
    background: var(--panel-soft);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
}

.chat-layout {
    display: block;
    min-height: calc(100vh - 72px);
    overflow: hidden;
    background: #ffffff;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.chat-layout-full {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    min-height: calc(100vh - 72px);
}

.chat-main {
    display: grid;
    grid-template-rows: 1fr auto;
    min-height: calc(100vh - 72px);
    background: #ffffff;
}

.chat-composer {
    padding: 14px 18px;
}

.chat-composer {
    border-top: 1px solid #e7e7e7;
    background: #ffffff;
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
}

.chat-scroll {
    padding: 18px 14px 28px;
    overflow-y: auto;
    background: #ffffff;
}

.message-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    margin-bottom: 10px;
}

.message {
    max-width: min(74%, 620px);
}

.message-row.mine {
    margin-left: auto;
    justify-content: flex-end;
}

.message .meta {
    font-size: 0.78rem;
    color: #8c8c93;
    margin: 4px 6px 0;
}

.message img,
.gallery-thumb {
    border-radius: 12px;
}

.message-bubble {
    padding: 12px 15px;
    border-radius: 18px;
    background: #f1f3f6;
    border: 0;
    box-shadow: none;
    color: #23252b;
    gap: 10px;
}

.message-row.mine .message-bubble {
    background: #dff2ff;
    color: #23252b;
}

.message-row.mine .meta {
    text-align: right;
    margin-right: 4px;
}

.feed-item img,
.feed-item video,
.message video {
    width: 100%;
    max-height: 540px;
    object-fit: contain;
    border-radius: 12px;
    background: #f4f4f6;
    border: 0;
}

.inline-form {
    display: flex;
    gap: 12px;
    align-items: end;
    flex-wrap: wrap;
}

.inline-form .field {
    flex: 1 1 180px;
}

.dashboard-grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.empty {
    padding: 22px;
    border: 1px dashed var(--border);
    border-radius: 16px;
    color: var(--muted);
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
}

.media-card {
    background: var(--panel-soft);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 12px;
}

.status-tag {
    display: inline-flex;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(124, 140, 255, 0.15);
    color: #c6ceff;
    font-size: 0.85rem;
}

.chat-profile {
    display: flex;
    gap: 12px;
    align-items: center;
}

.message-avatar-small {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f3f5f8;
    color: #8d95a1;
    font-size: 0.8rem;
    flex: 0 0 28px;
}

.chat-message-form textarea {
    min-height: 22px;
    height: 22px;
    max-height: 110px;
    resize: none;
}

.chat-composer form {
    background: transparent;
    border: 0;
    border-radius: 18px;
    padding: 0;
}

.chat-composer .inline-form {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    display: none;
}

.chat-composer form {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.ppv-lock {
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.ppv-card {
    background: #ffffff;
    border: 1px solid #e9edf2;
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

.ppv-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    color: #8e96a3;
    font-size: 0.95rem;
    margin-bottom: 12px;
}

.ppv-card-count,
.ppv-card-price {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.ppv-unlock-button {
    width: 100%;
    border-radius: 999px;
    background: #1fa6ea;
    color: #fff;
    padding: 14px 18px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.chat-composer .field label {
    display: none;
}

.chat-composer-bar {
    display: flex;
    align-items: center;
    gap: 10px;
}

.composer-input-wrap {
    flex: 1;
}

.chat-composer .field input,
.chat-composer .field textarea,
.chat-composer .field select {
    background: #f1f3f6;
    color: #1f2430;
    border: 0;
    border-radius: 999px;
    padding: 12px 16px;
}

.chat-composer button,
.ppv-lock button {
    background: #4ea4f4;
    border-radius: 18px;
    padding: 10px 16px;
}

.composer-icon-button,
.composer-send-button {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.composer-icon-button {
    background: transparent;
    color: #9aa3b1;
}

.composer-send-button {
    background: #2fc5b4;
    color: #fff;
}

.chat-hidden-upload {
    display: none !important;
}

.message .pill {
    background: rgba(0, 0, 0, 0.04);
    border: 0;
    color: #5a6474;
}

.chat-scroll .pill {
    font-size: 0.8rem;
}

@media (max-width: 900px) {
    .creator-header,
    .chat-layout {
        grid-template-columns: 1fr;
    }

    .creator-identity {
        align-items: start;
    }

    .chat-layout-full {
        width: 100vw;
        max-width: 100vw;
        margin-left: calc(50% - 50vw);
        margin-right: calc(50% - 50vw);
        min-height: calc(100vh - 72px);
    }

    .message {
        max-width: calc(100% - 40px);
    }
}
