:root {
    /* Color tokens */
    --bg-0: #0b0f1e;
    --surface: rgba(255,255,255,0.06);
    --surface-2: rgba(255,255,255,0.10);
    --border: rgba(255,255,255,0.12);
    --text: #f1f5f9;
    --muted: #94a3b8;
    --primary: #8b5cf6;
    --primary-2: #6366f1;
    --accent: #22d3ee;
    --good: #22c55e;
    --warn: #f59e0b;
    --info: #3b82f6;
    --danger: #ef4444;

    /* Effects */
    --radius: 14px;
    --radius-sm: 10px;
    --shadow-1: 0 10px 30px rgba(0,0,0,0.35);
    --shadow-glow: 0 0 0 1px rgba(139,92,246,0.35), 0 10px 40px rgba(99,102,241,0.25);
    --blur: blur(14px);
}

* { box-sizing: border-box; }
.hidden { display: none !important; }

html, body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--text);
    min-height: 100vh;
    background: var(--bg-0);
    overflow-x: hidden;
}

/* Aurora background */
body::before {
    content: ""; position: fixed; inset: -20%; z-index: -2;
    background:
        radial-gradient(40% 60% at 20% 20%, rgba(139,92,246,0.45), transparent 60%),
        radial-gradient(35% 45% at 80% 10%, rgba(34,211,238,0.35),  transparent 60%),
        radial-gradient(45% 55% at 70% 80%, rgba(99,102,241,0.45),  transparent 60%),
        radial-gradient(35% 50% at 10% 90%, rgba(236,72,153,0.30),  transparent 60%);
    filter: blur(40px) saturate(120%);
    animation: aurora 18s ease-in-out infinite alternate;
}
@keyframes aurora {
    0% { transform: translate3d(0,0,0); }
    100% { transform: translate3d(-2%,2%,0); }
}

/* Topbar */
.topbar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 24px; margin: 16px 16px 24px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, rgba(255,255,255,0.08), rgba(255,255,255,0.03));
    border: 1px solid var(--border);
    backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
    box-shadow: var(--shadow-1);
    position: sticky; top: 12px; z-index: 10;
}
.topbar h1 {
    margin: 0; font-size: 22px;
    background: linear-gradient(90deg, #a78bfa, #22d3ee, #f472b6, #a78bfa);
    background-size: 300% 100%;
    -webkit-background-clip: text; background-clip: text; color: transparent;
    animation: titleShine 8s linear infinite;
}
@keyframes titleShine {
    0% { background-position: 0% 50%; }
    100% { background-position: 300% 50%; }
}
.topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Buttons */
.btn {
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 9px 14px;
    font-size: 13.5px; font-weight: 600;
    cursor: pointer; color: var(--text);
    transition: transform .12s ease, box-shadow .2s ease, background .2s ease, opacity .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
    background: linear-gradient(135deg, var(--primary-2), var(--primary));
    box-shadow: 0 8px 24px rgba(99,102,241,0.35);
}
.btn-ghost { background: var(--surface); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger {
    background: linear-gradient(135deg, #f43f5e, var(--danger));
    box-shadow: 0 8px 24px rgba(239,68,68,0.35);
}
.btn-ai {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.08), 0 10px 30px rgba(139,92,246,0.45);
}
.btn-icon {
    background: transparent; border: 1px solid transparent;
    color: var(--muted); padding: 6px 8px; border-radius: 8px;
    cursor: pointer; transition: background .15s ease, color .15s ease;
}
.btn-icon:hover { background: var(--surface); color: var(--text); }

/* Board + columns */
.board {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 18px;
    max-width: 1500px;
    margin: 0 auto 24px;
    padding: 0 16px;
}
.column {
    display: flex; flex-direction: column;
    background: linear-gradient(180deg, rgba(255,255,255,0.07), rgba(255,255,255,0.03));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
    box-shadow: var(--shadow-1);
    overflow: hidden;
}
.column-header {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    background: rgba(0,0,0,0.15);
}
.column-header h2 {
    flex: 1; margin: 0;
    font-size: 15px; font-weight: 600;
}
.col-title {
    cursor: text; padding: 2px 6px; margin: -2px -6px;
    border-radius: 6px;
    transition: background .15s ease;
    outline: 1px dashed transparent;
}
.col-title:hover { background: rgba(255,255,255,0.05); outline-color: rgba(255,255,255,0.15); }
.col-title:focus { background: rgba(99,102,241,0.12); outline: 1px solid #6366f1; }
.column-header .count {
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: 999px; padding: 2px 10px;
    font-size: 12px; color: var(--muted);
}
.column-header .dot {
    width: 10px; height: 10px; border-radius: 50%;
    box-shadow: 0 0 14px currentColor;
}
.column[data-type="went-well"] .dot { background: var(--good); color: var(--good); }
.column[data-type="improve"]   .dot { background: var(--warn); color: var(--warn); }
.column[data-type="action"]    .dot { background: var(--info); color: var(--info); }

/* Add form */
.add-form {
    padding: 12px;
    display: flex; flex-direction: column; gap: 8px;
    border-bottom: 1px solid var(--border);
}
.add-form textarea {
    resize: vertical; min-height: 60px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: rgba(0,0,0,0.25);
    color: var(--text); font-family: inherit; font-size: 14px;
}
.add-form textarea:focus {
    outline: none; border-color: var(--primary-2);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.25);
}
.add-form-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* GIF preview */
.gif-preview {
    position: relative;
    border-radius: 8px; overflow: hidden;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(0,0,0,0.35);
}
.gif-preview img {
    display: block; width: 100%;
    max-height: 200px; object-fit: contain;
}
.gif-remove {
    position: absolute; top: 6px; right: 6px;
    background: rgba(0,0,0,0.6); color: #fff; border-radius: 6px;
}

/* Cards */
.cards {
    flex: 1; padding: 12px;
    display: flex; flex-direction: column; gap: 10px;
    min-height: 80px;
}
.empty {
    color: var(--muted); font-size: 13px;
    text-align: center; padding: 18px 8px;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
}
.card {
    position: relative;
    padding: 12px;
    border-radius: var(--radius-sm);
    background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.03));
    border: 1px solid var(--border);
    box-shadow: 0 6px 18px rgba(0,0,0,0.25);
    cursor: grab;
    animation: cardIn .25s ease;
    transition: transform .12s ease, border-color .15s ease, box-shadow .2s ease;
}
.card:hover { transform: translateY(-2px); border-color: rgba(255,255,255,0.22); }
.card.dragging { opacity: 0.5; cursor: grabbing; }
.card.drag-over { outline: 2px dashed var(--accent); outline-offset: 3px; }
.card.selected { outline: 2px solid var(--primary); box-shadow: 0 0 0 4px rgba(139,92,246,0.18); }
.column[data-type="went-well"] .card { border-left: 3px solid var(--good); }
.column[data-type="improve"]   .card { border-left: 3px solid var(--warn); }
.column[data-type="action"]    .card { border-left: 3px solid var(--info); }

.card-gif {
    display: block; width: 100%; height: auto;
    max-height: 200px; object-fit: contain;
    border-radius: 6px; margin-bottom: 8px;
    background: rgba(0,0,0,0.3);
}
.card-text {
    font-size: 14px; line-height: 1.45;
    white-space: pre-wrap; word-break: break-word;
}
.card-actions {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 8px;
}
.vote {
    background: var(--surface); color: var(--text);
    border: 1px solid var(--border);
    padding: 4px 10px; border-radius: 999px;
    font-size: 12px; cursor: pointer;
    transition: background .15s ease, transform .12s ease;
}
.vote:hover { background: var(--surface-2); transform: scale(1.04); }
.vote-group { display: inline-flex; align-items: center; gap: 4px; }
.vote-down {
    width: 26px; height: 26px; line-height: 1;
    font-size: 16px; font-weight: 700;
    border-radius: 999px;
    background: var(--surface); border: 1px solid var(--border);
    color: var(--muted);
}
.vote-down:hover:not(:disabled) {
    background: rgba(239,68,68,0.18); color: #fca5a5;
}
.vote-down:disabled { opacity: 0.35; cursor: not-allowed; }

/* Merge bar */
.merge-bar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 12px;
    background: rgba(99,102,241,0.12);
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}
.merge-check {
    position: absolute; top: 8px; right: 8px;
    width: 18px; height: 18px;
    accent-color: var(--primary); cursor: pointer;
}

/* Summary panel */
.summary-panel {
    max-width: 1500px;
    margin: 0 auto 24px;
    background: linear-gradient(135deg, rgba(139,92,246,0.12), rgba(99,102,241,0.08));
    border: 1px solid rgba(139,92,246,0.35);
    border-radius: var(--radius);
    overflow: hidden;
}
.summary-header {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.03);
}
.summary-time { color: var(--muted); font-size: 12px; }
.summary-actions { margin-left: auto; display: flex; gap: 6px; }
.summary-body {
    padding: 16px 20px;
    font-size: 14px; line-height: 1.55;
    max-height: 360px; overflow-y: auto;
    white-space: pre-wrap; word-break: break-word;
}
.summary-body.loading { color: var(--muted); font-style: italic; }

/* Modal */
.modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    z-index: 100;
}
.modal {
    background: #0f172a;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: min(560px, 92vw);
    max-height: 86vh; overflow: hidden;
    display: flex; flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    animation: pop .2s ease;
}
.modal-header, .modal-footer {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center;
    gap: 8px;
}
.modal-footer { border-bottom: none; border-top: 1px solid var(--border); justify-content: flex-end; }
.modal-body { padding: 16px; overflow-y: auto; flex: 1; }
.suggestion-item { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; }
.suggestion-item input { margin-top: 4px; accent-color: var(--primary); }

/* GIF picker */
.gif-search {
    width: 100%; padding: 10px 12px;
    border-radius: 8px; border: 1px solid var(--border);
    background: rgba(0,0,0,0.3); color: var(--text);
    margin-bottom: 12px; font-size: 14px;
}
.gif-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
}
.gif-thumb {
    width: 100%; height: 100px; object-fit: cover;
    border-radius: 6px; cursor: pointer;
    transition: transform .15s ease;
}
.gif-thumb:hover { transform: scale(1.04); }
.spinner {
    display: inline-block; width: 14px; height: 14px;
    border: 2px solid var(--border); border-top-color: var(--primary);
    border-radius: 50%; animation: spin 0.8s linear infinite;
    margin-right: 8px; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Chat */
#chat-toggle {
    position: fixed; right: 22px; bottom: 22px;
    width: 56px; height: 56px;
    border: none; border-radius: 50%;
    font-size: 24px; cursor: pointer; color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    box-shadow: 0 12px 30px rgba(139,92,246,0.45);
    z-index: 20;
}
.chat-panel {
    position: fixed; right: 22px; bottom: 90px;
    width: 360px; max-width: calc(100vw - 32px);
    height: 480px; max-height: 70vh;
    background: linear-gradient(180deg, rgba(15,23,42,0.92), rgba(15,23,42,0.8));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
    box-shadow: var(--shadow-1);
    display: flex; flex-direction: column;
    z-index: 25; overflow: hidden;
    animation: pop .2s ease;
}
.chat-header {
    padding: 12px 14px;
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid var(--border);
    background: rgba(255,255,255,0.04);
}

/* Chat header brand */
.chat-brand {
    display: flex; align-items: center; gap: 10px;
}
.chat-avatar {
    position: relative;
    width: 36px; height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: grid; place-items: center;
    box-shadow: 0 4px 14px rgba(139,92,246,0.45);
    animation: avatarFloat 3s ease-in-out infinite;
}
@keyframes avatarFloat {
    0%, 100% { transform: translateY(0)    rotate(0deg); }
    50%      { transform: translateY(-2px) rotate(-3deg); }
}
.chat-avatar-emoji {
    font-size: 18px;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
}
.chat-status-dot {
    position: absolute;
    bottom: -1px; right: -1px;
    width: 11px; height: 11px;
    border-radius: 50%;
    background: var(--good);
    border: 2px solid #0f172a;
    box-shadow: 0 0 8px rgba(34,197,94,0.6);
    animation: statusPulse 2s ease-in-out infinite;
}
@keyframes statusPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0.6); }
    50%      { box-shadow: 0 0 0 5px rgba(34,197,94,0); }
}
.chat-brand-text {
    display: flex; flex-direction: column; line-height: 1.2;
}
.chat-brand-text strong {
    font-size: 14px;
    background: linear-gradient(90deg, #a78bfa, #22d3ee);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.chat-subtitle {
    font-size: 11px; color: var(--muted);
}
.chat-messages {
    flex: 1; padding: 12px;
    display: flex; flex-direction: column; gap: 8px;
    overflow-y: auto;
}
.msg {
    padding: 9px 12px; border-radius: 12px;
    font-size: 14px; line-height: 1.4; max-width: 85%;
    white-space: pre-wrap; word-break: break-word;
}
.msg-user { align-self: flex-end; background: linear-gradient(135deg, var(--primary-2), var(--primary)); color: #fff; }
.msg-bot  { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); }
.msg-typing { color: var(--muted); font-style: italic; }
.msg-error  { background: rgba(239,68,68,0.15); border: 1px solid rgba(239,68,68,0.4); }
.chat-form {
    display: flex; gap: 8px; padding: 10px;
    border-top: 1px solid var(--border);
    background: rgba(0,0,0,0.2);
}
.chat-form input {
    flex: 1; padding: 9px 12px;
    border-radius: 10px; border: 1px solid var(--border);
    background: rgba(0,0,0,0.3); color: var(--text); font-size: 14px;
}
.chat-form input:focus {
    outline: none; border-color: var(--primary-2);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.25);
}

/* Auth gate */
.auth-gate {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg, #1a1a2e);
    backdrop-filter: blur(10px);
}
.auth-gate.hidden { display: none; }
.auth-box {
    background: var(--surface, #16213e);
    border: 1px solid var(--border, #333);
    border-radius: 16px;
    padding: 40px;
    text-align: center;
    max-width: 360px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.auth-box h2 { margin-bottom: 8px; font-size: 24px; }
.auth-box p { color: var(--text-muted, #888); margin-bottom: 20px; font-size: 14px; }
.auth-box form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.auth-box input {
    flex: 1;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid var(--border, #333);
    background: var(--bg, #1a1a2e);
    color: var(--text, #eee);
    font-size: 16px;
}
.auth-box input:focus { outline: 2px solid var(--accent, #6c63ff); }
.auth-error { color: #ff6b6b; font-size: 13px; margin-top: 12px; }
.auth-error.hidden { display: none; }

/* Animations */
@keyframes cardIn {
    from { opacity: 0; transform: translateY(6px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0)   scale(1); }
}
@keyframes pop {
    from { opacity: 0; transform: scale(0.96); }
    to   { opacity: 1; transform: scale(1); }
}

/* ===== Safe animations (additive only) ===== */

/* 1) Topbar slide-in on load */
.topbar { animation: slideDown .5s cubic-bezier(.2,.9,.3,1.2); }
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* 2) Columns fade-up with stagger */
.column { animation: fadeUp .55s cubic-bezier(.2,.9,.3,1.2) both; }
.column:nth-child(1) { animation-delay: .05s; }
.column:nth-child(2) { animation-delay: .15s; }
.column:nth-child(3) { animation-delay: .25s; }
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* 3) Cards bouncier entrance (override existing cardIn) */
@keyframes cardIn {
    0%   { opacity: 0; transform: translateY(10px) scale(0.95); }
    60%  { opacity: 1; transform: translateY(-2px) scale(1.02); }
    100% { opacity: 1; transform: translateY(0)    scale(1); }
}
.card { animation: cardIn .4s cubic-bezier(.2,.9,.3,1.4); }

/* 4) Vote click pop */
.vote:active { transform: scale(0.92); }
.vote {
    transition: background .15s ease, transform .12s cubic-bezier(.2,.9,.3,1.6);
}
.vote:hover {
    background: var(--surface-2);
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(34,197,94,0.25);
}

/* 5) Button shine sweep on hover */
.btn { position: relative; overflow: hidden; }
.btn::before {
    content: "";
    position: absolute; top: 0; left: -120%;
    width: 60%; height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255,255,255,0.18), transparent);
    transform: skewX(-20deg);
    transition: left .55s ease;
    pointer-events: none;
}
.btn:hover::before { left: 130%; }

/* 6) AI buttons pulse glow (subtle, no layout) */
.btn-ai { animation: aiPulse 3.5s ease-in-out infinite; }
@keyframes aiPulse {
    0%, 100% { box-shadow: 0 0 0 1px rgba(255,255,255,0.08), 0 10px 30px rgba(139,92,246,0.40); }
    50%      { box-shadow: 0 0 0 1px rgba(255,255,255,0.14), 0 14px 40px rgba(34,211,238,0.55); }
}

/* 7) Topbar dot pulse */
.column-header .dot { animation: dotPulse 2.5s ease-in-out infinite; }
@keyframes dotPulse {
    0%, 100% { transform: scale(1);   filter: brightness(1); }
    50%      { transform: scale(1.3); filter: brightness(1.4); }
}

/* 8) Summary panel slide-down */
.summary-panel:not(.hidden) { animation: slideDown .4s ease; }

/* 9) Chat bubble float */
#chat-toggle { animation: float 3s ease-in-out infinite; }
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-6px); }
}
#chat-toggle:hover { animation-play-state: paused; transform: scale(1.1); }

/* 10) Modal fade-in backdrop */
.modal-backdrop:not(.hidden) { animation: fadeIn .2s ease; }
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* 11) Card hover glow per column type */
.column[data-type="went-well"] .card:hover { box-shadow: 0 6px 22px rgba(34,197,94,0.30); }
.column[data-type="improve"]   .card:hover { box-shadow: 0 6px 22px rgba(245,158,11,0.30); }
.column[data-type="action"]    .card:hover { box-shadow: 0 6px 22px rgba(59,130,246,0.30); }

/* 12) Drag-over pulse */
.card.drag-over { animation: dragPulse .6s ease-in-out infinite; }
@keyframes dragPulse {
    0%, 100% { transform: scale(1);    outline-offset: 3px; }
    50%      { transform: scale(1.03); outline-offset: 6px; }
}

/* 13) Selected card breathe */
.card.selected { animation: breathe 1.8s ease-in-out infinite; }
@keyframes breathe {
    0%, 100% { box-shadow: 0 0 0 4px rgba(139,92,246,0.18); }
    50%      { box-shadow: 0 0 0 8px rgba(139,92,246,0.28); }
}

/* Chat bubble tooltip */
#chat-toggle::after {
    content: attr(data-tooltip);
    position: absolute;
    right: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%) translateX(6px);
    padding: 8px 12px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    font-size: 13px; font-weight: 600;
    white-space: nowrap;
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease, transform .25s ease;
}
/* Little arrow pointing to the bubble */
#chat-toggle::before {
    content: "";
    position: absolute;
    right: calc(100% + 6px);
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-left-color: var(--accent);
    opacity: 0;
    transition: opacity .25s ease;
    pointer-events: none;
}

/* Show tooltip permanently with a gentle bounce — disappears on hover */
#chat-toggle::after {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
    animation: tooltipBounce 2.5s ease-in-out infinite;
}
#chat-toggle::before { opacity: 1; }

#chat-toggle:hover::after,
#chat-toggle:hover::before {
    opacity: 0;
}

@keyframes tooltipBounce {
    0%, 100% { transform: translateY(-50%) translateX(0); }
    50%      { transform: translateY(-50%) translateX(-4px); }
}

.card-author {
    font-size: 11px;
    color: var(--text-muted, #888);
    font-style: italic;
    margin-top: 4px;
}