:root {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --bg: radial-gradient(160% 140% at 50% -40%, #2b1443 0%, #06050b 45%);
    --fg: rgba(248, 250, 252, 0.98);
    --hint: rgba(148, 163, 184, 0.92);
    --accent: #8b5cf6;
    --accent-strong: #ec4899;
    --accent-text: #ffffff;
    --surface: rgba(17, 24, 39, 0.75);
    --surface-strong: rgba(17, 24, 39, 0.9);
    --surface-border: rgba(139, 92, 246, 0.25);
    color-scheme: dark;
}

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

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--fg);
    padding-bottom: 120px;
}

a {
    color: var(--accent);
    text-decoration: none;
}

.page {
    padding: 20px 18px 120px;
    max-width: 960px;
    margin: 0 auto;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.brand {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.brand h1 {
    font-size: 28px;
    font-weight: 700;
    margin: 0;
    background: linear-gradient(120deg, #8b5cf6 0%, #ec4899 60%, #facc15 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand p {
    margin: 0;
    font-size: 14px;
    color: var(--hint);
}

.plan-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(15, 23, 42, 0.55);
    font-size: 13px;
    font-weight: 600;
}

.plan-badge span {
    padding: 4px 10px;
    border-radius: 999px;
    background: linear-gradient(120deg, rgba(139, 92, 246, 0.2), rgba(236, 72, 153, 0.2));
    border: 1px solid rgba(139, 92, 246, 0.5);
}

.hero-banner {
    position: relative;
    border-radius: 24px;
    overflow: hidden;
    padding: 24px 20px;
    margin-bottom: 20px;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.85), rgba(236, 72, 153, 0.75));
    box-shadow: 0 28px 50px rgba(124, 58, 237, 0.35);
}

.hero-banner::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(80% 120% at 100% 0%, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0) 70%);
    mix-blend-mode: screen;
    pointer-events: none;
}

.hero-content {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 1;
}

.hero-title {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.3;
}

.hero-subtitle {
    font-size: 14px;
    color: rgba(226, 232, 240, 0.9);
    line-height: 1.5;
}

.hero-bullets {
    display: grid;
    gap: 6px;
    font-size: 13px;
    color: rgba(226, 232, 240, 0.86);
}

.hero-cta {
    display: flex;
    margin-top: 6px;
}

.hero-cta button {
    padding: 12px 20px;
    border-radius: 999px;
    border: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(120deg, #f472b6, #8b5cf6);
    box-shadow: 0 18px 32px rgba(236, 72, 153, 0.35);
    color: #fff;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hero-cta button:hover {
    transform: translateY(-1px);
    box-shadow: 0 22px 40px rgba(236, 72, 153, 0.45);
}

.pinned-section {
    margin-bottom: 18px;
}

.pinned-section .section-title {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 10px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
}

.card {
    position: relative;
    z-index: 1;
    border-radius: 20px;
    overflow: hidden;
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid rgba(148, 163, 184, 0.12);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    z-index: 2;
    transform: translateY(-4px);
    border-color: rgba(139, 92, 246, 0.6);
    box-shadow: 0 18px 30px rgba(79, 70, 229, 0.3);
}

.card-image {
    position: relative;
    padding-top: 120%;
    background: rgba(15, 23, 42, 0.9);
    background-size: cover;
    background-position: center;
}

.card-image::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(10, 12, 26, 0.1) 0%, rgba(10, 12, 26, 0.75) 100%);
}

.card-image .fallback {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    font-weight: 700;
    color: rgba(148, 163, 184, 0.6);
}

.card-info {
    position: relative;
    z-index: 1;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.card-info h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.card-info p {
    margin: 0;
    font-size: 13px;
    color: var(--hint);
    line-height: 1.4;
}

.card-action {
    margin: 10px 16px 16px;
    padding: 10px 0;
    border-radius: 12px;
    border: 1px solid rgba(139, 92, 246, 0.3);
    color: rgba(139, 92, 246, 0.9);
    background: rgba(139, 92, 246, 0.12);
    font-size: 13px;
    font-weight: 600;
    text-align: center;
}

.load-more {
    margin-top: 16px;
}

.view {
    display: none;
}

.view.visible {
    display: block;
}

.detail-view {
    display: grid;
    gap: 12px;
}

.detail-avatar {
    width: 110px;
    height: 110px;
    border-radius: 26px;
    overflow: hidden;
    background: rgba(15, 23, 42, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 38px;
    color: rgba(148, 163, 184, 0.8);
}

.detail-avatar.chat-avatar {
    width: 64px;
    height: 64px;
    font-size: 22px;
}

.detail-card {
    border-radius: 22px;
    background: rgba(15, 23, 42, 0.65);
    border: 1px solid rgba(148, 163, 184, 0.16);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.detail-card h2 {
    margin: 0;
    font-size: 22px;
}

.detail-card .tagline {
    margin: 0;
    font-size: 14px;
    color: var(--hint);
}

.detail-section {
    display: grid;
    gap: 6px;
}

.detail-section h4 {
    margin: 0;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(148, 163, 184, 0.7);
}

.detail-section p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: rgba(226, 232, 240, 0.92);
}

.primary-button {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(120deg, #f472b6, #8b5cf6);
    color: #fff;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.primary-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 32px rgba(236, 72, 153, 0.35);
}

.primary-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
}

.notification {
    margin-top: 12px;
    padding: 12px;
    border-radius: 12px;
    background: rgba(16, 185, 129, 0.12);
    color: #34d399;
    font-size: 14px;
}

.notification.danger {
    background: rgba(239, 68, 68, 0.12);
    color: #f87171;
}

.empty-state {
    text-align: center;
    padding: 36px 16px;
    border-radius: 20px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(15, 23, 42, 0.5);
    color: var(--hint);
}

.back-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    margin-bottom: 12px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(15, 23, 42, 0.55);
    color: var(--fg);
    cursor: pointer;
    font-size: 13px;
}

.chat-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-item {
    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, 0.12);
    background: rgba(15, 23, 42, 0.55);
    padding: 16px;
    display: flex;
    gap: 14px;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.chat-item:hover {
    transform: translateY(-2px);
    border-color: rgba(139, 92, 246, 0.4);
}

.chat-meta {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chat-meta h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chat-meta p {
    margin: 0;
    font-size: 13px;
    color: var(--hint);
}

.chat-log {
    display: grid;
    gap: 10px;
    margin-top: 6px;
}

.bubble {
    max-width: 85%;
    padding: 12px 14px;
    border-radius: 16px;
    line-height: 1.45;
    font-size: 14px;
    position: relative;
    word-break: break-word;
}

.bubble::after {
    content: "";
    position: absolute;
    bottom: 0;
    width: 12px;
    height: 12px;
    transform: translateY(50%) rotate(45deg);
}

.bubble--assistant {
    background: rgba(139, 92, 246, 0.18);
    border: 1px solid rgba(139, 92, 246, 0.35);
    margin-right: auto;
}

.bubble--assistant::after {
    left: 14px;
    background: inherit;
    border-left: inherit;
    border-bottom: inherit;
}

.bubble--user {
    background: rgba(59, 130, 246, 0.20);
    border: 1px solid rgba(59, 130, 246, 0.35);
    margin-left: auto;
}

.bubble--user::after {
    right: 14px;
    background: inherit;
    border-right: inherit;
    border-bottom: inherit;
}

.bubble-time {
    display: block;
    margin-top: 6px;
    font-size: 11px;
    color: rgba(148, 163, 184, 0.6);
}

.create-form {
    display: grid;
    gap: 16px;
    border-radius: 22px;
    padding: 20px;
    border: 1px solid rgba(148, 163, 184, 0.15);
    background: rgba(15, 23, 42, 0.65);
}

.create-form h2 {
    margin: 0;
    font-size: 20px;
}

.form-group {
    display: grid;
    gap: 6px;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: rgba(226, 232, 240, 0.86);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(15, 23, 42, 0.75);
    color: var(--fg);
    font-size: 14px;
    resize: vertical;
}

.form-group textarea {
    min-height: 96px;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: rgba(139, 92, 246, 0.7);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.25);
}

.form-split {
    display: grid;
    gap: 12px;
}

.view-actions {
    display: flex;
    gap: 8px;
}

.secondary-button {
    padding: 12px 16px;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(15, 23, 42, 0.55);
    color: var(--fg);
    font-weight: 500;
    cursor: pointer;
}

.bottom-nav {
    position: fixed;
    left: 50%;
    bottom: 22px;
    transform: translateX(-50%);
    display: flex;
    gap: 24px;
    align-items: center;
    padding: 14px 26px;
    border-radius: 28px;
    background: rgba(10, 12, 26, 0.82);
    border: 1px solid rgba(148, 163, 184, 0.18);
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(18px);
    z-index: 100;
}

.nav-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid transparent;
    color: rgba(148, 163, 184, 0.8);
    font-size: 18px;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    background: transparent;
}

.nav-button:hover {
    transform: translateY(-2px);
    color: var(--accent-text);
}

.nav-button.active {
    color: var(--accent-text);
    border-color: rgba(139, 92, 246, 0.8);
    background: linear-gradient(120deg, rgba(139, 92, 246, 0.5), rgba(236, 72, 153, 0.45));
    box-shadow: 0 12px 20px rgba(139, 92, 246, 0.3);
}

@media (min-width: 768px) {
    .page {
        padding: 32px 32px 160px;
    }

    .hero-banner {
        padding: 36px 32px;
    }

    .create-form {
        padding: 28px;
    }
}
