/* =========================================================
   TALENTBUILDER
   Farben, Radien und Buttons orientieren sich an guide.css
========================================================= */

.mk-tb,
.mk-tb-tip {
    --tb-bg: #111;
    --tb-panel: rgba(17, 17, 17, .82);
    --tb-border: #252525;
    --tb-border-strong: #333;
    --tb-muted: #8d8d8d;
    --tb-orange: var(--mk-orange, #ff7a00);
    --tb-orange-soft: rgba(255, 122, 0, .22);
    --tb-gold: #ffc65c;
    --tb-node: 42px;
}

.mk-tb {
    position: relative;
    width: 100%;
    min-width: 0;
}

/* ---------- Modus-Buttons (Raid, Mythic+, …) ---------- */

.mk-tb-modes {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 18px 0 20px;
}

.mk-tb-mode,
.mk-tb-modes .mk-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-width: 110px;
    padding: 10px 22px;
    background: #151515;
    border: 1px solid #2a2a2a;
    border-radius: 10px;
    color: var(--mk-text, #fff);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: background .2s ease, border-color .2s ease, color .2s ease, transform .2s ease;
}

.mk-tb-mode:hover {
    border-color: var(--tb-orange, #ff7a00);
    color: var(--tb-orange, #ff7a00);
    transform: translateY(-2px);
}

.mk-tb-mode.active,
.mk-tb-mode.active:hover {
    background: var(--tb-orange, #ff7a00);
    border-color: var(--tb-orange, #ff7a00);
    color: #fff;
    box-shadow: 0 0 16px rgba(255, 122, 0, .22);
    transform: none;
}

.mk-tb-mode-own {
    margin-left: auto;
}

.mk-tb-mode:focus-visible,
.mk-tb-btn:focus-visible,
.mk-tb-node:focus-visible,
.mk-tb-switch button:focus-visible,
.mk-tb-hero-switch button:focus-visible,
.mk-tb-pvp-slot:focus-visible,
.mk-tb-pvp-option:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px rgba(255, 122, 0, .45);
}

/* ---------- Grundgerüst ---------- */

.mk-tb-app {
    position: relative;
}

.mk-tb-loading,
.mk-tb-note {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 320px;
    border: 1px solid var(--tb-border);
    border-radius: 18px;
    background: var(--tb-bg);
    color: var(--tb-muted);
    font-size: 16px;
}

.mk-tb-note {
    min-height: 0;
    padding: 22px;
}

/* ---------- Toolbar ---------- */

.mk-tb-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}

.mk-tb-counters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.mk-tb-counter {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 10px 16px;
    border: 1px solid var(--tb-border);
    border-radius: 12px;
    background: rgba(28, 28, 28, .35);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.mk-tb-counter span {
    color: var(--tb-muted);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.mk-tb-counter .mk-tb-short {
    display: none;
}

.mk-tb-counter strong {
    color: #fff;
    font-size: 17px;
    font-variant-numeric: tabular-nums;
}

.mk-tb-counter.is-full strong {
    color: var(--tb-orange);
}

.mk-tb-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.mk-tb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 42px;
    padding: 0 18px;
    border: 1px solid #2a2a2a;
    border-radius: 10px;
    background: #151515;
    color: #e6e6e6;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: border-color .2s, color .2s, background .2s;
}

.mk-tb-btn:hover:not(:disabled) {
    border-color: var(--tb-orange);
    color: var(--tb-orange);
}

.mk-tb-btn-primary {
    background: var(--tb-orange);
    border-color: var(--tb-orange);
    color: #fff;
}

.mk-tb-btn-primary:hover:not(:disabled) {
    background: var(--mk-orange-hover, #ff9100);
    border-color: var(--mk-orange-hover, #ff9100);
    color: #fff;
}

.mk-tb-btn:disabled {
    opacity: .4;
    cursor: not-allowed;
}

.mk-tb-input {
    flex: 1;
    min-width: 0;
    height: 42px;
    padding: 0 16px;
    border: 1px solid #2a2a2a;
    border-radius: 10px;
    background: #111;
    color: #fff;
    font: inherit;
    font-size: 14px;
}

.mk-tb-input:focus {
    outline: none;
    border-color: var(--tb-orange);
}

.mk-tb-import {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
}

.mk-tb-import[hidden] {
    display: none;
}

/* ---------- Bäume ---------- */

.mk-tb-switch {
    display: none;
}

.mk-tb-trees {
    display: flex;
    gap: 14px;
    align-items: stretch;
}

.mk-tb-tree {
    display: flex;
    flex-direction: column;
    min-width: 0;
    border: 1px solid var(--tb-border);
    border-radius: 18px;
    background: var(--tb-panel);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    overflow: hidden;
}

.mk-tb-tree-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--tb-border);
}

.mk-tb-tree-title {
    overflow: hidden;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mk-tb-tree-count {
    flex-shrink: 0;
    color: var(--tb-muted);
    font-size: 13px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.mk-tb-viewport {
    position: relative;
    flex: 1 0 auto;
    margin: 10px;
    min-height: 120px;
}

.mk-tb-canvas {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: 0 0;
}

.mk-tb-canvas-inner {
    position: absolute;
    top: 0;
    left: 0;
}

.mk-tb-canvas-inner[hidden] {
    display: none;
}

.mk-tb-empty {
    padding: 30px;
    color: var(--tb-muted);
}

/* ---------- Heldentalente ---------- */

.mk-tb-hero-switch {
    display: flex;
    gap: 6px;
    padding: 10px 10px 0;
}

.mk-tb-hero-switch button {
    flex: 1;
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid #2a2a2a;
    border-radius: 10px;
    background: #151515;
    color: #cfcfcf;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
    transition: border-color .2s, color .2s, background .2s;
}

.mk-tb-hero-switch button:hover {
    border-color: var(--tb-orange);
    color: var(--tb-orange);
}

.mk-tb-hero-switch button.active {
    background: linear-gradient(90deg, rgba(255, 122, 0, .45) 0%, rgba(255, 122, 0, .18) 60%, #151515 100%);
    border-color: rgba(255, 122, 0, .6);
    color: #fff;
}

.mk-tb-hero-empty {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 20px;
    text-align: center;
}

.mk-tb-hero-empty[hidden] {
    display: none;
}

.mk-tb-hero-empty p {
    margin: 0 0 4px;
    color: var(--tb-muted);
}

.mk-tb-hero-empty .mk-tb-btn {
    width: 100%;
    max-width: 240px;
}

/* ---------- Linien & Gates ---------- */

.mk-tb-lines {
    position: absolute;
    top: 0;
    left: 0;
    overflow: visible;
    pointer-events: none;
}

.mk-tb-line {
    stroke: #2f2f2f;
    stroke-width: 3;
    stroke-linecap: round;
    transition: stroke .2s;
}

.mk-tb-line.is-available {
    stroke: #6b5232;
}

.mk-tb-line.is-on {
    stroke: var(--tb-orange);
    filter: drop-shadow(0 0 3px rgba(255, 122, 0, .55));
}

.mk-tb-gate {
    stroke: #2c2c2c;
    stroke-width: 1;
    stroke-dasharray: 4 6;
}

.mk-tb-gate.is-open {
    stroke: rgba(255, 122, 0, .25);
}

.mk-tb-gate-label {
    position: absolute;
    z-index: 3;
    right: 6px;
    padding: 1px 7px;
    border-radius: 6px;
    background: #191919;
    color: #777;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .04em;
    pointer-events: none;
}

.mk-tb-gate-label.is-open {
    color: var(--tb-orange);
    background: rgba(255, 122, 0, .1);
}

/* ---------- Knoten ---------- */

.mk-tb-node {
    position: absolute;
    width: var(--tb-node);
    height: var(--tb-node);
    padding: 0;
    border: 2px solid #3a3a3a;
    border-radius: 9px;
    background: #0c0c0c;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s, transform .15s, filter .15s;
    -webkit-tap-highlight-color: transparent;
}

.mk-tb-passive {
    border-radius: 50%;
}

.mk-tb-icon {
    position: absolute;
    inset: 2px;
    display: flex;
    overflow: hidden;
    border-radius: 6px;
}

.mk-tb-passive .mk-tb-icon {
    border-radius: 50%;
}

.mk-tb-icon img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mk-tb-half {
    position: relative;
    width: 50%;
    height: 100%;
    overflow: hidden;
}

.mk-tb-half img {
    position: absolute;
    top: 0;
    width: 200%;
    max-width: none;
}

.mk-tb-half-0 img {
    left: 0;
}

.mk-tb-half-1 img {
    right: 0;
}

.mk-tb-half-1 {
    border-left: 1px solid #000;
}

.mk-tb-rank {
    position: absolute;
    right: -8px;
    bottom: -8px;
    z-index: 2;
    min-width: 26px;
    padding: 1px 5px;
    border: 1px solid #333;
    border-radius: 7px;
    background: #0d0d0d;
    color: #bdbdbd;
    font-size: 10px;
    font-weight: 700;
    line-height: 14px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    pointer-events: none;
}

.mk-tb-rank[hidden] {
    display: none;
}

/* Wahlknoten: Achteck, Rahmen über ::before (Rang-Badge bleibt sichtbar) */
.mk-tb-choice {
    --frame: #3a3a3a;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.mk-tb-choice::before {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--frame);
    clip-path: polygon(30% 0, 70% 0, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0 70%, 0 30%);
    transition: background .15s;
}

.mk-tb-choice .mk-tb-icon {
    inset: 2px;
    border-radius: 0;
    clip-path: polygon(30% 0, 70% 0, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0 70%, 0 30%);
}

/* Zustände */
.mk-tb-node.is-locked {
    filter: grayscale(1) brightness(.45);
}

.mk-tb-node.is-locked:hover {
    filter: grayscale(.6) brightness(.7);
}

.mk-tb-node.is-available {
    border-color: #6d5432;
}

.mk-tb-choice.is-available {
    --frame: #6d5432;
}

.mk-tb-node.is-available:hover {
    border-color: var(--tb-orange);
    transform: translateY(-1px);
}

.mk-tb-choice.is-available:hover {
    --frame: var(--tb-orange);
}

.mk-tb-node.is-selected {
    border-color: var(--tb-orange);
    box-shadow: 0 0 12px rgba(255, 122, 0, .35);
}

.mk-tb-choice.is-selected {
    --frame: var(--tb-orange);
    box-shadow: none;
    filter: drop-shadow(0 0 6px rgba(255, 122, 0, .45));
}

.mk-tb-node.is-selected .mk-tb-rank {
    border-color: rgba(255, 122, 0, .7);
    color: var(--tb-orange);
}

.mk-tb-node.is-max {
    border-color: var(--tb-gold);
    box-shadow: 0 0 14px rgba(255, 198, 92, .35);
}

.mk-tb-choice.is-max {
    --frame: var(--tb-gold);
    box-shadow: none;
    filter: drop-shadow(0 0 6px rgba(255, 198, 92, .45));
}

.mk-tb-node.is-max .mk-tb-rank {
    border-color: rgba(255, 198, 92, .7);
    color: var(--tb-gold);
}

.mk-tb-node.is-free {
    border-color: #8a8a8a;
    box-shadow: none;
}

.mk-tb-choice.is-free {
    --frame: #8a8a8a;
}

.mk-tb-node.mk-tb-deny {
    animation: mk-tb-shake .3s;
}

@keyframes mk-tb-shake {
    0%, 100% { translate: 0 0; }
    25% { translate: -3px 0; }
    75% { translate: 3px 0; }
}

/* ---------- PvP ---------- */

.mk-tb-pvp {
    margin-top: 14px;
    padding: 16px 18px;
    border: 1px solid var(--tb-border);
    border-radius: 18px;
    background: var(--tb-panel);
}

.mk-tb-pvp-head {
    margin-bottom: 12px;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
}

.mk-tb-pvp-head span {
    margin-left: 8px;
    color: var(--tb-muted);
    font-size: 12px;
    font-weight: 500;
}

.mk-tb-pvp-slots {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

.mk-tb-pvp-slot,
.mk-tb-pvp-option {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 8px 12px;
    border: 1px solid #2a2a2a;
    border-radius: 12px;
    background: #151515;
    color: #ddd;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: border-color .2s, color .2s;
}

.mk-tb-pvp-slot span,
.mk-tb-pvp-option span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mk-tb-pvp-slot:hover,
.mk-tb-pvp-slot.open,
.mk-tb-pvp-option:hover:not(:disabled) {
    border-color: var(--tb-orange);
}

.mk-tb-pvp-slot.filled {
    border-color: rgba(255, 122, 0, .5);
    color: #fff;
}

.mk-tb-pvp-option.active {
    border-color: var(--tb-orange);
    background: rgba(255, 122, 0, .12);
}

.mk-tb-pvp-option:disabled {
    opacity: .35;
    cursor: not-allowed;
}

.mk-tb-pvp-plus {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px dashed #444;
    border-radius: 8px;
    color: var(--tb-muted);
    font-size: 18px;
}

.mk-tb-pvp-icon {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 8px;
}

.mk-tb-pvp-picker {
    margin-top: 12px;
}

.mk-tb-pvp-picker[hidden] {
    display: none;
}

.mk-tb-pvp-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 8px;
    max-height: 340px;
    margin-bottom: 10px;
    overflow-y: auto;
}

/* ---------- Export ---------- */

.mk-tb-export {
    margin-top: 14px;
}

.mk-tb-export-label {
    display: block;
    margin-bottom: 8px;
    color: var(--tb-muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.mk-tb-export-row {
    display: flex;
    gap: 10px;
}

.mk-tb-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
    color: #cfcfcf;
}

.mk-tb-hint {
    margin-top: 10px;
    color: #6f6f6f;
    font-size: 12px;
}

/* ---------- Toast ---------- */

.mk-tb-toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    z-index: 10000;
    max-width: calc(100vw - 32px);
    padding: 12px 20px;
    border: 1px solid rgba(255, 122, 0, .5);
    border-radius: 12px;
    background: #161616;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 10px);
    transition: opacity .2s, transform .2s;
}

.mk-tb-toast.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

.mk-tb-toast.is-error {
    border-color: #b33;
}

/* ---------- Tooltip ---------- */

.mk-tb-tip {
    position: fixed;
    z-index: 9999;
    width: 330px;
    max-width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    overflow-y: auto;
    padding: 14px 16px;
    border: 1px solid #333;
    border-radius: 14px;
    background: rgba(14, 14, 14, .97);
    color: #e8e8e8;
    font-family: Inter, sans-serif;
    font-size: 13px;
    line-height: 1.5;
    box-shadow: 0 14px 40px rgba(0, 0, 0, .6);
    pointer-events: none;
}

.mk-tb-tip[hidden] {
    display: none;
}

.mk-tb-tip.is-sticky {
    pointer-events: auto;
    border-color: rgba(255, 122, 0, .45);
}

.mk-tb-tip-rank {
    margin-bottom: 8px;
    color: var(--mk-orange, #ff7a00);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.mk-tb-tip-entry + .mk-tb-tip-entry,
.mk-tb-tip .mk-tb-btn + .mk-tb-tip-entry {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #262626;
}

.mk-tb-tip-entry.active .mk-tb-tip-name {
    color: var(--mk-orange, #ff7a00);
}

.mk-tb-tip-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.mk-tb-tip-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border: 1px solid #333;
    border-radius: 8px;
}

.mk-tb-tip-name {
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.25;
}

.mk-tb-tip-meta {
    color: #8d8d8d;
    font-size: 12px;
}

.mk-tb-tip-desc {
    color: #ffd27a;
    white-space: pre-line;
}

.mk-tb-tip-lock {
    margin-top: 10px;
    color: #e46b6b;
    font-size: 12px;
    font-weight: 600;
}

.mk-tb-tip .mk-tb-btn {
    width: 100%;
    height: 38px;
    margin-top: 8px;
}

.mk-tb-tip-actions {
    display: flex;
    gap: 8px;
    margin-top: 6px;
}

.mk-tb-tip-actions .mk-tb-btn {
    flex: 1;
}

.mk-tb-tip-close {
    position: absolute;
    top: 6px;
    right: 8px;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 0;
    background: none;
    color: #888;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.mk-tb-tip-close:hover {
    color: #fff;
}

/* ---------- Mobil ---------- */

@media (max-width: 900px) {

    .mk-tb-mode-own {
        margin-left: 0;
    }

    .mk-tb-modes {
        flex-wrap: nowrap;
        gap: 8px;
        margin: 12px 0 16px;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .mk-tb-modes::-webkit-scrollbar {
        display: none;
    }

    .mk-tb-mode {
        flex: 0 0 auto;
        min-width: 0;
        padding: 10px 16px;
    }

    .mk-tb-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .mk-tb-counters {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .mk-tb-counter {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
        padding: 8px 10px;
    }

    .mk-tb-counter .mk-tb-long {
        display: none;
    }

    .mk-tb-counter .mk-tb-short {
        display: inline;
        font-size: 10px;
    }

    .mk-tb-actions .mk-tb-btn {
        flex: 1;
    }

    .mk-tb-switch {
        display: flex;
        gap: 6px;
        margin-bottom: 10px;
        padding: 4px;
        border: 1px solid var(--tb-border);
        border-radius: 12px;
        background: #111;
    }

    .mk-tb-switch button {
        flex: 1;
        padding: 9px 6px;
        border: 0;
        border-radius: 9px;
        background: transparent;
        color: #bdbdbd;
        font: inherit;
        font-size: 13px;
        font-weight: 600;
        cursor: pointer;
    }

    .mk-tb-switch button.active {
        background: var(--tb-orange);
        color: #fff;
    }

    .mk-tb-trees {
        display: block;
    }

    .mk-tb-trees .mk-tb-tree {
        display: none;
    }

    .mk-tb-trees[data-view="c"] .mk-tb-tree[data-g="c"],
    .mk-tb-trees[data-view="h"] .mk-tb-tree[data-g="h"],
    .mk-tb-trees[data-view="s"] .mk-tb-tree[data-g="s"] {
        display: flex;
    }

    .mk-tb-viewport {
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
    }

    .mk-tb-export-row {
        flex-wrap: wrap;
    }

    .mk-tb-export-row .mk-tb-input {
        flex-basis: 100%;
    }

    .mk-tb-export-row .mk-tb-btn {
        flex: 1;
    }

    .mk-tb-hint {
        display: none;
    }

    .mk-tb-pvp-head span {
        display: block;
        margin: 4px 0 0;
    }
}
