body {
    font-family: Arial, sans-serif;
    background-color: #222;
    color: #eee;
    margin: 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh; /* Ensure body takes full viewport height for scrolling */
}

h1 {
    color: #e0f2f7;
    text-align: center;
    margin-bottom: 10px;
}

.instruction {
    font-style: italic;
    color: #bbb;
    margin-bottom: 20px;
    text-align: center;
    max-width: 800px;
}

.game-container {
    display: flex;
    width: 100%;
    max-width: 1600px; /* Adjust as needed */
    gap: 20px;
    justify-content: center;
}

.player-area {
    background-color: #333;
    border: 2px solid #555;
    border-radius: 10px;
    padding: 15px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-width: 450px; /* Ensure zones have enough space */
}

.player-area h2 {
    color: #ffd700;
    text-align: center;
    margin-top: 0;
    margin-bottom: 10px;
}

.top-zones {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap; /* Allows wrap on smaller screens */
}

.zone {
    background-color: #444;
    border: 1px dashed #666;
    border-radius: 8px;
    padding: 10px;
    min-height: 150px; /* Standard minimum height for zones */
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: auto; /* For scrolling content within zones */
    box-sizing: border-box; /* Include padding and border in the element's total width and height */
    position: relative; /* For drop target highlighting */
}

/* Drop target highlight */
.zone.drop-target {
    border: 2px solid #00ff00; /* Green highlight */
    background-color: #5a5a5a;
    box-shadow: 0 0 15px rgba(0,255,0,0.5);
}


.zone h3 {
    color: #aaddff;
    margin-top: 0;
    margin-bottom: 10px;
    text-align: center;
    font-size: 0.95em;
}

/* Specific Zone Sizing */
.deck-zone {
    flex-basis: calc(33.33% - 10px);
    min-width: 140px; /* Minimum width for deck zone */
    display: flex;
    flex-direction: column;
    justify-content: space-between; /* Pushes buttons to bottom */
    align-items: center;
}
.memory-pile-zone, .phase-pile-zone {
    flex-basis: calc(33.33% - 10px);
    min-width: 140px;
}

.main-play-area {
    display: flex;
    gap: 10px;
    min-height: 300px;
    flex: 1; /* Allows this section to grow */
}

.field-area, .energy-field {
    flex: 1; /* Each takes half the main play area width */
    min-width: 180px;
    background-color: #4c4c4c; /* Slightly different background */
}

.hand-zone {
    min-height: 200px; /* Ensure hand zone is tall enough to be scrollable */
    margin-top: auto; /* Pushes hand to the bottom of the player-area */
    width: 100%;
    border: 2px solid #8e44ad; /* Distinct color for hand */
    background-color: #5d3575;
}
.hand-zone h3 {
    color: #e6b3ff;
}
.hand-zone .hide-instruction {
    font-size: 0.8em;
    color: #ccc;
    margin-top: 5px;
}

/* Card Placeholders & Buttons */
.card-back {
    background-color: #004d40; /* Dark teal for card back */
    border: 2px solid #00c853; /* Bright green border */
    border-radius: 8px;
    width: 100px; /* Standard card width */
    height: 140px; /* Standard card height */
    margin-bottom: -120px; /* Overlap for stacked effect */
    flex-shrink: 0; /* Prevent shrinking in flex container */
    position: relative;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    color: #e0f2f7;
    font-size: 0.9em;
    text-align: center;
    overflow: hidden; /* Hide any overflow */
}

.card-back:last-child {
    margin-bottom: 0; /* No margin for the last card */
}

.card-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 10px;
    min-height: 140px; /* Ensure space even if few cards */
    justify-content: flex-end; /* Stack from bottom up */
    position: relative; /* For absolute positioning of individual cards */
    height: 100%; /* Take full height of deck-zone for stacking */
}

/* Base style for all displayed cards (in hand, eventually field) */
.card {
    background-color: #777;
    border: 1px solid #aaa;
    border-radius: 8px;
    width: 100px; /* Standard card width */
    height: 140px; /* Standard card height */
    box-shadow: 0 4px 8px rgba(0,0,0,0.6);
    display: flex;
    flex-direction: column;
    padding: 5px;
    font-size: 0.7em;
    box-sizing: border-box;
    overflow: hidden; /* Hide overflowing text if content is too long */
    position: relative; /* For text positioning */
    color: #1a1a1a; /* Darker text for readability on light card */
    background-image: linear-gradient(to bottom, #f0f0f0, #d0d0d0);
    cursor: grab; /* Indicate draggable */
}

.card:active {
    cursor: grabbing;
}


.card .card-name {
    font-weight: bold;
    text-align: center;
    margin-bottom: 3px;
    color: #333;
}
.card .type {
    font-style: italic;
    text-align: center;
    margin-bottom: 5px;
    font-size: 0.9em;
    color: #555;
}
.card .stats, .card .cost {
    font-size: 0.8em;
    text-align: center;
    margin-bottom: 3px;
    font-weight: bold;
    color: #444;
}
.card .abilities, .card .effect {
    font-size: 0.75em;
    margin-top: auto; /* Push to bottom of card */
    text-align: left;
    background-color: rgba(255,255,255,0.7);
    padding: 3px;
    border-radius: 3px;
    max-height: 40%; /* Limit ability text height */
    overflow: hidden; /* Hide overflow if text is too long */
}

/* Specific card type colors - for visual differentiation in hand */
.dreamwalker { background-image: linear-gradient(to bottom, #e0b0ff, #c080e0); } /* Purple-ish */
.chakra { background-image: linear-gradient(to bottom, #ffe0b0, #e0c080); } /* Orange-ish */
.equipment { background-image: linear-gradient(to bottom, #b0f0ff, #80d0e0); } /* Cyan-ish */
.spell { background-image: linear-gradient(to bottom, #ffb0b0, #e08080); } /* Red-ish */
.intention { background-image: linear-gradient(to bottom, #b0ffb0, #80e080); } /* Green-ish */
.response { background-image: linear-gradient(to bottom, #b0b0ff, #8080e0); } /* Blue-ish */
.field { background-image: linear-gradient(to bottom, #ffffb0, #e0e080); } /* Yellow-ish */


.card-area {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 10px;
    flex: 1; /* Allow card areas to grow within their zones */
    width: 100%; /* Ensure they take full width */
    min-height: 50px; /* Smallest height for visual space */
}

button {
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    padding: 8px 15px;
    cursor: pointer;
    font-size: 0.8em;
    margin-top: 5px;
    width: 80%;
}

button:hover {
    background-color: #0056b3;
}

.center-divider {
    width: 2px;
    background-color: #666;
    margin: 0 20px;
}
