:root {
    --overall-background: #FAF3E0;
    --overall-foreground: #5A3E2B;
    --grid-background: #BFA285;
    --grid-lines: #D35D38;
    --neutral-tile: #DCB98A;
    --neutral-tile-foreground: #3A2C1A;
    --moving-tile: #D9A15B;
    --moving-tile-foreground: #4F321F;
    --partial-tile: #E3A048;
    --partial-tile-foreground: #533A20;
    --hinted-tile: #D8A28C;
    --hinted-tile-foreground: #4A2E1D;
    --final-tile: #F0A020;
    --final-tile-foreground: #FAF3E0;
    --late-completion: #C9974B;
    --late-completion-foreground: #FAF3E0;
}

body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 90dvh;
    margin: 0;
    background-color: var(--overall-background);
    color: var(--overall-foreground);
    -webkit-user-select: none; /* Safari */
    -ms-user-select: none; /* IE 10 and IE 11 */
    user-select: none; /* Standard syntax */
    font-family: "Times New Roman", Times, serif;
}
.toolbar-area {
    width: 100vmin;
    height: 10dvh;
    display: flex;
    justify-content: space-around;
    align-items: center;
}
.toolbar-button {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--overall-foreground);
    padding-inline: 0px; /* Workaround for the inline padding setting in the iPhone's user agent style sheet. */
}
.button-font-size {
    font-size: 9vmin;
}
.modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60%;
    max-height: 100%;
    background: white;
    padding: 1vmin;
    border: 2px solid var(--overall-foreground);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    text-align: center;
    z-index: 100;
    font-size: 5vmin;
}
.modal h1 {
    font-size: 6vmin;
}
.modal .close-button,.close-button-hideable {
    background: var(--grid-background);
    border: none;
    padding: 1vmin 2vmin;
    cursor: pointer;
    color: white;
    font-size: 4vmin;
}
.modal-wide,.modal-fullscreen {
    width: 70%;
}
.modal-badge p {
    margin-left:  4vmin;
    margin-right: 4vmin;
}
.modal-complete {
    top: auto;
    bottom: 0%;
    transform: translate(-50%, -10%);
}
.clue-image-full {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 100vw;
    max-height: 100dvh;
    z-index: 100;
    background: var(--overall-background);
}
div.clue-image-full {
    display: none;
    height: 100%;
    width: 100%;
}
.play-area-normal,.play-area-peek {
    width: 90vmin;
    height: 90vmin;
    display: grid;
    gap: 2px;
    padding: 5px;
    box-sizing: border-box;
}
.play-area-normal {
    background-color: var(--grid-background);
    border: 2px solid var(--grid-lines);
}
.play-area-peek {
    border: 2px solid var(--overall-background);
}
.play-area-normal div {
    background-color: var(--grid-background);
    border: 1px solid var(--grid-lines);
}
.peek {
    background-color: var(--grid-background);
    border: 2px solid var(--grid-lines);
}

.holding-area {
    width: 90vmin;
    height: 50vmin;
    display: grid;
    padding: 5px;
}
.button-square {
    margin: auto;
    width: 100%;
    height: 100%;
    display: inline-grid;
    text-align: center;
    align-content: center;
}
.tile {
    width: 100%;
    height: 100%;
    border-radius: 4px;
    position: absolute;
    touch-action: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 5vmin;
    font-weight: bold;
    box-sizing: border-box;
}
.tile-neutral {
    background-color: var(--neutral-tile) !important;
    color: var(--neutral-tile-foreground);
    border: 1px solid var(--neutral-tile-foreground) !important;
    transition: top 0.4s, left 0.4s;
}
.tile-moving {
    background-color: var(--moving-tile) !important;
    color: var(--moving-tile-foreground);
    border: 1px solid var(--moving-tile-foreground);
    box-shadow: 0 8px 12px rgba(0, 0, 0, 0.3);
}
.tile-partial {
    background-color: var(--partial-tile) !important;
    color: var(--partial-tile-foreground);
    border: 1px solid var(--partial-tile-foreground) !important;
    /*transition: top 0.1s ease-out, left 0.1s ease-out;*/
}
.tile-final {
    background-color: var(--final-tile) !important;
/*    color: var(--final-tile-foreground);
    border: 2px solid var(--overall-foreground) !important;*/
}
.tile-hinted,.tile-hinted-final {
    background-color: var(--hinted-tile) !important;
    color: var(--hinted-tile-foreground) !important; /* Decided on option B. */

    border: 1px solid var(--hinted-tile-foreground) !important;
    transition: top 0.4s, left 0.4s;
}
.tile-final,.tile-hinted-final {
    color: var(--final-tile-foreground) !important;
    border: 2px solid var(--overall-foreground) !important;
}

/* "Call to action" button, visually distinct from the small "Close" button. */
.cta-button {
    display: flex;
    border-radius: 4px;
    justify-content: center;
    align-items: center;
    /*height: 5dvh;*/
    font-size: 5vmin;
    font-family: inherit;
}
.cta-grid {
    display: grid;
    text-align: left;
    padding-bottom: 4dvh;
    padding-left: 4dvh;
    padding-right: 4dvh;
}

.history-nav-bar {
    display: grid;
    grid-template-columns: auto auto auto;
}
.history-grid {
    display: grid;
    align-content: space-evenly;
    grid-template-columns: auto auto;
    align-items: center;
    color: var(--neutral-tile-foreground);
    row-gap: 2dvh;
    padding-bottom: 4dvh;
    padding-left: 4dvh;
    padding-right: 4dvh;
}
.history-label {
    display: flex;
}
.history-current {
    font-weight: bold;
}
/* For general-purpose Call To Action buttons. */
.history-button-notstarted,.cta-button {
    background-color: var(--neutral-tile);
    color: var(--neutral-tile-foreground);
    border: 1px solid var(--neutral-tile-foreground);
}
/* For actions on the current game. */
.history-button-current,.cta-button-current {
    background-color: var(--overall-background);
    color: var(--overall-foreground);
    border: 1px solid var(--overall-foreground);
}
/* For default or singular actions. */
.history-button-inprogress,.cta-button-strong {
    background-color: var(--partial-tile);
    color: var(--partial-tile-foreground);
    border: 1px solid var(--partial-tile-foreground);
}
.history-button-extendsstreak {
    background-color: var(--final-tile);
    color: var(--final-tile-foreground);
    border: 1px solid var(--overall-foreground); /* For consistency with the actual final tiles. */
}
.history-button-late {
    background-color: var(--late-completion);
    color: var(--late-completion-foreground);
    border: 1px solid var(--overall-foreground); /* For consistency with the actual final tiles. */
}
/*.history-button-archived {
    background-color: var(--archived-tile);
    color: var(--archived-tile-foreground);
    border: 1px solid var(--archived-tile-foreground);
}*/
.settings-grid {
    grid-template-columns: auto auto;
    row-gap: 6vmin;
    column-gap: 2vmin;
}
.gameload-grid,.thisgame-grid,.badge-grid {
    grid-template-columns: auto;
    font-size: 5vmin;
    display: grid;
    align-content: space-evenly;
    align-items: center;
    color: var(--neutral-tile-foreground);
    row-gap: 2dvh;
    padding-bottom: 4dvh;
    padding-left: 4dvh;
    padding-right: 4dvh;
}
input {
    accent-color: var(--grid-background);
}
a {
    text-decoration-line: none;
}

/* Overrides for the landscape layout. */
@media only screen and (orientation: landscape) {

    .main-container {
	width: 100%;
	display: grid;
	grid-template-columns: 45% 55%;
    }

    .play-column {
	display: grid;
	justify-content: center;
    }

    .modal {
	position: relative;
	font-size: 3.8vmin;
    }

    .modal h1 {
	/* Date wraps at 5vmin. */
	font-size: 4.5vmin;
    }
    
    .modal-wide {
	width: 80%;
    }

    .modal-fullscreen {
	/* The Help modal will need to be centered in Landscape. */
	position: absolute;
	width: 60%;
    }

    .thisgame-grid,.gameload-grid {
	font-size: 4vmin;
    }
    
    .history-button,.cta-button {
	font-size: 4vmin;
    }

    .close-button,.close-button-hideable {
	/*font-size: 3vmin;*/
    }
    /* Any modal that can be accessed directly from a button need not have a Close button? */
    .close-button-hideable {
	display: none;
    }
}
