body {
    background: url('../images/ui/bg/perchment.jpg');
    background-size: cover;
    background-attachment: fixed;
    margin: 0;
    color: white;
    font-family: stoneserif;
}

button {
    font-family: stoneserif;
}

@font-face {
  font-family: goudy;
  src: url('../fonts/planewalker.otf');
  font-weight: 700;
}

@font-face {
  font-family: stoneserif;
  src: url('../fonts/stoneserif.otf');
  font-weight: 700;
}

.red-button {
    display: flex;
    justify-content: center;
    align-items: center;
    background: url('../images/ui/menu/button1.png');
    width: 200px;
    height: 58px;
    color: white;
    font-family: goudy;
    font-size: 1.5em;
    cursor: pointer;
}

.red-button:hover {
    background: url('../images/ui/menu/button2.png');
}

.red-button:active {
    background: url('../images/ui/menu/button3.png');
}

.preload img{
    opacity: 0;
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
}

#top-menu-button {
    position: absolute;
    top: 25px;
    left: 10px;
    z-index: 4;
    transform: scale(0.75);
}

#centered-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100vw;
    /*height: 100vh;*/
    max-width: 430px;
    /*max-height: 800px; /*932px;*/
    aspect-ratio: 9 / 16;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    border-radius: 16px;
}

.border-wrapper {
    position: relative;
    width: 100%;
    /*height: 100%;*/
    display: grid;
    grid-template-areas:
        "corner1 border-up corner2"
        "border-left content-inner border-right"
        "corner3 border-down corner4";
    grid-template-columns: 20px 1fr 20px;
    grid-template-rows: 20px 1fr 20px;
    box-sizing: border-box;
}

.corner {
    width: 20px;
    height: 20px;
    background-size: cover;
    background-repeat: no-repeat;
}

.corner1 {
    grid-area: corner1;
    background-image: url('../images/ui/borders/corner1.png');
}
.corner2 {
    grid-area: corner2;
    background-image: url('../images/ui/borders/corner2.png');
}
.corner3 {
    grid-area: corner3;
    background-image: url('../images/ui/borders/corner3.png');
}
.corner4 {
    grid-area: corner4;
    background-image: url('../images/ui/borders/corner4.png');
}

.border {
    background-repeat: repeat;
    background-size: contain;
}

.border-up {
    grid-area: border-up;
    height: 20px;
    background-image: url('../images/ui/borders/border_top.png');
    background-size: 100% 20px;
}
.border-down {
    grid-area: border-down;
    height: 20px;
    background-image: url('../images/ui/borders/border_bottom.png');
    background-size: 100% 20px;
}
.border-left {
    grid-area: border-left;
    width: 20px;
    background-image: url('../images/ui/borders/border_left.png');
    background-size: 20px 100%;
}
.border-right {
    grid-area: border-right;
    width: 20px;
    background-image: url('../images/ui/borders/border_right.png');
    background-size: 20px 100%;
}

.content-inner {
    grid-area: content-inner;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    height: 100%;
    width: 100%;
    background-image: url('../images/ui/bg/stone.jpg');
    background-size: cover;
    padding: 12px;
    margin: -12px;
}


#header,
#menu,
#footer {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 12px;
    flex-direction: row;
    background: rgba(0,0,0,0.5);
    margin: -0px;
}

#header {
    height: 275px;
}

#header #region-image {
    position: absolute;
    top: 20px;
    left: 20px;
    width: calc(100% - 40px);
    height: 275px;
    overflow: hidden;
    object-fit: cover;
    opacity: 0.5;
    z-index: 0;
    pointer-events: none;
}

#header #region-image img {
    width: 100%;
}

#header #character-image {
    position: absolute;
    z-index: 1;
    bottom: 0;
    top: 0;
    top: 20px;
    left: 20px;
    width: 100%;
    height: 275px;
    overflow: hidden;
}

#header #character-image img {
    width: 200px;
    position: absolute;
    bottom: 0;
    z-index: 3;
}

#header #character-image .image-shadow {
    width: 200px;
    position: absolute;
    bottom: -4px;
    left: 4px;
    z-index: 2;
    filter: brightness(0) invert(0);
    display: inline;
    opacity: 0.5;
}

#header #character-tooltip {
    background: url('../images/ui/interactions/tooltip.png');
    background-size: cover;
    width: 200px;
    aspect-ratio: 377 / 276;
    z-index: 4;
    position: absolute;
    top: 30px;
    right: 30px;
}

#header #character-tooltip #tooltip-text {
    padding: 15px 15px 10px 20px;
    color: black;
}

#header #tiles-wrapper {
    z-index: 10;
    width: 50%;
    width: 100%;
    text-align: right;
    padding: 15px;
    margin-top: 150px;
    font-size: 0.8em;
}

#header #tiles-wrapper #tiles {
    height: 92px;
}

#header #tiles-wrapper #tiles .tile {
    background: url('../images/ui/boxes/tile.png') no-repeat center;
    width: 48px;
    height: 92px;
    display: inline-block;
    vertical-align: middle;
    opacity: 0;
    padding-left: 20px;
    padding-top: 40px;
    margin-top: -20px;
    margin-left: -10px;
    cursor: pointer;
}

#header #tiles-wrapper #tiles .tile img {
    width: 25px;
    display: block;
}

#header #tiles-wrapper #tiles .mana-hidden {
    display: none;
}

#header #tiles-wrapper #tiles-text {
    opacity: 0;
}

.mana {
    position: relative;
    display: inline-block;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: white;
}

.mana img {
    width: 22px;
    position: absolute;
    top: 1px;
    left: 1px;
}

.pulse {
    animation: pulse-scale 0.05s linear infinite alternate;
    filter: brightness(1.1);
}

.selected {
    animation: pulse-scale 0.5s linear infinite alternate;
    filter: brightness(1.3);
}

@keyframes pulse-scale {
    from {
        transform: scale(1);
    }
    to {
        transform: scale(1.2);
    }
}

.mana.green {
    background: #a3c095;
}

.mana.red {
    background: #fcb392;
}

.mana.blue {
    background: #a8e0f9;
}

.mana.white {
    background: #fffdea;
}

.mana.black {
    background: #d5cfcf;
}

.mana-text {
    margin-right: 3px;
}

#menu {
    height: 60px;
    background: rgba(0,0,0,0.7);
}

#menu button {
    height: 44px;
    min-width: 44px;
    background: rgba(255,255,255,0);
    border: 0;
    border-right: 1px solid rgba(0,0,0,0.5);
    margin: 0;
    padding: 0 20px;
    color: #fff;
    cursor: pointer;
    outline: none;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: grayscale(1);
}

#menu button:last-child {
    border-right: none;
}

#menu button:hover, #menu button:focus {
    background: rgba(255,255,255,0.05);
    filter: none;
    transition: background 0.2s, filter 0.2s;
}

#footer {
    align-self: flex-end;
    aspect-ratio: 1 / 1;
    background: rgba(0,0,0,1);
}

/* To stack them vertically, ensure their parent uses flex-direction: column */
.content-inner {
    flex-direction: column;
}

#overlay,
#alert {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.9);
    z-index: 9999;
    display: none;
}

#alert {
    background: rgba(0,0,0,0.3);
}

#overlay .centered,
#alert .centered {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
}

#overlay-menu {
    display: flex;
    flex-direction: column;
    gap: 0px;
    align-items: center;
    background: url('../images/ui/logo/TalesoftaleS.png') center top no-repeat;
    width: 100vw;
    padding-top: 135px;
    margin-top: -135px;
}

#alert-menu {
    width: 300px;
    height: 100px;
    background: url('../images/ui/bg/perchment.jpg') center top;
    box-shadow: 4px 4px 0 0 rgb(0, 0, 0);
    border: 1px solid black;
}

#alert-menu #alert-text {
    color: black;
    margin: 15px; 
}

#alert-menu #alert-buttons {
    text-align: center;
    position: absolute;
    bottom: 15px;
    width: 100%;
}

#alert-menu #alert-buttons button {
    border: 0;
    box-shadow: 2px 2px 0 0 rgb(0, 0, 0);
    background: url('../images/ui/menu/stone_button.png');
    color: #ccc;
    font-size: 1em;
    padding: 5px;
    width: 100px;
    cursor: pointer;
}

#alert-menu #alert-buttons button:hover {
    border: 0;
    color: white;
}

#alert-menu #alert-buttons button:active {
    border: 0;
    box-shadow: -1px -1px rgb(0, 0, 0);
}