/**
 * Dungeon Pages: Underboss tracker — styles.
 * Scoped under .dpu-tracker.
 */

.dpu-tracker { color: #e0e0e0; font-family: 'Segoe UI', sans-serif; position: relative; }
.dpu-tracker * { box-sizing: border-box; }

.dpu-tracker:not(.dpu-editable) .dpu-cell,
.dpu-tracker:not(.dpu-editable) .dpu-card { cursor: default; }
.dpu-tracker.dpu-editable .dpu-cell,
.dpu-tracker.dpu-editable .dpu-card { cursor: pointer; }

/* ===== Toolbar ===== */
.dpu-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin: 0 0 10px;
    padding-bottom: 6px;
}
.dpu-stats {
    display: flex;
    gap: 14px;
    align-items: center;
    flex-wrap: wrap;
    font-size: 12px;
    color: #999;
}
.dpu-stat { white-space: nowrap; }
.dpu-stat strong {
    color: #4da44b;
    font-size: 14px;
    font-weight: 700;
    margin-right: 4px;
}

.dpu-tabs { display: flex; gap: 4px; }
.dpu-tab {
    appearance: none;
    -webkit-appearance: none;
    background: #1a1a1a;
    color: #888;
    border: 1px solid #333;
    padding: 6px 14px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    border-radius: 5px;
    line-height: 1.2;
}
.dpu-tab:hover { color: #ccc; background: #222; }
.dpu-tab.active { background: #2a2a30; color: #4da44b; border-color: #4da44b; }

.dpu-view { display: none; }
.dpu-view.active { display: block; }

/* ===== Cards ===== */
.dpu-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}
.dpu-card {
    background: #1c1c22;
    border: 1px solid #2c2c34;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.dpu-card:hover { transform: translateY(-2px); }
.dpu-card.status-won {
    border-color: #4da44b;
    box-shadow: 0 0 0 1px #4da44b inset;
}
.dpu-card.status-attempted {
    border-color: #b94a4a;
    box-shadow: 0 0 0 1px #b94a4a inset;
}

.dpu-card-art {
    aspect-ratio: 1 / 1;
    background: #0a0a0c;
    overflow: hidden;
    position: relative;
}
.dpu-card-art img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.dpu-card-set-pill {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0,0,0,0.7);
    color: #ffd166;
    padding: 3px 10px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    border-radius: 12px;
    z-index: 1;
}
.dpu-card-set-pill.core { color: #87CEEB; }

.dpu-card-body { padding: 11px 14px 13px; }
.dpu-card-underboss {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    margin: 0 0 2px;
    line-height: 1.2;
}
.dpu-card-dungeon {
    font-size: 12px;
    color: #999;
    margin: 0 0 8px;
    font-style: italic;
}
.dpu-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 12px;
    color: #aaa;
    margin: 0 0 8px;
}
.dpu-wl .dpu-w { color: #6bd16a; font-weight: 700; }
.dpu-wl .dpu-l { color: #d96a6a; font-weight: 700; }
.dpu-best { color: #ffd166; font-weight: 600; font-size: 11px; }
.dpu-card-heroes {
    display: flex;
    gap: 4px;
    padding-top: 8px;
    border-top: 1px solid #2c2c34;
}

.dpu-hero {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #0a0a0c;
    border: 1px solid #333;
    overflow: hidden;
    flex-shrink: 0;
}
.dpu-hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dpu-hero-sm { width: 20px; height: 20px; }

/* ===== Stamps ===== */
.dpu-stamp {
    position: absolute;
    bottom: 10px;
    right: -8px;
    padding: 4px 14px;
    font-weight: 900;
    font-size: 18px;
    letter-spacing: 3px;
    text-transform: uppercase;
    border: 3px solid currentColor;
    border-radius: 4px;
    transform: rotate(-12deg);
    opacity: 0.85;
    background: rgba(0,0,0,0.15);
    pointer-events: none;
    z-index: 2;
    text-shadow: 0 0 4px rgba(0,0,0,0.6);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.1);
    font-family: 'Impact', 'Arial Black', sans-serif;
}
.dpu-stamp-defeated {
    color: #f4ffe8;
    background:
        repeating-linear-gradient(135deg,
            rgba(255,255,255,0.10) 0 2px,
            transparent 2px 5px),
        repeating-linear-gradient(45deg,
            rgba(0,0,0,0.18) 0 2px,
            transparent 2px 4px),
        #3d8a3b;
    border-color: #f4ffe8;
    text-shadow: 0 1px 0 rgba(0,0,0,0.45);
    box-shadow:
        inset 0 0 0 1px rgba(0,0,0,0.25),
        inset 0 0 14px rgba(0,0,0,0.25);
    opacity: 0.92;
}
.dpu-stamp-lost { color: #d96a6a; }

/* ===== Matrix ===== */
.dpu-legend {
    display: flex;
    gap: 18px;
    font-size: 12px;
    color: #999;
    margin: 0 0 10px;
    flex-wrap: wrap;
    align-items: center;
}
.dpu-swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    vertical-align: middle;
    margin-right: 6px;
}
.dpu-swatch-diag { background: rgba(255, 209, 102, 0.4); }
.dpu-swatch-won  { background: #4da44b; }
.dpu-swatch-lost { background: #b94a4a; }
.dpu-legend-hint { color: #666; }

.dpu-matrix-wrap {
    background: #14141a;
    border: 1px solid #2c2c34;
    border-radius: 10px;
    padding: 10px;
    overflow: auto;
    max-height: 70vh;
}
.dpu-matrix {
    border-collapse: collapse;
    font-size: 11px;
    position: relative;
}
.dpu-matrix th,
.dpu-matrix td { padding: 0; }
.dpu-matrix thead th {
    position: sticky; top: 0; z-index: 3;
    background: #14141a;
}
.dpu-matrix .dpu-corner {
    position: sticky; top: 0; left: 0; z-index: 5;
    background: #14141a;
    border-right: 2px solid #333;
    border-bottom: 2px solid #333;
    min-width: 240px;
    text-align: left;
    padding: 6px 10px;
    color: #888;
    font-weight: 600;
    font-size: 11px;
}
.dpu-matrix .dpu-col-head {
    width: 44px; min-width: 44px;
    padding: 4px 2px;
    text-align: center;
    border-bottom: 2px solid #333;
    background: #14141a;
}
.dpu-matrix .dpu-col-head img {
    width: 36px; height: 36px;
    object-fit: cover;
    border-radius: 50%;
    border: 1px solid #333;
    display: block;
    margin: 0 auto;
}
.dpu-matrix .dpu-row-head {
    position: sticky; left: 0; z-index: 2;
    background: #1a1a20;
    text-align: left;
    padding: 6px 10px;
    border-right: 2px solid #333;
    border-bottom: 1px solid #2c2c34;
    min-width: 240px;
    max-width: 240px;
}
.dpu-row-label { display: flex; flex-direction: column; gap: 4px; }
.dpu-row-dungeon { font-size: 12px; font-weight: 600; color: #fff; }
.dpu-row-heroes { display: flex; gap: 2px; }

.dpu-matrix .dpu-cell {
    width: 44px;
    height: 44px;
    border: 1px solid #232328;
    text-align: center;
    vertical-align: middle;
    background: #16161c;
    transition: background 0.1s;
    font-size: 9px;
    color: #ccc;
    font-weight: 700;
    line-height: 1;
}
.dpu-matrix .dpu-cell:hover { background: #2a2a30; }
.dpu-matrix .dpu-cell.diag {
    background: rgba(255, 209, 102, 0.06);
    box-shadow: 0 0 0 1px rgba(255, 209, 102, 0.4) inset;
}
.dpu-matrix .dpu-cell.diag:hover { background: rgba(255, 209, 102, 0.18); }

.dpu-matrix .dpu-cell.status-won {
    background: #2e6b2d;
    color: #d6f0d5;
}
.dpu-matrix .dpu-cell.status-won.diag {
    background: linear-gradient(135deg, #ffd166 0%, #4da44b 60%);
    color: #0f0f12;
}
.dpu-matrix .dpu-cell.status-attempted {
    background: #6b2d2d;
    color: #f0d5d5;
}
.dpu-matrix .dpu-cell.status-attempted.diag {
    background: linear-gradient(135deg, #ffd166 0%, #b94a4a 60%);
    color: #0f0f12;
}

/* ===== Popover ===== */
.dpu-popover {
    position: fixed;
    z-index: 10000;
    width: 320px;
    background: #1c1c22;
    border: 1px solid #4da44b;
    border-radius: 10px;
    box-shadow: 0 12px 36px rgba(0,0,0,0.7);
    padding: 12px 14px 14px;
    color: #e0e0e0;
    font-size: 13px;
}
.dpu-pop-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    border-bottom: 1px solid #2c2c34;
    padding-bottom: 8px;
    margin-bottom: 10px;
}
.dpu-pop-title {
    font-weight: 700;
    color: #fff;
    line-height: 1.3;
    font-size: 13px;
}
.dpu-pop-close {
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
    padding: 0;
}
.dpu-pop-close:hover { color: #fff; }

.dpu-pop-attempts {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 10px;
}
.dpu-pop-empty {
    color: #777;
    font-style: italic;
    font-size: 12px;
    padding: 4px 0;
}
.dpu-pop-att {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    background: #16161c;
    margin-bottom: 4px;
    font-size: 12px;
}
.dpu-pop-att.outcome-win  { border-left: 3px solid #4da44b; }
.dpu-pop-att.outcome-loss { border-left: 3px solid #b94a4a; }
.dpu-pop-badge {
    background: #2c2c34;
    color: #fff;
    border-radius: 50%;
    width: 22px; height: 22px;
    display: grid; place-items: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}
.dpu-pop-att.outcome-win  .dpu-pop-badge { background: #4da44b; color: #0f0f12; }
.dpu-pop-att.outcome-loss .dpu-pop-badge { background: #b94a4a; color: #fff; }
.dpu-pop-att-main {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dpu-pop-att-main a { color: #87CEEB; text-decoration: none; }
.dpu-pop-att-main a:hover { text-decoration: underline; }
.dpu-pop-del {
    background: none;
    border: none;
    color: #777;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 0 4px;
}
.dpu-pop-del:hover { color: #d96a6a; }

.dpu-pop-form { display: flex; flex-direction: column; gap: 6px; }
.dpu-pop-row {
    display: flex;
    gap: 10px;
    align-items: center;
    font-size: 12px;
}
.dpu-pop-row label { display: flex; align-items: center; gap: 4px; cursor: pointer; }
.dpu-pop-score {
    flex: 1;
    background: #14141a;
    border: 1px solid #333;
    color: #fff;
    padding: 6px 8px;
    border-radius: 5px;
    font-size: 12px;
}
.dpu-pop-input {
    background: #14141a;
    border: 1px solid #333;
    color: #fff;
    padding: 6px 8px;
    border-radius: 5px;
    font-size: 12px;
    width: 100%;
}
.dpu-pop-save {
    background: #4da44b;
    color: #0f0f12;
    border: none;
    padding: 8px 14px;
    font-weight: 700;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 12px;
}
.dpu-pop-save:hover { background: #5cc05a; }
.dpu-pop-save:disabled { opacity: 0.6; cursor: wait; }
.dpu-pop-err {
    color: #d96a6a;
    font-size: 11px;
    padding: 4px 0 0;
}
