* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --gold-primary: #D4AF37;
    --gold-secondary: #B8941F;
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    
    /* Responsive scaling variables */
    --base-scale: clamp(0.8, 1vw + 1vh, 1.2);
    --chip-size: clamp(50px, 4.5vw + 4.5vh, 70px);
    --chip-size-top: clamp(55px, 5vw + 5vh, 70px);
    --slot-size: clamp(50px, 4.5vw + 4.5vh, 70px);
    --slot-size-top: clamp(55px, 5vw + 5vh, 70px);
    --pyramid-max-width: clamp(500px, 60vw, 750px);
    --pyramid-min-height: clamp(350px, 45vh, 450px);
    --title-size: clamp(2rem, 5vw + 3vh, 4rem);
    --text-size-base: clamp(0.85rem, 1.2vw + 1.2vh, 1rem);
    --text-size-small: clamp(0.7rem, 1vw + 1vh, 0.9rem);
    --text-size-large: clamp(1.2rem, 2vw + 2vh, 1.5rem);
    --gap-base: clamp(12px, 1.5vw + 1.5vh, 24px);
    --padding-base: clamp(12px, 1.5vw + 1.5vh, 24px);
    --border-width: clamp(2px, 0.3vw, 3px);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    background: #000000;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, 
        #8b0000 0%, 
        #660000 25%, 
        #000000 50%, 
        #330000 75%, 
        #8b0000 100%);
    background-size: 400% 400%;
    animation: backgroundGradientMove 15s ease infinite;
    z-index: -1;
    pointer-events: none;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

@keyframes backgroundGradientMove {
    0% {
        background-position: 0% 0%;
    }
    25% {
        background-position: 100% 0%;
    }
    50% {
        background-position: 100% 100%;
    }
    75% {
        background-position: 0% 100%;
    }
    100% {
        background-position: 0% 0%;
    }
}

@keyframes float {
    0%, 100% { transform: translateY(0px) translateX(0px) rotate(0deg); }
    33% { transform: translateY(-30px) translateX(20px) rotate(5deg); }
    66% { transform: translateY(20px) translateX(-15px) rotate(-5deg); }
}

@keyframes glow {
    0% { box-shadow: 0 0 20px rgba(212, 175, 55, 0.5); }
    100% { box-shadow: 0 0 40px rgba(212, 175, 55, 0.8); }
}

@keyframes shine {
    0% { background-position: -200% center; }
    100% { background-position: 200% center; }
}

@keyframes sparkleUp {
    0% {
        transform: translateY(0) translateX(0) scale(0);
        opacity: 0;
    }
    5% {
        opacity: 1;
        transform: translateY(-10px) translateX(0) scale(0.8);
    }
    50% {
        transform: translateY(calc(-50vh - 50px)) translateX(var(--sparkle-x, 0)) scale(1);
        opacity: 1;
    }
    95% {
        opacity: 1;
    }
    100% {
        transform: translateY(calc(-100vh - 100px)) translateX(var(--sparkle-x, 0)) scale(0.5);
        opacity: 0;
    }
}

.sparkle {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 1;
    box-shadow: 0 0 6px currentColor, 0 0 12px currentColor, 0 0 18px currentColor;
    filter: blur(0.5px);
}

/* Glass Background Triangles */
.glass-background {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.glass-background::before,
.glass-background::after {
    content: '';
    position: absolute;
    width: 120px;
    height: 120px;
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(212, 175, 55, 0.3);
}

.glass-background::before {
    top: 10%;
    left: 10%;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.5), rgba(212, 175, 55, 0.3));
    animation: float 20s ease-in-out infinite;
}

.glass-background::after {
    top: 20%;
    right: 20%;
    background: linear-gradient(135deg, rgba(192, 192, 192, 0.5), rgba(169, 169, 169, 0.3));
    animation: float 18s ease-in-out infinite 2s;
}

/* Additional triangles via JavaScript will be added */

/* Glass Morphism */
.glass-panel {
    background: rgba(212, 175, 55, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 215, 0, 0.4);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.6),
                0 0 40px rgba(255, 215, 0, 0.2),
                inset 0 0 20px rgba(192, 192, 192, 0.1);
    border-radius: 24px;
    padding: 24px;
}

/* Pyramid triangle container styles are above */

/* Screen Management */
.screen {
    display: none;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

.screen.active {
    display: block !important;
}

/* Login Screen */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-panel {
    width: 100%;
    max-width: min(400px, 90vw);
    text-align: center;
}

.login-panel h2 {
    font-size: clamp(1.5rem, 4vw + 2vh, 2rem);
    background: linear-gradient(135deg, #ff0000 0%, #cc0000 25%, #990000 50%, #cc0000 75%, #ff0000 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 10px rgba(255, 0, 0, 0.5);
    background-size: 200% 200%;
    animation: gradientShift 3s ease infinite;
    margin-bottom: 8px;
}

.login-panel p {
    background: linear-gradient(135deg, #ff0000 0%, #cc0000 25%, #990000 50%, #cc0000 75%, #ff0000 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 10px rgba(255, 0, 0, 0.5);
    background-size: 200% 200%;
    animation: gradientShift 3s ease infinite;
    margin-bottom: var(--gap-base);
    font-size: var(--text-size-small);
}

/* Forms */
.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    background: linear-gradient(135deg, #ff0000 0%, #cc0000 25%, #990000 50%, #cc0000 75%, #ff0000 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 10px rgba(255, 0, 0, 0.5);
    background-size: 200% 200%;
    animation: gradientShift 3s ease infinite;
    margin-bottom: clamp(6px, 0.8vw, 8px);
    font-size: var(--text-size-small);
    font-weight: 500;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: clamp(10px, 1.2vw, 12px) clamp(12px, 1.5vw, 16px);
    border-radius: clamp(10px, 1.2vw, 12px);
    background: rgba(255, 255, 255, 0.1);
    border: clamp(0.8px, 0.1vw, 1px) solid rgba(255, 255, 255, 0.2);
    color: white;
    font-size: var(--text-size-base);
    transition: all 0.3s ease;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--gold-primary);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.2);
}

/* Buttons */
.btn-primary {
    width: 100%;
    padding: 12px 24px;
    border-radius: 12px;
    background: linear-gradient(to right, var(--gold-primary), var(--gold-secondary));
    color: transparent;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: var(--text-size-base);
    position: relative;
    overflow: hidden;
}

.btn-primary::after {
    content: attr(data-text);
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #ff0000 0%, #cc0000 25%, #990000 50%, #cc0000 75%, #ff0000 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 10px rgba(255, 0, 0, 0.5);
    background-size: 200% 200%;
    animation: gradientShift 3s ease infinite;
    font-weight: 600;
    font-size: var(--text-size-base);
    pointer-events: none;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(212, 175, 55, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 8px;
    background: rgba(212, 175, 55, 0.2);
    border: 1px solid rgba(212, 175, 55, 0.5);
    color: transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.btn-secondary::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 8px;
    background: rgba(212, 175, 55, 0.2);
    border: 1px solid rgba(212, 175, 55, 0.5);
    z-index: -1;
}

.btn-secondary::after {
    content: attr(data-text);
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #ff0000 0%, #cc0000 25%, #990000 50%, #cc0000 75%, #ff0000 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 10px rgba(255, 0, 0, 0.5);
    background-size: 200% 200%;
    animation: gradientShift 3s ease infinite;
    pointer-events: none;
}

.btn-secondary:hover::before {
    background: rgba(212, 175, 55, 0.3);
}

.btn-glass {
    padding: 8px 16px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-glass::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    z-index: -1;
}

.btn-glass::after {
    content: attr(data-text);
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 25%, #d4af37 50%, #ffed4e 75%, #ffd700 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 10px rgba(255, 215, 0, 0.5);
    background-size: 200% 200%;
    animation: gradientShift 3s ease infinite;
    pointer-events: none;
}

.btn-glass:hover {
    background: rgba(255, 255, 255, 0.15);
}

.link-button {
    background: none;
    border: none;
    background: linear-gradient(135deg, #ff0000 0%, #cc0000 25%, #990000 50%, #cc0000 75%, #ff0000 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 10px rgba(255, 0, 0, 0.5);
    background-size: 200% 200%;
    animation: gradientShift 3s ease infinite;
    cursor: pointer;
    margin-top: 16px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.link-button:hover {
    color: white;
}

.error-message {
    padding: 12px;
    border-radius: 8px;
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.5);
    color: #fecaca;
    margin-bottom: 16px;
    font-size: 0.9rem;
    display: none;
}

.error-message.show {
    display: block;
}

/* App Screen */
.app-container {
    max-width: min(1400px, 95vw);
    margin: 0 auto;
    padding: var(--padding-base);
}

.app-header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: var(--gap-base);
    position: relative;
    padding: 0 var(--padding-base);
}

/* Red gradient text effect */
.red-gradient-text {
    background: linear-gradient(135deg, #ff0000 0%, #cc0000 25%, #990000 50%, #cc0000 75%, #ff0000 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 10px rgba(255, 0, 0, 0.5);
    background-size: 200% 200%;
    animation: gradientShift 3s ease infinite;
}

.app-header h1 {
    font-size: var(--title-size);
    background: linear-gradient(135deg, #ff0000 0%, #cc0000 25%, #990000 50%, #cc0000 75%, #ff0000 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 10px rgba(255, 0, 0, 0.5);
    background-size: 200% 200%;
    animation: gradientShift 3s ease infinite;
    text-align: center;
    margin: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: clamp(8px, 1vw, 12px);
    position: absolute;
    right: 0;
    flex-wrap: wrap;
}

.user-info {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 25%, #d4af37 50%, #ffed4e 75%, #ffd700 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 10px rgba(255, 215, 0, 0.5);
    background-size: 200% 200%;
    animation: gradientShift 3s ease infinite;
    font-size: var(--text-size-small);
    padding: clamp(6px, 0.8vw, 8px) clamp(8px, 1.2vw, 12px);
    border-radius: clamp(6px, 0.8vw, 8px);
    position: relative;
}

.user-info::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    z-index: -1;
}

#resetPyramidBtn {
    font-size: var(--text-size-small);
    padding: clamp(6px, 0.8vw, 8px) clamp(10px, 1.5vw, 16px);
}

.app-layout {
    display: flex;
    flex-direction: column;
    gap: var(--gap-base);
}

.main-content {
    display: grid;
    grid-template-columns: 1fr clamp(280px, 25vw, 350px);
    gap: var(--gap-base);
    align-items: start;
}

@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .header-right {
        position: static;
        justify-content: center;
        margin-top: clamp(12px, 1.5vw, 16px);
    }
    
    .app-header {
        flex-direction: column;
    }
}

@media (max-width: 768px) {
    .pyramid-triangle-container {
        max-width: 95vw;
    }
    
    .chip-list {
        grid-template-columns: repeat(auto-fit, minmax(clamp(50px, 12vw, 70px), 1fr));
    }
    
    .app-container {
        padding: clamp(8px, 1vw, 12px);
    }
}

@media (max-width: 480px) {
    :root {
        --chip-size: clamp(40px, 10vw, 60px);
        --chip-size-top: clamp(45px, 11vw, 65px);
        --slot-size: clamp(40px, 10vw, 60px);
        --slot-size-top: clamp(45px, 11vw, 65px);
        --pyramid-max-width: 95vw;
        --title-size: clamp(1.5rem, 8vw, 2.5rem);
    }
    
    .pyramid-level {
        gap: clamp(4px, 1vw, 8px);
    }
}

.chips-section {
    display: flex;
    flex-direction: column;
    gap: var(--gap-base);
}

/* Pyramid */
.pyramid-section {
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
    min-height: clamp(400px, 50vh, 500px);
    overflow: visible; /* Allow chips to extend beyond triangle */
}

.pyramid-triangle-container {
    position: relative;
    width: 100%;
    max-width: var(--pyramid-max-width);
    min-height: var(--pyramid-min-height);
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
    background: linear-gradient(135deg, 
        rgba(212, 175, 55, 0.6) 0%, 
        rgba(255, 215, 0, 0.55) 25%,
        rgba(192, 192, 192, 0.4) 50%,
        rgba(255, 215, 0, 0.55) 75%,
        rgba(212, 175, 55, 0.6) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: var(--border-width) solid rgba(255, 215, 0, 0.8);
    box-shadow: 
        0 8px 32px 0 rgba(0, 0, 0, 0.8),
        0 8px 32px 0 rgba(212, 175, 55, 0.6),
        inset 0 0 60px rgba(255, 215, 0, 0.3),
        0 0 120px rgba(255, 215, 0, 0.5),
        0 0 60px rgba(192, 192, 192, 0.3);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: clamp(10px, 1.5vw, 15px) clamp(15px, 2vw, 20px) clamp(20px, 3vw, 30px) clamp(15px, 2vw, 20px);
    overflow: hidden; /* Hide content that extends beyond triangle */
    transition: transform 0.3s ease-out, 
                box-shadow 0.3s ease-out;
}

.pyramid-triangle-container:hover {
    box-shadow: 
        0 12px 48px 0 rgba(0, 0, 0, 0.9),
        0 12px 48px 0 rgba(212, 175, 55, 0.7),
        inset 0 0 60px rgba(255, 215, 0, 0.4),
        0 0 150px rgba(255, 215, 0, 0.6),
        0 0 80px rgba(192, 192, 192, 0.4);
}

/* Shine effect for pyramid */
.pyramid-triangle-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 215, 0, 0.5), 
        rgba(192, 192, 192, 0.4),
        rgba(255, 215, 0, 0.5),
        transparent);
    animation: shine 3s ease-in-out infinite;
    pointer-events: none;
}

@keyframes shine {
    0% { left: -100%; }
    50%, 100% { left: 100%; }
}

.pyramid-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    width: 100%;
    padding-top: 15px;
    padding-bottom: 5px;
    position: relative;
    z-index: 1;
}

.pyramid-level {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: clamp(8px, 1.2vw, 12px);
    padding: clamp(4px, 0.6vw, 6px) 0 clamp(6px, 0.8vw, 8px) 0;
    position: relative;
    width: 100%;
    flex-shrink: 0;
    min-height: clamp(60px, 8vh, 80px);
}

/* Divider lines between levels */
.pyramid-level::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 10%;
    right: 10%;
    height: 1px;
    background: linear-gradient(to right, 
        transparent, 
        rgba(255, 215, 0, 0.5), 
        rgba(192, 192, 192, 0.6),
        rgba(255, 215, 0, 0.5),
        transparent);
    pointer-events: none;
}

.pyramid-level:last-child::after {
    display: none; /* No line after last level */
}

.pyramid-slot {
    position: relative;
    min-width: var(--slot-size);
    min-height: var(--slot-size);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible; /* Allow chips and labels to extend */
    z-index: 2;
    padding-bottom: clamp(15px, 2vh, 20px);
    transition: transform 0.2s ease-out;
}

.pyramid-slot.top-level {
    min-width: var(--slot-size-top);
    min-height: var(--slot-size-top);
    margin-top: clamp(10px, 1.5vh, 15px);
}

.poker-chip {
    width: var(--chip-size);
    height: var(--chip-size);
    border-radius: 50%;
    background: linear-gradient(135deg, 
        rgba(255, 215, 0, 0.4) 0%,
        rgba(255, 255, 255, 0.3) 20%,
        rgba(212, 175, 55, 0.5) 40%,
        rgba(192, 192, 192, 0.4) 50%,
        rgba(212, 175, 55, 0.5) 60%,
        rgba(255, 255, 255, 0.3) 80%,
        rgba(255, 215, 0, 0.4) 100%);
    border: var(--border-width) solid rgba(255, 215, 0, 0.7);
    overflow: hidden;
    cursor: grab;
    transition: all 0.3s ease;
    position: relative;
    box-shadow: 
        0 8px 16px rgba(0, 0, 0, 0.6),
        inset 0 2px 4px rgba(255, 255, 255, 0.5),
        inset 0 -2px 4px rgba(0, 0, 0, 0.4),
        0 0 30px rgba(255, 215, 0, 0.5),
        0 0 15px rgba(192, 192, 192, 0.3);
    transform-style: preserve-3d;
}

.poker-chip::before {
    content: '';
    position: absolute;
    top: 10%;
    left: 10%;
    width: 30%;
    height: 30%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.6) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 2;
}

.poker-chip.top-level {
    width: var(--chip-size-top);
    height: var(--chip-size-top);
    border-width: var(--border-width);
    animation: glow 2s ease-in-out infinite alternate;
    box-shadow: 
        0 10px 20px rgba(0, 0, 0, 0.4),
        inset 0 2px 4px rgba(255, 255, 255, 0.4),
        inset 0 -2px 4px rgba(0, 0, 0, 0.3),
        0 0 30px rgba(212, 175, 55, 0.5);
}

.poker-chip:hover {
    transform: scale(1.15) translateY(-5px);
    z-index: 50;
    box-shadow: 
        0 12px 24px rgba(0, 0, 0, 0.4),
        inset 0 2px 4px rgba(255, 255, 255, 0.4),
        inset 0 -2px 4px rgba(0, 0, 0, 0.3),
        0 0 30px rgba(212, 175, 55, 0.6);
}

.poker-chip:active {
    cursor: grabbing;
    transform: scale(1.05) translateY(-2px);
}

.poker-chip.dragging {
    opacity: 0.7;
    z-index: 100;
    transform: scale(1.1) rotate(5deg);
}

.poker-chip.deleting {
    animation: deleteChip 0.3s ease-out forwards;
    pointer-events: none;
    z-index: 100;
}

@keyframes deleteChip {
    0% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
    50% {
        opacity: 0.5;
        transform: scale(0.8) rotate(180deg);
    }
    100% {
        opacity: 0;
        transform: scale(0.3) rotate(360deg);
    }
}

.poker-chip img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    position: relative;
    z-index: 1;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.poker-chip .chip-initial {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(to bottom right, 
        rgba(212, 175, 55, 0.4), 
        rgba(184, 148, 31, 0.3),
        rgba(212, 175, 55, 0.4));
    color: #ffd700;
    font-weight: bold;
    font-size: clamp(1rem, 1.3vw + 1.3vh, 1.3rem);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 1;
}

.poker-chip .chip-rings {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    pointer-events: none;
    z-index: 2;
}

.poker-chip .chip-rings::after {
    content: '';
    position: absolute;
    inset: 6px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.poker-chip .chip-rings::before {
    content: '';
    position: absolute;
    inset: 12px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.poker-chip .king-crown {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    background: var(--gold-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    z-index: 10;
}

.empty-slot {
    width: var(--slot-size);
    height: var(--slot-size);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: clamp(1.5px, 0.2vw, 2px) dashed rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.empty-slot.top-level {
    width: var(--slot-size-top);
    height: var(--slot-size-top);
}

.pyramid-slot.drag-over {
    transform: scale(1.1);
    transition: transform 0.2s ease-out;
}

.pyramid-slot.drag-over::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 4px dashed var(--gold-primary);
    animation: pulse 1s ease-in-out infinite;
    transition: opacity 0.2s ease-out;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.chip-label {
    position: absolute;
    bottom: clamp(-18px, -2vh, -20px);
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    font-size: clamp(0.6rem, 0.7vw + 0.7vh, 0.7rem);
    color: #000000;
    background: rgba(255, 255, 255, 0.8);
    padding: clamp(2px, 0.2vw, 2px) clamp(4px, 0.6vw, 6px);
    border-radius: clamp(3px, 0.4vw, 4px);
    font-weight: 500;
    z-index: 10;
    pointer-events: none;
    max-width: clamp(60px, 8vw, 80px);
    overflow: hidden;
    text-overflow: ellipsis;
}

.chip-name-button {
    position: absolute;
    bottom: clamp(-16px, -1.8vh, -18px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: clamp(0.8px, 0.1vw, 1px) solid rgba(255, 255, 255, 0.5);
    border-radius: clamp(6px, 0.8vw, 8px);
    padding: clamp(2px, 0.2vw, 2px) clamp(4px, 0.6vw, 6px);
    font-size: clamp(0.5rem, 0.6vw + 0.6vh, 0.6rem);
    color: #000000;
    font-weight: 500;
    cursor: default;
    white-space: nowrap;
    max-width: clamp(65px, 8.5vw, 85px);
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.2),
        inset 0 1px 1px rgba(255, 255, 255, 0.2);
    transition: all 0.2s ease;
    z-index: 5;
    pointer-events: none;
}

.chip-name-button:hover {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(255, 255, 255, 0.6);
}

/* Settings */
.settings-section-bottom {
    margin-top: 24px;
    width: 100%;
}

.settings-panel h2 {
    background: linear-gradient(135deg, #ff0000 0%, #cc0000 25%, #990000 50%, #cc0000 75%, #ff0000 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 10px rgba(255, 0, 0, 0.5);
    background-size: 200% 200%;
    animation: gradientShift 3s ease infinite;
    margin-bottom: var(--gap-base);
    font-size: var(--text-size-large);
}

.setting-group {
    margin-bottom: 24px;
}

.setting-group label {
    display: block;
    background: linear-gradient(135deg, #ff0000 0%, #cc0000 25%, #990000 50%, #cc0000 75%, #ff0000 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 10px rgba(255, 0, 0, 0.5);
    background-size: 200% 200%;
    animation: gradientShift 3s ease infinite;
    margin-bottom: 12px;
    font-weight: 500;
}

.setting-group input[type="range"] {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}

.setting-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: var(--gold-primary);
    border-radius: 50%;
    cursor: pointer;
}

.setting-group input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--gold-primary);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.chips-per-level {
    max-height: 200px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chip-level-input {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chip-level-input span {
    background: linear-gradient(135deg, #ff0000 0%, #cc0000 25%, #990000 50%, #cc0000 75%, #ff0000 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 10px rgba(255, 0, 0, 0.5);
    background-size: 200% 200%;
    animation: gradientShift 3s ease infinite;
    font-size: 0.9rem;
    min-width: 80px;
}

.chip-level-input input {
    flex: 1;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
}

.chip-level-input input:focus {
    outline: none;
    border-color: var(--gold-primary);
}

.text-hint {
    font-size: 0.75rem;
    background: linear-gradient(135deg, #ff0000 0%, #cc0000 25%, #990000 50%, #cc0000 75%, #ff0000 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 10px rgba(255, 0, 0, 0.5);
    background-size: 200% 200%;
    animation: gradientShift 3s ease infinite;
    margin-top: 8px;
}

/* Chip Management */
.chips-section {
    position: sticky;
    top: 24px;
    align-self: start;
}

.chip-management {
    background: rgba(192, 192, 192, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: clamp(0.8px, 0.1vw, 1px) solid rgba(192, 192, 192, 0.4);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.6),
                0 0 40px rgba(192, 192, 192, 0.2),
                inset 0 0 20px rgba(192, 192, 192, 0.1);
    border-radius: clamp(18px, 2.4vw, 24px);
    padding: var(--padding-base);
    transition: transform 0.3s ease-out, 
                box-shadow 0.3s ease-out;
    position: relative;
    min-width: clamp(200px, 20vw, 280px);
    max-width: clamp(400px, 50vw, 600px);
    min-height: clamp(300px, 40vh, 500px);
    max-height: clamp(500px, 80vh, 900px);
    resize: none;
    overflow: hidden;
}

.chip-management-resize-handle {
    position: absolute;
    width: clamp(16px, 2vw, 20px);
    height: clamp(16px, 2vw, 20px);
    background: rgba(192, 192, 192, 0.6);
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    cursor: nwse-resize;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4),
                inset 0 1px 2px rgba(255, 255, 255, 0.5);
    transition: all 0.2s ease;
    pointer-events: all;
}

.chip-management-resize-handle:hover {
    background: rgba(192, 192, 192, 0.9);
    transform: scale(1.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6),
                inset 0 1px 2px rgba(255, 255, 255, 0.7),
                0 0 15px rgba(192, 192, 192, 0.5);
}

.chip-management-resize-handle:active {
    transform: scale(1.1);
}

.chip-management-resize-handle.left {
    bottom: clamp(8px, 1vh, 12px);
    left: clamp(8px, 1vw, 12px);
    cursor: nesw-resize;
}

.chip-management-resize-handle.right {
    bottom: clamp(8px, 1vh, 12px);
    right: clamp(8px, 1vw, 12px);
    cursor: nwse-resize;
}

.chip-management-resize-handle::before {
    display: none;
}

.chip-management-resize-handle::after {
    display: none;
}

.chip-management:hover {
    box-shadow: 0 12px 48px 0 rgba(0, 0, 0, 0.8),
                0 0 50px rgba(192, 192, 192, 0.3),
                inset 0 0 30px rgba(192, 192, 192, 0.2);
}

.chip-management h3 {
    background: linear-gradient(135deg, #ff0000 0%, #cc0000 25%, #990000 50%, #cc0000 75%, #ff0000 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 10px rgba(255, 0, 0, 0.5);
    background-size: 200% 200%;
    animation: gradientShift 3s ease infinite;
    margin-bottom: clamp(12px, 1.6vw, 16px);
    font-size: clamp(1rem, 1.2vw + 1.2vh, 1.2rem);
}

.add-chip-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.add-chip-form input {
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
}

.file-upload-label {
    cursor: pointer;
}

.chip-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(clamp(60px, 8vw, 80px), 1fr));
    gap: clamp(12px, 1.6vw, 16px);
    max-height: clamp(400px, 50vh, 500px);
    overflow-y: auto;
    padding: clamp(6px, 0.8vw, 8px);
}

.chip-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 50%;
    overflow: visible;
    cursor: grab;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chip-item:hover {
    transform: scale(1.1) translateY(-3px);
}

.chip-item:active {
    cursor: grabbing;
    transform: scale(1.05);
}

.chip-item .chip-preview {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.25) 0%,
        rgba(255, 255, 255, 0.15) 30%,
        rgba(212, 175, 55, 0.2) 50%,
        rgba(184, 148, 31, 0.15) 70%,
        rgba(255, 255, 255, 0.1) 100%);
    border: var(--border-width) solid rgba(255, 255, 255, 0.4);
    box-shadow: 
        0 6px 12px rgba(0, 0, 0, 0.3),
        inset 0 2px 4px rgba(255, 255, 255, 0.3),
        inset 0 -2px 4px rgba(0, 0, 0, 0.2),
        0 0 15px rgba(212, 175, 55, 0.3);
    position: relative;
    overflow: hidden;
    transform-style: preserve-3d;
}

.chip-item .chip-preview::before {
    content: '';
    position: absolute;
    top: 15%;
    left: 15%;
    width: 25%;
    height: 25%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.6) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 2;
}

.chip-item .chip-preview .chip-rings {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    pointer-events: none;
    z-index: 2;
}

.chip-item .chip-preview .chip-rings::after {
    content: '';
    position: absolute;
    inset: 6px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.chip-item .chip-preview .chip-rings::before {
    content: '';
    position: absolute;
    inset: 12px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.chip-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
    -moz-user-select: none;
    -ms-user-select: none;
    position: relative;
    z-index: 1;
}

.chip-item .chip-initial-bg {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(to bottom right, 
        rgba(212, 175, 55, 0.4), 
        rgba(184, 148, 31, 0.3),
        rgba(212, 175, 55, 0.4));
    color: #ffd700;
    font-weight: bold;
    font-size: 1.1rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 1;
}

.chip-item.selected .chip-preview {
    border-color: var(--gold-primary);
    box-shadow: 
        0 8px 16px rgba(0, 0, 0, 0.4),
        inset 0 2px 4px rgba(255, 255, 255, 0.4),
        inset 0 -2px 4px rgba(0, 0, 0, 0.3),
        0 0 25px rgba(212, 175, 55, 0.6);
}

.chip-item .delete-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    background: rgba(239, 68, 68, 0.8);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    line-height: 1;
}

.chip-item:hover .delete-btn {
    display: flex;
}

.chip-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.chip-item .chip-name-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    padding: 4px 6px;
    font-size: 0.7rem;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    box-sizing: border-box;
}

.chip-item .chip-name-input:focus {
    outline: 2px solid var(--gold-primary);
    outline-offset: 2px;
    background: rgba(0, 0, 0, 0.7);
}

/* Color Picker */
.color-picker-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.color-input {
    display: flex;
    align-items: center;
    gap: 12px;
}

.color-input label {
    background: linear-gradient(135deg, #ff0000 0%, #cc0000 25%, #990000 50%, #cc0000 75%, #ff0000 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 10px rgba(255, 0, 0, 0.5);
    background-size: 200% 200%;
    animation: gradientShift 3s ease infinite;
    font-size: 0.9rem;
    min-width: 150px;
}

.color-input input[type="color"] {
    width: 60px;
    height: 40px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    cursor: pointer;
    background: none;
    padding: 0;
}

.color-input input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-input input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 6px;
}

/* Side Text Display */
.side-text-display {
    margin-top: 24px;
}

.side-text-display h3 {
    background: linear-gradient(135deg, #ff0000 0%, #cc0000 25%, #990000 50%, #cc0000 75%, #ff0000 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 10px rgba(255, 0, 0, 0.5);
    background-size: 200% 200%;
    animation: gradientShift 3s ease infinite;
    margin-bottom: 12px;
}

.side-text-content {
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.6;
    white-space: pre-wrap;
}

.side-text-content strong {
    font-weight: bold;
    color: white;
}

.side-text-content em {
    font-style: italic;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: rgba(212, 175, 55, 0.5);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(212, 175, 55, 0.7);
}

/* Chip Image Edit Button */
.chip-image-edit-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(212, 175, 55, 0.9);
    border: 2px solid rgba(255, 255, 255, 0.5);
    color: white;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.chip-image-edit-btn:hover {
    background: rgba(212, 175, 55, 1);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* Image Edit Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h3 {
    background: linear-gradient(135deg, #ff0000 0%, #cc0000 25%, #990000 50%, #cc0000 75%, #ff0000 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 10px rgba(255, 0, 0, 0.5);
    background-size: 200% 200%;
    animation: gradientShift 3s ease infinite;
    margin: 0;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.drop-zone {
    min-height: 300px;
    border: 2px dashed rgba(255, 255, 255, 0.3);
    border-radius: 16px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
}

.drop-zone:hover {
    border-color: rgba(212, 175, 55, 0.6);
    background: rgba(255, 255, 255, 0.08);
}

.drop-zone.drag-over {
    border-color: var(--gold-primary);
    background: rgba(212, 175, 55, 0.1);
    transform: scale(1.02);
}

.drop-zone.has-image {
    padding: 10px;
    min-height: auto;
}

.drop-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.drop-icon {
    font-size: 48px;
    opacity: 0.7;
}

.drop-zone-content p {
    color: rgba(255, 255, 255, 0.8);
    margin: 0;
}

.drop-hint {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6) !important;
}

.preview-image {
    width: 100%;
    max-width: 400px;
    height: auto;
    border-radius: 50%;
    object-fit: cover;
    aspect-ratio: 1;
    border: 3px solid rgba(212, 175, 55, 0.5);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal-actions button {
    padding: 10px 20px;
}

#removeImageBtn::after {
    background: none !important;
    -webkit-background-clip: unset !important;
    -webkit-text-fill-color: #ffffff !important;
    background-clip: unset !important;
    text-shadow: 0 2px 10px rgba(255, 255, 255, 0.5) !important;
    color: #ffffff !important;
}

/* Sound Upload Settings */
.sound-upload-group {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sound-upload-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sound-upload-item label {
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.sound-upload-item input[type="file"] {
    padding: 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 0.85rem;
    cursor: pointer;
}

.sound-upload-item input[type="file"]:hover {
    background: rgba(255, 255, 255, 0.15);
}

.sound-upload-item input[type="file"]::file-selector-button {
    padding: 6px 12px;
    border-radius: 6px;
    background: rgba(212, 175, 55, 0.3);
    border: 1px solid rgba(212, 175, 55, 0.5);
    color: white;
    cursor: pointer;
    margin-right: 8px;
    font-size: 0.85rem;
}

.sound-upload-item input[type="file"]::file-selector-button:hover {
    background: rgba(212, 175, 55, 0.4);
}

.sound-status {
    font-size: 0.8rem;
    margin-top: 4px;
}

.sound-remove-btn {
    margin-top: 4px;
    padding: 6px 12px;
    font-size: 0.85rem;
}

