/* General Page Structure */
body {
    background-color: #f8f9fa;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    color: #343a40;
    line-height: 1.6;
}

main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 2rem;
}

/* Game Section */
#game-section {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    padding: 2.5rem;
    margin-bottom: 3rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#app {
    margin-bottom: 1.5rem;
}

.morris-controls {
    text-align: center;
    margin-top: 1.5rem;
}

#restart-btn {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s;
}

#restart-btn:hover {
    background-color: #0056b3;
}

/* Internal Navigation / More Games */
.internal-nav {
    text-align: center;
    margin-bottom: 3rem;
}

.internal-nav h3 {
    font-size: 2.5rem;
    font-weight: 600;
    color: #003366;
    margin-top: 0;
    margin-bottom: 2rem;
}

/* Re-using homepage game button styles */
.game-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.game-btn {
    background: #f8f9fa;
    border-radius: 10px;
    text-align: center;
    padding: 1.5rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid #e9ecef;
    color: #343a40;
    text-decoration: none;
}

.game-btn:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
}

.game-btn img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.game-btn span {
    font-size: 1.3rem;
    font-weight: 600;
}


/* Info Sections & Cards */
.info-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 3rem;
}

.info-card {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    padding: 2.5rem;
}

.info-card h2 {
    font-size: 2rem;
    font-weight: 600;
    color: #003366;
    margin-top: 0;
    margin-bottom: 1.5rem;
}

.info-card h3 {
    font-size: 1.4rem;
    color: #005f9e;
    margin-bottom: 0.5rem;
}

.info-card p, .info-card li {
    color: #343a40;
}

.info-card ol, .info-card ul {
    padding-left: 20px;
}

.info-card dl dt {
    font-weight: bold;
    color: #005f9e;
    margin-top: 1rem;
}

.info-card dl dd {
    margin-left: 0;
    padding-bottom: 0.5rem;
}

/* Responsive Design */
@media (max-width: 992px) {
    .info-section {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    main {
        padding: 2rem 1rem;
    }
    #game-section, .info-card {
        padding: 2rem;
    }
    .internal-nav h3, .info-card h2 {
        font-size: 2rem;
    }
}

  @media (orientation: portrait) and (max-width: 540px) {
    #game-section {
      padding: 1.25rem;
    }
    .morris-board {
      width: 92vw;
      height: 92vw;
    }
    .morris-point {
      width: 36px;
      height: 36px;
      margin: -18px 0 0 -18px;
    }
    .morris-container {
      padding: 0.5rem;
    }
  }

  @media (orientation: portrait) and (max-width: 430px) {
    .morris-board {
      width: 90vw;
      height: 90vw;
    }
    .morris-point {
      width: 34px;
      height: 34px;
      margin: -17px 0 0 -17px;
    }
  }

  @media (orientation: landscape) and (max-height: 520px) {
    #game-section {
      padding: 1.25rem;
    }
    .morris-board {
      width: min(82vw, 64vh);
      height: min(82vw, 64vh);
    }
    .morris-point {
      width: 38px;
      height: 38px;
      margin: -19px 0 0 -19px;
    }
    .morris-container {
      padding: 0.5rem;
    }
  }

/*
  Nine Men's Morris board CSS
  The board consists of three concentric squares connected by lines at the midpoints, with 24 intersection points for pieces.
  This CSS creates a visually accurate board, with clear lines and points for piece placement.
*/

.morris-board {
  position: relative;
  width: 480px;
  height: 480px;
  margin: 0 auto;
  background: #f8f8f8;
  border: 4px solid #333;
  box-shadow: 0 0 20px #aaa;
  touch-action: manipulation;
}

.morris-square {
  position: absolute;
  border: 3px solid #333;
  background: none;
}

.morris-square.outer {
  top: 20px;
  left: 20px;
  width: 440px;
  height: 440px;
}
.morris-square.middle {
  top: 90px;
  left: 90px;
  width: 320px;
  height: 320px;
}
.morris-square.inner {
  top: 180px;
  left: 180px;
  width: 140px;
  height: 140px;
}

.morris-line {
  position: absolute;
  background: #333;
}

/* Horizontal lines connecting squares */
.morris-line.h {
  height: 3px;
  width: 70px;
}

/* Vertical lines connecting squares */
.morris-line.v {
  width: 3px;
  height: 70px;
}

/* Place lines at correct positions */
.morris-line.h.top {
  top: 240px;
  left: 20px;
}
.morris-line.h.bottom {
  top: 240px;
  right: 20px;
}
.morris-line.v.left {
  left: 240px;
  top: 20px;
}
.morris-line.v.right {
  left: 240px;
  bottom: 20px;
}

/* Board points */
.morris-point {
  position: absolute;
  width: 36px;
  height: 36px;
  margin: -18px 0 0 -18px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #333;
  box-shadow: 0 2px 6px #bbb;
  z-index: 2;
  transition: background 0.2s, border 0.2s;
  /* Larger touch target for mobile */
}
.morris-point.occupied-white {
  background: #f4f4f4;
  border-color: #aaa;
}
.morris-point.occupied-black {
  background: #222;
  border-color: #555;
}
.morris-point.selected {
  box-shadow: 0 0 12px #0078d7;
  border-color: #0078d7;
}

/* Piece styles */
.morris-piece {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  z-index: 3;
  box-shadow: 0 2px 8px #888;
}
.morris-piece.white {
  background: #fff;
  border: 2px solid #bbb;
}
.morris-piece.black {
  background: #222;
  border: 2px solid #555;
}

/* AI move and capture glow effects */
.ai-glow {
  box-shadow: 0 0 16px 6px #ffeb3b, 0 0 8px 2px #fff200;
  z-index: 2;
  border-radius: 50%;
  animation: ai-glow-pulse 1s infinite alternate;
}

@keyframes ai-glow-pulse {
  from { box-shadow: 0 0 16px 6px #ffeb3b, 0 0 8px 2px #fff200; }
  to   { box-shadow: 0 0 32px 12px #fffde7, 0 0 16px 4px #fff200; }
}

.ai-capture-glow {
  box-shadow: 0 0 16px 6px #ff1744, 0 0 8px 2px #ff5252;
  z-index: 2;
  border-radius: 50%;
  animation: ai-capture-glow-pulse 1s infinite alternate;
}

@keyframes ai-capture-glow-pulse {
  from { box-shadow: 0 0 16px 6px #ff1744, 0 0 8px 2px #ff5252; }
  to   { box-shadow: 0 0 32px 12px #ff8a80, 0 0 16px 4px #ff5252; }
}

/* Responsive */
@media (max-width: 600px) {
  .morris-board {
    width: 96vw;
    height: 96vw;
    max-width: 96vw;
    max-height: 96vw;
    margin: 0 auto;
    display: block;
    touch-action: manipulation;
  }
  .morris-point {
    width: 44px;
    height: 44px;
    margin: -22px 0 0 -22px;
    user-select: none;
    touch-action: manipulation;
  }
  .morris-container {
    max-width: 100vw;
    width: 100vw;
    margin: 1rem auto 0 auto;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    overflow-x: hidden;
  }
  .morris-info-row {
    flex-direction: column;
    gap: 1rem;
    align-items: center;
    max-width: 100%;
  }
  .morris-history-card, .morris-rules-card, .morris-strategy-card, .morris-faq-card {
    width: 95%;
    min-width: 0;
    padding: 1rem;
    font-size: 1rem;
    align-items: flex-start;
    border-radius: 10px;
  }
  #restart-btn {
    font-size: 1.1em;
    padding: 12px 24px;
    width: auto;
    margin-top: 1rem;
  }
}
