/* Font Imports */

@import url('https://fonts.googleapis.com/css2?family=Chakra+Petch:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300;1,400;1,500;1,600;1,700&family=Noto+Color+Emoji&family=Noto+Emoji:wght@300..700&display=swap');


/* CSS Variables */
:root {
    --game-screen-scale: 34;
    --statistics-screen-scale: calc((100 - var(--game-screen-scale)) / 2);
    --logs-screen-scale: calc((100 - var(--game-screen-scale)) / 2);
    --slot-size: min(calc(var(--slot-scale) * (1vw * var(--game-screen-scale) / 100)), calc(var(--slot-scale) * 1vh));
    --standard-shadow: 0px 0px 8px 1px black;
    --highlight-shadow: 0px 0px 8px 1px lawngreen;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 5px;
}

::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 5px;
}

::-webkit-scrollbar-track {
    background: #1A1B26;
}

/* Font Definitions */
@font-face {
    font-family: 'Noto Color Emoji';
    unicode-range: U+1F300-1F5FF, U+1F600-1F64F;
}

/* Base Styles */

body,
button,
input,
select {
    font-family: 'Handjet';
    font-family: 'Sixtyfour Convergence';
    font-family: 'Press Start 2P';
    font-family: 'Silkscreen';
    font-family: 'Tomorrow';
    font-family: 'Nova Square';
    font-family: 'Goldman';
    font-family: 'Electrolize';
    font-family: 'Oxanium';
    font-family: 'Chakra Petch', 'Noto Color Emoji';
    color: beige;
    font-size: 16px;
    text-shadow: 0 0 8px black;
    background-size: 100% 100%;
    background-position: center center;
    background-origin: border-box;
}

body {
    background-color: black;
    margin: 0;
    display: flex;
    flex-direction: row;
    min-height: 100vh;
    touch-action: manipulation;
    text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
    background-size: cover;
}

button {
    flex: auto;
    border: none;
    transition: box-shadow 0.2s;
}

/* Table Styling */
table {
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    line-height: 1;
    border-radius: 10px;
}

td {
    padding: 0;
    vertical-align: middle;
    text-align: center;
    width: var(--slot-size);
    height: var(--slot-size);
    position: relative;
    overflow: hidden;
    text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
    transition: box-shadow 0.2s;
}

td span {
    align-content: center;
    /*display: grid;*/
    background-size: cover;
}

tr {
    height: var(--slot-size);
    white-space: nowrap;
}

tr:first-child td:first-child {
    border-top-left-radius: 10px;
}

tr:first-child td:last-child {
    border-top-right-radius: 10px;
}

tr:last-child td:first-child {
    border-bottom-left-radius: 10px;
}

tr:last-child td:last-child {
    border-bottom-right-radius: 10px;
}

.statistics-left tr:first-child td:first-child {
    border-top-left-radius: 25px;
}

.statistics-left tr:first-child td:last-child {
    border-top-right-radius: 25px;
}

.statistics-left tr:last-child td:first-child {
    border-bottom-left-radius: 25px;
}

.statistics-left tr:last-child td:last-child {
    border-bottom-right-radius: 25px;
}

.statistics-right tr:first-child td:first-child {
    border-top-left-radius: 25px;
}

.statistics-right tr:first-child td:last-child {
    border-top-right-radius: 25px;
}

.statistics-right tr:last-child td:first-child {
    border-bottom-left-radius: 25px;
}

.statistics-right tr:last-child td:last-child {
    border-bottom-right-radius: 25px;
}


/* Game Layout */
#central-game-field {
    display: flex;
    flex-direction: column;
    width: calc(var(--game-screen-scale) * 1vw);
    box-sizing: border-box;
    padding-inline: 2vw;
    justify-content: space-evenly;
    max-height: 100vh;
}

#central-game-field table {
    box-shadow: var(--standard-shadow);
}

.game-main-buttons-container {
    height: calc((var(--slot-size)) / 2);
}

.statistics-left,
.statistics-right {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    width: calc(var(--statistics-screen-scale) * 1vw);
    overflow-y: auto;
}

.statistics-left-buttons-container,
.statistics-right-buttons-container {
    display: none;
}

.statistics-right-content-container,
.statistics-left-content-container {
    height: 98vh;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1vh;
}


/* Slots and Containers */
.container {
    cursor: pointer;
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 2;
}

.container:hover {
    z-index: 100 !important;
}

.container:hover .thing-tooltip {
    flex-direction: column;
    display: flex;
}

.tooltips-disabled .thing-tooltip {
    display: none !important;
}

.container.dragging .thing-tooltip {
    display: none !important;
}

.player-inventory-slot,
.player-equipment-slot,
.player-skills-slot,
.enemy-equipment-slot,
.enemy-skills-slot,
.new-skills-slot,
.new-things-slot {
    position: relative;
    width: var(--slot-size);
    height: var(--slot-size);
    margin: 0;
    padding: 0;
}


/* Tooltips */
.thing-tooltip {
    font-size: 1vw;
    display: none;
    position: fixed;
    background: #000;
    box-shadow: 0 0 10px 1px black;
    padding: 5px;
    border-radius: 10px;
    z-index: 1000;
    max-width: 50vw;
}

.in-tooltip-description {
    padding-left: 1.5vw;
    text-align: left;
    white-space: pre-wrap;
}

.thing-tooltip td {
    width: auto;
    min-width: 1.5vw;
    height: auto;
    padding: 5px;
}

.thing-tooltip tr {
    height: auto;
}


.thing-tooltip-type,
.thing-tooltip-stats,
.thing-tooltip-modificators {
    align-items: flex-start;
    margin: 1vh;
}


/* Status Bars */
.player-character-bars,
.enemy-character-bars {
    width: min(calc(var(--slot-scale) * (3vw * var(--game-screen-scale) / 100)), calc(var(--slot-scale) * 3vh));
    border-radius: 5px;
    margin-bottom: 5px;
    padding-bottom: 5px;
}

.enemy-character-bars {
    display: none;
}

.player-health-bar,
.player-shield-bar,
.enemy-health-bar,
.enemy-shield-bar {
    z-index: 20;
    width: 100%;
    height: 25px;
    background: #444;
    position: relative;
    margin: 3px 0;
    border-radius: 10px;
    overflow: hidden;
    outline: 2px solid black;
}

.player-health-bar,
.enemy-health-bar {
    box-shadow: 3px 0px 10px 0px black;
}

.player-shield-bar,
.enemy-shield-bar {
    margin-bottom: 10px;
    box-shadow: 0px 3px 10px 0px black;
}

.player-health-fill,
.enemy-health-fill {
    background: #d93636;
    height: 100%;
    transition: width 0.3s ease-in-out;
}

.player-shield-fill,
.enemy-shield-fill {
    background: #d1b02d;
    height: 100%;
    transition: width 0.3s ease-in-out;
}

.player-health-text,
.player-shield-text,
.enemy-health-text,
.enemy-shield-text {
    z-index: 40;
    position: absolute;
    top: 0px;
    width: 100%;
    text-align: center;
    line-height: 26px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2px;
}


/* Battle Log */
.battle-log-message {
    position: relative;
    display: flex;
    flex-direction: column;
    border: 1px solid black;
    box-sizing: border-box;
    padding: 5px;
    background-color: rgb(0, 0, 0, 0.4);
    width: 100%;
    box-shadow: inset 0 0 20px 1px black;
    border-radius: 10px 0 0 10px;
    transition: box-shadow 0.2s;
}

.game-log-text {
    flex: 0.7;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    width: 100%;
    justify-content: start;
    border-radius: 10px 0 0 10px;
}

.last-log-message {
    height: -webkit-fill-available;
    width: 100%;
    box-sizing: border-box;
    overflow-y: auto;
    margin-bottom: 1vh;
    border-radius: 10px;
    transition: box-shadow 0.2s;
}

.last-log-message .battle-log-message {
    border-radius: 10px;
}


/* Buttons */
#resume-button,
#retreat-button {
    box-shadow: 0 0 10px 1px black;
    background-color: rgb(0, 0, 0, 0.4);
    border-radius: 10px;
    position: relative;
    display: flex;
    flex-direction: column-reverse;
    flex: none;
    justify-content: space-around;
    align-items: center;
    visibility: hidden;
    width: min(calc(var(--slot-scale) * (3vw * var(--game-screen-scale) / 100)), calc(var(--slot-scale) * 3vh));
    height: 100%;
}

#resolve-loot-button,
#finish-choice-button {
    box-shadow: 0 0 10px 1px black;
    background-color: rgb(0, 0, 0, 0.4);
    border-radius: 10px;
    position: relative;
    display: flex;
    flex: none;
    flex-direction: column-reverse;
    justify-content: space-around;
    align-items: center;
    visibility: hidden;
    margin-top: calc(-1 * (var(--slot-size)) / 2);
    width: calc(var(--game-screen-scale) * 1vw - 4vw);
    ;
    height: 100%;
}


/* Hover Effects */
#player-equipment:hover,
#player-inventory:hover,
#enemy-equipment:hover,
#enemy-skills:hover,
#player-skills:hover,
.player-character-bars:hover,
.enemy-character-bars:hover,
.last-log-message:hover,
#choice-container:hover,
#resume-button:hover,
#retreat-button:hover,
#resolve-loot-button:hover,
#finish-choice-button:hover {
    border-color: lawngreen;
    box-shadow: var(--highlight-shadow);
    z-index: 10;
    transition: box-shadow 0.2s;
}

.player-character-bars:hover,
.enemy-character-bars:hover {
    padding: 5px;
    margin: -5px -5px 5px -5px;
}


/* Charts */
#battle-charts-container {
    flex: 0.3;
    border-radius: 10px 10px 0 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    background-color: black;
}

#battle-chart {
    padding: 5px;
    width: 100% !important;
}

.chart-tabs {
    display: flex;
    margin-bottom: 15px;
    gap: 10px;
    padding: 10px 10px 0px 10px;
}

.chart-tab {
    padding: 8px 15px;
    border: none;
    background: #2c3942;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.chart-tab.active {
    background: #4CAF50;
    color: white;
}

.chart-container {
    height: 400px;
    position: relative;
}


/* Selection Highlights */
.selected-slot-white,
.selected-slot-lawngreen,
.selected-slot-darkblue,
.selected-slot-darkviolet,
.selected-slot-darkred {
    z-index: 5;
    transition-duration: 0.2s;
}

.selected-slot-white {
    border-color: white;
    box-shadow: 0px 0px 15px 0px #ffffffd9;
}

.selected-slot-lawngreen {
    border-color: lawngreen;
    box-shadow: var(--highlight-shadow);
}

.selected-slot-darkblue {
    border-color: darkblue;
    box-shadow: 0px 0px 8px 1px darkblue;
}

.selected-slot-darkviolet {
    border-color: darkviolet;
    box-shadow: 0px 0px 8px 1px darkviolet;
}

.selected-slot-darkred {
    border-color: darkred;
    box-shadow: 0px 0px 8px 1px darkred;
}






/* not sorted */
.retreat-resume-buttons-container {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    height: 100%;
}

.applied-effect-container {
    display: flex;
    flex-direction: row;
    justify-content: start;
    flex-wrap: wrap;
    gap: 5px;
}

.noto-color-emoji-regular {
    font-family: "Noto Color Emoji", sans-serif;
    font-weight: 400;
    font-style: normal;
}

.noto-emoji {
    font-family: "Noto Emoji", sans-serif;
    font-optical-sizing: auto;
    font-weight: 400;
    font-style: normal;
}

.game-log-and-charts {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.player-income-effects {
    display: flex;
    flex-direction: row;
    justify-content: start;
    gap: 1em;
    overflow: auto;
    font-size: 1vw;
}

.enemy-income-effects {
    display: flex;
    flex-direction: row;
    justify-content: end;
    gap: 1em;
    overflow: auto;
    font-size: 1vw;
}

.player-income-poison,
.player-income-burn,
.player-income-freeze,
.enemy-income-poison,
.enemy-income-burn,
.enemy-income-freeze {
    display: flex;
    flex-direction: column;
    font-size: 150%;
    align-items: center;
    gap: 0.15em;
}


.stat-section {
    display: flex;
    flex-direction: column;
    justify-content: center;
    background-size: 100% 100%;
    background-position: center;
    background-origin: border-box;
    background-clip: content-box;
}

.test-buttons {
    position: absolute;
    top: 2%;
    left: 49%;
    content-visibility: hidden;
    width: 100px;
    height: 100px;
    z-index: 10000;
    overflow: visible;
    color: green;
}

.test-buttons button {
    background-color: black;
    color: white;
    width: 100%;
    text-align: center;

}

.test-buttons:hover {
    background-color: black;
}


.test-buttons:hover {
    content-visibility: visible;
}

.source-bonus-highlight,
.target-bonus-highlight {
    transition-duration: 0.2s;
    color: #4aff4a;
}


.missing-source-bonus-highlight,
.missing-target-bonus-highlight {
    transition-duration: 0.2s;
    color: #ff3f3f;
}

.round-stage-info {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    white-space: nowrap;
    font-size: 1vw;
    padding: 1vh;
    box-sizing: border-box;
    height: 2vh;
}

#statistics-right-game-log,
#statistics-left-game-log {
    position: relative;
    display: flex;
    border: 1px solid black;
    border-radius: 5px;
}

.stat-container {
    display: flex;
    flex-direction: column;
    background-size: 100% 100%;
    background-position: center;
    background-origin: border-box;
    background-clip: content-box;
    /*border-radius: 25px;*/
}

.statistics-left td,
.statistics-right td {
    display: inline-grid;
    height: calc((100 / 5 * 1vh) - 1vh);
    width: calc(var(--statistics-screen-scale) * 0.33vw - 13px);
    overflow-y: auto;
    box-sizing: border-box;
    background-size: cover;
    background-position: center;
    background-origin: border-box;
    background-clip: content-box;
    /*border-radius: 25px;*/
}

.statistics-left tr:last-child td:last-child,
.statistics-right tr:last-child td:last-child {
    border-bottom-right-radius: 25px;
}

.statistics-left tr:first-child td:last-child,
.statistics-right tr:first-child td:last-child {
    border-top-right-radius: 25px;
}

.statistics-left tr:last-child td:first-child,
.statistics-right tr:last-child td:first-child {
    border-bottom-left-radius: 25px;
}

.statistics-left tr:first-child td:first-child,
.statistics-right tr:first-child td:first-child {
    border-top-left-radius: 25px;
}

.statistics-character {
    display: flex;
    flex-direction: column;
    width: calc(var(--statistics-screen-scale) * 0.34vw);
}

.statistics-things {
    display: flex;
    flex-direction: column;
    width: calc(var(--statistics-screen-scale) * 0.66vw);
}

.statistics-player-items,
.statistics-enemy-items {
    align-items: start;
    text-align-last: justify;
    justify-content: flex-end;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 50%;
    padding-bottom: 20px;
}

.statistics-player-skills,
.statistics-enemy-skills {
    align-items: start;
    text-align-last: justify;
    justify-content: flex-start;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 50%;
}

.stat-item-icon {
    width: var(--slot-size);
    height: var(--slot-size);
    border: 1px solid #ffffffa6;
    border-radius: 5px;
    margin: 0 auto 10px auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

.stat-item-stats-icon-tags {
    display: flex;
    flex-flow: wrap;
    flex-direction: row;
    height: auto;
    color: #fff;
    background-size: cover;
    background-position: center;
    background-origin: border-box;
    background-clip: content-box;
    justify-content: center;
    gap: 5%;
}

.skill-stats {
    display: flex;
    flex-direction: column;
    height: auto;
    color: #fff;
    background-size: cover;
    background-position: center;
    background-origin: border-box;
    background-clip: content-box;
    justify-content: space-between;
    font-size: 1vw;
}

.stat-skill-head {
    display: flex;
    flex-flow: wrap;
    flex-direction: column;
    height: 25%;
}

.stat-skill-name {
    margin-top: 15%;
    white-space: pre-wrap;
    max-width: 80%;
    align-self: center;
}

.stat-skill-description {
    white-space: pre-wrap;
    max-width: 70%;
    align-self: center;
    height: 75%;
}

.log-item-img,
.stat-item-stats-icon-tags img,
.skill-stats img {
    cursor: pointer;
    height: 1.2em;
    width: auto;
    align-self: center;
    box-shadow: 0 0 2px black;
    margin-top: -1px;
}

.log-item-img {
    padding-left: 5px;
}

.skill-stats img {
    align-items: center;
    margin-top: auto;
    margin-bottom: auto;
}

.stat-item-stats-icon .container {
    height: auto;
}

.stat-item-stats-tag {
    display: flex;
    flex-direction: row;
    border-radius: 5px;
    justify-content: space-between;
    align-items: center;
    transition: box-shadow 0.2s;
    margin-top: auto;
    margin-bottom: auto;
    padding: 2px 0 2px 0;
}

.tag-green-highlight {
    box-shadow: 0 0 3px 1px lawngreen;
    margin-top: auto;
    margin-bottom: auto;
    padding: 2px 0 2px 0;
    transition: box-shadow 0.2s;
}

.tag-crimson-highlight {
    box-shadow: 0 0 3px 1px crimson;
    margin-top: auto;
    margin-bottom: auto;
    padding: 2px 0 2px 0;
    transition: box-shadow 0.2s;
}

.stat-info-container {
    display: flex;
    flex-direction: column;
    width: calc((var(--statistics-screen-scale) / 26) * 1vw);
    font-size: 150%;
    align-items: center;
    background-size: cover;
    gap: 0.15em;
    transition-property: color;
    transition-duration: 0.2s;
}

.all-stats-info-container {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 5px;
    align-content: center;
    background-size: cover;
    background-position: center;
    background-origin: border-box;
    background-clip: content-box;
}

.statistics-skills {
    justify-content: flex-start;
}

.statistics-left h3,
.statistics-right h3 {
    font-size: unset;
    margin: 10px;
    min-width: 50%;
    max-width: 50%;
    color: #fff;
}

.statistics-left h4,
.statistics-right h4 {
    margin: 5px 0 5px 0;
    color: #aaa;
}

.statistics-left p,
.statistics-right p {
    padding: 0 5px 0 5px;
    margin: 2px 0;
    color: #ddd;
}

.logs {
    display: flex;
    flex-direction: row;
    justify-content: center;
    width: calc(var(--logs-screen-scale) * 1vw);
}

.body-equipment,
.body-inventory-and-skills {
    display: flex;
    justify-content: space-between;
    margin-top: min(calc(var(--slot-scale)* (0.25vw * var(--game-screen-scale) / 100)), calc(var(--slot-scale) * 0.25vh));
}

.body-inventory,
.body-skills,
.body-enemy-skills,
.body-equipment {
    display: flex;
    align-items: start;
}

.body-equipment-right {
    display: contents;
}

.body-stats-and-equipment-left,
.body-stats-and-equipment-right {
    display: flex;
    flex-direction: column;
    width: calc(50vw * var(--game-screen-scale) / 100);
}

.body-stats-and-equipment-left {
    align-items: start;
}

.body-stats-and-equipment-right {
    align-items: end;
}

.trash-bin {
    cursor: help;
    display: flex;
    height: min(calc(var(--slot-scale) * (2vw * var(--game-screen-scale) / 100) + 2px), calc(var(--slot-scale) * 2vh + 2px));
    width: var(--slot-size);
    border-radius: 5px;
    color: #ffffffa6;
    border: 1px solid #00000069;
    justify-content: center;
    align-items: center;
    font-size: xxx-large;
    background-size: 100% 100%;
    background-position: center center;
    background-origin: border-box;
    box-shadow: 0 0 20px 2px black;
    opacity: 0.3;
}

.controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}


.image {
    width: calc(100% - 1px);
    height: calc(100% - 1px);
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

.stat-background-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
    z-index: -1;
}

.stat-background-image-header {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
    z-index: -1;
}

.overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 0;
    transition: height 0.1s linear;
    background: linear-gradient(to top, rgba(255, 255, 255, 0) 50%, rgb(255, 255, 255, 0.5) 100%);
}

#player-equipment,
#player-inventory,
#enemy-equipment {
    position: relative;
    margin-bottom: min(calc(var(--slot-scale)* (0.25vw * var(--game-screen-scale) / 100)), calc(var(--slot-scale) * 0.25vh));
    background-position: center center;
    background-origin: border-box;
    background-size: cover;
    transition-duration: 0.2s;
    transition-property: box-shadow;
}

#player-inventory {
    margin-bottom: 2vh;
}



#enemy-skills,
#player-skills {
    position: relative;
    margin-bottom: min(calc(var(--slot-scale)* (0.25vw * var(--game-screen-scale) / 100)), calc(var(--slot-scale) * 0.25vh));
    background-position: center center;
    background-origin: border-box;
    background-size: cover;
    transition-duration: 0.2s;
    transition-property: box-shadow;
}

#choice-container {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    flex-direction: column;
    align-items: center;
    font-size: 1.5vw;
    gap: 1vh;
    text-align: center;
    margin-top: 7.4vh;
    border-radius: 10px;
}

#choice-container:hover {
    padding: 5px 10px 10px 10px;
    margin: calc(7.4vh - 5px) -10px 10px -10px;
}

.new-skills-slot,
.new-things-slot {
    background-color: rgba(50, 50, 50, 0.5);
}

#new-skills,
#new-things {
    margin-bottom: 10px;
}

.draggable {
    touch-action: none;
}

.dragging {
    border: 2px dashed #666;
}

.slot.dragover {
    background-color: rgba(0, 255, 0, 0.2);
}

.rotate90 {
    display: inline-block;
    transform: rotate(90deg);
    margin-top: -1px;
    margin-bottom: 1px;
    margin-right: 3px;
}

@media (orientation: portrait) {
    .body-inventory-and-skills {
        /*flex-direction: column;*/
        flex-wrap: wrap;
    }

    .statistics-left,
    .statistics-right {
        display: none;
    }

    :root {
        --game-screen-scale: 100;
        --statistics-screen-scale: 100;
        --logs-screen-scale: 100;
    }
}

@media (orientation: landscape) {

    .body-equipment,
    .body-inventory-and-skills {
        flex-direction: row;
    }

    .statistics-left,
    .statistics-right {
        display: flex;
    }
}