@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700;900&family=Crimson+Pro:wght@300;400;600&family=DM+Mono:wght@400;500&display=swap');

.ct-wrap {
    --ct-bg: #FAF8F5;
    --ct-ink: #1C1917;
    --ct-ink-light: #44403C;
    --ct-ink-muted: #78716C;
    --ct-rule: #D6D3D1;
    --ct-accent: #991B1B;
    --ct-good: #166534;
    --ct-mid: #92400E;
    --ct-bad: #991B1B;
    --ct-pending: #6366F1;
    --ct-font-display: 'Playfair Display', Georgia, serif;
    --ct-font-body: 'Crimson Pro', Georgia, serif;
    --ct-font-mono: 'DM Mono', monospace;

    font-family: var(--ct-font-body);
    color: var(--ct-ink);
    background: var(--ct-bg);
    max-width: 100vw;
    margin: 0;
    padding: 0 0 40px;
    box-sizing: border-box;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    overflow: hidden; /* prevent horizontal page expansion */
}
.ct-loading { text-align: center; padding: 60px 0; color: var(--ct-ink-muted); font-style: italic; }

/* HEADER */
.ct-header { text-align: center; padding: 24px 20px 16px; border-bottom: 3px double var(--ct-rule); }
.ct-title { font-family: var(--ct-font-display); font-size: 1.8rem; font-weight: 900; letter-spacing: 0.06em; margin: 0; }
.ct-subtitle { font-size: 0.82rem; color: var(--ct-ink-muted); letter-spacing: 0.08em; text-transform: uppercase; margin: 4px 0 0; }

/* FILTER BAR */
.ct-filters {
    display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center;
    padding: 14px 20px; background: #fff; border-bottom: 1px solid var(--ct-rule);
}
.ct-filters select,
.ct-filters input[type="text"],
.ct-filters input[type="number"] {
    font-family: var(--ct-font-mono); font-size: 0.75rem; padding: 5px 10px;
    border: 1px solid var(--ct-rule); background: #fff; color: var(--ct-ink); border-radius: 0; appearance: auto;
}
.ct-filters input[type="text"] { width: 150px; }
.ct-filters input[type="number"] { width: 60px; }
.ct-conf-label { font-family: var(--ct-font-mono); font-size: 0.72rem; color: var(--ct-ink-muted); display: flex; align-items: center; gap: 4px; }

.ct-status-btn {
    font-family: var(--ct-font-mono); font-size: 0.72rem; padding: 5px 12px;
    border: 1px solid var(--ct-rule); background: #fff; color: var(--ct-ink-light); cursor: pointer; transition: all 0.15s;
}
.ct-status-btn:hover { border-color: var(--ct-ink-muted); }
.ct-status-btn.active { background: var(--ct-ink); color: #fff; border-color: var(--ct-ink); }

.ct-today-btn {
    font-family: var(--ct-font-mono); font-size: 0.72rem; padding: 5px 14px;
    border: 1px solid var(--ct-accent); background: #fff; color: var(--ct-accent);
    cursor: pointer; font-weight: 600; transition: all 0.15s;
}
.ct-today-btn:hover { background: var(--ct-accent); color: #fff; }

/* CATEGORY QUICK FILTERS */
.ct-cat-bar { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; justify-content: center; padding: 8px 20px; border-bottom: 1px solid var(--ct-rule); }
.ct-cat-btn {
    font-family: var(--ct-font-mono); font-size: 0.68rem; padding: 4px 10px;
    border: 1px solid var(--ct-rule); background: #fff; color: var(--ct-ink-muted);
    cursor: pointer; text-transform: uppercase; letter-spacing: 0.04em; transition: all 0.15s;
}
.ct-cat-btn:hover { border-color: var(--ct-ink-muted); }
.ct-cat-btn.active { background: var(--ct-ink); color: #fff; border-color: var(--ct-ink); }

/* THIS WEEK STRIP */
.ct-week-strip {
    text-align: center; padding: 10px 20px; font-family: var(--ct-font-mono);
    font-size: 0.78rem; color: var(--ct-ink-light); background: rgba(0,0,0,0.02);
    border-bottom: 1px solid var(--ct-rule); letter-spacing: 0.01em;
}
.ct-week-strip strong { color: var(--ct-ink); }

/* VIEWPORT WRAPPER — contains the fixed center line + scrolling viewport */
.ct-viewport-wrap {
    position: relative;
    overflow: hidden;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
}

/* FIXED CENTER LINE — stays at 50% of viewport, does not scroll */
.ct-center-line {
    position: absolute;
    top: 0; bottom: 0;
    left: 50%;
    width: 0;
    border-left: 2px dashed rgba(153, 27, 27, 0.25);
    z-index: 15;
    pointer-events: none;
}
.ct-center-date {
    position: absolute;
    top: 6px;
    left: -60px;
    width: 120px;
    text-align: center;
    font-family: var(--ct-font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    padding: 3px 10px;
    background: var(--ct-ink);
    color: #fff;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

/* SCROLLING VIEWPORT */
.ct-viewport {
    overflow: scroll;
    height: 500px;
    width: 100%;
    cursor: grab;
    -webkit-overflow-scrolling: touch;
    position: relative;
}
.ct-viewport:active { cursor: grabbing; }
.ct-viewport::-webkit-scrollbar { height: 6px; }
.ct-viewport::-webkit-scrollbar-track { background: var(--ct-bg); }
.ct-viewport::-webkit-scrollbar-thumb { background: var(--ct-rule); }

/* CANVAS — the wide scrollable area inside viewport */
.ct-canvas {
    position: relative;
    min-height: 800px;
    padding: 30px 0 60px;
}

/* DATE AXIS — horizontal line near the top */
.ct-axis { position: absolute; top: 30px; left: 0; right: 0; height: 1px; background: var(--ct-rule); z-index: 1; }

/* DATE TICKS */
.ct-tick { position: absolute; top: 26px; width: 1px; height: 8px; background: var(--ct-rule); z-index: 2; }
.ct-tick-label {
    position: absolute; top: 8px; font-family: var(--ct-font-mono); font-size: 0.6rem;
    color: var(--ct-ink-muted); transform: translateX(-50%); white-space: nowrap; z-index: 2;
}
.ct-tick-week .ct-tick-label { font-weight: 500; color: var(--ct-ink-light); font-size: 0.65rem; }

/* DAY COLUMNS — stack cards downward from the axis */
.ct-day-column {
    position: absolute;
    top: 42px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    z-index: 3;
}

/* PREDICTION CARDS */
.ct-card {
    width: 110px; padding: 8px 10px; background: #fff;
    border: 1px solid var(--ct-rule); border-left: 3px solid var(--ct-rule);
    font-size: 0.72rem; cursor: pointer; transition: box-shadow 0.15s, transform 0.15s;
    position: relative; z-index: 4;
}
.ct-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.1); transform: translateY(-2px); z-index: 10; }

/* Scored cards get border-left-color set inline via JS gradient */
.ct-card.ct-scored { border-left-width: 4px; }
.ct-card.ct-pending { border-left-color: var(--ct-pending); border-left-width: 4px; border-style: dashed; border-left-style: solid; }

.ct-card-cat { font-family: var(--ct-font-mono); font-size: 0.58rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ct-accent); margin-bottom: 3px; }
.ct-card-text { font-size: 0.72rem; line-height: 1.35; color: var(--ct-ink-light); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ct-card-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 5px; font-family: var(--ct-font-mono); font-size: 0.62rem; color: var(--ct-ink-muted); }
.ct-card-score { font-weight: 600; } /* color set inline via JS gradient */
.ct-card-conf { color: var(--ct-pending); }

.ct-cluster-badge { font-family: var(--ct-font-mono); font-size: 0.6rem; color: var(--ct-ink-muted); text-align: center; padding: 2px 0; }

/* TOOLTIP */
.ct-tooltip {
    position: fixed; z-index: 1000; width: 360px; max-height: 420px; overflow-y: auto;
    background: #fff; border: 1px solid var(--ct-rule); box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    padding: 18px 20px; pointer-events: auto; display: none;
}
.ct-tooltip.visible { display: block; }
.ct-tooltip-close { position: absolute; top: 8px; right: 12px; background: none; border: none; font-size: 1.2rem; color: var(--ct-ink-muted); cursor: pointer; }
.ct-tooltip-cat { font-family: var(--ct-font-mono); font-size: 0.65rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ct-accent); margin-bottom: 4px; }
.ct-tooltip-headline { font-family: var(--ct-font-display); font-size: 0.95rem; font-weight: 700; line-height: 1.25; margin: 0 0 8px; }
.ct-tooltip-prediction { font-size: 0.88rem; line-height: 1.5; margin: 8px 0; color: var(--ct-ink-light); }
.ct-tooltip-meta { display: flex; flex-wrap: wrap; gap: 12px; font-family: var(--ct-font-mono); font-size: 0.7rem; color: var(--ct-ink-muted); padding: 8px 0; border-top: 1px solid var(--ct-rule); margin-top: 8px; }
.ct-tooltip-score { font-size: 1.1rem; font-weight: 600; font-family: var(--ct-font-mono); }
.ct-tooltip-outcome { font-size: 0.82rem; line-height: 1.45; margin: 8px 0; padding: 8px 10px; border-left: 2px solid var(--ct-good); background: rgba(22,101,52,0.04); }
.ct-tooltip-outcome.fail { border-left-color: var(--ct-bad); background: rgba(153,27,27,0.04); }
.ct-tooltip-redteam { font-size: 0.8rem; line-height: 1.4; padding: 6px 10px; margin: 6px 0; background: rgba(99,102,241,0.05); border-left: 2px solid var(--ct-pending); color: var(--ct-ink-light); }
.ct-tooltip-redteam strong { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ct-pending); }
.ct-tooltip-reasoning { font-size: 0.8rem; color: var(--ct-ink-muted); line-height: 1.45; margin: 6px 0; }
.ct-tooltip-failure-tag { display: inline-block; font-family: var(--ct-font-mono); font-size: 0.62rem; padding: 2px 8px; background: #fecaca; color: #991b1b; margin-top: 4px; }

.ct-empty { text-align: center; padding: 60px 20px; color: var(--ct-ink-muted); font-style: italic; }

/* RESPONSIVE */
@media (max-width: 768px) {
    .ct-card { width: 85px; padding: 6px 8px; }
    .ct-card-text { -webkit-line-clamp: 2; font-size: 0.65rem; }
    .ct-tooltip { width: 300px; }
    .ct-filters { gap: 6px; }
    .ct-filters select, .ct-filters input[type="text"] { font-size: 0.7rem; padding: 4px 6px; }
    .ct-zoom-bar { margin-left: 0; border-left: none; padding-left: 0; }
}
@media (max-width: 480px) {
    .ct-card { width: 65px; }
    .ct-card-cat { display: none; }
    .ct-tooltip { position: fixed; bottom: 0; left: 0 !important; right: 0 !important; top: auto !important; width: 100% !important; max-height: 60vh; border-radius: 12px 12px 0 0; }
}
