@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;800&display=swap');

body {
    font-family: 'Inter', sans-serif;
    background-color: #0f172a;
    color: #f8fafc;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #1e293b; }
::-webkit-scrollbar-thumb { background: #475569; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #64748b; }

.custom-scrollbar::-webkit-scrollbar { width: 6px; }
.custom-scrollbar::-webkit-scrollbar-track { background: transparent; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: #334155; border-radius: 3px; }

body.auth-locked > aside,
body.auth-locked > main,
body.auth-locked > #global-filters-panel,
body.auth-locked > #champion-modal,
body.auth-locked > #nav-reopen,
body.auth-locked > #nav-backdrop {
    display: none !important;
}

.nav-item { transition: all 0.2s; cursor: pointer; }
.nav-item.active { background-color: #3b82f6; border-left: 4px solid #60a5fa; font-weight: bold; }
.nav-item:not(.active):hover { background-color: #1e293b; }

#toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 9999; }
.toast {
    background-color: #1e293b;
    border-left: 4px solid #3b82f6;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    padding: 16px;
    border-radius: 8px;
    margin-top: 10px;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

.dash-chart-box {
    position: relative;
    width: 100%;
    height: 280px;
    overflow: hidden;
}

.dash-chart-box-tall {
    height: 340px;
}

.dash-chart-box canvas {
    max-width: 100% !important;
}

@media (min-width: 1280px) {
    .dash-chart-box { height: 300px; }
    .dash-chart-box-tall { height: 360px; }
}

#view-champions:not(.hidden) {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.champ-picker-window {
    flex: 1 1 40%;
    min-height: 160px;
    max-height: 46%;
}

.champ-detail-split {
    flex: 1 1 52%;
    min-height: 220px;
    display: grid;
    grid-template-columns: minmax(240px, 0.9fr) minmax(280px, 1.2fr);
    gap: 0.5rem;
    min-width: 0;
}

.champ-wr-chart-box {
    position: relative;
    width: 100%;
    min-height: 160px;
}

.champ-wr-chart-box canvas {
    max-width: 100% !important;
}

.champ-role-chip {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 999px;
    padding: 2px 8px;
    color: #cbd5e1;
}

@media (max-width: 1100px) {
    .champ-detail-split {
        grid-template-columns: 1fr;
    }
    .champ-picker-window {
        max-height: 34%;
    }
}

#view-crawler:not(.hidden) {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.crawler-layout {
    flex: 1 1 auto;
    min-height: 0;
}

.crawler-console {
    min-height: 280px;
}

@media (max-width: 1279px) {
    .crawler-console {
        min-height: 360px;
        height: 42vh;
    }
}

.lane-picker-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
    margin-bottom: 1rem;
}
@media (min-width: 720px) {
    .lane-picker-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1100px) {
    .lane-picker-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
.lane-pick {
    text-align: left;
    border-radius: 14px;
    padding: 0.75rem 0.85rem;
    border: 1px solid #1e293b;
    background: linear-gradient(180deg, #111827 0%, #0b1220 100%);
    transition: border-color 0.15s, transform 0.15s;
}
.lane-pick:hover { border-color: #334155; }
.lane-pick.is-on {
    border-color: #60a5fa;
    box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.35), 0 10px 30px rgba(37, 99, 235, 0.12);
}
.lane-pick-label { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: #e2e8f0; }
.lane-pick-meta { font-size: 0.8rem; color: #94a3b8; margin-top: 0.2rem; }
.lane-pick-wr { font-size: 0.72rem; font-weight: 700; color: #64748b; margin-top: 0.15rem; }
.lane-pick-wr.is-good { color: #34d399; }

.analysis-panel {
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.9), rgba(2, 6, 23, 0.92));
    border: 1px solid #1e293b;
    border-radius: 18px;
    padding: 1.1rem 1.15rem 1.2rem;
}
.analysis-head, .deep-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.85rem;
}
.analysis-head h4, .deep-toolbar h4 { font-weight: 800; color: #f8fafc; font-size: 1.05rem; }
.analysis-head p, .deep-toolbar p { color: #94a3b8; font-size: 0.75rem; margin-top: 0.2rem; max-width: 42rem; }
.champ-filter { display: flex; flex-direction: column; gap: 0.25rem; min-width: 220px; font-size: 0.7rem; color: #94a3b8; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.champ-filter select {
    background: #0f172a;
    color: #e2e8f0;
    border: 1px solid #334155;
    border-radius: 10px;
    padding: 0.45rem 0.6rem;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
}
.champ-strip {
    display: flex;
    gap: 0.45rem;
    overflow-x: auto;
    padding: 0.85rem 0 0.2rem;
    margin-bottom: 0.4rem;
}
.champ-chip {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex: 0 0 auto;
    background: #0f172a;
    border: 1px solid #1e293b;
    border-radius: 999px;
    padding: 0.28rem 0.65rem 0.28rem 0.28rem;
    color: #e2e8f0;
}
.champ-chip.is-on { border-color: #a78bfa; background: #1e1b4b; }
.champ-chip img { width: 22px; height: 22px; border-radius: 999px; }
.champ-chip-name { font-size: 0.78rem; font-weight: 700; max-width: 8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.champ-chip-n { font-size: 0.68rem; color: #94a3b8; }
.champ-chip-w { font-size: 0.68rem; font-weight: 800; color: #34d399; }
.champ-chip-l { font-size: 0.68rem; font-weight: 800; color: #f87171; }
.deep-toolbar { margin-top: 0.9rem; padding-top: 0.9rem; border-top: 1px solid #1e293b; }
#btn-deep-analysis {
    background: linear-gradient(180deg, #7c3aed, #6d28d9);
    color: white;
    font-size: 0.78rem;
    font-weight: 800;
    padding: 0.55rem 0.9rem;
    border-radius: 12px;
}
#btn-deep-analysis:hover { filter: brightness(1.08); }
#btn-deep-analysis:disabled { opacity: 0.55; }
.deep-status { font-size: 0.75rem; color: #cbd5e1; white-space: pre-wrap; margin-top: 0.6rem; }
.bin-slider { display: flex; align-items: center; gap: 0.8rem; margin: 0.75rem 0 0.2rem; font-size: 0.75rem; color: #94a3b8; }
.bin-slider b { color: #e2e8f0; }
.bin-slider input { flex: 1; accent-color: #8b5cf6; }
.chart-card {
    margin-top: 0.85rem;
    background: #0b1220;
    border: 1px solid #1e293b;
    border-radius: 16px;
    padding: 0.9rem 0.95rem 0.7rem;
}
.tempo-copy { font-size: 0.95rem; font-weight: 700; color: #e2e8f0; }
.tone-early .tempo-copy { color: #fbbf24; }
.tone-late .tempo-copy { color: #7dd3fc; }
.tone-even .tempo-copy { color: #c4b5fd; }
.tempo-pills { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; margin: 0.75rem 0 0.35rem; }
.tempo-pill { background: #111827; border-radius: 12px; padding: 0.55rem 0.65rem; }
.tempo-pill-k { font-size: 0.68rem; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 700; }
.tempo-pill-wr { font-size: 1.15rem; font-weight: 800; color: #f8fafc; }
.tempo-pill-n { font-size: 0.68rem; color: #64748b; }
.hist-title { font-size: 0.92rem; font-weight: 800; color: #f8fafc; }
.hist-note { font-size: 0.72rem; color: #64748b; margin-top: 0.15rem; }
.hist-legend { display: flex; flex-wrap: wrap; gap: 0.7rem; margin: 0.45rem 0 0.35rem; }
.hist-key { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.72rem; color: #cbd5e1; }
.hist-key i, .hist-dot { width: 0.55rem; height: 0.55rem; border-radius: 999px; display: inline-block; }
.share-list { display: flex; flex-direction: column; gap: 0.4rem; margin-top: 0.65rem; }
.share-row { display: flex; align-items: center; gap: 0.55rem; }
.share-name { width: 5.5rem; flex-shrink: 0; font-size: 0.75rem; font-weight: 700; color: #e2e8f0; display: inline-flex; align-items: center; gap: 0.35rem; }
.share-track { flex: 1; height: 8px; background: #1e293b; border-radius: 999px; overflow: hidden; }
.share-fill { display: block; height: 100%; border-radius: 999px; }
.share-pct { width: 6.2rem; text-align: right; font-size: 0.72rem; color: #94a3b8; font-weight: 700; }
.deep-empty { font-size: 0.85rem; color: #64748b; margin-top: 0.8rem; }
.hist-scroll { overflow-x: auto; padding-bottom: 0.35rem; position: relative; z-index: 1; }
.hist-plot { display: flex; gap: 0.35rem; margin-top: 0.45rem; }
.hist-y {
    width: 1.8rem;
    height: 132px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    text-align: right;
    font-size: 10px;
    color: #94a3b8;
    font-variant-numeric: tabular-nums;
}
.hist-canvas { position: relative; flex: 1; min-width: 0; }
.hist-gridlines {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 132px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    pointer-events: none;
    z-index: 0;
}
.hist-gridlines span { border-top: 1px dashed #334155; display: block; }
.hist-row { display: flex; align-items: flex-start; min-width: max-content; height: auto; }
.hist-bin {
    width: 68px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    border-left: 1px solid #334155;
    padding: 0 3px;
    box-sizing: border-box;
}
.hist-bin.is-behind { background: rgba(248, 113, 113, 0.07); }
.hist-bin.is-ahead { background: rgba(52, 211, 153, 0.06); }
.hist-bars {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 132px;
    width: 100%;
    position: relative;
    z-index: 1;
}
.hist-bar { flex: 1; border-radius: 3px 3px 0 0; min-height: 0; }
.hist-tick {
    font-size: 9px;
    color: #cbd5e1;
    margin-top: 4px;
    height: auto;
    line-height: 1.2;
    text-align: center;
    word-break: break-word;
}
.hist-split { display: flex; flex-direction: column; align-items: center; gap: 1px; margin-top: 3px; }
.hist-split b { font-size: 10px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.deep-empty { font-size: 0.85rem; color: #64748b; margin-top: 0.8rem; }
.tempo-card .hist { margin-top: 0.85rem; }

.crawler-log-window {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem;
    color: #34d399;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.8rem;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
}
