/* ===== AI Agent Lab — agent agency tycoon ===== */

.al-page {
    max-width: 1500px;
    margin: 0 auto;
    padding: 1rem 1.5rem 3rem;
    font-variant-numeric: tabular-nums;
}

/* ---- Top bar ---- */
.al-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 0 1rem;
    border-bottom: 1px solid #1e293b;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.al-logo {
    font-weight: 800;
    font-size: 1.4rem;
    letter-spacing: 0.25em;
    background: linear-gradient(135deg, #22d3ee, #34d399);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.al-tagline {
    color: var(--text-secondary, #94a3b8);
    font-size: 0.85rem;
    margin-left: 0.8rem;
}

.al-session {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text-secondary, #94a3b8);
    font-size: 0.9rem;
}

/* ---- Layout ---- */
.al-layout {
    display: grid;
    grid-template-columns: 340px minmax(320px, 1fr) 320px;
    gap: 1rem;
    align-items: start;
}

.al-col {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
}

.al-panel {
    background: var(--bg-card, #1a2235);
    border: 1px solid #1e293b;
    border-radius: 12px;
    padding: 1rem;
}

.al-panel h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-secondary, #94a3b8);
    margin: 0.8rem 0 0.5rem;
}

.al-panel h3:first-child {
    margin-top: 0;
}

/* ---- Stats ---- */
.al-money {
    font-size: 2.1rem;
    font-weight: 800;
    color: #34d399;
}

.al-cred {
    font-size: 0.95rem;
    font-weight: 700;
    color: #fbbf24;
    margin-top: 0.1rem;
}

.al-substats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1rem;
    font-size: 0.8rem;
    color: var(--text-secondary, #94a3b8);
    margin: 0.3rem 0 0.9rem;
}

.al-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-bottom: 0.6rem;
}

.al-badge {
    font-size: 0.68rem;
    font-weight: 700;
    color: #67e8f9;
    border: 1px solid rgba(34, 211, 238, 0.45);
    border-radius: 999px;
    padding: 0.12rem 0.5rem;
}

.al-badge.gold {
    color: #fde68a;
    border-color: rgba(250, 204, 21, 0.5);
}

.al-alert {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.45);
    color: #fca5a5;
    border-radius: 8px;
    padding: 0.4rem 0.6rem;
    font-size: 0.78rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.al-stat-row {
    display: flex;
    justify-content: space-between;
    gap: 0.6rem;
    font-size: 0.82rem;
    padding: 0.3rem 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.08);
}

.al-stat-row:last-child { border-bottom: none; }
.al-stat-row span:first-child { color: var(--text-secondary, #94a3b8); }
.al-stat-row em {
    font-style: normal;
    color: var(--text-muted, #64748b);
    font-size: 0.75rem;
}

/* ---- Meters ---- */
.al-meter-bar {
    height: 7px;
    background: #0d1424;
    border-radius: 4px;
    overflow: hidden;
}

.al-meter-fill {
    height: 100%;
    background: #22d3ee;
    border-radius: 4px;
    transition: width 0.25s linear;
}

.al-meter-fill.run { background: linear-gradient(90deg, #22d3ee, #34d399); }

/* ---- Debug button ---- */
.al-debug {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    width: 100%;
    padding: 0.9rem;
    font: inherit;
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: 0.15em;
    color: #06222b;
    background: linear-gradient(135deg, #22d3ee, #34d399);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.05s, filter 0.15s;
}

.al-debug:hover { filter: brightness(1.12); }
.al-debug:active { transform: scale(0.97); }

.al-debug-sub {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    opacity: 0.8;
}

/* ---- Projects (left) ---- */
.al-projects { max-height: 56vh; overflow-y: auto; }

.al-proj {
    background: #131c2e;
    border: 1px solid #1e293b;
    border-radius: 8px;
    padding: 0.55rem 0.65rem;
    margin-bottom: 0.5rem;
}

.al-proj-head {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.2rem;
}

.al-proj-pay { color: #34d399; white-space: nowrap; }
.al-proj-eta { color: var(--text-secondary, #94a3b8); font-size: 0.75rem; white-space: nowrap; }

.al-proj-meta {
    font-size: 0.72rem;
    color: var(--text-secondary, #94a3b8);
    margin-bottom: 0.35rem;
}

.al-fw { font-style: normal; font-weight: 700; }
.al-fw-langchain { color: #a5b4fc; }
.al-fw-openclaw { color: #f9a8d4; }
.al-fw-hermes { color: #fcd34d; }
.al-fw-any { color: #67e8f9; }

.al-proj-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-bottom: 0.45rem;
}

.al-tag {
    font-size: 0.66rem;
    font-weight: 600;
    color: #67e8f9;
    border: 1px solid rgba(34, 211, 238, 0.4);
    border-radius: 999px;
    padding: 0.08rem 0.45rem;
}

.al-tag.missing {
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.5);
}

.al-accept { width: 100%; }

.al-empty {
    color: var(--text-secondary, #94a3b8);
    font-size: 0.82rem;
    font-style: italic;
    padding: 0.3rem 0;
}

/* ---- Skill trees (center) ---- */
.al-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.4rem;
    margin-bottom: 0.7rem;
}

.al-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    font: inherit;
    color: #f0f4f8;
    background: #131c2e;
    border: 1px solid #1e293b;
    border-radius: 8px;
    padding: 0.5rem 0.4rem;
    cursor: pointer;
    transition: border-color 0.15s, filter 0.15s;
}

.al-tab:hover { filter: brightness(1.25); }
.al-tab.active { border-color: #22d3ee; box-shadow: 0 0 0 1px #22d3ee; }

.al-tab-name { font-size: 0.82rem; font-weight: 700; }
.al-tab-count { font-size: 0.68rem; color: var(--text-secondary, #94a3b8); }
.al-tab-count.gold { color: #fde68a; font-weight: 700; }

.al-tree-blurb {
    font-size: 0.78rem;
    color: var(--text-secondary, #94a3b8);
    margin: 0 0 0.7rem;
    line-height: 1.5;
}

.al-tree-blurb .gold, strong.gold { color: #fde68a; }

.al-tree { display: flex; flex-direction: column; gap: 0.35rem; }

.al-skill {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    text-align: left;
    font: inherit;
    color: #f0f4f8;
    background: #131c2e;
    border: 1px solid #1e293b;
    border-radius: 8px;
    padding: 0.5rem 0.65rem;
    margin-left: calc(var(--depth, 0) * 14px);
    width: calc(100% - var(--depth, 0) * 14px);
    cursor: pointer;
    transition: border-color 0.15s, filter 0.15s;
    box-sizing: border-box;
}

.al-skill:hover:not(:disabled):not(.locked) { filter: brightness(1.25); }
.al-skill:disabled { opacity: 0.45; cursor: not-allowed; }

.al-skill.owned {
    border-color: rgba(52, 211, 153, 0.45);
    background: rgba(52, 211, 153, 0.06);
}

.al-skill.owned .al-skill-name { color: #6ee7b7; }

.al-skill.locked {
    opacity: 0.45;
    cursor: default;
}

.al-skill-name { font-size: 0.84rem; font-weight: 600; }
.al-skill-desc { font-size: 0.7rem; color: var(--text-secondary, #94a3b8); }
.al-skill-cost { font-size: 0.76rem; font-weight: 700; color: #34d399; }

/* ---- Buttons ---- */
.al-btn {
    font: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    color: #f0f4f8;
    background: #263650;
    border: 1px solid #33466b;
    border-radius: 8px;
    padding: 0.4rem 0.9rem;
    cursor: pointer;
    transition: filter 0.15s;
}

a.al-btn {
    display: inline-block;
    text-decoration: none;
}

.al-btn:hover:not(:disabled) { filter: brightness(1.2); }
.al-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.al-btn-primary { background: linear-gradient(135deg, #0e7490, #059669); border: none; }
.al-btn-small { font-size: 0.75rem; padding: 0.3rem 0.7rem; }
.al-btn-block { display: block; width: 100%; margin-bottom: 0.6rem; }

/* ---- Log ---- */
.al-log {
    height: 170px;
    overflow-y: auto;
    font-size: 0.78rem;
    line-height: 1.5;
}

.al-log-line { color: var(--text-secondary, #94a3b8); }
.al-log-earn { color: #34d399; }
.al-log-buy { color: #67e8f9; }
.al-log-milestone { color: #facc15; font-weight: 600; }

/* ---- Shop ---- */
.al-shop {
    max-height: 80vh;
    overflow-y: auto;
}

.al-shop-section { margin-bottom: 0.9rem; }

.al-shop-item {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    width: 100%;
    text-align: left;
    font: inherit;
    color: #f0f4f8;
    background: #131c2e;
    border: 1px solid #1e293b;
    border-radius: 8px;
    padding: 0.5rem 0.65rem;
    margin-bottom: 0.4rem;
    cursor: pointer;
    transition: border-color 0.15s, filter 0.15s;
}

.al-shop-item:hover:not(:disabled) { filter: brightness(1.25); }
.al-shop-item:disabled { opacity: 0.45; cursor: not-allowed; }
.al-shop-special { border-color: #22d3ee; }

.al-current {
    border-color: rgba(52, 211, 153, 0.45);
    background: rgba(52, 211, 153, 0.06);
}

.al-shop-name { font-size: 0.85rem; font-weight: 600; }
.al-owned { font-style: normal; color: #34d399; font-size: 0.72rem; }
.al-shop-desc { font-size: 0.7rem; color: var(--text-secondary, #94a3b8); }
.al-shop-cost { font-size: 0.78rem; font-weight: 700; color: #34d399; }

/* ---- Modals ---- */
#al-modal-root { display: none; }
#al-modal-root.open {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1000;
}

.al-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 8, 15, 0.75);
    backdrop-filter: blur(3px);
}

.al-modal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(480px, calc(100vw - 2rem));
    max-height: 85vh;
    overflow-y: auto;
    background: var(--bg-card, #1a2235);
    border: 1px solid #33466b;
    border-radius: 16px;
    padding: 1.6rem;
}

.al-modal-close {
    position: absolute;
    top: 0.8rem;
    right: 0.9rem;
    font: inherit;
    font-size: 1rem;
    line-height: 1;
    color: var(--text-secondary, #94a3b8);
    background: none;
    border: none;
    padding: 0.3rem;
    cursor: pointer;
}

.al-modal-close:hover { color: #f0f4f8; }

.al-modal h2 { margin: 0 0 0.7rem; font-size: 1.25rem; }
.al-modal p { color: var(--text-secondary, #94a3b8); font-size: 0.9rem; line-height: 1.6; }

.al-learn-tag {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.15em;
    color: #facc15;
    border: 1px solid rgba(250, 204, 21, 0.5);
    border-radius: 999px;
    padding: 0.15rem 0.6rem;
    margin-bottom: 0.7rem;
}

.al-field {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary, #94a3b8);
    margin-bottom: 0.8rem;
}

.al-field input,
.al-start-lookup input {
    display: block;
    width: 100%;
    margin-top: 0.3rem;
    font: inherit;
    font-size: 0.9rem;
    color: #f0f4f8;
    background: #0d1424;
    border: 1px solid #33466b;
    border-radius: 8px;
    padding: 0.5rem 0.7rem;
    box-sizing: border-box;
}

.al-hint { font-size: 0.78rem; color: var(--text-secondary, #94a3b8); }

.al-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
    margin-top: 1rem;
}

.al-modal-error { color: #fca5a5; font-size: 0.8rem; margin-top: 0.6rem; }

/* ---- Start screen ---- */
.al-start-logo {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: 0.3em;
    text-align: center;
    background: linear-gradient(135deg, #22d3ee, #34d399);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.al-start-sub { text-align: center; margin-bottom: 1.4rem; }

.al-start-divider {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-secondary, #94a3b8);
    margin: 1rem 0 0.6rem;
}

.al-start-lookup {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.7rem;
}

.al-start-lookup input { margin-top: 0; flex: 1; }

.al-session-row {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    width: 100%;
    text-align: left;
    font: inherit;
    color: #f0f4f8;
    background: #131c2e;
    border: 1px solid #1e293b;
    border-radius: 8px;
    padding: 0.55rem 0.7rem;
    margin-bottom: 0.4rem;
    cursor: pointer;
}

.al-session-row:hover { border-color: #22d3ee; }
.al-session-name { font-weight: 600; font-size: 0.9rem; }
.al-session-meta { font-size: 0.75rem; color: var(--text-secondary, #94a3b8); }

/* ---- Ranking page ---- */
.al-ranking {
    max-width: 640px;
    margin: 1.5rem auto 0;
}

.al-ranking-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.al-ranking-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--bg-card, #1a2235);
    border: 1px solid #1e293b;
    border-radius: 12px;
    padding: 0.8rem 1.1rem;
    margin-bottom: 0.5rem;
}

.al-ranking-first {
    border-color: #facc15;
    box-shadow: 0 0 0 1px rgba(250, 204, 21, 0.35);
}

.al-ranking-pos {
    flex: 0 0 2rem;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-secondary, #94a3b8);
    text-align: center;
}

.al-ranking-first .al-ranking-pos { color: #facc15; }

.al-ranking-name {
    flex: 1;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.al-ranking-score {
    font-weight: 800;
    color: #34d399;
    white-space: nowrap;
}

.al-ranking-hint {
    text-align: center;
    margin-top: 1rem;
}

/* ---- Toast ---- */
.al-toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translate(-50%, 20px);
    background: #263650;
    border: 1px solid #33466b;
    color: #f0f4f8;
    font-size: 0.85rem;
    border-radius: 999px;
    padding: 0.55rem 1.2rem;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    z-index: 1100;
    pointer-events: none;
}

.al-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---- Responsive ---- */
@media (max-width: 1100px) {
    .al-layout { grid-template-columns: 1fr 1fr; }
    .al-col-center { order: -1; grid-column: 1 / -1; }
}

@media (max-width: 700px) {
    .al-layout { grid-template-columns: 1fr; }
    .al-projects { max-height: none; }
    .al-shop { max-height: none; }
}
