:root {
    --bg: #0b0e13;
    --bg2: #12161d;
    --card: #161b24;
    --card-hover: #1c2230;
    --border: #262e3d;
    --text: #e6e9ef;
    --muted: #8b94a7;
    --accent: #f0a832;
    --accent2: #e8922e;
    --blue: #3d6bff;
    --red: #e6483e;
    --green: #57bb6a;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background:
        radial-gradient(1200px 500px at 80% -10%, rgba(240, 168, 50, 0.10), transparent 60%),
        radial-gradient(900px 500px at 10% -10%, rgba(61, 107, 255, 0.08), transparent 60%),
        var(--bg);
    color: var(--text);
    font-family: "Segoe UI", Roboto, system-ui, -apple-system, Arial, sans-serif;
    min-height: 100vh;
}

/* ---------- top bar ---------- */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 26px;
    background: rgba(10, 13, 18, 0.9);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(6px);
}

.logo { display: flex; align-items: center; gap: 12px; }
.logo-icon {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: #12151b;
    font-weight: 900;
    font-size: 17px;
    padding: 6px 10px;
    border-radius: 8px;
    letter-spacing: 1px;
}
.logo-text { font-weight: 700; letter-spacing: 3px; font-size: 15px; color: var(--text); }

.user { display: flex; align-items: center; gap: 16px; }
.hint { color: var(--muted); font-size: 13px; }
.hint b { color: var(--accent); }

.btn {
    text-decoration: none;
    display: inline-block;
    font-size: 14px;
    font-weight: 600;
    padding: 9px 18px;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all .15s ease;
    background: none;
    color: var(--text);
    font-family: inherit;
}
.btn-login { background: linear-gradient(135deg, var(--blue), #2a4fc9); color: #fff; }
.btn-login:hover { filter: brightness(1.12); }
.btn-logout { background: var(--card); border-color: var(--border); }
.btn-logout:hover { border-color: var(--red); color: var(--red); }
.btn-big { font-size: 16px; padding: 12px 24px; }
.btn.big img { display: block; }

.btn-accent { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #14171d; }
.btn-accent:hover { filter: brightness(1.1); }
.btn-ghost { background: var(--card); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--muted); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { filter: brightness(1.1); }

/* ---------- login ---------- */
.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 75vh; padding: 20px; }
.login-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 48px 44px;
    text-align: center;
    max-width: 440px;
    box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.login-card h1 { font-size: 26px; letter-spacing: 2px; margin-bottom: 12px; }
.login-card h1 b { color: var(--accent); }
.login-card p { color: var(--muted); margin-bottom: 26px; line-height: 1.5; }

/* ---------- app ---------- */
.app { max-width: 1280px; margin: 0 auto; padding: 26px 26px 60px; }

.notice {
    display: none;
    margin-bottom: 18px;
    padding: 13px 18px;
    border-radius: 10px;
    font-size: 14px;
    border: 1px solid;
}
.notice.ok { display: block; background: rgba(87, 187, 106, .12); border-color: rgba(87,187,106,.4); color: var(--green); }
.notice.err { display: block; background: rgba(230, 72, 62, .12); border-color: rgba(230,72,62,.4); color: var(--red); }

/* ---------- toast ---------- */
#toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 12px 22px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 10px 30px rgba(0,0,0,.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease, transform .2s ease;
    z-index: 200;
    max-width: 90vw;
    text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }
#toast.show.ok { border-color: var(--green); color: var(--green); }
#toast.show.err { border-color: var(--red); color: var(--red); }

/* ---------- categories ---------- */
.cats {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}
.cat {
    padding: 10px 20px;
    border-radius: 10px;
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--muted);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    user-select: none;
    transition: all .15s ease;
}
.cat:hover { color: var(--text); border-color: var(--muted); }
.cat.active { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #14171d; border-color: transparent; }

/* ---------- grid ---------- */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}
.wcard {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.wcard:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.wcard-img {
    height: 130px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(80% 80% at 50% 50%, #1d2430, #10141c);
    padding: 10px;
    position: relative;
}
.wcard-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.wcard-img.split { padding: 10px 0; }

.split-imgwrap {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}
.split-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.split-img.t { clip-path: polygon(0 0, 50% 0, 50% 100%, 0 100%); }
.split-img.ct { clip-path: polygon(50% 0, 100% 0, 100% 100%, 50% 100%); }
.split-img.broken { visibility: hidden; }
.split-divider {
    position: absolute;
    left: 50%;
    top: 8px;
    bottom: 8px;
    width: 2px;
    transform: translateX(-50%);
    background: rgba(255,255,255,.35);
    box-shadow: 0 0 6px rgba(0,0,0,.6);
}
.split-tag {
    position: absolute;
    top: 6px;
    font-size: 9px;
    font-weight: 800;
    line-height: 1;
    padding: 3px 5px;
    border-radius: 5px;
    color: #fff;
    letter-spacing: .3px;
    z-index: 2;
}
.split-tag.tag-t { left: 8px; background: linear-gradient(135deg, #ffd17e, #e0701f); color: #241408; }
.split-tag.tag-ct { right: 8px; background: linear-gradient(135deg, #7ba6ff, #2a4fc9); }
.wcard-img.split .wcard-badges { display: none; }
.wcard-body { padding: 10px 12px; }
.wcard-name { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wcard-skin { font-size: 12px; color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wcard.special { border-color: rgba(240, 168, 50, .5); background: linear-gradient(180deg, rgba(240,168,50,.08), var(--card)); }

.wcard-badges {
    position: absolute;
    top: 6px;
    right: 6px;
    display: flex;
    gap: 3px;
    z-index: 2;
}
.badge-team {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #20242e;
    border: 1px solid var(--border);
    border-radius: 50%;
    opacity: .45;
    transition: opacity .12s ease;
}
.badge-team.on { opacity: 1; }
.badge-team.t.on { border-color: rgba(240, 160, 50, .7); }
.badge-team.ct.on { border-color: rgba(90, 140, 255, .7); }

.wcard-name svg, .lbl-ic svg { vertical-align: -2px; }
.lbl-ic { display: inline-flex; vertical-align: -2px; margin-right: 3px; }
.wcard-skin.two {
    display: flex;
    align-items: center;
    gap: 2px;
    white-space: nowrap;
    overflow: hidden;
}
.wcard-skin.two .lbl-sep { margin: 0 5px; color: var(--muted); flex: none; }
.lbl-sep { color: var(--muted); }
.team-opt-icons { display: inline-flex; align-items: center; margin-right: 6px; vertical-align: -2px; }
.team-opt-icons svg { margin-right: -2px; }

.team-current {
    display: flex;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.tc-cell {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 10px;
    min-width: 150px;
    flex: 1 1 150px;
}
.tc-cell img {
    width: 100%;
    height: 56px;
    object-fit: contain;
    background: radial-gradient(80% 80% at 50% 50%, #1d2430, #10141c);
    border-radius: 6px;
}
.tc-cell img.broken { visibility: hidden; }
.tc-meta {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
}
.tc-meta span { overflow: hidden; text-overflow: ellipsis; }
.tc-meta svg { flex: none; }

.empty { text-align: center; color: var(--muted); padding: 60px 0; }

/* ---------- modal ---------- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(5, 8, 12, .75);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-box {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 16px;
    max-width: 900px;
    width: 100%;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(0,0,0,.6);
}
.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.modal-title { font-size: 17px; font-weight: 700; }
.modal-title small { color: var(--muted); font-weight: 400; font-size: 13px; display: block; margin-top: 2px; }
.modal-body { padding: 18px 20px; overflow-y: auto; flex: 1; }

.search { width: 100%; margin-bottom: 16px; }

/* ---------- team apply switch ---------- */
.team-switch {
    display: inline-flex;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 3px;
    gap: 3px;
    margin-bottom: 14px;
}
.team-opt {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    user-select: none;
    transition: all .12s ease;
}
.team-opt:hover { color: var(--text); }
.team-opt.active { background: var(--accent); color: #14171d; }
.search input {
    width: 100%;
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 10px;
    padding: 11px 14px;
    font-size: 14px;
    outline: none;
}
.search input:focus { border-color: var(--accent); }

.skins-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.skin-card {
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 8px;
    cursor: pointer;
    transition: all .12s ease;
    position: relative;
}
.skin-card:hover { border-color: var(--muted); transform: translateY(-2px); }
.skin-card.active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(240,168,50,.25); }
.skin-card-img {
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(80% 80% at 50% 50%, #1d2430, #10141c);
    border-radius: 6px;
    margin-bottom: 6px;
    overflow: hidden;
}
.skin-card-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.skin-card-name { font-size: 11px; color: var(--text); text-align: center; line-height: 1.25; min-height: 28px; display: flex; align-items: center; justify-content: center; }
.skin-card .check {
    position: absolute;
    top: 5px; right: 5px;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: var(--accent);
    color: #14171d;
    font-size: 12px;
    font-weight: 900;
    display: none;
    align-items: center;
    justify-content: center;
}
.skin-card.active .check { display: flex; }

.modal-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}
.settings-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 12px; color: var(--muted); }
.field select, .field input {
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
    outline: none;
}
.field select:focus, .field input:focus { border-color: var(--accent); }
.actions { display: flex; gap: 10px; }

/* knife two-pane */
.agent-tabs {
    display: flex;
    gap: 8px;
    padding: 12px 20px 0;
}
.agent-tab {
    padding: 9px 20px;
    border-radius: 8px 8px 0 0;
    background: var(--card);
    border: 1px solid var(--border);
    border-bottom: none;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
    transition: all .12s ease;
}
.agent-tab:hover { color: var(--text); }
.agent-tab.active { background: var(--accent); border-color: transparent; color: #14171d; }

.knife-panes { display: grid; grid-template-columns: 220px 1fr; gap: 18px; }
.knife-types { display: flex; flex-direction: column; gap: 6px; max-height: 60vh; overflow-y: auto; padding-right: 4px; }
.knife-type {
    padding: 10px 12px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    transition: all .12s ease;
}
.knife-type:hover { color: var(--text); }
.knife-type.active { border-color: var(--accent); color: var(--text); background: rgba(240,168,50,.08); }
.knife-type .img { height: 46px; display: flex; align-items: center; justify-content: center; margin-bottom: 4px; }
.knife-type .img img { max-width: 100%; max-height: 100%; object-fit: contain; }

@media (max-width: 720px) {
    .knife-panes { grid-template-columns: 1fr; }
    .knife-types { flex-direction: row; overflow-x: auto; max-height: none; }
    .knife-type { min-width: 140px; }
}
