/**
 * Layout Styles
 * Main containers, grids, and structural layouts
 */

/* ==================== */
/* MAIN CONTAINERS      */
/* ==================== */

.game-container {
    max-width: 100%;
    width: 100%;
    background: transparent;
    padding: var(--space-sm) var(--space-md);
    margin: 0;
    position: relative;
    z-index: var(--z-background);
    
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    
    /* Take up most of the viewport */
    min-height: 95vh;
}

.start-container {
    width: 100%;
    max-width: 700px;
    padding: var(--space-xl);
    background: var(--panel-bg);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    text-align: center;
    position: relative;
    z-index: var(--z-background);
}

.report-container {
    width: 100%;
    max-width: 900px;
    margin: var(--space-xl) auto;
    padding: var(--space-xl);
    background: var(--panel-bg);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    text-align: center;
}

/* ==================== */
/* PROBLEM AREA         */
/* ==================== */

.problem-area {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    padding: 0 var(--space-md) var(--space-lg);
    width: 100%;
    overflow: visible;
    
    /* Fill available space */
    flex: 1;
    /* Changed from center to flex-start + padding to move pens lower */
    justify-content: flex-start;
    padding-top: 5vh;  /* Push content down by 5% of viewport height */
}

/* ==================== */
/* GAME MODE LAYOUTS    */
/* ==================== */

/* Anomaly & Analogy horizontal layout - cross-browser flexbox */
.anomaly-layout,
.analogy-layout {
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: start;
    -webkit-align-items: flex-start;
    -ms-flex-align: start;
    align-items: flex-start;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    -ms-flex-pack: center;
    justify-content: center;
    gap: 10vw;
    /* 5% margin from screen edges */
    width: 90%;
    max-width: 90vw;
    margin-left: 5%;
    margin-right: 5%;
    overflow: visible;
    min-height: 65vh;
    padding: 0;
    
    /* Center vertically */
    flex: 1;
    align-content: center;
}

/* Antithesis & Antinomy vertical sections */
.problem-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
    overflow: visible;
}

/* ==================== */
/* ANIMAL GRID          */
/* ==================== */

.animal-grid {
    display: -ms-grid;
    display: grid;
    gap: var(--slot-gap);
    width: 100%;
    height: 100%;
    /* ========================================================== */
    /* GRID ALIGNMENT - Controls how animal slots are positioned  */
    /* align-items: end = slots align to BOTTOM for baseline      */
    /* ========================================================== */
    justify-items: stretch;
    align-items: end;  /* Align slots to BOTTOM for consistent baseline */
}

/* Grid variants for different pen types */
.animal-grid--main {
    grid-template-columns: repeat(auto-fit, minmax(var(--slot-size), 1fr));
    max-width: 100%;
}

.animal-grid--out {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    place-items: stretch;  /* Slot fills the cell - alignment handled inside */
}

.animal-grid--question {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--slot-gap);
}

.animal-grid--answers {
    grid-template-columns: repeat(auto-fit, minmax(var(--slot-size-small), 1fr));
    gap: var(--slot-gap);
}

/* 5-column grid for anomaly main pen */
.animal-grid--anomaly {
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: 1fr;
}

/* 4-column grid for some problems */
.animal-grid--4col {
    grid-template-columns: repeat(4, 1fr);
}

/* ==================== */
/* FLEXBOX UTILITIES    */
/* ==================== */

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.flex-column {
    display: flex;
    flex-direction: column;
}

.flex-row {
    display: flex;
    flex-direction: row;
}

.flex-wrap {
    flex-wrap: wrap;
}

.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

/* ==================== */
/* PEN CONTAINER        */
/* ==================== */

.pen {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    overflow: visible;
}

/* ==================== */
/* GATE/ARROW ELEMENT   */
/* ==================== */

.gate-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 15vh;
}

.gate-image {
    width: clamp(120px, 15vw, 220px);
    height: auto;
    pointer-events: none;
}

/* ==================== */
/* BUCKET CONTAINER     */
/* ==================== */

.bucket-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 10vh;
}
