/* ========================= */
/* ===== General Styles ==== */
/* ========================= */

body {
    margin: 0 1em;
    background: #FAF8EF;
    min-width: 610px;
    width: auto;
}

.head {
    padding: 5px;
    margin-bottom: 10px;
}

h1 {
    margin: 0.25em 0;
    float: left;
}

h3 {
    margin: 0;
    margin-bottom: 0.5em;
}

#aboutlink, #ruleslink, #close-about, #close-rules {
    margin: 1em !important;
    float: right;
}

#ruleslink2 {
    max-width: 40px;
}


/* ========================= */
/* = About & Rules Section = */
/* ========================= */

.rules, .about, .close {
    max-height: 0;
    overflow: hidden;
    margin-top: 5px;
    margin-left: 25px;
    margin-right: 25px;
    margin-bottom: 0px;
    padding: 0 25px;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 5px;
    box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
    transition: max-height 0.5s ease-in-out, padding 0.5s ease-in-out;
}

.rules.show, .about.show {
    max-height: 10000px;
    padding: 10px 25px;
    margin-top: 50px;
    margin-left: 25px;
    margin-right: 25px;
    margin-bottom: 25px;
}

.main-list {
    list-style-type: none;
    padding-left: 0;
    font-size: 14px;
}

.main-list > li {
    margin-bottom: 6px;
    line-height: 1.4;
}

.main-list > li > b {
    display: inline-block;
    min-width: 160px;
}

.sub-list {
    list-style-type: disc;
    padding-left: 2em;
    margin-top: 4px;
    font-size: 14px;
}

.sub-list li b {
    min-width: auto;
}

.winning-images {
  width: 100%;
  max-width: 700px;
  margin: 2em auto;
  border-collapse: collapse;
  text-align: center;
}
.winning-images td {
  padding: 0 20px;
  vertical-align: top;
}

.winning-images img {
  width: 100%;
  max-width: 300px;
  border-radius: 5px;
  margin-bottom: -0.3em;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.winning-images .caption {
  font-size: 0.9em;
  margin-bottom: 2em;
}

.color-ring {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    margin: 0 5px;
    vertical-align: middle;
    border: 4px solid currentColor;
    background-color: transparent;
}
.color-circle {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    margin: 0 5px;
    vertical-align: middle;
    border: 4px solid currentColor;
    background-color: currentColor;
}


/* ========================= */
/* === Navigation Styles === */
/* ========================= */

nav {
    width: 15em;
}

nav ul {
    padding-left: 0em;
}

nav > ul > li > a, nav label, #messages, #ruleslink, #ruleslink2, #aboutlink, #close-about, #close-rules {
    cursor: pointer;
    display: block;
    padding: 0.25em;
    margin: 0.25em 0;
    border-radius: 5px;
    background: #BBADA0;
    color: #fff;
    text-decoration: none;
}

@media (min-width: 1025px) {
    nav > ul > li > a, nav label, #messages {
        padding: 0.5em;
        margin: 0.5em 0;
        border-radius: 5px;
    }
}

nav input[type="checkbox"] {
    margin-right: 0.5em;
}


/* ========================= */
/* == Main Content/Layout == */
/* ========================= */

.wrap {
    overflow: hidden;
    clear: both;
}

.wrap main {
    float: left;
    margin-right: 1em;
    margin-bottom: 1em;
}

.wrap main #messages, .wrap main #gamedate {
    margin-top: 1em;
    overflow: hidden;
}

.wrap aside {
    float: left;
    margin-left: 1em;
    margin-right: 1em;
    margin-bottom: 1em;
}


/* ========================= */
/* === Game-Status Box === */
/* ========================= */

#gameinfo {
    background: #EEE4DA;
    padding: 10px;
    margin: 10px 0;
    border-radius: 5px;
    font-size: 16px;
    text-align: center;
}

.gameinfo-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    column-gap: 20px;
    align-items: center;
}

.game-title {
    grid-row: 1 / span 2;
    grid-row: 1;
    font-size: 3em;
    font-weight: bold;
    align-self: center;
    justify-self: center;   
}

#game-status {
    background: #EEE4DA;
    padding: 10px;
    margin: 10px 0;
    border-radius: 5px;
    font-size: 16px;
    text-align: left;
    width: 260px;
}

#game-status p {
    margin: 5px 0;
}

#current-player, #selected-piece {
    font-weight: bold;
    color: black;
}

.player-red {
    color: red !important;
}

.player-black {
    color: black !important;
}

.end-message {
    margin-top: 0.5em;
    color: var(--accent-color, #000);
    text-align: left;
    font-weight: bold;
    line-height: 1.35;
}

.hidden {
  display: none;
}


/* ========================= */
/* ========= Board ========= */
/* ========================= */

.board-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 20px;
}

.board-numbers-top {
  width: 420px;
  margin: 0 auto 5px;
  margin-left: 105px;
}

.board-numbers-top .numbers {
  display: flex;
  justify-content: space-between;
}

.board-numbers-left { 
  grid-column: 1; 
  grid-row: 1; 
  display: flex; 
  flex-direction: column; 
  gap: 40px; 
  margin-right: 5px;
  margin-top: 55px; 
}

.number {
    width: 50px;
    height: 50px;
    text-align: center;
    font-weight: bold;
    line-height: 50px;
    font-size: 20px;
}

.board-content {
  display: grid;
  grid-template-columns: 50px auto;
  grid-auto-rows: auto;
  column-gap: 5px;
  align-items: start;
}

.board {
    grid-column: 2;
    grid-row: 1;
    display: grid;
    grid-template-columns: repeat(5, 50px);
    grid-template-rows: repeat(5, 50px);
    gap: 40px;
    background-color: #BBADA0;
    padding: 40px;
    border-radius: 10px;
    width: 420px;
    height: 420px;
    border: 10px solid black;
    position: relative;
}

.background-board {
    background-image: url('../images/Spielfeld.png');
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 0;
    pointer-events: none;
    width: 364px;
    height: 364px;
    margin: 69px
}

.cell {
    width: 60px;
    height: 60px;
    background-color: #EEE4DA;
    border-radius: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    position: relative;
    z-index: 1;
}

.cell.cell-highlight {
    background-color: #dcb418;
}

.cell.selected {
    background-color: #f7e290 !important;
}

.cell.movable {
    background-color: #d25e00
}

.piece {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.piece.black {
    background-color: black;
}

.piece.red {
    background-color: #a20023;
}

.move-score {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: bold;
    font-size: 14px;
    z-index: 3;
    color: white;
    border: 2px solid #EEE4DA;
    border-radius:  50%;
    min-width: 18px;
    min-height: 18px;
    line-height: 18px;
    text-align: center;
    background-color: #EEE4DA;
    pointer-events: none;
}

.move-score.win {
    color: #01b301;
}

.move-score.loss {
    color: rgb(255, 0, 0);
}

.move-score.draw {
    color: #adadad;
}

.recommend-marker {
    position: absolute;
    top: 25%;
    left: 25%;
    transform: translate(-135%, 5%);
    font-weight: bold;
    color: rgb(225, 255, 0);
    font-size: 1em;
    pointer-events: none;
}

.arrow-layer {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 0;
}


/* ========================= */
/* ===== Message Boxes ===== */
/* ========================= */

#messages {
  grid-column: 2; 
  grid-row: 2; 
  justify-self: center;
  width: 420px;
  margin: 10px 0 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}

.message {
    line-height: 1.5;
    font-size: 16px;
    font-weight: bold;
    max-width: 360px;
    word-wrap: break-word;
    white-space: normal;
    width: 100%;
    text-align: center;
}

#error {
    color: red;
}

#info {
    color: black;
}

.hidden {
    display: none;
}


/* ========================= */
/* ======= Game-Date ======= */
/* ========================= */

.game-date {
    grid-column: 2;
    grid-row: 3;
    justify-self: center;
    font-size: 14px;
    font-weight: bold;
    color: #000000;
    text-align: center;
    margin-top: 10px;
}


/* ========================= */
/* ==== Buttons & Menus ==== */
/* ========================= */

#savegameName {
    width: calc(100% - 16px);
    padding: 6px;
    font-size: 12px;
    border: 1px solid #BBADA0;
    border-radius: 5px;
    margin-bottom: 5px;
    text-align: center;
}

.menu-button {
    display: block;
    padding: 5px 10px;
    font-size: 14px;
    background: #BBADA0;
    color: white !important;
    text-align: center;
    text-decoration: none !important;
    border-radius: 5px;
    margin-top: 5px;
    cursor: pointer;
}

.menu-button:hover {
    background: #A89A8C;
}

.hidden {
    display: none;
}

.game-list .menu-button {
    font-size: 12px;
    padding: 8px 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    display: inline-block;
}

.options-container {
    display: none;
    background: white;
    padding: 15px;
    border-radius: 5px;
    box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
    margin-top: 5px;
    border: 2px solid #BBADA0;
    text-align: center;
}

.game-list {
    list-style: none;
    padding: 0;
    margin: 10px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.game-list li {
    width: 100%;
    display: flex;
    justify-content: center;
}

.game-list a {
    display: block;
    padding: 10px;
    font-size: 14px;
    background: #BBADA0;
    color: white;
    text-align: center;
    text-decoration: none;
    border-radius: 5px;
    width: 100%;
    max-width: 200px;
    box-sizing: border-box;
}

.no-games {
    font-style: italic;
    color: gray;
    text-align: center;
    padding: 10px;
}

label.ai-speed { cursor: default !important; }
label.ai-speed * { cursor: default !important; }
label.ai-speed #aiSpeedInput { cursor: pointer !important; }

.optionsaialevel {
  pointer-events: none;
}

.optionsaialevelselect {
  pointer-events: auto;
  cursor: pointer;
}


/* ========================= */
/* ====== Info Window ====== */
/* ========================= */

#info-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 60%;
    max-width: 400px;
    background: white;
    border-radius: 5px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    padding: 20px;
    text-align: center;
}

#info-modal.show {
    display: block;
}

.modal-content {
    position: relative;
    padding: 20px;
}

#example-image {
    width: 100%;
    height: auto;
    margin-bottom: 10px;
}

#example-description {
    text-align: justify;
    hyphens: auto;
    line-height: 1.5;
    margin-top: 10px;
}

#close-modal {
    position: absolute;
    top: -10px;
    right: -5px;
    font-size: 22px;
    font-weight: bold;
    cursor: pointer;
    background: transparent;
    border: none;
    color: black;
}


/* ========================= */
/* ======== History ======== */
/* ========================= */

.scroll-box {
    max-height: 400px;
    width: 250px;
    overflow-y: auto;
    border-radius: 5px;
    padding-top: 0.5rem;
    padding-bottom: 1rem;
    padding-left: 4rem;
    padding-right: 0.5rem;
    margin-bottom: 1rem;
}

.scroll-box::-webkit-scrollbar {
    width: 8px;
}

.scroll-box::-webkit-scrollbar-thumb {
    background-color: #aaa;
    border-radius: 5px;
}

.scroll-box::-webkit-scrollbar-thumb:hover {
    background-color: #888;
}

#history li, 
#historyForward li {
    margin-left: -1em;
    padding: 0.2em;
    font-family: monospace;
    white-space: pre;
}
