/* B"H */
/*
    THE GREAT RESTRUCTURING
    The old laws were found wanting. They were a patchwork of fixes, a fragile dam
    holding back the chaos of the void. They are hereby struck from existence.

    In their place, a new, perfect architecture is decreed. A firmament built on
    unyielding pillars of modern CSS, designed to be absolute, responsive, and
    divinely beautiful across all realities, all screens, all scrying mirrors.
    This is not a repair. This is a re-creation.
*/

/* --- The Palette of Creation --- */
/* These are not mere colors. They are the fundamental emanations of light from which
   this reality is woven. To change them is to change the nature of the world. */
:root {
    --color-background: #010101;
    --color-text: #a9a9a9;
    --color-gold-light: #d4af37;
    --color-gold-shadow: #b8860b;
    --color-red-divine: #8c0000;
    --color-red-hover: #ff4500;
    --color-border: #555;
    --color-disabled: #444;
    --font-serif: 'Times New Roman', Times, serif;
}

/* --- The Primordial Decree --- */
/* Before any form is given, a universal law is applied to all things: their
   dimensions shall be true, without the deceit of padding or borders. */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* --- The First Pillar: The Law of Centering --- */
/* The body of the world is now a perfect grid, whose sole purpose is to hold
   the antechamber of creation in its exact center, always and forever. */
html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
}

body {
    background-color: var(--color-background);
    color: var(--color-text);
    font-family: var(--font-serif);
    display: grid;
    place-items: center;
}

/* --- The Second Pillar: The Law of the Vessel --- */
/* The main menu is no longer a simple container. It is a self-aware vessel.
   It will never grow too large for its world, and if its contents are too vast,
   it will grant the user a divine scroll to perceive them all. */
#main-menu {
    display: flex;
    flex-direction: column;
    gap: 25px;
    align-items: center;
    width: 90%;
    max-width: 500px;
    max-height: 90vh; /* It shall never exceed 90% of the world's height. */
    overflow-y: auto; /* If content is too tall, the divine scroll appears. */
    padding: 40px 30px;
    border: 1px solid var(--color-border);
    background-color: rgba(10, 10, 10, 0.85);
    backdrop-filter: blur(5px); /* A subtle distortion of the void behind it. */
    box-shadow: 0 0 35px rgba(255, 223, 186, 0.1);
}

/* --- The Holy Inscriptions --- */
h1 {
    color: var(--color-gold-light);
    font-size: clamp(2.5rem, 8vw, 4rem); /* A fluid font size, adapting to the world. */
    font-weight: normal;
    text-shadow: 0 0 10px var(--color-gold-light), 0 0 20px var(--color-gold-shadow);
}

p {
    font-style: italic;
    color: var(--color-text);
    margin-top: -15px;
}

/* --- The Utterances of Choice --- */
#game-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
}

.game-button {
    font-size: 1.1em;
    padding: 15px;
    cursor: pointer;
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text);
    transition: all 0.2s ease-in-out;
}

.game-button:not(:disabled):hover, .game-button.selected {
    background-color: var(--color-gold-light);
    color: var(--color-background);
    border-color: var(--color-gold-light);
    box-shadow: 0 0 20px var(--color-gold-shadow);
    transform: scale(1.03); /* The choice becomes magnified. */
}

.game-button:disabled {
    color: var(--color-disabled);
    border-color: #222;
    background-color: rgba(0, 0, 0, 0.2);
    cursor: not-allowed;
}

/* --- The Final Summons: The Heartbeat of Potential --- */
#player-selection {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    width: 100%;
}

#ai-players {
    width: 80px;
    padding: 8px;
    background-color: #222;
    border: 1px solid var(--color-border);
    color: var(--color-text);
    text-align: center;
    font-size: 1.2em;
}

#start-game {
    font-size: 1.3em;
    padding: 15px;
    cursor: pointer;
    background: transparent;
    border: 2px solid var(--color-red-divine);
    color: var(--color-text);
    width: 100%;
    margin-top: 10px;
    transition: all 0.3s ease;
    animation: pulse-glow 3s infinite ease-in-out; /* The divine heartbeat. */
}

#start-game:hover {
    background-color: var(--color-red-divine);
    color: white;
    box-shadow: 0 0 25px var(--color-red-hover);
    animation-play-state: paused; /* The heart stills when touched. */
}

/* The Keyframe Incantation that gives the button its life. */
@keyframes pulse-glow {
    0% { box-shadow: 0 0 5px var(--color-red-divine); }
    50% { box-shadow: 0 0 20px var(--color-red-hover); }
    100% { box-shadow: 0 0 5px var(--color-red-divine); }
}


/* --- The Laws of the Game World --- */
/* A firm, absolute structure for the reality that comes after the choice. */
#game-container {
    position: absolute;
    inset: 0; /* A modern decree to fill all space. */
    display: none;
}

#game-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

#game-ui-container {
    position: absolute;
    inset: auto 0 20px 0; /* An unyielding anchor to the bottom. */
    z-index: 2;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column-reverse; /* Actions are now below the status. */
    pointer-events: none;
    gap: 10px;
}

.ui-panel {
    background-color: rgba(0, 0, 0, 0.75);
    border: 1px solid var(--color-gold-light);
    padding: 15px 25px;
    border-radius: 5px;
    box-shadow: 0 0 20px var(--color-gold-shadow);
    color: var(--color-gold-light);
    font-size: 1.5em;
    text-align: center;
    backdrop-filter: blur(3px);
}

#player-actions {
    pointer-events: all;
    display: flex;
    gap: 20px;
}

#player-actions button {
    font-size: 1em;
    padding: 10px 30px;
    background-color: #333;
    border: 1px solid var(--color-gold-light);
    color: var(--color-gold-light);
    cursor: pointer;
    transition: all 0.2s ease;
}

#player-actions button:hover {
    background-color: var(--color-gold-light);
    color: #000;
    transform: scale(1.05);
}