@import url("../../css/icons.css");
@import url("../../css/pdl_ai.css");

:root {
    --bg-color: #000;
    --text-color: #fff;
    --text-light: #a3a3a3;
    --text-muted: #686868;
    --border-color: rgba(255, 255, 255, 0.09);
    --surface-color: #0d0d0d;
    --color-classic-1: rgba(255, 255, 255, 0.035);
    --color-classic-2: rgba(30, 30, 30, 0.34);
    --color-classic-1-eco: rgba(10, 10, 10, 1);
    --color-classic-2-eco: rgba(20, 20, 20, 1);
    --color-pixypurple-light: rgb(180, 0, 255);
    --color-pixypurple-medium: rgb(120, 0, 160);
    --color-pixypurple-dark-transluscent: rgba(47, 27, 54, 0.48);
    --radius-s: 12px;
    --radius-m: 18px;
    --radius-l: 30px;
    --radius-xl: 40px;
    --radius-pill: 50px;
}

@font-face {
    font-family: "Oxygen";
    src: url("../../css/fonts/Font-Oxygen-Regular.ttf") format("truetype");
    font-display: swap;
}

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

html,
body {
    height: 100%;
    min-height: 100%;
    background: var(--bg-color);
    color: var(--text-color);
    font-family: "Oxygen", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    min-height: 100dvh;
    overflow: hidden;
}

body::before {
    position: fixed;
    z-index: -1;
    inset: 0;
    content: "";
    background:
        linear-gradient(rgba(0, 0, 0, 0.62), rgba(0, 0, 0, 0.86)),
        url("../../css/bg/bg_r_purple.png") center / cover no-repeat;
    pointer-events: none;
}

.pixchat-page .site-header {
    position: fixed;
    z-index: 25;
    top: 0;
    left: 0;
    display: flex;
    width: 100%;
    height: 60px;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    background: rgba(8, 8, 8, 0.34);
    backdrop-filter: blur(12px) saturate(125%);
    -webkit-backdrop-filter: blur(12px) saturate(125%);
}

.pixchat-page .site-header img {
    height: 50px;
    border-radius: 10px;
}

.pixchat-title {
    position: absolute;
    left: 50%;
    color: #fff;
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    transform: translateX(-50%);
}

.menu {
    position: fixed;
    z-index: 20;
    top: 0;
    left: 0;
    display: flex;
    width: 100%;
    height: 100%;
    flex-direction: column;
    align-content: center;
    flex-wrap: wrap;
    gap: 20px;
    padding: 80px 20px 20px;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
    backdrop-filter: blur(15px);
}

.menu.open {
    opacity: 1;
    pointer-events: auto;
}

.menu a {
    color: #fff;
    font-size: 28px;
    text-align: center;
    text-decoration: underline;
    text-decoration-color: #7c2bce;
}

.menu-btn {
    display: flex;
    width: 35px;
    height: 26px;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
}

.menu-btn span {
    display: block;
    height: 4px;
    border-radius: 2px;
    background: #7c2bce;
}

.menu-btn.open span:nth-child(1) {
    transform: translateY(11px) rotate(45deg);
}

.menu-btn.open span:nth-child(2) {
    visibility: hidden;
    opacity: 0;
}

.menu-btn.open span:nth-child(3) {
    transform: translateY(-11px) rotate(-45deg);
}

.pixchat-shell {
    display: flex;
    flex: 1;
    width: min(100%, 820px);
    margin: 0 auto;
    min-height: 0;
    flex-direction: column;
    padding: 60px 12px 0;
}

#pixchatApp {
    display: flex;
    flex: 1;
    min-height: 0;
    flex-direction: column;
}

#pixchatApp[hidden] {
    display: none !important;
}

.pixchat-thread {
    position: relative;
    z-index: 7;
    display: flex;
    flex: 1;
    min-height: 0;
    flex-direction: column;
    gap: 14px;
    overflow-y: auto;
    padding: 8px 28px 8px 4px;
    scrollbar-width: none;
}

.pixchat-thread::-webkit-scrollbar {
    display: none;
}

.section-navigation.pixchat-thread-nav {
    --section-nav-color: rgba(255, 255, 255, 0.42);
    --section-nav-active-color: var(--color-pixypurple-light);
    --section-nav-line-width: 18px;
    --section-nav-active-line-width: 38px;
    --section-nav-line-height: 3px;
    --section-nav-gap: 12px;
    position: fixed;
    z-index: 9;
    top: 50%;
    right: 16px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: var(--section-nav-gap);
    transform: translateY(-50%);
}

.pixchat-thread-nav[hidden] {
    display: none !important;
}

.pixchat-thread-nav .section-navigation__link {
    position: relative;
    display: block;
    width: var(--section-nav-line-width);
    height: max(24px, var(--section-nav-line-height));
    padding: 0;
    border: 0;
    border-radius: var(--radius-pill);
    background: transparent;
    cursor: pointer;
    transition: width 0.25s ease, filter 0.25s ease;
}

.pixchat-thread-nav .section-navigation__link::after {
    position: absolute;
    top: 50%;
    right: 0;
    width: 100%;
    height: var(--section-nav-line-height);
    border-radius: inherit;
    background: var(--section-nav-color);
    content: "";
    transition: background-color 0.25s ease, height 0.25s ease, box-shadow 0.25s ease;
    transform: translateY(-50%);
}

.pixchat-thread-nav .section-navigation__link:hover,
.pixchat-thread-nav .section-navigation__link:focus-visible,
.pixchat-thread-nav .section-navigation__link[aria-current="true"] {
    width: var(--section-nav-active-line-width);
}

.pixchat-thread-nav .section-navigation__link:hover::after,
.pixchat-thread-nav .section-navigation__link:focus-visible::after,
.pixchat-thread-nav .section-navigation__link[aria-current="true"]::after {
    height: calc(var(--section-nav-line-height) + 2px);
    background: var(--section-nav-active-color);
    box-shadow: 0 0 10px color-mix(in srgb, var(--section-nav-active-color) 65%, transparent);
}

.pixchat-thread-nav .section-navigation__link::before {
    position: absolute;
    top: 50%;
    right: calc(100% + 10px);
    z-index: 1;
    width: max-content;
    max-width: min(240px, 50vw);
    padding: 6px 9px;
    border-radius: 10px;
    background: rgba(18, 12, 22, 0.88);
    backdrop-filter: blur(8px);
    color: #fff;
    content: attr(aria-label);
    font-size: 13px;
    line-height: 1.2;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-50%) translateX(4px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.pixchat-thread-nav .section-navigation__link:hover::before,
.pixchat-thread-nav .section-navigation__link:focus-visible::before {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

.pixchat-empty {
    margin: auto;
    max-width: 420px;
    padding: 28px 24px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    background: var(--color-classic-1);
    backdrop-filter: blur(10px) saturate(115%);
    text-align: center;
}

.pixchat-empty h1 {
    font-size: 1.8rem;
    letter-spacing: -0.05em;
}

.pixchat-empty p {
    margin-top: 10px;
    color: var(--text-light);
    font-size: 0.95rem;
}

.pixchat-msg {
    display: flex;
    max-width: 92%;
    flex-direction: column;
    gap: 8px;
}

.pixchat-msg.is-user {
    align-self: flex-end;
}

.pixchat-msg.is-assistant {
    align-self: flex-start;
}

.pixchat-bubble {
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-m);
    background: rgba(13, 13, 13, 0.5);
    backdrop-filter: blur(8px);
    color: #fff;
    font-size: 0.95rem;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
}

.pixchat-msg.is-user .pixchat-bubble {
    background: rgba(75, 0, 100, 0.32);
    border-color: rgba(180, 0, 255, 0.28);
}

.pixchat-msg.is-assistant .pixchat-bubble {
    position: relative;
    isolation: isolate;
}

.pixchat-msg.is-assistant .pixchat-bubble::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: inherit;
    padding: 1px;
    background: var(--pdl-ai-gradient);
    background-size: 300% 300%;
    animation: pdl-ai-flow var(--pdl-ai-flow) linear infinite;
    opacity: 0.85;
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    mask-composite: exclude;
}

.pixchat-bubble:empty {
    display: none;
}

.pixchat-bubble.is-pending {
    display: none;
}

.pixchat-thinking {
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.pixchat-thinking__trigger {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 16px;
    border: 1px solid rgba(180, 0, 255, 0.28);
    border-radius: 16px;
    background: rgba(13, 13, 13, 0.72);
    color: #fff;
    font: inherit;
    font-size: 0.88rem;
    text-align: left;
    cursor: pointer;
    transition:
        background 0.25s ease,
        border-radius 0.3s ease,
        border-color 0.25s ease;
}

.pixchat-thinking__trigger:hover {
    background: rgba(75, 0, 100, 0.28);
    border-color: rgba(180, 0, 255, 0.42);
}

.pixchat-thinking.is-open .pixchat-thinking__trigger {
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

.pixchat-thinking__title {
    font-weight: 600;
    letter-spacing: -0.02em;
}

.pixchat-thinking__icon {
    width: 9px;
    height: 9px;
    flex-shrink: 0;
    border-right: 2px solid var(--color-pixypurple-light);
    border-bottom: 2px solid var(--color-pixypurple-light);
    transform: rotate(45deg) translateY(-2px);
    transition: transform 0.35s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.pixchat-thinking.is-open .pixchat-thinking__icon {
    transform: rotate(-135deg) translateY(-2px);
}

.pixchat-thinking__content {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition:
        max-height 0.4s ease,
        opacity 0.25s ease;
}

.pixchat-thinking.is-open .pixchat-thinking__content {
    opacity: 1;
}

.pixchat-thinking__inner {
    position: relative;
    min-height: 112px;
    margin-top: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background: #050505;
}

.pixchat-thinking__inner .pdl-ai-aurora.is-inline {
    position: absolute;
    inset: 0;
    opacity: 1;
    border-radius: inherit;
}

.pixchat-bubble.is-streaming::after {
    content: "";
    display: inline-block;
    width: 2px;
    height: 1em;
    margin-left: 2px;
    vertical-align: -0.12em;
    background: var(--color-pixypurple-light);
    animation: pixchat-caret 0.9s step-end infinite;
}

@keyframes pixchat-caret {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.pixchat-card--loading {
    pointer-events: none;
}

.pixchat-gen-placeholder {
    position: relative;
    overflow: hidden;
    width: 100%;
    background: #050505;
}

.pixchat-gen-placeholder[data-ratio="cover"] {
    aspect-ratio: 1;
}

.pixchat-gen-placeholder[data-ratio="component"] {
    aspect-ratio: 16 / 11;
}

.pixchat-gen-placeholder .pdl-ai-aurora.is-inline {
    position: absolute;
    inset: 0;
    opacity: 1;
}

.pixchat-card {
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-l);
    background: var(--color-classic-2);
    backdrop-filter: blur(8px);
}

.pixchat-card canvas,
.pixchat-card iframe {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    background: #050505;
    border: 0;
}

.pixchat-card iframe {
    aspect-ratio: 16 / 11;
}

.pixchat-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px 12px;
}

.pixchat-card-actions button,
.pixchat-card-actions a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: 1px solid rgba(180, 0, 255, 0.35);
    border-radius: var(--radius-pill);
    background: rgba(120, 0, 160, 0.18);
    color: #fff;
    font: inherit;
    font-size: 0.78rem;
    text-decoration: none;
    cursor: pointer;
    transition: transform 180ms ease, background 180ms ease;
}

.pixchat-card-actions button:hover,
.pixchat-card-actions a:hover {
    transform: translateY(-2px);
    background: rgba(120, 0, 160, 0.32);
}

.pixchat-composer {
    position: relative;
    z-index: 8;
    flex-shrink: 0;
    padding: 8px 0 calc(12px + env(safe-area-inset-bottom, 0px));
    background: transparent;
}

.pixchat-waves {
    position: fixed;
    z-index: 5;
    right: 0;
    bottom: 0;
    left: 0;
    height: min(56vh, 520px);
    overflow: hidden;
    pointer-events: none;
    opacity: 0;
    transform: translateY(18%);
    transition: opacity 0.8s ease, transform 0.9s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.pixchat-waves::before {
    content: "";
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 42%;
    background: linear-gradient(
        180deg,
        transparent 0%,
        color-mix(in srgb, var(--pdl-ai-pink) 28%, transparent) 38%,
        color-mix(in srgb, var(--pdl-ai-cyan) 34%, #1a0822) 100%
    );
    pointer-events: none;
}

.pixchat-waves.is-on {
    opacity: 1;
    transform: translateY(0);
}

.pixchat-waves.is-leaving {
    opacity: 0;
    transform: translateY(22%);
}

.pixchat-wave {
    position: absolute;
    left: -35%;
    width: 170%;
    bottom: -38%;
    height: 115%;
    border-radius: 48% 52% 40% 60% / 62% 58% 42% 38%;
    opacity: 0.9;
    pointer-events: none;
    transform-origin: 50% 100%;
    will-change: transform;
}

.pixchat-wave--1 {
    bottom: -36%;
    height: 118%;
    background:
        radial-gradient(ellipse 48% 90% at 30% 100%, color-mix(in srgb, var(--pdl-ai-pink) 82%, transparent), transparent 72%),
        radial-gradient(ellipse 40% 80% at 70% 100%, color-mix(in srgb, var(--pdl-ai-cyan) 58%, transparent), transparent 74%),
        linear-gradient(180deg, transparent, color-mix(in srgb, var(--pdl-ai-pink) 48%, transparent) 78%);
    filter: blur(16px);
}

.pixchat-wave--2 {
    bottom: -40%;
    height: 122%;
    background:
        radial-gradient(ellipse 50% 95% at 62% 100%, color-mix(in srgb, var(--pdl-ai-cyan) 76%, transparent), transparent 70%),
        radial-gradient(ellipse 36% 75% at 16% 100%, color-mix(in srgb, var(--pdl-ai-mint) 48%, transparent), transparent 72%);
    filter: blur(18px);
}

.pixchat-wave--3 {
    bottom: -32%;
    height: 108%;
    background:
        radial-gradient(ellipse 40% 88% at 48% 100%, color-mix(in srgb, var(--pdl-ai-mint) 70%, transparent), transparent 68%),
        linear-gradient(180deg, transparent, color-mix(in srgb, var(--pdl-ai-cyan) 42%, transparent) 82%);
    filter: blur(14px);
}

.pixchat-wave--4 {
    bottom: -44%;
    height: 128%;
    background:
        radial-gradient(ellipse 54% 100% at 82% 100%, color-mix(in srgb, var(--pdl-ai-mint) 42%, transparent), transparent 74%),
        radial-gradient(ellipse 44% 88% at 10% 100%, color-mix(in srgb, var(--pdl-ai-pink) 50%, transparent), transparent 72%);
    filter: blur(22px);
}

.pixchat-waves[data-state="thinking"] .pixchat-wave--1 { animation: pixchat-sweep 7.2s ease-in-out infinite; }
.pixchat-waves[data-state="thinking"] .pixchat-wave--2 { animation: pixchat-sweep 8.4s ease-in-out infinite reverse; }
.pixchat-waves[data-state="thinking"] .pixchat-wave--3 { animation: pixchat-sweep 6.4s ease-in-out infinite 0.4s; }
.pixchat-waves[data-state="thinking"] .pixchat-wave--4 { animation: pixchat-sweep 9.2s ease-in-out infinite reverse 0.2s; }

.pixchat-waves[data-state="working"] .pixchat-wave--1 { animation: pixchat-work-1 5.6s ease-in-out infinite; }
.pixchat-waves[data-state="working"] .pixchat-wave--2 { animation: pixchat-work-2 6.8s ease-in-out infinite; }
.pixchat-waves[data-state="working"] .pixchat-wave--3 { animation: pixchat-work-3 4.8s ease-in-out infinite; }
.pixchat-waves[data-state="working"] .pixchat-wave--4 { animation: pixchat-work-4 7.6s ease-in-out infinite; }

.pixchat-waves[data-state="searching"] .pixchat-wave--1 { animation: pixchat-jump 2.8s ease-in-out infinite; }
.pixchat-waves[data-state="searching"] .pixchat-wave--2 { animation: pixchat-jump 3.2s ease-in-out infinite 0.18s; }
.pixchat-waves[data-state="searching"] .pixchat-wave--3 { animation: pixchat-jump 2.5s ease-in-out infinite 0.28s; }
.pixchat-waves[data-state="searching"] .pixchat-wave--4 { animation: pixchat-jump 3.5s ease-in-out infinite 0.1s; }

.pixchat-waves[data-state="idle"] .pixchat-wave {
    animation: none;
}

@keyframes pixchat-sweep {
    0%, 100% { transform: translateX(10%); }
    50% { transform: translateX(-10%); }
}

@keyframes pixchat-work-1 {
    0%, 100% { transform: translateX(-8%) scaleY(1.02) rotate(-3deg); }
    50% { transform: translateX(9%) scaleY(1.1) rotate(4deg); }
}

@keyframes pixchat-work-2 {
    0%, 100% { transform: translateX(10%) scaleY(1.06) rotate(4deg); }
    50% { transform: translateX(-11%) scaleY(1) rotate(-3deg); }
}

@keyframes pixchat-work-3 {
    0%, 100% { transform: translateX(-5%) scaleY(1.04) rotate(2deg); }
    50% { transform: translateX(6%) scaleY(1.12) rotate(-2deg); }
}

@keyframes pixchat-work-4 {
    0%, 100% { transform: translateX(6%) scaleY(1.02) rotate(0deg); }
    50% { transform: translateX(-7%) scaleY(1.08) rotate(-5deg); }
}

@keyframes pixchat-jump {
    0%, 100% { transform: translateX(0) scaleY(1.04); }
    28% { transform: translateX(9%) scaleY(1.1); }
    52% { transform: translateX(-10%) scaleY(1.02); }
    76% { transform: translateX(6%) scaleY(1.08); }
}

.pixchat-mentions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.pixchat-mentions button {
    padding: 4px 10px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: var(--radius-pill);
    background: rgba(10, 8, 14, 0.78);
    color: var(--text-light);
    font: inherit;
    font-size: 0.75rem;
    cursor: pointer;
    transition: color 180ms ease, border-color 180ms ease, background 180ms ease;
}

.pixchat-mentions button:hover,
.pixchat-mentions button.is-on {
    color: #fff;
    border-color: rgba(180, 0, 255, 0.45);
    background: rgba(120, 0, 160, 0.22);
}

.pixchat-composer .pdl-ai-prompt {
    max-width: none;
    margin: 0;
    padding: 8px 8px 8px 16px;
    border-radius: var(--radius-pill);
    background: rgba(10, 8, 14, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.16);
    box-shadow: 0 10px 36px rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(22px) saturate(140%);
    -webkit-backdrop-filter: blur(22px) saturate(140%);
}

.pixchat-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 8px;
    color: var(--text-muted);
    font-size: 0.72rem;
}

.pixchat-disabled {
    margin: auto;
    padding: 24px;
    text-align: center;
    color: var(--text-light);
}

.pixchat-shutdown {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    padding: 24px 20px 32px;
}

.pixchat-shutdown[hidden] {
    display: none !important;
}

.pixchat-shutdown .pixchat-empty {
    max-width: 34rem;
}

.pixchat-shutdown-card {
    padding: 28px 24px;
    border: 1px solid rgba(180, 0, 255, 0.28);
    border-radius: var(--radius-l);
    background: rgba(12, 8, 18, 0.72);
}

.pixchat-shutdown-lead {
    color: var(--text-light);
    font-size: 1rem;
    line-height: 1.5;
}

.pixchat-shutdown-card p {
    margin-top: 12px;
    color: rgba(255, 255, 255, 0.78);
    line-height: 1.55;
}

.pixchat-shutdown-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-top: 20px;
}

.pixchat-shutdown-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 18px;
    border: 1px solid rgba(180, 0, 255, 0.45);
    border-radius: var(--radius-pill);
    background: rgba(100, 62, 139, 0.35);
    color: #fff;
    font-weight: 600;
    text-decoration: none;
}

.pixchat-shutdown-link {
    color: var(--color-pixypurple-light);
    font-size: 0.92rem;
}

.pixchat-shutdown a {
    color: var(--color-pixypurple-light);
}

body.is-shutdown #pixchatApp,
body.is-shutdown #pixchatDisabled {
    display: none !important;
}

.site-footer[hidden] {
    display: none !important;
}

body.lowperf::before {
    background: #050505;
}

body.lowperf .site-header,
body.lowperf .menu,
body.lowperf .pixchat-empty,
body.lowperf .pixchat-bubble,
body.lowperf .pixchat-card,
body.lowperf .pixchat-composer .pdl-ai-prompt {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

body.lowperf .pixchat-empty,
body.lowperf .pixchat-card {
    background: var(--color-classic-2-eco);
}

body.lowperf .pixchat-wave,
body.lowperf .pixchat-msg.is-assistant .pixchat-bubble::before {
    animation: none;
}

body.lowperf .pixchat-waves {
    opacity: 0 !important;
}

body.lowperf .pixchat-card-actions button:hover,
body.lowperf .pixchat-card-actions a:hover {
    transform: none;
}

@media (max-width: 760px) {
    .pixchat-title {
        font-size: 0.95rem;
    }

    .pixchat-msg {
        max-width: 100%;
    }
}
