:root {
    --bg: #1a1a2e;
    --accent: #e94560;
    --sec: #16213e;
    --text: #fff;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    height: 100vh;
    overflow: hidden;
    user-select: none;
    display: flex;
    flex-direction: column;
}

.tab-bar {
    display: flex;
    background: rgba(0,0,0,0.3);
    width: 100%;
    border-bottom: 1px solid #0f3460;
    align-items: center;
    padding: 0 15px;
    box-sizing: border-box;
    height: 60px;
}

.tab-scroll-area {
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    height: 100%;
    align-items: center;
    scrollbar-width: none;
}

.tab-scroll-area::-webkit-scrollbar {
    display: none;
}

.tab-btn {
    padding: 0 20px;
    background: transparent;
    border: none;
    color: #a0a0a0;
    font-size: 16px;
    cursor: pointer;
    height: 100%;
    border-bottom: 3px solid transparent;
    transition: 0.2s;
}

.tab-btn:hover {
    color: white;
    background: rgba(255,255,255,0.05);
}

.tab-btn.active {
    color: var(--accent);
    border-bottom: 3px solid var(--accent);
    font-weight: bold;
}

.account-container {
    margin-left: auto;
    display: flex;
    align-items: center;
}

.account-btn {
    background: var(--sec);
    border: 1px solid #0f3460;
    color: var(--accent);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    margin-left: 10px;
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 55px;
    background-color: #16213e;
    min-width: 200px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.5);
    border: 1px solid #0f3460;
    border-radius: 8px;
    z-index: 9999;
}

.dropdown-content button {
    color: white;
    padding: 15px;
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    border-bottom: 1px solid #0f3460;
}

.show {
    display: block !important;
}

.tab-content {
    display: none;
    width: 100%;
    height: 100%;
    flex-direction: column;
    align-items: center;
    overflow: hidden;
    position: relative;
}

.tab-content.active {
    display: flex;
}

.action-btn {
    background: var(--accent);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
}

.action-btn:hover {
    background: #ff2e63;
    transform: translateY(-1px);
}

.action-btn.secondary {
    background: #333;
    border: 1px solid #555;
}

.action-btn.active-tool {
    border: 2px solid #fff;
    box-shadow: 0 0 10px var(--accent);
}

select, input {
    background: var(--sec);
    color: white;
    border: 1px solid #0f3460;
    padding: 8px;
    border-radius: 6px;
    margin: 5px;
}

canvas {
    flex-grow: 1;
    width: 100%;
    background: #1a1a2e;
    cursor: crosshair;
}

.cookie-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.stats-bar {
    background: rgba(0,0,0,0.3);
    padding: 10px 25px;
    border-radius: 50px;
    border: 1px solid #0f3460;
    margin: 10px;
    display: flex;
    gap: 20px;
}

.game-area-cookie {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    position: relative;
    background-size: cover;
    background-position: center;
    border-radius: 10px;
    margin: 10px;
    box-shadow: inset 0 0 50px rgba(0,0,0,0.5);
}

.big-cookie {
    font-size: 100px;
    background: none;
    border: none;
    cursor: pointer;
    transition: transform 0.05s;
    z-index: 10;
    text-shadow: 0 0 30px rgba(255,255,255,0.2);
}

.big-cookie:active {
    transform: scale(0.9);
}

.shop-area {
    width: 100%;
    height: 45%;
    background: rgba(0,0,0,0.2);
    border-top: 2px solid #0f3460;
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
}

.shop-grid, .skins-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 10px;
}

.upgrade-card {
    background: rgba(255,255,255,0.05);
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #0f3460;
    width: 100%;
    max-width: 280px;
    display: flex;
    justify-content: space-between;
    cursor: pointer;
}

.skin-item {
    background: #16213e;
    border: 2px solid #0f3460;
    border-radius: 8px;
    width: 80px;
    height: 80px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
}

.skin-item.owned {
    border-color: #55efc4;
    background: rgba(85, 239, 196, 0.1);
}

.skin-item.active-skin {
    border-color: #ffd700;
    box-shadow: 0 0 10px #ffd700;
}

.skin-label {
    font-size: 11px;
    font-weight: bold;
    text-shadow: 0 0 4px black;
    color: white;
    z-index: 2;
}

.worker-col {
    width: 80px;
    height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.worker-icon {
    font-size: 20px;
    animation: work 0.5s infinite alternate;
}

@keyframes work {
    from {
        transform: translateX(-2px);
    }

    to {
        transform: translateX(2px);
    }
}

.float-text {
    position: absolute;
    font-weight: bold;
    font-size: 1.5em;
    pointer-events: none;
    z-index: 9999;
    /* Neue Animation mit CSS-Variablen für die Richtung */
    animation: floatScatter 1s ease-out forwards;
    text-shadow: 0 0 4px rgba(0,0,0,0.5);
    /* Zentriert den Text genau unter der Maus als Startpunkt */
    transform: translate(-50%, -50%);
}

@keyframes floatScatter {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(0.8);
    }
    50% {
        transform: translate(calc(-50% + (var(--tx) * 0.5)), calc(-50% + (var(--ty) * 0.5))) scale(1.2);
    }
    100% {
        opacity: 0;
        /* Fliegt zu den im JS berechneten Koordinaten */
        transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(1);
    }
}

.falling-cookie {
    position: absolute;
    font-size: 40px;
    animation: fall linear forwards;
    cursor: pointer;
    z-index: 100;
}

@keyframes fall {
    from {
        top: -50px;
    }

    to {
        top: 110vh;
    }
}

.sim-header {
    padding: 15px;
    background: rgba(255,255,255,0.05);
    width: 100%;
    text-align: center;
    z-index: 5;
}

.chat-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    max-width: 800px;
    background: rgba(0,0,0,0.2);
    border-left: 1px solid #0f3460;
    border-right: 1px solid #0f3460;
}

.chat-messages {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-msg {
    background: #2a2a4e;
    padding: 10px 15px;
    border-radius: 15px;
    max-width: 80%;
}

.chat-msg.mine {
    background: var(--accent);
    align-self: flex-end;
}

.chat-input-area {
    padding: 15px;
    background: #16213e;
    display: flex;
    gap: 10px;
}

.chat-input-area input {
    flex-grow: 1;
    background: #0f172a;
    border: none;
    color: white;
    padding: 12px;
    border-radius: 20px;
}

.leaderboard-container, .account-box, .random-container {
    width: 100%;
    max-width: 600px;
    padding: 20px;
    text-align: center;
}

.lb-entry {
    display: flex;
    justify-content: space-between;
    padding: 15px;
    border-bottom: 1px solid #333;
}

.coin-scene {
    width: 150px;
    height: 150px;
    margin: 0 auto;
    perspective: 600px;
    cursor: pointer;
}

.coin {
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 3s;
}

.coin__face {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 30px;
    border: 4px solid #ffd700;
    background: radial-gradient(circle, #ffd700, #b8860b);
    backface-visibility: hidden;
}

.coin__face--tails {
    transform: rotateY(180deg);
    background: radial-gradient(circle, #c0c0c0, #808080);
    border-color: #c0c0c0;
}

.flip-heads {
    transform: rotateY(1800deg);
}

.flip-tails {
    transform: rotateY(1980deg);
}

.rng-box {
    background: rgba(0,0,0,0.3);
    padding: 20px;
    border-radius: 10px;
    border: 1px solid #0f3460;
}

.ttt-board {
    display: grid;
    grid-template-columns: repeat(3, 100px);
    gap: 10px;
    margin-top: 20px;
}

.cell {
    width: 100px;
    height: 100px;
    background: var(--sec);
    border: 2px solid #0f3460;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 60px;
    cursor: pointer;
}

.runner-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.8);
    padding: 20px;
    border-radius: 10px;
    display: none;
}

.alpaca-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    font-size: 40vh;
    opacity: 0.3;
    pointer-events: none;
    filter: grayscale(0.3);
}

#welcome-content {
    background: rgba(0,0,0,0.6);
    padding: 30px;
    border-radius: 15px;
    max-width: 600px;
    z-index: 2;
    text-align: center;
    margin-top: 50px;
}

.patch-notes-box {
    position: absolute;
    bottom: 30px;
    right: 30px;
    width: 300px;
    height: 140px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid #444;
    border-radius: 12px;
    padding: 20px;
    text-align: left;
    z-index: 10;
    backdrop-filter: blur(5px);
    overflow: hidden;
    pointer-events: none;
}

.patch-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.patch-list li {
    padding: 5px 0;
    font-size: 0.85em;
    color: #ccc;
}

.tag {
    background: #333;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.8em;
    margin-right: 10px;
}

.tag.new {
    background: var(--accent);
    color: white;
}

#crossy-container {
    width: 100%;
    height: 100%;
    position: relative;
    background: #000;
    overflow: hidden;
}

#crossy-ui {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 10;
}

.score-display {
    font-size: 24px;
    font-weight: 900;
    color: white;
    text-shadow: 2px 2px 0 #000;
    background: rgba(0,0,0,0.3);
    padding: 5px 15px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.2);
}

#crossy-menu {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.c3d-title {
    font-size: 80px;
    font-weight: 900;
    margin: 0;
    background: linear-gradient(to bottom right, #4ade80, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
