.source-tag {
    margin-top: 10px;
    padding: 4px 8px;
    font-size: 0.78em;
    color: #888;
    border-top: 1px solid #333;
}

.source-tag a {
    color: #6af;
    text-decoration: none;
}

/* ================================================================
   Sessions 3D hélicoïdal — pills avec effet profondeur + animation
   ================================================================ */

#sessionsWrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Hauteur fixe pour éviter tout saut de layout */
    height: 90px;
    margin: 12px 0 8px;
    justify-content: center;
}

#sessionsHelix {
    position: relative;
    width: 360px;
    height: 60px;
    perspective: 480px;
    perspective-origin: 50% 50%;
    transform-style: preserve-3d;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    /* Laisser déborder les cartes latérales */
    overflow: visible;
}

/* Le wrapper doit aussi laisser déborder */
#sessionsWrapper {
    overflow: visible !important;
}

/* ── Pill ────────────────────────────────────────────────────── */
.session-card {
    position: absolute;
    width: 152px;
    padding: 7px 30px 7px 12px;
    border-radius: 999px;
    background: #1c1c1e;
    border: 1px solid #383838;
    box-shadow:
        0 1px 0 rgba(255,255,255,0.04) inset,
        0 4px 16px rgba(0,0,0,0.5),
        0 1px 3px rgba(0,0,0,0.8);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    /* Transition GPU uniquement sur transform et opacity */
    transition:
        transform 0.42s cubic-bezier(0.4, 0, 0.2, 1),
        opacity   0.42s cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow 0.22s ease;
    pointer-events: auto;
    user-select: none;
}

.session-card.active {
    background: #26262a;
    border-color: #505058;
    box-shadow:
        0 1px 0 rgba(255,255,255,0.07) inset,
        0 6px 24px rgba(0,0,0,0.65),
        0 2px 6px rgba(0,0,0,0.9);
}

.session-card:not(.active):hover {
    border-color: #484850;
    box-shadow:
        0 1px 0 rgba(255,255,255,0.05) inset,
        0 6px 20px rgba(0,0,0,0.6),
        0 2px 4px rgba(0,0,0,0.85);
}

/* ── Textes ─────────────────────────────────────────────────── */
.session-label {
    font-size: 0.76em;
    font-weight: 600;
    color: #d0d0d8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
    line-height: 1.3;
}

.session-preview {
    font-size: 0.68em;
    color: #50505a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
    margin-top: 1px;
}

.session-card.active .session-label  { color: #e8e8f0; }
.session-card.active .session-preview { color: #68686e; }

/* ── Boutons ✕ et ✎ ─────────────────────────────────────────── */
.session-del,
.session-ren {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.68em;
    line-height: 1;
    padding: 2px 3px;
    border-radius: 50%;
    color: #484850;
    pointer-events: auto;
    transition: color 0.15s, background 0.15s;
}

.session-del { right: 6px; }
.session-ren { right: 20px; }

.session-del:hover { color: #ff5555; background: rgba(255,80,80,0.12); }
.session-ren:hover { color: #9090cc; background: rgba(140,140,200,0.12); }

/* ── Bouton + ───────────────────────────────────────────────── */
.session-add {
    position: absolute;
    right: -34px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    background: #1c1c1e;
    border: 1px solid #383838;
    border-radius: 50%;
    color: #555560;
    cursor: pointer;
    font-size: 1.05em;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    pointer-events: auto;
    transition: color 0.15s, border-color 0.15s, box-shadow 0.15s;
    box-shadow: 0 2px 6px rgba(0,0,0,0.45);
}

.session-add:hover {
    color: #b0b0c0;
    border-color: #585860;
    box-shadow: 0 3px 10px rgba(0,0,0,0.55);
}

/* ── Compteur ───────────────────────────────────────────────── */
#sessionCounter {
    font-size: 0.66em;
    color: #363640;
    margin-top: 5px;
    letter-spacing: 0.08em;
    font-variant-numeric: tabular-nums;
}

#input {
	transition: height 0.08s ease;
    width: 100%;
    min-height: 80px;
    max-width: 878px;
    resize: both;
    overflow-y: auto;
	margin-left: auto;

    padding: 10px;
    font-size: 14px;
    line-height: 1.4;

    border-radius: 8px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

#newSessionBtn {
  margin-left: auto;
}

#tokenDisplay {
    font-size: 0.82em;
    color: #888;
    padding: 3px 10px;
    font-variant-numeric: tabular-nums;
	letter-spacing: 0.01em;
}

#contextMaxInput::-webkit-inner-spin-button,
#contextMaxInput::-webkit-outer-spin-button {
	    opacity: 0.4;
}

.token-count {
    color: #ccc;
    font-weight: 600;
}
.token-max {
    color: #666;
}
.token-sep {
    color: #555;
}
.token-detail {
    color: #666;
    font-size: 0.92em;
}

.think-icon {
    width: 75px;
    height: 75px;
    image-rendering: pixelated;
    margin-right: 6px;
    vertical-align: middle;
}

.msg {
    padding: 12px 14px;
    max-width: 80%;

    border-radius: 14px;

    border: 1px solid rgba(255,255,255,0.05);

    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.05),
        0 3px 12px rgba(0,0,0,0.35);

    backdrop-filter: blur(3px);

    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease;
}

.msg:hover {
    transform: translateY(-1px);

    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.08),
        0 5px 18px rgba(0,0,0,0.45);
}

.msg-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.msg-content {
    white-space: normal;
}

.text {
    margin: 0;
    padding: 0;
}

.msg-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
    align-items: center;
}

.msg-content .text p {
    margin: 0;
}

.msg-content .text {
    line-height: 1.3;
}

.msg-actions button {
    opacity: 0.6;
}

.msg-actions button:hover {
    opacity: 1;
}

.extensions {
    margin-top: 10px;
    color: #ccc;
    font-size: 14px;
}

span {
  padding: 10px;
  border-radius: 7px;
}

.ext {
    display: inline-block;
    padding: 4px 2px;
    margin: 0px;
    background: #222;
	border-radius: 25% 10%;
    color: #7bdcff;
}

.login-box {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
    max-width: 300px;
}

.login-box input {
    padding: 10px;
    border-radius: 8px;
    border: none;
}

.login-box button {
    padding: 10px;
    cursor: pointer;
}

.thinking {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    opacity: 0.8;
}

.dots {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.loader {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-style: italic;
    opacity: 0.8;
}

.dot {
    width: 6px;
    height: 6px;
    background: #aaa;
    border-radius: 50%;
    animation: bounce 1.2s infinite ease-in-out;
}

.dot:nth-child(2) { animation-delay: 0.2s; }
.dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
    40% { transform: translateY(-6px); opacity: 1; }
}

html { color-scheme: dark; }

body {
    background: #0f111a;
    max-width: 900px;
    color: #e6e6e6;
    font-family: Arial, sans-serif;
    margin: 20px;
}

#topbar {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

input, select, button {
    background: #1c1f2b;
    color: #e6e6e6;
    border: 1px solid #333;
    padding: 8px;
    border-radius: 6px;
}

button:hover { background: #2a2f45; cursor: pointer; }

#chat {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}

.user {
    background: linear-gradient(
        180deg,
        #322049 0%,
        #261a38 100%
    );
	align-self: flex-end;
}

.assistant {
    background: linear-gradient(
        180deg,
        #232c42 0%,
        #1a2235 100%
    );
	align-self: flex-start;
}

#stats { font-size: 12px; opacity: 0.8; }