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

.scoring-images {
  width: 100%;
  max-width: 700px;
  border-collapse: collapse;
}

.scoring-images td {
  padding: 0 20px;
  vertical-align: top;
}

.scoring-images img {
  width: 100%;
  max-width: 300px;
  border-radius: 5px;
  margin-bottom: -0.3em;
}

.scoring-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 Info Box */
/* ============= */

.gameinfo {
  background: #EEE4DA;
  border-radius: 8px;
  padding: 12px;
  margin: 10px 0 0 0;
}

.top-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  align-items: center;
}

.game-title {
  font-size: 2.2em;
  font-weight: 800;
  text-align: center;
  align-self: center !important;
}

#game-status, #game-score {
  font-size: 16px;
  text-align: left;
}

#game-status p, #game-score p {
  margin: 4px 0;
}

#score-red, #score-black {
    font-weight: bold;
}

.pass-row {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 20px;
  margin: 25px 0 10px 0;
  background: transparent;
}

#pass-button {
  display: inline-block;
  background: #BBADA0;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  padding: 8px 18px;
  border-radius: 5px;
  transition: background .2s ease;
}

#pass-button.hidden {
  visibility: hidden;
  pointer-events: none;
}

#pass-button .pass-score{
  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: 30px;
  height: 30px;
  margin-left: 10px;

  border-radius: 999px;
  background: #EEE4DA;
  border: 2px solid #000;

  font-weight: 800;
  font-size: 12px;
  line-height: 1;
  box-sizing: border-box;
  pointer-events: none;
}
#pass-button .pass-score.win  { border-color: #01b301; color: #01b301; }
#pass-button .pass-score.loss { border-color: rgb(255, 0, 0);   color: rgb(255, 0, 0); }
#pass-button .pass-score.draw { border-color: #adadad;  color: #adadad; }

#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);
    grid-column: 2 / 4;
    text-align: left;
    font-weight: bold;
    line-height: 2.6;
}

.hidden {
  display: none;
}


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

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

.board-numbers-left { 
  grid-column: 1; 
  grid-row: 1; 
  display: flex; 
  flex-direction: column; 
  gap: 16px; 
  margin-top: 130px;
}

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

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

.background-board {
    position: absolute;
    top: 20px + 40px*2 + 10px + 10px;
    left: 10px;
    z-index: 0;
    pointer-events: none;

    width: calc(6 * 60px + 4 * 26px);
    height: calc(8 * 60px + 6 * 26px);

    background-image:
      url('../images/linja_spielfeld.png'),
      url('../images/linja_spielfeld.png'),
      url('../images/linja_spielfeld.png'),
      url('../images/linja_spielfeld.png'),
      url('../images/linja_spielfeld.png'),
      url('../images/linja_spielfeld.png'),
      url('../images/linja_spielfeld.png');

    background-repeat: repeat-x;
    background-size: auto 10px;
    background-position:
      left 0 top calc(20px + 40px*2 + 10px + 10px + 60px - 17px),
      left 0 top calc(20px + 40px*2 + 10px + 10px + 2*60px),
      left 0 top calc(20px + 40px*2 + 10px + 10px + 3*60px + 15px),
      left 0 top calc(20px + 40px*2 + 10px + 10px + 4*60px + 31px),
      left 0 top calc(20px + 40px*2 + 10px + 10px + 5*60px + 47px),
      left 0 top calc(20px + 40px*2 + 10px + 10px + 6*60px + 63px),
      left 0 top calc(20px + 40px*2 + 10px + 10px + 7*60px + 79px);
}

.board {
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: #BBADA0;
    padding: 20px;
    border-radius: 10px;
    border: 10px solid black;
    position: relative;
}

.top-zone,
.bottom-zone {
    display: grid;
    grid-template-columns: repeat(9, 40px);
    grid-template-rows: repeat(2, 40px);
    gap: 10px;
}

.mainboard {
    padding-top: 10px;
    padding-bottom: 10px;
    display: grid;
    grid-template-columns: repeat(6, 60px);
    grid-template-rows: repeat(8, 60px);
    gap: 16px;
}

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

.zone-cell {
    width: 40px;
    height: 40px;
    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;
    pointer-events: none;
}

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


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