* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    background-color: #0a0a0a;
    color: white;
    font-family: sans-serif;
    overflow: hidden;
}

/* Canvas Container - Fullscreen */
#canvas-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

#place-canvas {
    display: block;
    width: 100vw;
    height: 100vh;
}

/* Button Container - unten mittig im Canvas */
.button-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 1000;
}

/* Button Style */
.button {
    background-color: rgba(1, 105, 255, 0.9);
    color: white;
    border-radius: 50px;
    border: 2px solid rgba(167, 167, 167, 0.5);
    padding: 10px 20px;
    cursor: pointer;
    transition: 0.3s all;
    backdrop-filter: blur(5px);
}
.button:hover {
    background-color: rgba(0, 100, 200, 0.9);
}
.button:active {
    transform: scale(0.95);
}

.button-danger { background-color: rgba(255, 0, 0, 0.9); }
.button-danger:hover { background-color: rgba(179, 0, 0, 0.9); }

.button-success { background-color: rgba(0, 200, 0, 0.9); }
.button-success:hover { background-color: rgba(0, 150, 0, 0.9); }

.button-paint { 
    background: linear-gradient(135deg, rgba(88, 100, 242, 0.9), rgba(76, 89, 225, 0.9));
    font-size: 18px;
    font-weight: bold;
    padding: 12px 30px;
    min-width: 250px;
}
.button-paint:hover { 
    background: linear-gradient(135deg, rgba(76, 89, 225, 0.9), rgba(64, 77, 213, 0.9));
    transform: scale(1.05);
}

.button-warning { background-color: rgba(255, 165, 0, 0.9); }
.button-warning:hover { background-color: rgba(255, 140, 0, 0.9); }

.button-discord { background-color: rgba(88, 100, 242, 0.9); }
.button-discord:hover { background-color: rgba(76, 89, 225, 0.8); }

.button.active {
    background-color: rgba(0, 255, 0, 0.9);
    border: 2px solid rgba(0, 255, 0, 1);
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
    display: none;
}

#cooldown-timer {
    background-color: rgba(255, 100, 0, 0.95);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: bold;
    border: 2px solid rgba(255, 140, 0, 0.8);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Pixel Controls */
.pixel-controls {
    /* Position INNERHALB der color-palette */
    position: relative;
    display: flex;
    gap: 15px;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    /* padding: 15px 25px; */
    /* background: rgba(20, 20, 20, 0.95); */
    border-radius: 15px;
    /* border: 2px solid rgba(0, 255, 0, 0.3); */
    backdrop-filter: blur(10px);
    animation: slideIn 0.3s ease;
    margin-top: 15px; /* Abstand zur Farbpalette */
}

.pending-counter {
    background: linear-gradient(135deg, rgba(88, 100, 242, 0.9), rgba(76, 89, 225, 0.9));
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 16px;
    border: 2px solid rgba(88, 100, 242, 1);
    box-shadow: 0 0 15px rgba(88, 100, 242, 0.5);
    animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Pixel Info Panel */
.pixel-info-panel {
    position: fixed;
    bottom: 20px;
    right: calc(50% - 150px);
    background-color: rgba(255, 255, 255, 0.95);
    color: rgb(0, 0, 0);
    padding: 20px;
    border-radius: 30px;
    border: 1px solid rgba(167, 167, 167, 0.5);
    backdrop-filter: blur(10px);
    width: 300px;
    z-index: 1000;
}

.close-pixel-info {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 32px;
    font-weight: bold;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    line-height: 1;
    transition: color 0.2s ease;
    z-index: 10;
}

.close-pixel-info:hover {
    color: #ff0000;
}

.pixel-info-panel h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #000000;
    padding-right: 35px;
    padding-right: 30px;
}

.pixel-info-panel p {
    margin: 8px 0;
    font-size: 14px;
}

/* Farbpalette */
.color-palette {
    position: fixed;
    bottom: 0px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(255, 255, 255, 0.356);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    padding: 15px;
    padding-top: 45px;
    padding-bottom: 20px;
    border-radius: 25px 25px 0 0;
    border: 1px solid rgba(167, 167, 167, 0.5);
    backdrop-filter: blur(5px);
    width: 100%;
    z-index: 10000; /* Über ALLEN UI-Elementen */
    display: flex;
    flex-direction: column;
    align-items: center; /* Zentriert alle Kinder horizontal */
}

.palette-close-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 50, 50, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10001; /* Über der Color Palette */
}

.palette-close-btn:hover {
    background: rgba(255, 0, 0, 1);
    transform: scale(1.1);
}

.palette-close-btn:active {
    transform: scale(0.95);
}

.color-palette-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    justify-content: center; /* Zentriert die Farben horizontal */
    max-width: 700px; /* Begrenzt Breite für bessere Zentrierung */
}

.color-btn {
    width: 35px;
    height: 35px;
    border: 2px solid rgba(0, 0, 0, 0.4);
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.color-btn:hover {
    transform: scale(1.15);
    border-color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.color-btn.selected {
    border: 3px solid #0099ff;
    box-shadow: 0 0 15px #0099ff;
    transform: scale(1.1);
}

/* Profilbild oben rechts */
.profile-picture {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
    background-color: rgba(20, 20, 20, 0.95);
    backdrop-filter: blur(10px);
    z-index: 1001;
    cursor: pointer;
    transition: all 0.3s;
}

.profile-picture:hover {
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.8);
}

.profile-picture img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    image-rendering: pixelated;
}

/* Profil Dropdown Menu */
.profile-menu {
    position: fixed;
    top: 90px;
    right: 20px;
    background: linear-gradient(135deg, rgba(240, 243, 255, 0.98), rgba(230, 235, 250, 0.98));
    border-radius: 20px;
    padding: 0;
    width: 380px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(15px);
    z-index: 1000;
    animation: slideDown 0.3s ease;
    overflow: hidden;
}

.profile-menu-header {
    background: linear-gradient(135deg, #5865F2, #7289DA);
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 15px;
}

.profile-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
}

.profile-info {
    flex: 1;
    color: white;
}

.profile-username {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 12px;
}

.user-id {
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    font-weight: normal;
}

.verified-badge {
    flex-shrink: 0;
}

.profile-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    background: rgba(255, 255, 255, 0.15);
    padding: 6px 10px;
    border-radius: 8px;
}

.stat-icon {
    font-size: 14px;
}

.stat-label {
    font-weight: 500;
}

.stat-value {
    font-weight: bold;
    margin-left: auto;
}

.stat-percent {
    color: rgba(255, 255, 255, 0.8);
    font-size: 12px;
}

.info-icon {
    opacity: 0.6;
    cursor: help;
}

.menu-section {
    padding: 15px;
}

.menu-title {
    font-size: 12px;
    font-weight: bold;
    color: #4F5660;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.store-buy-btn {
    width: 100%;
    background: linear-gradient(90deg,#0099ff,#0cb4ff);
    color: white;
    border: none;
    padding: 14px 18px;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.25s;
    box-shadow: 0 6px 14px -4px rgba(0,153,255,0.45);
    position: relative;
    overflow: hidden;
}
.store-buy-btn:before { content: ""; position: absolute; inset: 0; background: linear-gradient(120deg,rgba(255,255,255,0.25),rgba(255,255,255,0) 60%); opacity: 0; transition: opacity .25s; }
.store-buy-btn:hover:before { opacity: 1; }
.store-buy-btn:hover { background: linear-gradient(90deg,#008be6,#05a8ff); box-shadow: 0 10px 24px -6px rgba(0,153,255,0.55); transform: translateY(-3px); }
.store-buy-btn svg { width: 16px; height: 16px; }
.menu-btn:active {
    transform: scale(0.98);
}

.menu-icon {
    flex-shrink: 0;
    opacity: 0.7;
}

.discord-icon {
    color: #5865F2;
}

.reddit-icon {
    color: #FF4500;
}

.twitch-icon {
    font-size: 12px;
    margin-right: -8px;
}

.logout-btn {
    background: rgba(237, 66, 69, 0.1);
    color: #ED4245;
    margin-top: 8px;
}

.logout-btn:hover {
    background: rgba(237, 66, 69, 0.2);
}

/* Store Button */
.store-button {
    position: fixed;
    top: 90px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(240, 243, 255, 0.98), rgba(230, 235, 250, 0.98));
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    cursor: pointer;
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    transition: all 0.3s;
}

.store-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 153, 255, 0.4);
}

/* Store Menu */
.store-menu {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(160deg, rgba(246,248,255,0.97), rgba(236,240,250,0.95));
    border-radius: 26px;
    padding: 0;
    width: 900px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* internal content scroll in child */
    box-shadow: 0 20px 60px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.05);
    backdrop-filter: blur(18px) saturate(140%);
    z-index: 10001;
    animation: fadeIn 0.25s ease;
    border: 1px solid rgba(255,255,255,0.4);
}

.store-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.1);
    border: none;
    color: #000;
    font-size: 28px;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10;
}

.store-close-btn:hover {
    background: rgba(0, 0, 0, 0.2);
    transform: scale(1.1);
}

.store-header {
    padding: 22px 32px 18px 32px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-radius: 26px 26px 0 0;
    position: relative;
    box-shadow: inset 0 -1px 0 rgba(255,255,255,0.25);
}

.store-icon {
    flex-shrink: 0;
}

.store-header h2 {
    margin: 0;
    color: rgb(0, 0, 0);
    font-size: 22px;
    font-weight: bold;
    letter-spacing: .5px;
}

.store-balance {
    background: linear-gradient(145deg, #ffffff 0%, #f1f5ff 100%);
    margin: 22px 28px 10px 28px;
    padding: 18px 24px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 19px;
    font-weight: 700;
    color: #0099ff;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    border: 1px solid rgba(0,153,255,0.15);
}

.credits-text {
    color: #666;
    font-weight: normal;
    font-size: 16px;
}

.add-credits-btn {
    margin-left: auto;
    background: #0099ff;
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.add-credits-btn:hover {
    background: #007acc;
    transform: scale(1.1);
}

.store-section {
    margin: 26px 28px 18px 28px;
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.store-section-icon {
    font-size: 22px;
}

.store-section-title {
    margin: 0;
    color: #0099ff;
    font-size: 18px;
    font-weight: bold;
}

.store-section-subtitle {
    margin: 0 0 0 5px;
    color: #aaa;
    font-size: 13px;
    font-weight: normal;
}

.store-items {
    padding: 0 28px 28px 28px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.store-item {
    background: rgba(227, 233, 244, 1);
    border-radius: 20px;
    padding: 22px 20px 20px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    min-height: 250px;
    border: 1px solid rgba(255,255,255,0.5);
    transition: box-shadow .25s, transform .25s;
}

.store-item-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.store-item-icon svg {
    width: 58px;
    height: 58px;
    filter: drop-shadow(0 4px 8px rgba(0,153,255,0.25));
}

.store-item-title {
    margin: 4px 0 6px 0;
    color: #163256;
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    letter-spacing: .3px;
}

.store-item-description {
    margin: 0 0 18px 0;
    color: #5e6b7a;
    font-size: 12px;
    text-align: center;
    line-height: 1.4;
}

.store-item-quantity {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
    width: 100%;
}

.qty-btn {
    background: #ffffff;
    border: none;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    color: #3b5672;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
.qty-btn:hover { background: #f0f6ff; color: #163256; }
}

.qty-btn:hover {
    background: #f5f5f5;
    color: #333;
}

.store-item-quantity input {
    background: linear-gradient(145deg,#ffffff,#eef4ff);
    border: 1px solid rgba(0,153,255,0.25);
    padding: 8px 14px;
    border-radius: 12px;
    text-align: center;
    font-size: 15px;
    font-weight: 700;
    color: #163256;
    flex: 1;
    min-width: 0;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.08);
}

.qty-max-btn {
    background: #ffffff;
    border: 1px solid rgba(0,153,255,0.25);
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .5px;
    color: #3b5672;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
.qty-max-btn:hover { background: #f0f6ff; color: #0099ff; }
}

.qty-max-btn:hover {
    background: #f5f5f5;
    color: #0099ff;
}

.store-buy-btn {
    width: 100%;
    background: #0099ff;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
}

.store-buy-btn:hover {
    background: #007acc;
}

.store-buy-btn svg {
    width: 14px;
    height: 14px;
}

.buy-price { font-size: 16px; }
.buy-credits { font-size: 13px; opacity: 0.95; }

.store-profile {
    padding: 8px 28px 32px 28px;
    text-align: center;
    background: linear-gradient(180deg, rgba(255,255,255,0.7) 0%, rgba(235,240,255,0.6) 100%);
    margin: 14px 28px 32px 28px;
    border-radius: 22px;
    padding-top: 32px;
    box-shadow: 0 8px 20px -6px rgba(0,40,120,0.25);
    border: 1px solid rgba(255,255,255,0.5);
}

.store-profile-picture {
    width: 120px;
    height: 120px;
    margin: 0 auto 18px auto;
    border-radius: 50%;
    overflow: visible;
    position: relative;
}

.store-profile-picture img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    border: 5px solid #ffffff;
    box-shadow: 0 8px 18px -4px rgba(0,0,0,0.4);
}

.store-profile-badge {
    position: absolute;
    bottom: -4px;
    right: -4px;
    background: linear-gradient(160deg,#6e35b7,#5B2C91 70%);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 16px -4px rgba(0,0,0,0.45), 0 0 0 3px rgba(255,255,255,0.7);
}

.store-profile-badge svg {
    position: absolute;
    width: 100%;
    height: 100%;
}

.profile-pixel-count {
    position: relative;
    z-index: 1;
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.35);
    letter-spacing: .5px;
}

.store-profile-title {
    margin: 0 0 6px 0;
    color: #163256;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: .4px;
}

.store-profile-subtitle {
    margin: 0;
    color: #5e6b7a;
    font-size: 12px;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Welcome Popup */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.3s ease;
}

.popup-container {
    background-color: rgba(243, 243, 243, 0.98);
    border-radius: 15px;
    padding: 40px;
    max-width: 800px;
    width: 90%;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.4s ease;
}

.popup-container h2 {
    color: #000000;
    margin-bottom: 20px;
    font-size: 28px;
    text-align: center;
}

.popup-container p {
    color: #191919;
    font-size: 16px;
    margin-bottom: 25px;
    text-align: center;
    line-height: 1.5;
}

.popup-info {
    background: rgba(1, 105, 255, 0.1);
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 25px;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.popup-info h3 {
    color: #FFD700;
    font-size: 20px;
    margin-bottom: 20px;
    text-align: center;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.rules-section {
    margin-bottom: 20px;
}

.rules-section:last-child {
    margin-bottom: 0;
}

.rules-section h4 {
    color: #000000;
    font-size: 16px;
    margin-bottom: 12px;
    font-weight: bold;
}

.rules-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.rules-list li {
    font-size: 13px;
    margin-bottom: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    line-height: 1.5;
    transition: all 0.2s;
}

.rules-list.forbidden li {
    background-color: rgba(255, 50, 50, 0.15);
    color: #000000;
}

.rules-list.forbidden li:hover {
    background-color: rgba(255, 50, 50, 0.25);
    transform: translateX(5px);
}

.rules-list.allowed li {
    background-color: rgba(0, 255, 100, 0.15);
    color: #000000;
}

.rules-list.allowed li:hover {
    background-color: rgba(0, 255, 100, 0.25);
    transform: translateX(5px);
}

.popup-container .button {
    width: 100%;
    padding: 15px 20px;
    font-size: 18px;
    font-weight: bold;
}

.popup-link {
    color: #0169ff;
    text-decoration: underline;
    font-weight: bold;
    transition: all 0.2s;
}

.popup-link:hover {
    color: #0052cc;
    text-shadow: 0 0 8px rgba(1, 105, 255, 0.5);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Pixel Budget Display */
.pixel-budget-display {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 16px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.budget-icon {
    font-size: 18px;
}

.budget-value {
    font-size: 16px;
    font-weight: bold;
    color: #ffffff;
    min-width: 50px;
}

.budget-regen {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    font-style: italic;
}