/* === LEGEND === */
.legend-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1.5rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem 2rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
}

.legend-item .badge {
    width: 28px;
    height: 28px;
    font-size: 0.9rem;
}

.legend-item .b-3 {
    color: #000;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    align-items: stretch;
}

.weapon-ref-card {
    background: rgba(24, 24, 27, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: all 0.3s ease;
}

.weapon-ref-card:hover {
    border-color: var(--primary);
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.weapon-ref-card .ref-card-header,
.info-entry-card .ref-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 1rem 2.5rem 1rem 1.25rem;
    font-weight: 700;
    font-size: 1.1rem;
    border-bottom: 1px solid var(--border-color);
    min-height: 4.8rem;
}

.weapon-ref-card .header-text-wrap,
.info-entry-card .header-text-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    line-height: 1.2;
}

.weapon-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.ref-card-body {
    padding: 0.5rem 0;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.ref-column-headers {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.col-label {
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.col-stats {
    display: flex;
    align-items: center;
    width: 130px;
}

.col-divider {
    width: 1px;
    height: 14px;
    background: rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
    margin: 0 4px;
}

.col-label.text-stagger,
.col-label.text-defense {
    flex: 1;
    text-align: center;
}

.ref-attack-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    gap: 0.5rem;
}

.ref-attack-row:last-child {
    border-bottom: none;
}

.ref-attack-name {
    font-size: 0.95rem;
    line-height: 1.2;
    color: var(--text-main);
    font-weight: 600;
    flex: 1;
    word-wrap: break-word;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.play-indicator {
    width: 14px;
    height: 14px;
    color: var(--primary);
    opacity: 0.6;
    transition: opacity 0.2s ease, transform 0.2s ease;
    flex-shrink: 0;
}

.ref-attack-stats {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    width: 130px;
}

.mini-badge {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.mini-badge .b-dot {
    display: inline-block;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    line-height: 24px;
    text-align: center;
    color: #fff;
    font-size: 0.85rem;
}

/* text-stagger and text-defense colors defined in Priority Guide section above */

/* === SKILL PREVIEW TOOLTIP === */
.preview-tooltip {
    position: absolute;
    z-index: 100;
    width: 375px;
    background: var(--bg-surface);
    border: 1px solid var(--primary);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6),
        0 0 20px rgba(59, 130, 246, 0.2);
    pointer-events: none;
    transition: opacity 0.15s ease;
}

.preview-tooltip.hidden {
    opacity: 0;
    visibility: hidden;
}

.preview-video {
    width: 100%;
    display: block;
}

/* Highlight row on hover when previews are available */
.ref-attack-row[data-preview]:hover {
    background: rgba(59, 130, 246, 0.1);
    cursor: pointer;
}

.ref-attack-row[data-preview]:hover .play-indicator,
.clickable-preview:hover .play-indicator {
    opacity: 1;
    transform: scale(1.1);
}

.clickable-preview {
    cursor: pointer;
    transition: background 0.2s ease;
    position: relative;
}

.clickable-preview:hover {
    background: rgba(59, 130, 246, 0.1);
}

.mystic-play {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
}

/* Disable preview on touch devices */
@media (hover: none) {
    .preview-tooltip {
        display: none !important;
    }
}

/* === MYSTIC STAT LAYOUT === */
.mystic-stat-body {
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 1.1rem 1rem;
    gap: 0.5rem;
    flex-grow: 1;
}

.mystic-stat-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.45rem;
    flex: 1;
}

.mystic-stat-num {
    width: 28px !important;
    height: 28px !important;
    font-size: 0.85rem !important;
    border-radius: 6px !important;
    line-height: normal !important;
    font-weight: 800 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.mystic-stat-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.winner-display {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.winner-icon-wrap {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
}

.winner-icon {
    width: 44px;
    height: 44px;
    object-fit: contain;
}

.outcome-info {
    display: flex;
    flex-direction: column;
}

@media (max-width: 600px) {
    .winner-display {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
}

.mystic-stat-divider {
    width: 1px;
    height: 40px;
    background: var(--border-color);
    flex-shrink: 0;
}