@import url('https://fonts.googleapis.com/css2?family=VT323&display=swap');

:root {
    --bg-color: #0b1021;
    --panel-bg: #141b2d;
    --text-color: #e0e6ed;
    --accent-color: #4ade80;
    --moop-colors: #f87171, #fbbf24, #a78bfa, #60a5fa, #34d399;
    --highlight: #facc15;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'VT323', monospace;
    font-size: 1.2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    overflow-x: hidden;
}

#game-wrapper {
    width: 100%;
    max-width: 800px;
    padding: 2rem;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

header {
    text-align: center;
}

h1 {
    font-size: 3rem;
    margin: 0;
    color: var(--accent-color);
    text-shadow: 0 0 10px rgba(74, 222, 128, 0.5);
}

.subtitle {
    margin: 0.25rem 0 0;
    font-size: 1.5rem;
    color: #94a3b8;
    letter-spacing: 2px;
}

#status-panel {
    background: var(--panel-bg);
    border: 2px solid var(--accent-color);
    padding: 1rem 2rem;
    border-radius: 8px;
    text-align: center;
    width: 100%;
    box-sizing: border-box;
    min-height: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

#status-text {
    margin: 0;
    font-size: 1.4rem;
}

#piles-area {
    display: flex;
    justify-content: center;
    gap: 2rem;
    width: 100%;
    flex-wrap: wrap;
    padding: 1rem;
    box-sizing: border-box;
}

.pile {
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 2px solid transparent;
    transition: border-color 0.2s, background 0.2s;
    min-width: 80px;
}

.pile:hover {
    border-color: #475569;
    background: rgba(255, 255, 255, 0.05);
}

.pile.selected {
    border-color: var(--highlight);
    background: rgba(250, 204, 21, 0.05);
}

.moop-item {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.2s;
    position: relative;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

.moop-item::after {
    content: '✕';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.2rem;
    color: rgba(0,0,0,0.4);
    font-weight: bold;
}

.moop-item:hover {
    transform: scale(1.1);
}

.moop-item.taken {
    opacity: 0;
    transform: scale(0.5);
    pointer-events: none;
}

/* Generate colors for piles using nth-child on the pile, not the item, to keep piles distinct? 
   Actually let's vary items within a pile for visual interest */
.pile:nth-child(1) .moop-item { background: #f87171; }
.pile:nth-child(2) .moop-item { background: #fbbf24; }
.pile:nth-child(3) .moop-item { background: #a78bfa; }
.pile:nth-child(4) .moop-item { background: #60a5fa; }
.pile:nth-child(5) .moop-item { background: #34d399; }

/* Hover effect for items that will be taken */
.pile.selecting .moop-item {
    opacity: 0.5;
}
.pile.selecting .moop-item.select-highlight {
    opacity: 1;
    box-shadow: 0 0 15px var(--highlight);
    border: 2px solid var(--highlight);
}

#controls {
    margin-top: 1rem;
}

button {
    font-family: 'VT323', monospace;
    font-size: 1.3rem;
    padding: 0.75rem 1.5rem;
    border: 2px solid var(--accent-color);
    background: transparent;
    color: var(--accent-color);
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.2s, color 0.2s;
}

button:hover {
    background: var(--accent-color);
    color: var(--bg-color);
}

button:disabled {
    border-color: #475569;
    color: #475569;
    cursor: not-allowed;
}

button:disabled:hover {
    background: transparent;
    color: #475569;
}

.panel {
    background: var(--panel-bg);
    border: 1px solid #334155;
    padding: 1.5rem;
    border-radius: 8px;
    width: 100%;
    box-sizing: border-box;
    margin-top: 1rem;
}

.panel h3 {
    margin-top: 0;
    color: var(--accent-color);
}

#back-nav {
    margin-top: auto;
    padding: 2rem;
}

#back-nav a {
    color: #94a3b8;
    text-decoration: none;
    font-size: 1.2rem;
}

#back-nav a:hover {
    color: var(--accent-color);
}
