:root {
    --cell-size: 50px;
    --viewport-width: 500px;
    --viewport-height: 90px;
}

html, body {
    background-color: transparent;
    color: white;
    font-family: "Microsoft YaHei", sans-serif;
    margin: 0;
    padding: 20px;
    overflow: hidden;
    pointer-events: none; 
}

#party-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#top-bar {
    display: flex;
    justify-content: flex-end;
    align-items: stretch;
    width: 100%;
    margin-bottom: 8px;
    pointer-events: none;
    box-sizing: border-box;
    min-height: 24px;
}

#party-controls {
    display: flex;
    gap: 8px;
    padding: 8px;
    background-color: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    flex-wrap: nowrap;
    align-items: center;
    pointer-events: auto;
    overflow-x: auto;
    overflow-y: hidden;
    box-sizing: border-box;
    
    flex-grow: 1; 
    max-width: 100%; 
    transition: max-width 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), 
                padding 0.4s, opacity 0.3s, border-color 0.4s;
}

#party-controls.collapsed {
    max-width: 0;
    padding-left: 0;
    padding-right: 0;
    opacity: 0;
    border-color: transparent;
}

#party-controls::-webkit-scrollbar {
    display: none; 
}

#toggle-bar-btn {
    pointer-events: auto;
    flex-shrink: 0;

    height: auto;
    width: auto;
    min-width: 32px;
    flex: 0 0 auto;

    box-sizing: border-box;
    margin-left: 8px;
    background-color: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: white;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 14px;
    user-select: none;
    overflow: hidden
}

#toggle-bar-btn img {
    width: 24px;
    height: 24px;
    object-fit: contain;
    display: block;
    pointer-events: none;
    opacity: 0.8;
}

#toggle-bar-btn:hover {
    background-color: rgba(102, 204, 255, 0.5);
    border-color: rgba(100, 150, 200, 1);
}

#toggle-bar-btn.collapsed {
    transform: rotate(180deg);
}

.welcome-message {
    color: #fff;
    font-size: 14px;
    font-family: sans-serif;
    padding: 5px 10px;
    opacity: 0.8;
    text-align: center;
    width: 100%;
    font-style: italic;
    animation: fadeIn 0.5s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 0.8; }
}

.member-toggle {
    padding: 4px 12px;
    background-color: rgba(100, 150, 200, 0.5);
    border: 1px solid rgba(100, 150, 200, 0.8);
    border-radius: 4px;
    color: white;
    cursor: pointer;
    font-size: 12px;
    font-family: "Microsoft YaHei", sans-serif;
    transition: all 0.2s ease;
    white-space: nowrap;
    user-select: none;
    flex-shrink: 0; 
}

.member-toggle:hover {
    background-color: rgba(100, 150, 200, 0.7);
    border-color: rgb(171, 186, 200);
}

.member-toggle.active {
    background-color: rgba(102, 204, 255, 0.7);
    border-color: rgb(126, 212, 255);
}

.member-toggle.inactive {
    background-color: rgba(100, 100, 100, 0.5);
    border-color: rgba(100, 100, 100, 0.8);
    opacity: 0.6;
}

.party-member-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
}

.player-name-label {
    font-size: 16px;
    color: #aaa;
    min-width: 100px;
    text-shadow: 1px 1px 2px black;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cast-viewport {
    width: auto; 
    min-width: 0;
    flex: 1;
    border: 2px solid rgba(255, 255, 255, 0.2);
    background-color: rgba(0, 0, 0, 0.6);
    border-radius: 4px;
    height: var(--viewport-height);
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
    flex-shrink: 0;
}



.skill-item {
    position: absolute;
    width: var(--cell-size);
    height: var(--cell-size);
    top: 50%;
    margin-top: calc(var(--cell-size) / -2);
    
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    will-change: transform;
    
    overflow: visible;

    animation: popInNormal 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.skill-icon {
    width: var(--cell-size);
    height: var(--cell-size);
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    background-size: cover;
    background-position: center;
    position: relative;
    z-index: 5;
}

.skill-name {
    position: absolute;
    top: 100%;
    left: 50%;
    width: 200px; 
    margin-left: -100px;
    color: white;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    text-align: center;
    white-space: nowrap;
    overflow: visible;
    pointer-events: none; 
    line-height: 1.2;
    margin-top: 2px;
    z-index: 15;
    transform-origin: top center; 
}

.cast-bar {
    position: absolute;
    height: var(--cell-size);
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    
    background: linear-gradient(90deg, rgba(100, 200, 255, 0.6), rgba(100, 150, 255, 0.0));
    border: 1px solid rgba(150, 220, 255, 0.7);
    border-radius: 8px 8px 8px 8px;
    pointer-events: none;
    z-index: 10;
    
    transform-origin: left center;
}

.skill-item.ogcd .skill-icon {
    transform: scale(0.75);
    border-color: rgba(255, 200, 100, 0.5);
}

.skill-item.casting .skill-icon {
    opacity: 0.6;
}

@keyframes popInNormal {
    from { opacity: 0; transform: scale(0.8); }
    to   { opacity: 1; transform: scale(1); }
}