body, html {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: 'Courier New', Courier, monospace;
    overflow: hidden;
    background: #111;
}

/* CRITICAL: Black background for the map container */
#map {
    width: 100vw;
    height: 100vh;
    z-index: 1;
    background-color: #111; 
}

#ui-panel {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 300px;
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    padding: 20px;
    border-radius: 8px;
    z-index: 1000;
    box-shadow: 0 0 20px rgba(0, 255, 204, 0.2);
    border: 2px solid #00ffcc;
}

h1 {
    margin-top: 0;
    font-size: 1.4rem;
    text-align: center;
    color: #00ffcc;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Market Ticker Styles */
.market-ticker {
    background: rgba(0, 255, 204, 0.1);
    border: 1px solid #00ffcc;
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 15px;
}

.ticker-title {
    font-size: 0.7rem;
    color: #00ffcc;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
    text-align: center;
}

.coin-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    border-bottom: 1px solid rgba(0, 255, 204, 0.2);
    font-size: 0.85rem;
}

.coin-row:last-child {
    border-bottom: none;
}

.coin-icon {
    font-size: 1.2rem;
    width: 25px;
}

.coin-name {
    flex: 1;
    margin-left: 5px;
}

.coin-price {
    font-weight: bold;
    font-size: 0.9rem;
}

.status-indicator {
    font-size: 0.7rem;
    color: #888;
    text-align: right;
    margin-top: 5px;
}

.emoji-picker {
    margin-bottom: 15px;
    border-bottom: 1px solid #444;
    padding-bottom: 15px;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
    margin-top: 5px;
}

.emoji-btn {
    background: #222;
    border: 1px solid #555;
    color: #fff;
    font-size: 1.5rem;
    padding: 5px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.emoji-btn:hover { background: #444; transform: scale(1.1); }
.emoji-btn.active { background: #00ffcc; color: #000; border-color: #00ffcc; font-weight: bold; }

#current-selection { margin-top: 10px; font-size: 1rem; color: #aaa; }

.stats { display: flex; justify-content: space-between; margin-bottom: 15px; font-size: 1.2rem; }
.highlight { color: #ffd700; font-weight: bold; }

.controls { display: flex; gap: 10px; margin-bottom: 15px; }
button { flex: 1; padding: 10px; cursor: pointer; border: none; border-radius: 4px; font-weight: bold; font-family: inherit; transition: transform 0.1s; }
button:active { transform: scale(0.95); }
#btn-buy { background-color: #00ffcc; color: #000; }
#btn-reset { background-color: #ff4444; color: white; }

.instructions { font-size: 0.8rem; color: #ccc; line-height: 1.4; border-top: 1px solid #444; padding-top: 10px; }

/* --- ROBOT STYLES --- */
#pixel-robot {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 80px;
    height: 100px;
    z-index: 1000;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
#pixel-robot.hidden { display: none; }
.robot-wrapper { position: relative; width: 100%; height: 100%; image-rendering: pixelated; }
.robot-grid { display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(6, 1fr); width: 100%; height: 100%; gap: 1px; }
.cell { width: 100%; height: 100%; border-radius: 0; }
.empty { background: transparent; }
.head { background: #ddd; border: 1px solid #555; }
.eye { background: #000; animation: blink 4s infinite; }
.mouth { background: #333; }
.body { background: #bbb; border: 1px solid #555; }
.foot { background: #888; border: 1px solid #555; }
.ant-ball { background: #ff0055; border-radius: 0; animation: glow 1s infinite alternate; }
@keyframes glow { from { box-shadow: 0 0 2px #ff0055; } to { box-shadow: 0 0 8px #ff0055; } }
@keyframes blink { 0%, 96%, 100% { transform: scaleY(1); } 98% { transform: scaleY(0.1); } }
.action-anim { animation: robot-action 0.4s ease-in-out; }
@keyframes robot-action { 0% { transform: translateY(0) scale(1); } 20% { transform: translateY(-10px) scale(1.1); } 40% { transform: translateY(0) scale(0.9); } 60% { transform: translateY(-5px) scale(1.05); } 100% { transform: translateY(0) scale(1); } }
.action-anim .eye { animation: eye-squeeze 0.4s ease-in-out; }
@keyframes eye-squeeze { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(1.5); } }
.action-anim .mouth { animation: mouth-open 0.4s ease-in-out; }
@keyframes mouth-open { 0%, 100% { height: 4px; } 50% { height: 10px; } }
.speech-bubble { position: absolute; top: -40px; right: 0px; background: #fff; color: #000; padding: 5px 10px; border-radius: 4px; font-size: 1.2rem; border: 2px solid #000; white-space: nowrap; opacity: 0; transition: opacity 0.2s; pointer-events: none; box-shadow: 2px 2px 0 #000; }
.speech-bubble.show { opacity: 1; }

/* --- CLUSTER & PIXEL STYLES --- */
.pixel-marker {
    position: absolute;
    transform: translate(-50%, -50%);
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 0 #000;
    z-index: 600;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
    transition: all 0.2s ease;
    cursor: pointer;
    pointer-events: auto;
}

.pixel-marker:hover {
    transform: translate(-50%, -50%) scale(1.1);
    z-index: 700;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
}

.pixel-bg {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    border-radius: 4px;
    opacity: 0.8;
    z-index: -1;
}

.pixel-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1;
}

.pixel-emoji { font-size: 1.2rem; }
.pixel-count { font-size: 0.7rem; margin-top: 2px; background: rgba(0,0,0,0.6); padding: 1px 3px; border-radius: 2px; }

/* Tooltip Styles */
.tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.95);
    border: 2px solid #00ffcc;
    color: #fff;
    padding: 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    z-index: 2000;
    pointer-events: none;
    min-width: 150px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    opacity: 0;
    transition: opacity 0.2s;
}

.tooltip.hidden { opacity: 0; }
.tooltip.visible { opacity: 1; }

.tooltip-header {
    font-weight: bold;
    font-size: 1rem;
    margin-bottom: 5px;
    border-bottom: 1px solid #444;
    padding-bottom: 3px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.tooltip-body div { margin-bottom: 2px; }
.highlight-green { color: #00ff00; }
.highlight-blue { color: #00aaff; }