:root {
    --bg: #1a1a1a;
    --text: #f0f0f0;
    --accent: #c9a84f; /* Egyptian yellow dark */
    --bglight: #f7e8b5; /* Egyptian yellow light */
    --maxwidth-menu: 480px;
    --yellow: rgb(207, 188, 9);
    --yellow-light: rgb(245, 233, 125);
    --yellow-dark: rgb(163, 147, 3);
    --yellow-disabled: rgb(100, 90, 2);
    --purple: rgb(138, 43, 226);
    --purple-light: rgb(167, 79, 250);
    --purple-dark: rgb(113, 21, 199);
    --blue: rgb(56, 54, 219);
    --blue-light: rgb(82, 79, 250);
    --blue-dark: rgb(42, 39, 197);
    --yellow-elements: rgb(255, 255, 200);
    --yellow-elements-hover: rgb(245, 233, 165);
    --yellow-elements-select: rgb(226, 213, 137);
    --reminder: rgb(92, 238, 189);
}

.player-green { color: #4ae750; }
.player-blue { color: #24bce2; }
.player-red { color: #f44336; }
.player-yellow { color: #FFD700; }
.player-purple { color: #ba2cd3; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, sans-serif;
    display: flex;
    flex-direction: column;
}

#debug-menu {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    color: var(--text);
    padding: 10px;
    z-index: 1000;
    width: 300px;
}

@media (min-width: 1024px) {
    #debug-menu {
        display: block;
    }
}

.screen {
    display: grid;
    width: 100%;
    height: 100%;
    place-items: center;
    text-align: center;
    box-sizing: border-box;
    padding: 5px;
}

.header {
    width: 100%;
}

.header-with-back-button {
    width: 100%;
    max-width: var(--maxwidth-menu);
    display: grid;
    grid-template-columns: 32px 1fr 32px;
}

.back-button {
    display: flex;
    align-self: center;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.back-button img {
    display: block; /* removes wrong click hitbox */
    width: 100%;
    height: 100%;
}

.new-button-yellow.loading {
    pointer-events: none;
    background-color: var(--yellow-disabled);
    animation: wait-to-confirm-fill 1.5s linear forwards;
}

@keyframes wait-to-confirm-fill {
    to {
        background-color: var(--yellow);
    }
}

.player-name {
    color: var(--yellow-light);
}

/* Player selection screen */
#main-menu-top-button {
    margin-top: 20px;
}

#rename-input-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin-top: 20px;
    margin-bottom: 50px;
}

/* Player selection screen */

#player-count-options {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 50px;
    margin-top: 20px;
}

.player-count-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.player-count-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.player-count-label {
    margin: 0;
    font-size: 18px;
}

.player-count {
    font-size: 32px;
}

.add-subtract-button {
    display: flex;
    align-self: center;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.add-subtract-button img {
    display: block; /* removes wrong click hitbox */
    width: 100%;
    height: 100%;
}

/* Bidding tile preference screen */

#bidding-tile-select-dropdown-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin-top: 20px;
    margin-bottom: 50px;
}

.bidding-tile-select-row {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 4rem;
}

.bidding-tile-select-name {
    font-weight: bold;
    font-size: 18px;
}

.bidding-tile-select-dropdown {
    font-size: 18px;
    width: 150px;
    padding: 8px 12px;
    background-color: var(--yellow-elements);
    border: 2px solid var(--yellow);
    border-radius: 5px;
    color: black;
    cursor: pointer;
    transition: background-color 0.2s;
}

.bidding-tile-select-dropdown:hover {
    background-color: var(--yellow-elements-hover);
}

.bidding-tile-select-dropdown:focus {
    outline: none;
    border-color: var(--yellow-light);
    box-shadow: 0 0 0 2px rgba(207, 188, 9, 0.2);
}

/* Tile selection screen */

.tile-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-top: 20px;
    max-width: var(--maxwidth-menu);
    padding: 0 10px;
}

.tile-grid-centered {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 20px;
    max-width: var(--maxwidth-menu);
}

.tile-grid-centered .tile-button {
    width: 100px;
    flex: 0 0 auto;
}

.tile-button {
    width: 100%;
    aspect-ratio: 1 / 1;
    padding: 0;
    border: 4px solid transparent;
    overflow: hidden;
    background: none;
    cursor: pointer;
}

.tile-button img {
    width: 100%;
    height: 100%;
}

.tile-button.selected {
    border-color: var(--accent);
}

#confirm-tile-take-button {
    margin-top: 40px;
}

#tile-selection-buttons-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin-top: 40px;
}

/* Ra invoke prompt screen */

#invoke-ra-options {
    display: flex;
    flex-direction: column;
    gap: 50px;
    margin-top: 40px;
}

/* Player bidding screen */
#current-bidder {
    margin-top: 5px;
    font-size: 18px;
}

#player-bidding-options {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin-top: 20px;
}

#drought-reminder-text {
    margin-bottom: 40px;
    color: var(--reminder);
}

/* Bidding outcome screen */
#bidding-outcome-redo-button {
    margin: 30px 0;
}

/* Monument discard screen */
#monument-discard-options {
    margin-bottom: 30px;
}

/* Game state review screen */
.state-review-display-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-top: 20px;
    max-width: var(--maxwidth-menu);
}

.state-review-display-grid img {
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: none;
}

.state-review-tile-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 15px;
    margin-top: 20px;
    max-width: var(--maxwidth-menu);
}

.state-review-tile-grid img {
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: none;
}

#ra-progress-display {
    font-size: 20px;
    font-weight: bold;
}

#ra-progress-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.player-state {
    text-align: left;
}

.state-review-player {
    padding: 0 10px;
    margin-bottom: 60px;
}

.state-review-player p {
    font-size: 18px;
}

#state-review-display {
    padding: 0 10px;
    margin-bottom: 60px;
}

/* Edit game state screen */

.edit-player-section {
    width: 100%;
    max-width: var(--maxwidth-menu);
    text-align: left;
    margin-top: 24px;
    padding: 0 10px;
    box-sizing: border-box;
}

.edit-player-tile-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid #333;
}

.edit-player-tile-image {
    width: 40px;
    height: 40px;
}

.edit-player-tile-name {
    flex: 1;
    font-size: 16px;
}

.edit-player-tile-count {
    font-size: 20px;
    min-width: 24px;
    text-align: center;
}

.edit-player-button {
    display: block;
    width: 100%;
    background: var(--purple);
    color: white;
    border: 2px solid var(--purple);
    border-radius: 8px;
    cursor: pointer;
    padding: 4px 12px;
    text-align: left;
    margin-bottom: 10px;
    transition: background-color 0.2s;
}

.edit-player-button:hover {
    background-color: var(--purple-dark);
    border-color: var(--purple-dark);
}

.edit-player-button h3 {
    margin: 0;
    color: var(--text);
}

/* Custom button styles */

.new-input {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    background-color: var(--yellow-elements);
    border: 2px solid var(--yellow);
    border-radius: 5px;
    color: black;
    box-sizing: border-box;
}

.new-input:focus {
    outline: none;
    border-color: var(--yellow-light);
    box-shadow: 0 0 0 2px rgba(207, 188, 9, 0.2);
}

.input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.input-label {
    font-size: 14px;
    font-weight: bold;
    color: var(--text);
}

.new-button-yellow {
    margin: 8px 0;
    padding: 12px 30px;
    font-size: 16px;
    border-radius: 20px;
    border: 4px solid var(--yellow-light);
    background-color: var(--yellow);
    color: black;
    cursor: pointer;
    transition: background-color 0.2s;
}

.new-button-purple:hover {
    background-color: var(--purple-dark);
}
.new-button-purple {
    margin: 8px 0;
    padding: 12px 30px;
    font-size: 16px;
    border-radius: 20px;
    border: 4px solid var(--purple-light);
    background-color: var(--purple);
    color: white;
    cursor: pointer;
    transition: background-color 0.2s;
}

.new-button-blue:hover {
    background-color: var(--blue-dark);
}
.new-button-blue {
    margin: 8px 0;
    padding: 12px 30px;
    font-size: 16px;
    border-radius: 20px;
    border: 4px solid var(--blue-light);
    background-color: var(--blue);
    color: white;
    cursor: pointer;
    transition: background-color 0.2s;
}

.new-button-yellow:hover {
    background-color: var(--yellow-dark);
}

.new-button-yellow:disabled,
.new-button-purple:disabled,
.new-button-blue:disabled,
.bidding-tile-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.new-button-yellow:disabled:hover {
    background-color: var(--yellow);
}

.new-button-purple:disabled:hover {
    background-color: var(--purple);
}

.new-button-blue:disabled:hover {
    background-color: var(--blue);
}

.bidding-tile-button:disabled:hover {
    border-color: rgb(51, 231, 216);
    background-color: var(--yellow);
}

.bidding-tile-button {
    width: 80px;
    border: 4px solid rgb(51, 231, 216);
    background-color: var(--yellow);
    color: black;
    font-size: 24px;
    border-radius: 25px;
    padding: 8px;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
}

.bidding-tile-button:hover {
    border: 4px solid rgb(29, 204, 189);
    background-color: var(--yellow-dark);
}

/* Custom Modal Styles */
.modal-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-backdrop.show {
    display: flex;
}

.modal-content {
    background-color: #1a1a1a;
    border: 3px solid white;
    border-radius: 5px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    font-size: 26px;
    margin-bottom: 20px;
    text-align: center;
}

.modal-body {
    margin-bottom: 20px;
}

.modal-footer {
    display: flex;
    justify-content: center;
    gap: 10px;
}

/* Tutorial modal */
.tutorial-modal-content {
    max-width: 640px;
    box-sizing: border-box;
}

.tutorial-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.tutorial-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: fill;
    border-radius: 4px;
}

.tutorial-text {
    margin: 0;
    font-size: 18px;
    color: var(--text);
    min-height: 120px;
}

@media (max-width: 480px) {
    .tutorial-text {
        min-height: 150px;
    }
}

.tutorial-footer {
    justify-content: space-between;
}