/* ========================= */
/* === Allgemeine 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;
}

/* ========================= */
/* === 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;
}

/* ========================= */
/* === Hauptinhalt/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;
}

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

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

.colour-red {
    color: #a20023 !important;
}

.colour-black {
    color: #000 !important;
}

.colour-yellow {
    color: #dcb418 !important;
}

.colour-white {
    color: #fff !important;
}

.colour-blue {
    color: #0020d2 !important;
}

.hidden-status {
    visibility: hidden;
}

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


/* ========================= */
/* === Available Colours === */
/* ========================= */

#colour-palette { 
    height: 50px;
    display:flex; 
    gap:20px; 
    align-items:center;
    justify-content: center;
    background-color: #EEE4DA;
    border-radius: 5px;
    padding: 5px;
}

.colour-token { 
    position: relative;
    width:35px;
    height:35px;
    border-radius:50%;
    pointer-events: auto;
    cursor: pointer;
}

.colour-token.selected {
    outline: 4px solid #000 !important;
    box-shadow: 0 0 0 2px rgba(0,0,0,0.4) !important;
}

.colour-token.red{background:#a20023}
.colour-token.yellow{background:#dcb418}
.colour-token.blue{background:#0020d2}
.colour-token.black{background:#000}
.colour-token.white{background:#fff;border:1px solid #bbb}
.palette-item{display:flex;align-items:center;gap:6px}
.hidden{display:none}

.colour-token.disabled {
  cursor: none;
}

.palette-count {
  font-size: 0.9rem;
  color: #fff;
  min-width: 1.5em;
  text-align: center;
  background-color: #BBADA0;
  border-radius: 15px;
  padding: 5px;
  margin-right: 2px;
  margin-left: 10px;
}

#colour-palette.is-off .palette-item,
#colour-palette.is-off .recommend-marker,
#colour-palette.is-off .palette-count {
  visibility: hidden;
}
#colour-palette.is-off {
  pointer-events: none;
}


/* ========================= */
/* === Spielfeld (Board) === */
/* ========================= */


#board{
  --axis-color: rgba(255, 255, 255, 0.35);
  --axis-thickness: 3px;

  --row-line-gap: 6px;
  --row-line-len: 34px;
  --row-line-shift: 0px;

  --col-diag-len: 40px;
  --col-anchor-x: -10px;
  --col-anchor-y: 20px;
}

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

.board {
    background-image: url('../images/holz.jpg');
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    gap: 40px;
    padding: 40px;
    border-radius: 10px;
    width: 720px;
    height: 720px;
    border: 10px solid black;
    position: relative;
}

.row-label{
  position: absolute;
  transform: translateY(-50%);
  font-size: 20px;
  font-weight: bold;
  text-shadow: 1px 1px 2px #000;
  color: #eee;
  pointer-events: none;
}
.row-label.left  { text-align: right;  width: 16px; }
.row-label.left::after{
  content:"";
  position:absolute;
  left:50%;
  top:calc(100% + var(--row-line-gap));
  width:var(--row-line-len);
  height:var(--axis-thickness);
  background:var(--axis-color);
  border-radius:999px;
  transform:translateX(calc(-50% + var(--row-line-shift)));
}
.row-label.right { text-align: left;   width: 16px; }
.row-label.right::after{
  content:"";
  position:absolute;
  left:100%;
  top:100%;
  width:var(--col-diag-len);
  height:var(--axis-thickness);
  background:var(--axis-color);
  border-radius:999px;
  transform-origin:0 0;
  transform:translate(var(--col-anchor-x), var(--col-anchor-y)) rotate(-62deg);
}

.cell {
    width: 60px;
    height: 60px;
    background-color: rgb(238, 228, 218, 0.45);
    border-radius: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    z-index: 1;

    box-shadow:
    inset -2px -2px 6px rgba(255, 255, 255, 0.45),
    inset  4px 4px 10px rgba(0, 0, 0, 0.25);
}

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

.piece {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    position:relative;
    z-index: 2;

    box-shadow:
    inset -2px -2px 6px rgba(255,255,255,0.45),
    inset  4px  4px 10px rgba(0,0,0,0.25);
}

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

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

.piece.yellow {
    background-color: #dcb418;
}

.piece.blue {
    background-color: #0020d2;
}

.piece.white {
    background-color: #fff;
}

.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;
}


/* ========================= */
/* === Message Boxen === */
/* ========================= */

#messages {
  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 {
    justify-self: center;
    font-size: 14px;
    font-weight: bold;
    color: #000000;
    text-align: center;
    margin-top: 10px;
}


/* ========================= */
/* === Buttons & Menüs === */
/* ========================= */

#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;
}


/* ========================= */
/* = Game Configurations == */
/* ========================= */

.gameConfig {
    display: flex;
    align-items: center;
    gap: 15px;
    border-radius: 5px;
    background-color: #BBADA0;
    pointer-events: none;
}

.gameConfig2 {
    display: flex;
    align-items: center;
    gap: 15px;
    border-radius: 5px;
    padding-left: 8px;
    padding-top: 0px;
    padding-bottom: 0px;
    background-color: #BBADA0;
    pointer-events: none;
}

.gameConfigSelect {
    padding: 6px 10px;
    border-radius: 5px;
    border: 1px solid #000;
    pointer-events: auto;
    cursor: pointer;
}

.gameConfigChips {
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
    cursor: pointer;
    margin-left: 15px;
}

.gameConfigChips.row {
  flex-direction: row;
}

.gameConfigChips.column {
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.chipOption {
   position: relative;
}

.chipOption input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.chipOption label {
    display: inline-block;
    padding: 4px 4px;
    border-radius: 5px;
    background: #EEE4DA;
    border: 1px solid #EEE4DA;
    color: #000;
    cursor: pointer;
    transition: background 0.2s ease;
}

.chipOption input[type="radio"]:checked + label {
    background: #b9a894;
    border: 3px solid #000;
    color: #fff;
}

#colourChips {
  display: flex;
  gap: 0px;
  margin-left: 0px;
  flex-wrap: nowrap;
}

#colourChips .chip {
  padding: 4px 10px;
}


/* ========================= */
/* ======== Historie ======= */
/* ========================= */

.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;
}
