/* Mini uses Chat Slim's proven surface with a deliberately smaller lane. */
body.twilight-mini-mode .sidebar,
body.twilight-mini-mode #sidebar-toggle,
body.twilight-mini-mode .operator-mobile-nav,
body.twilight-mini-mode .composer-mode-rail,
body.twilight-mini-mode .pro-composer-hint,
body.twilight-mini-mode #attach-button,
body.twilight-mini-mode #voice-button,
body.twilight-mini-mode #file-input,
body.twilight-mini-mode #menu-button,
body.twilight-mini-mode #share-button,
body.twilight-mini-mode #topbar-model-chip,
body.twilight-mini-mode .pro-welcome-grid,
body.twilight-mini-mode .welcome-chips {
    display: none !important;
}

body.twilight-mini-mode .topbar-brand-name {
    color: #80e0c0;
    letter-spacing: 0.18em;
}

/* The shared Pro room hides the legacy brand on small screens. Twilight gets
   a deliberately tiny, text-first header instead of an orphaned status dot. */
body.twilight-mini-mode .topbar {
    display: flex !important;
    min-height: 54px;
    height: 54px;
    padding: 0 10px;
    border-bottom: 1px solid rgba(128, 224, 192, 0.14);
}

body.twilight-mini-mode .topbar::before {
    content: "TWILIGHT" !important;
    color: #80e0c0;
    font-family: var(--pro-font-display, "Chakra Petch", sans-serif);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.18em;
}

body.twilight-mini-mode .topbar-brand {
    display: none !important;
}

body.twilight-mini-mode .pro-room-signal {
    min-width: 0;
    margin-left: auto;
    padding: 5px 0 5px 8px;
    border: 0;
    background: transparent;
    box-shadow: none;
}

body.twilight-mini-mode .pro-room-signal span:last-child {
    display: grid !important;
}

body.twilight-mini-mode .pro-room-signal strong,
body.twilight-mini-mode .pro-room-signal em {
    color: #80e0c0;
}

body.twilight-mini-mode .pro-room-signal em {
    letter-spacing: 0.06em;
}

body.twilight-mini-mode .mini-thread-controls {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

body.twilight-mini-mode .mini-thread-controls button {
    min-height: 28px;
    padding: 0 9px;
    border: 1px solid rgba(128, 224, 192, 0.22);
    border-radius: 999px;
    background: rgba(128, 224, 192, 0.04);
    color: #b9d9ce;
    font: 500 0.68rem/1 var(--pro-font-mono, "JetBrains Mono", monospace);
}

body.twilight-mini-mode .mini-thread-controls button:hover {
    border-color: rgba(128, 224, 192, 0.5);
    color: #80e0c0;
}

body.twilight-mini-mode .mini-thread-drawer {
    position: fixed;
    z-index: 24;
    top: 66px;
    right: 24px;
    width: min(360px, calc(100vw - 32px));
    max-height: min(520px, calc(100vh - 96px));
    padding: 14px;
    overflow: auto;
    border: 1px solid rgba(128, 224, 192, 0.2);
    border-radius: 16px;
    background: rgba(8, 15, 22, 0.96);
    box-shadow: 0 18px 52px rgba(0, 0, 0, 0.42);
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
    transition: opacity 140ms ease, transform 140ms ease;
}

body.twilight-mini-mode .mini-thread-drawer.is-open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

body.twilight-mini-mode .mini-thread-heading {
    margin-bottom: 10px;
    color: #80e0c0;
    font: 600 0.72rem/1.2 var(--pro-font-mono, "JetBrains Mono", monospace);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

body.twilight-mini-mode .mini-thread-list {
    display: grid;
    gap: 6px;
}

body.twilight-mini-mode .mini-thread-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 7px;
    padding: 7px;
    border-radius: 10px;
}

body.twilight-mini-mode .mini-thread-row.is-active {
    background: rgba(128, 224, 192, 0.08);
}

body.twilight-mini-mode .mini-thread-open,
body.twilight-mini-mode .mini-thread-rename {
    border: 0;
    background: transparent;
    color: #d8e7e2;
    text-align: left;
    font: 500 0.78rem/1.3 var(--pro-font-body, "IBM Plex Sans", sans-serif);
}

body.twilight-mini-mode .mini-thread-open {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.twilight-mini-mode .mini-thread-rename {
    color: #80e0c0;
    font-size: 0.66rem;
}

body.twilight-mini-mode .mini-thread-meta,
body.twilight-mini-mode .mini-thread-empty {
    color: #71847e;
    font: 500 0.62rem/1.2 var(--pro-font-mono, "JetBrains Mono", monospace);
}

body.twilight-mini-mode .mini-thread-empty {
    margin: 8px 2px;
}

body.twilight-mini-mode .topbar-brand-mark {
    color: #d9b69c;
}

body.twilight-mini-mode .pro-room-signal {
    opacity: 0.9;
}

body.twilight-mini-mode .welcome-avatar {
    overflow: hidden;
    background: #172743;
    box-shadow: 0 12px 34px rgba(20, 48, 70, 0.35);
}

body.twilight-mini-mode .welcome-avatar img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

body.twilight-mini-mode .pro-lock-disc {
    overflow: hidden;
}

body.twilight-mini-mode .pro-lock-disc img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

body.twilight-mini-mode .tabletop-panel,
body.twilight-mini-mode .study-panel,
body.twilight-mini-mode .social-panel,
body.twilight-mini-mode .botspot-panel,
body.twilight-mini-mode .home-panel {
    display: none !important;
}

body.twilight-mini-mode .welcome-copy {
    max-width: 32rem;
}

body.twilight-mini-mode .composer-wrap {
    padding-top: 1rem;
}

body.twilight-mini-mode .composer-shell {
    border-color: rgba(128, 224, 192, 0.42);
}

body.twilight-mini-mode .message-assistant .message-avatar {
    overflow: hidden;
    background: #172743;
}

body.twilight-mini-mode .message-assistant .message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

body.twilight-mini-mode .mini-source-list {
    display: grid;
    gap: 0.35rem;
    margin-top: 0.75rem;
    padding-top: 0.65rem;
    border-top: 1px solid rgba(128, 224, 192, 0.2);
    font-size: 0.82rem;
}

body.twilight-mini-mode .mini-source-list a {
    color: #80e0c0;
    overflow-wrap: anywhere;
}

/* Twilight gets her own room, not an empty copy of Big J-Bot's shell. */
body.twilight-mini-mode .chat-shell {
    max-width: 980px;
    width: min(100%, 980px);
    padding-left: 22px;
    padding-right: 22px;
    background:
        radial-gradient(circle at 50% 24%, rgba(128, 224, 192, 0.08), transparent 32%),
        linear-gradient(180deg, rgba(8, 15, 22, 0.96), rgba(5, 9, 14, 0.98));
}

body.twilight-mini-mode .chat-shell::before {
    opacity: 0.35;
    background: radial-gradient(circle at 50% 18%, rgba(128, 224, 192, 0.1), transparent 42%);
}

body.twilight-mini-mode .chat-shell::after {
    left: 0;
    right: 0;
    bottom: 78px;
    opacity: 0.16;
}

body.twilight-mini-mode .chat-stage {
    width: min(100%, 760px);
    max-width: 760px;
    padding-top: 18px;
}

body.twilight-mini-mode .welcome-state {
    width: min(100%, 680px);
    max-width: none;
    margin: clamp(38px, 8vh, 80px) auto 0;
    padding: 0 14px 18px;
}

body.twilight-mini-mode .welcome-intro {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
}

body.twilight-mini-mode .welcome-avatar {
    width: 54px;
    height: 54px;
    flex: 0 0 54px;
    margin: 0;
    border: 1px solid rgba(128, 224, 192, 0.65);
    border-radius: 50%;
    background: #0b1720;
    box-shadow: 0 0 0 5px rgba(128, 224, 192, 0.06), 0 12px 34px rgba(20, 48, 70, 0.35);
}

body.twilight-mini-mode .welcome-avatar:empty::before {
    content: "T";
    display: grid;
    width: 100%;
    height: 100%;
    place-items: center;
    color: #80e0c0;
    font: 700 1rem/1 var(--pro-font-display, "Chakra Petch", sans-serif);
    letter-spacing: 0.05em;
}

body.twilight-mini-mode .welcome-state h1 {
    margin: 0;
    font-size: clamp(1.75rem, 3.2vw, 2.35rem);
    letter-spacing: -0.025em;
}

body.twilight-mini-mode .welcome-eyebrow {
    color: #80e0c0;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

body.twilight-mini-mode .welcome-copy {
    margin: 14px auto 0;
    max-width: 32rem;
    color: #9fbab0;
}

body.twilight-mini-mode .composer-wrap {
    width: min(100%, 760px);
    max-width: 760px;
    margin: 0 auto;
    padding: 8px 0 4px;
}

body.twilight-mini-mode .composer-shell {
    min-height: 58px;
    border: 1px solid rgba(128, 224, 192, 0.42);
    border-radius: 18px;
    background: rgba(8, 18, 24, 0.92);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.26), 0 0 0 4px rgba(128, 224, 192, 0.04);
}

body.twilight-mini-mode #message-input {
    min-height: 42px;
    padding: 14px 52px 12px 16px;
    color: #e8f4ef;
}

body.twilight-mini-mode #send-button {
    width: 40px;
    height: 40px;
    margin-right: 8px;
    border-radius: 12px;
    background: #80e0c0;
    color: #06100d;
    border: 0;
}

body.twilight-mini-mode #send-button:disabled {
    opacity: 0.45;
}

body.pro-chatroom.pro-operator-enabled.twilight-mini-mode .topbar::before {
    content: "TWILIGHT" !important;
    color: #80e0c0 !important;
    font-family: var(--pro-font-display, "Chakra Petch", sans-serif) !important;
    font-size: 0.78rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.18em !important;
}

body.twilight-mini-mode .composer-shell {
    grid-template-columns: minmax(0, 1fr) auto !important;
}

/* This badge belongs to the full shell; Mini reports her local state in the header. */
body.twilight-mini-mode #ambient-status-badge,
body.twilight-mini-mode #ambient-popover {
    display: none !important;
}

@media (max-width: 640px) {
    body.twilight-mini-mode .chat-shell {
        padding-left: 12px;
        padding-right: 12px;
    }

    body.twilight-mini-mode .welcome-intro {
        align-items: flex-start;
        justify-content: flex-start;
        text-align: left;
    }

    body.twilight-mini-mode .welcome-copy {
        text-align: left;
    }
}

/* Twilight design pass: a full-width private room, not a shrunken command chair. */
body.twilight-mini-mode {
    background: #070b10;
}

body.twilight-mini-mode .slim-app {
    padding: 0;
    background:
        radial-gradient(circle at 50% 8%, rgba(128, 224, 192, 0.1), transparent 25%),
        radial-gradient(circle at 14% 90%, rgba(217, 182, 156, 0.07), transparent 28%),
        linear-gradient(180deg, #091219 0%, #070b10 46%, #05080c 100%);
}

body.twilight-mini-mode .chat-shell {
    width: 100%;
    max-width: none;
    height: 100%;
    margin: 0;
    padding: 0 24px 18px;
    gap: 0;
    border: 0;
    border-radius: 0;
    background:
        radial-gradient(ellipse at 50% 24%, rgba(128, 224, 192, 0.07), transparent 34%),
        linear-gradient(180deg, rgba(7, 15, 20, 0.82), rgba(5, 9, 13, 0.98));
    box-shadow: none;
}

body.twilight-mini-mode .chat-shell::before {
    inset: 0;
    opacity: 0.7;
    background:
        radial-gradient(circle at 50% 22%, rgba(128, 224, 192, 0.1), transparent 24%),
        linear-gradient(120deg, transparent 0 37%, rgba(128, 224, 192, 0.035) 50%, transparent 63%);
    mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, 0.72) 58%, transparent 100%);
}

body.twilight-mini-mode .chat-shell::after {
    left: 50%;
    right: auto;
    bottom: 108px;
    width: min(760px, calc(100% - 48px));
    height: 1px;
    transform: translateX(-50%);
    background: linear-gradient(90deg, transparent, rgba(128, 224, 192, 0.28), transparent);
    opacity: 0.7;
}

body.twilight-mini-mode .topbar {
    width: min(100%, 1180px);
    height: 72px;
    min-height: 72px;
    margin: 0 auto;
    padding: 0;
    border-bottom: 1px solid rgba(128, 224, 192, 0.16);
}

body.twilight-mini-mode .topbar::before {
    font-size: 0.82rem !important;
    letter-spacing: 0.22em !important;
}

body.twilight-mini-mode .pro-room-signal {
    padding-right: 12px;
}

body.twilight-mini-mode .pro-room-signal strong {
    font-size: 0.76rem;
    letter-spacing: 0.02em;
}

body.twilight-mini-mode .pro-room-signal em {
    color: rgba(159, 186, 176, 0.7);
    font-size: 0.58rem;
}

body.twilight-mini-mode .mini-thread-controls button {
    min-height: 30px;
    padding: 0 12px;
    border-color: rgba(128, 224, 192, 0.28);
    background: rgba(128, 224, 192, 0.045);
}

body.twilight-mini-mode .chat-stage {
    width: min(100%, 1120px);
    max-width: 1120px;
    margin: 0 auto;
    padding-top: 0;
}

body.twilight-mini-mode .welcome-state {
    width: min(100%, 760px);
    margin: clamp(88px, 17vh, 160px) auto 0;
    padding: 0;
    text-align: center;
}

body.twilight-mini-mode .welcome-intro {
    display: block;
}

body.twilight-mini-mode .welcome-avatar {
    width: 76px;
    height: 76px;
    margin: 0 auto 18px;
    border-color: rgba(128, 224, 192, 0.72);
    box-shadow:
        0 0 0 8px rgba(128, 224, 192, 0.045),
        0 0 54px rgba(128, 224, 192, 0.14),
        0 18px 40px rgba(0, 0, 0, 0.32);
}

body.twilight-mini-mode .welcome-state h1 {
    font-size: clamp(2.15rem, 4vw, 3.3rem);
    font-weight: 560;
    letter-spacing: -0.04em;
}

body.twilight-mini-mode .welcome-eyebrow {
    margin-bottom: 10px;
    color: #80e0c0;
    font-size: 0.7rem;
    letter-spacing: 0.16em;
}

body.twilight-mini-mode .welcome-copy {
    max-width: 31rem;
    margin: 20px auto 0;
    color: rgba(184, 207, 198, 0.72);
    font-size: 0.98rem;
    line-height: 1.65;
}

body.twilight-mini-mode .welcome-copy::after {
    content: "";
    display: block;
    width: 64px;
    height: 1px;
    margin: 24px auto 0;
    background: linear-gradient(90deg, transparent, rgba(217, 182, 156, 0.65), transparent);
}

body.twilight-mini-mode .composer-wrap {
    width: min(100%, 960px);
    max-width: 960px;
    margin: 0 auto;
    padding: 16px 0 0;
}

body.twilight-mini-mode .composer-shell {
    min-height: 68px;
    padding: 10px 12px 10px 18px;
    border: 1px solid rgba(128, 224, 192, 0.35);
    border-radius: 22px;
    background: rgba(10, 20, 25, 0.86);
    box-shadow:
        0 18px 48px rgba(0, 0, 0, 0.28),
        0 0 0 5px rgba(128, 224, 192, 0.025);
    backdrop-filter: blur(16px);
}

body.twilight-mini-mode #message-input {
    min-height: 46px;
    padding: 14px 16px 12px 0;
    font-size: 0.98rem;
}

body.twilight-mini-mode #send-button {
    width: 44px;
    height: 44px;
    margin: 0;
    border-radius: 14px;
    background: #80e0c0;
    box-shadow: 0 8px 18px rgba(128, 224, 192, 0.16);
}

body.twilight-mini-mode #send-button:hover:not(:disabled) {
    background: #a5f0d4;
    transform: translateY(-1px);
}

body.twilight-mini-mode .ambient-badge,
body.twilight-mini-mode .ambient-popover {
    display: none !important;
}

/* The converged Big-J-Bot shell has a deliberate left rail. Mini hides that
   rail, so this higher-specificity reset is essential: no phantom 20vw gutter. */
body.pro-chatroom.pro-operator-enabled.twilight-mini-mode .chat-shell {
    width: 100% !important;
    max-width: none !important;
    padding: 0 24px 18px !important;
}

body.pro-chatroom.pro-operator-enabled.twilight-mini-mode .topbar {
    width: min(100%, 1180px) !important;
    max-width: 1180px !important;
}

body.pro-chatroom.pro-operator-enabled.twilight-mini-mode .chat-stage,
body.pro-chatroom.pro-operator-enabled.twilight-mini-mode .composer-wrap {
    width: min(100%, 1120px) !important;
    max-width: 1120px !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

@media (max-width: 640px) {
    body.twilight-mini-mode .chat-shell {
        padding: 0 14px 12px;
    }

    body.twilight-mini-mode .topbar {
        height: 62px;
        min-height: 62px;
    }

    body.twilight-mini-mode .welcome-state {
        margin-top: 72px;
    }

    body.twilight-mini-mode .welcome-avatar {
        width: 64px;
        height: 64px;
    }

    body.twilight-mini-mode .welcome-state h1 {
        font-size: 2.2rem;
    }

    body.twilight-mini-mode .composer-wrap {
        padding-top: 12px;
    }
}
