/* Modals and components UI - extracted from inline index.html */

.proficiencies {
    margin-top: 20px;
}

.prof-title {
    font-size: 1.2em;
    color: var(--ui-teal);
    margin-bottom: 10px;
    font-weight: bold;
}

.roulette-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.roulette-container {
    width: 750px;
    height: 200px;
    overflow: hidden;
    position: relative;
    border: 3px solid var(--ui-gold);
    border-radius: 10px;
    background: rgba(26, 26, 46, 0.8);
}

.roulette-pointer {
    position: absolute;
    top: 0;
    left: 50%;
    width: 3px;
    height: 100%;
    background: var(--p-ff0000);
    z-index: 10;
    transform: translateX(-50%);
}

.roulette-items {
    display: flex;
    align-items: center;
    height: 100%;
    transition: transform 3s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.roulette-item {
    min-width: 160px;
    width: 160px;
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2em;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: var(--p-000000);
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.5);
    flex-shrink: 0;
}

.roulette-result {
    margin-top: 30px;
    font-size: 1.5em;
    color: var(--ui-gold);
    text-align: center;
}

.confirm-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.confirm-modal.active {
    display: flex;
}

.confirm-box {
    background: linear-gradient(135deg, var(--ui-navy-1) 0%, var(--ui-navy-2) 100%);
    border: 2px solid var(--ui-teal);
    border-radius: 15px;
    padding: 30px;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.confirm-title {
    font-size: 1.5em;
    color: var(--ui-teal);
    margin-bottom: 20px;
    font-weight: bold;
}

.confirm-message {
    font-size: 1.1em;
    color: var(--p-ffffff);
    margin-bottom: 30px;
    line-height: 1.5;
}

.confirm-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.confirm-btn {
    padding: 12px 30px;
    font-size: 1em;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
}

.confirm-btn.yes {
    background: var(--ui-teal);
    color: var(--ui-navy-1);
}

.confirm-btn.yes:hover {
    background: var(--ui-teal-2);
    transform: scale(1.05);
}

.confirm-btn.no {
    background: var(--ui-red);
    color: var(--p-ffffff);
}

.confirm-btn.no:hover {
    background: var(--ui-red-2);
    transform: scale(1.05);
}

.refine-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.refine-modal.active {
    display: flex;
}

.refine-box {
    background: linear-gradient(135deg, var(--ui-navy-1) 0%, var(--ui-navy-2) 100%);
    border: 3px solid var(--ui-gold);
    border-radius: 15px;
    padding: 30px;
    min-width: 450px;
    max-width: 500px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7);
}

.refine-title {
    font-size: 1.8em;
    color: var(--ui-gold);
    margin-bottom: 20px;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.refine-info {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.refine-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 10px 0;
    font-size: 1.1em;
    color: var(--p-ffffff);
}

.refine-stat-label {
    color: var(--ui-teal);
    font-weight: bold;
}

.refine-stat-value {
    color: var(--ui-gold);
    font-weight: bold;
}

.refine-cost {
    font-size: 1.2em;
    color: var(--ui-danger);
    margin: 15px 0;
    font-weight: bold;
}

.refine-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

.refine-btn {
    padding: 15px 35px;
    font-size: 1.1em;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
}

.refine-btn.upgrade {
    background: linear-gradient(135deg, var(--ui-teal) 0%, var(--ui-teal-2) 100%);
    color: var(--ui-navy-1);
    box-shadow: 0 4px 15px rgba(78, 205, 196, 0.4);
}

.refine-btn.upgrade:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(78, 205, 196, 0.6);
}

.refine-btn.close {
    background: var(--ui-red);
    color: var(--p-ffffff);
}

.refine-btn.close:hover {
    background: var(--ui-red-2);
    transform: scale(1.05);
}

.qi-breakdown-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.qi-breakdown-modal.active {
    display: flex;
}

.qi-breakdown-box {
    background: linear-gradient(135deg, var(--ui-navy-1) 0%, var(--ui-navy-2) 100%);
    border: 2px solid var(--ui-teal);
    border-radius: 15px;
    padding: 30px;
    min-width: 500px;
    max-width: 600px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7);
}

.qi-breakdown-title {
    font-size: 1.8em;
    color: var(--ui-gold);
    text-align: center;
    margin-bottom: 25px;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}


.sidepanel {
    width: 300px;
    min-width: 300px;
    height: 100%;
    background: rgba(26, 26, 46, 0.95);
    border-right: 2px solid var(--ui-teal);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-bottom: 20px;
    gap: 15px;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidepanel-btn {
    width: 80%;
    max-width: 200px;
    height: 65px;
    background: rgba(78, 205, 196, 0.2);
    border: 2px solid var(--ui-teal);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
    color: var(--ui-teal);
    transition: all 0.3s;
    position: relative;
    line-height: 1;
}

.sidepanel-btn:hover {
    background: rgba(78, 205, 196, 0.4);
    transform: scale(1.1);
}

.sidepanel-btn.active {
    background: var(--ui-teal);
    color: var(--ui-navy-1);
}

.sidepanel-btn.danger {
    border-color: var(--ui-danger);
    color: var(--ui-danger);
}

.sidepanel-btn.danger:hover {
    background: rgba(255, 107, 107, 0.4);
}

.sidepanel-divider {
    width: 80%;
    max-width: 200px;
    height: 2px;
    background: var(--ui-teal);
    margin: 10px 0;
}

.sidepanel-info {
    width: 100%;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 2px solid var(--ui-teal);
    margin-bottom: 10px;
}

.sidepanel-stat {
    margin: 12px 0;
    font-size: 1em;
    color: var(--p-ffffff);
    text-align: center;
}

.sidepanel-stat-label {
    color: var(--ui-teal);
    font-weight: bold;
    display: block;
    margin-bottom: 5px;
    font-size: 1em;
}

.sidepanel-stat-value {
    color: var(--ui-gold);
    font-weight: bold;
    font-size: 1.1em;
}

.sidepanel-progress {
    width: 90%;
    height: 12px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 6px;
    margin: 8px auto;
    overflow: hidden;
    border: 1px solid var(--ui-teal);
}

.sidepanel-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--ui-teal) 0%, var(--ui-teal-2) 100%);
    transition: width 0.3s;
    border-radius: 3px;
}

.container {
    width: 100%;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
    height: 100%;
    overflow-y: auto;
}

.tooltip {
    position: fixed;
    left: 75px;
    background: rgba(0, 0, 0, 0.9);
    color: var(--p-ffffff);
    padding: 8px 12px;
    border-radius: 5px;
    font-size: 0.9em;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 99999;
    border: 1px solid var(--ui-teal);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.sidepanel-btn:hover .tooltip {
    opacity: 1;
}

/* Dantian Orb Styles - 3 layers: Impurities (black), Corruption (red), Purity (blue) */
.dantian-orb {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 3px solid var(--p-ffffff);
    background: var(--p-0a0a0a);
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.3), inset 0 0 20px rgba(0, 0, 0, 0.5);
}

/* Impurities layer (black) - bottom */
.dantian-impurities {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 0%;
    background: linear-gradient(to top, var(--p-000000), var(--p-1a1a1a), var(--p-2a2a2a));
    transition: height 0.5s ease-out;
}

/* Corruption layer (red/purple) - middle */
.dantian-corruption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 0%;
    background: linear-gradient(to top, var(--p-4a0a0a), var(--p-8b0000), var(--p-dc143c));
    transition: height 0.5s ease-out, bottom 0.5s ease-out;
    box-shadow: inset 0 0 15px rgba(220, 20, 60, 0.5);
}

/* Purity layer (blue) - top */
.dantian-purity {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 100%;
    background: linear-gradient(to top, var(--p-1a4a6e), var(--ui-teal), var(--p-7fefef));
    transition: height 0.5s ease-out, bottom 0.5s ease-out, background 0.5s ease-out;
    box-shadow: inset 0 0 15px rgba(78, 205, 196, 0.3);
}

/* Divine purity layer (golden/yellow) - for Heaven cultivation manual */
.dantian-purity.divine {
    background: linear-gradient(to top, var(--p-8b6914), var(--ui-gold), var(--p-fff4b0));
    box-shadow: inset 0 0 15px rgba(255, 215, 0, 0.3);
}

/* Heaven Chosen purity layer (golden/yellow) - for Heaven Chosen origin */
.dantian-purity.heaven-chosen {
    background: linear-gradient(to top, var(--p-8b6914), var(--ui-gold), var(--p-fff4b0));
    box-shadow: inset 0 0 15px rgba(255, 215, 0, 0.3);
}

/* Infinity purity layer (purple) */
.dantian-purity.infinity {
    background: linear-gradient(to top, var(--p-7c3aed), var(--p-a855f7), var(--p-d8b4fe));
    box-shadow: inset 0 0 15px rgba(168, 85, 247, 0.3);
}

.dantian-glow {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.4) 0%, transparent 50%);
    pointer-events: none;
    z-index: 10;
}

/* One variable-driven pulse for the orb glow. State classes (or JS, inline) just set
   --orb-glow-color, so the glow can follow the elemental blend the same way the fill does. */
@keyframes dantian-orb-pulse {
    0%, 100% { box-shadow: 0 0 15px var(--orb-glow-color, var(--ui-teal)), inset 0 0 20px rgba(0, 0, 0, 0.5); }
    50%      { box-shadow: 0 0 25px var(--orb-glow-color, var(--ui-teal)), inset 0 0 20px rgba(0, 0, 0, 0.5); }
}

.dantian-orb.state-pure,
.dantian-orb.state-corrupted,
.dantian-orb.state-divine,
.dantian-orb.state-infinity {
    animation: dantian-orb-pulse 2.5s ease-in-out infinite;
}

.dantian-orb.state-corrupted { --orb-glow-color: var(--p-dc143c); }
.dantian-orb.state-divine    { --orb-glow-color: var(--ui-gold); }
.dantian-orb.state-infinity  { --orb-glow-color: var(--p-a855f7); border-color: rgba(168, 85, 247, 0.6); }

/* Bloodline Skill Tree Styles with D3.js */
.skill-node-root {
    fill: var(--ui-teal);
    stroke: var(--ui-teal);
    stroke-width: 3;
    transition: all 0.3s;
}

.skill-node-available {
    fill: rgba(78, 205, 196, 0.2);
    stroke: var(--ui-teal);
    stroke-width: 3;
    transition: all 0.3s;
}

.skill-node-available:hover {
    fill: rgba(78, 205, 196, 0.4);
    stroke: var(--ui-teal);
    stroke-width: 4;
}

.skill-node-purchased {
    fill: rgba(255, 215, 0, 0.3);
    stroke: var(--ui-gold);
    stroke-width: 3;
    transition: all 0.3s;
}

.skill-node-purchased:hover {
    fill: rgba(255, 215, 0, 0.5);
}

.skill-node-locked {
    fill: rgba(100, 100, 100, 0.1);
    stroke: var(--p-666666);
    stroke-width: 2;
    opacity: 0.5;
}

.node.active circle {
    stroke-width: 5 !important;
}

.node text {
    pointer-events: none;
    user-select: none;
}

.skill-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.95);
    border: 2px solid var(--ui-teal);
    border-radius: 8px;
    padding: 15px;
    color: var(--p-ffffff);
    font-size: 0.9em;
    z-index: 10000;
    pointer-events: none;
    max-width: 300px;
    display: none;
}

.skill-tooltip.show {
    display: block;
}

.skill-tooltip-title {
    color: var(--ui-gold);
    font-weight: bold;
    margin-bottom: 8px;
    font-size: 1.1em;
}

.skill-tooltip-desc {
    color: var(--p-cccccc);
    margin-bottom: 8px;
}

.skill-tooltip-cost {
    color: var(--ui-teal);
    font-weight: bold;
}

.skill-tooltip-requires {
    color: var(--ui-danger);
    font-size: 0.9em;
    margin-top: 5px;
}

/* Rarity Info Button - Reusable tooltip button for rarity chances */
.rarity-info-btn {
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-weight: bold;
    cursor: pointer;
    position: relative;
    font-size: 14px;
}
.rarity-info-tooltip {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(20, 20, 30, 0.98);
    border-radius: 8px;
    padding: 12px;
    min-width: 200px;
    z-index: 1000;
    margin-top: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}
.rarity-info-btn:hover .rarity-info-tooltip {
    display: block;
}
.rarity-info-tooltip::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 8px solid transparent;
}
.rarity-info-title {
    font-weight: bold;
    margin-bottom: 8px;
    text-align: center;
    border-bottom: 1px solid var(--p-4a4a6a);
    padding-bottom: 6px;
}
.rarity-info-row {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
    font-size: 0.9em;
}
.rarity-info-row.locked {
    color: var(--p-666666);
}

/* Purple variant (Disciples) */
.rarity-info-btn--purple {
    background: rgba(138, 43, 226, 0.3);
    border: 1px solid var(--p-8a2be2);
    color: var(--p-8a2be2);
}
.rarity-info-btn--purple:hover {
    background: rgba(138, 43, 226, 0.5);
}
.rarity-info-tooltip--purple {
    border: 2px solid var(--p-8a2be2);
}
.rarity-info-tooltip--purple::before {
    border-bottom-color: var(--p-8a2be2);
}
.rarity-info-tooltip--purple .rarity-info-title {
    color: var(--p-8a2be2);
}
/* Left-positioned tooltip (hides default top arrow) */
.rarity-info-tooltip--left::before {
    display: none;
}

/* Orange variant (Treasure Pavilion) */
.rarity-info-btn--orange {
    background: rgba(255, 140, 0, 0.3);
    border: 1px solid var(--p-ff8c00);
    color: var(--p-ff8c00);
}
.rarity-info-btn--orange:hover {
    background: rgba(255, 140, 0, 0.5);
}
.rarity-info-tooltip--orange {
    border: 2px solid var(--p-ff8c00);
}
.rarity-info-tooltip--orange::before {
    border-bottom-color: var(--p-ff8c00);
}
.rarity-info-tooltip--orange .rarity-info-title {
    color: var(--p-ff8c00);
}

/* Green variant (Guardian / safety breakthrough treasures) */
.rarity-info-btn--green {
    background: rgba(74, 222, 128, 0.25);
    border: 1px solid var(--p-4ade80);
    color: var(--p-4ade80);
}
.rarity-info-btn--green:hover {
    background: rgba(74, 222, 128, 0.45);
}
.rarity-info-tooltip--green {
    border: 2px solid var(--p-4ade80);
}
.rarity-info-tooltip--green::before {
    border-bottom-color: var(--p-4ade80);
}
.rarity-info-tooltip--green .rarity-info-title {
    color: var(--p-4ade80);
}

/* Red variant (Trial / challenge breakthrough treasures) */
.rarity-info-btn--red {
    background: rgba(248, 113, 113, 0.25);
    border: 1px solid var(--p-f87171);
    color: var(--p-f87171);
}
.rarity-info-btn--red:hover {
    background: rgba(248, 113, 113, 0.45);
}
.rarity-info-tooltip--red {
    border: 2px solid var(--p-f87171);
}
.rarity-info-tooltip--red::before {
    border-bottom-color: var(--p-f87171);
}
.rarity-info-tooltip--red .rarity-info-title {
    color: var(--p-f87171);
}

/* Slider styles moved to css/sliders.css */

/* Soul Distribution Card */
.soul-dist-card {
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.4), rgba(30, 30, 50, 0.6));
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 12px;
    border: 2px solid;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}
.soul-dist-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}
.soul-dist-card.qi { border-color: var(--ui-teal); }
.soul-dist-card.body { border-color: var(--ui-danger); }
.soul-dist-card.luck { border-color: var(--ui-gold); }
.soul-dist-card.talent { border-color: var(--ui-purple); }
.soul-dist-value {
    font-size: 1.4em;
    font-weight: bold;
    text-shadow: 0 0 15px currentColor;
}
.soul-dist-label {
    font-size: 1.1em;
    font-weight: bold;
    text-shadow: 0 0 8px currentColor;
}

/* ─── Mobile Modal Overrides ─── */
@media (max-width: 768px), (max-height: 500px) and (pointer: coarse) {
    .modal-inner {
        padding: 10px !important;
        max-height: 92vh !important;
        border-radius: 8px !important;
        font-size: 0.82em !important;
    }

    .modal-inner .modal-title {
        font-size: 1.1em !important;
        margin-bottom: 6px !important;
    }

    .modal-inner h3 {
        font-size: 1em !important;
        margin-bottom: 6px !important;
    }

    .modal-inner button {
        padding: 7px 10px !important;
        font-size: inherit !important;
    }

    .modal-inner [style*="gap: 15px"] {
        gap: 8px !important;
    }

    .modal-inner [style*="padding-bottom: 15px"] {
        padding-bottom: 6px !important;
    }

    .modal-inner [style*="min-width: 320px"] {
        min-width: unset !important;
    }

    .confirm-box,
    .refine-box,
    .qi-breakdown-box {
        padding: 14px !important;
        min-width: unset !important;
        max-width: 92vw !important;
        font-size: 0.82em !important;
    }

    .confirm-title,
    .refine-title,
    .qi-breakdown-title {
        font-size: 1.15em !important;
        margin-bottom: 10px !important;
    }

    .confirm-message {
        font-size: inherit !important;
        margin-bottom: 12px !important;
    }

    .confirm-btn,
    .refine-btn {
        padding: 8px 16px !important;
        font-size: inherit !important;
    }
}
