/* General Page Structure */
body {
  background:
    radial-gradient(circle at 10% 12%, rgba(244, 211, 94, 0.22), transparent 38%),
    radial-gradient(circle at 90% 85%, rgba(29, 120, 116, 0.24), transparent 36%),
    linear-gradient(145deg, #f7fff7, #e7f5f2);
    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 {
    width: min(var(--morris-board-size, 440px), 96%);
    text-align: center;
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.morris-status {
  margin-top: 1rem;
  margin-bottom: 0.55rem;
  width: min(var(--morris-board-size, 440px), 96%);
  padding: 0.6rem 0.9rem;
  border-radius: 999px;
  background: linear-gradient(135deg, #f4e2bf, #e4c89a);
  border: 1px solid #af8053;
  color: #442711;
  font-size: 0.98rem;
  font-weight: 650;
  text-align: center;
  box-shadow: 0 5px 14px rgba(69, 40, 22, 0.18);
}

.morris-info {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
  width: min(var(--morris-board-size, 440px), 96%);
  margin: 0.9rem auto 0.7rem;
}

.morris-player-card {
  min-height: 98px;
  background: linear-gradient(155deg, #f8ebcf 0%, #edd4a7 100%);
  border: 1px solid #bb8c5e;
  border-radius: 14px;
  padding: 0.55rem 0.65rem 0.65rem;
  box-shadow: 0 6px 16px rgba(60, 35, 19, 0.16);
}

.morris-player-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
}

.morris-player-name-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
}

.morris-player-name {
  color: #3f220d;
  font-size: 0.95rem;
  font-weight: 700;
}

.morris-player-chip {
  position: relative;
  overflow: hidden;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: inset 0 -2px 2px rgba(0, 0, 0, 0.25), 0 1px 4px rgba(0, 0, 0, 0.32);
}

.morris-player-chip.human {
  background: radial-gradient(circle at 66% 34%, #ff9f9f 0 26%, #cb2f2f 80%);
  border: 1px solid #a61e1e;
}

.morris-player-chip.computer {
  background: radial-gradient(circle at 66% 34%, #808890 0 24%, #20262c 80%);
  border: 1px solid #0a0a0a;
}

.morris-player-chip::before {
  content: '';
  position: absolute;
  inset: 23%;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.morris-player-count {
  min-width: 2ch;
  text-align: center;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  background: linear-gradient(135deg, #f9efdb, #ebd3aa);
  border: 1px solid #b18255;
  color: #553015;
  font-size: 0.93rem;
  font-weight: 800;
}

.morris-captured-label {
  margin-top: 0.38rem;
  color: #563116;
  font-size: 0.83rem;
  font-weight: 650;
}

.morris-captured-strip {
  margin-top: 0.34rem;
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 0.2rem;
}

.morris-captured-piece {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  transform: scale(0.82);
  opacity: 0.28;
  border: 1px solid rgba(70, 43, 26, 0.22);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.35);
  transition: transform 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease;
}

.morris-captured-piece.active {
  transform: scale(1);
  opacity: 1;
  box-shadow: inset 0 -1px 2px rgba(0, 0, 0, 0.25), 0 1px 4px rgba(15, 25, 35, 0.24);
}

/* Human captures computer stones (dark), computer captures human stones (red). */
.morris-captured-piece.vs-computer {
  background: radial-gradient(circle at 66% 34%, #808890 0 24%, #20262c 80%);
}

.morris-captured-piece.vs-human {
  background: radial-gradient(circle at 66% 34%, #ff9f9f 0 26%, #cb2f2f 80%);
}

.morris-captured-piece::before {
  content: '';
  position: absolute;
  inset: 24%;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.28);
}

#restart-btn {
  border: none;
  background: linear-gradient(135deg, #1d7874, #0d3b66);
  color: #ffffff;
  padding: 0.55rem 0.9rem;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 700;
    cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#restart-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(13, 59, 102, 0.24);
}

/* 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 {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    padding: 2.5rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 3rem;
}

.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-section {
        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:
    radial-gradient(circle at 24% 24%, rgba(255, 237, 198, 0.68), transparent 45%),
    linear-gradient(140deg, #d8a25f 0%, #b97c43 52%, #a56e3a 100%);
  border: 10px solid #8b4513;
  border-radius: 10px;
  box-shadow: 0 10px 22px rgba(58, 34, 17, 0.27), inset 0 0 14px rgba(70, 37, 13, 0.25);
  touch-action: manipulation;
}

.morris-board svg {
  shape-rendering: geometricPrecision;
  overflow: visible;
}

.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%;
  overflow: hidden;
  background:
    radial-gradient(circle at 30% 30%, #efd4a6 0 30%, #c58c51 62%, #9f6837 100%);
  border: 2px solid #7b4b24;
  box-shadow:
    inset 0 1px 2px rgba(255, 242, 213, 0.66),
    0 2px 7px rgba(65, 38, 19, 0.24);
  z-index: 2;
  touch-action: manipulation;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  /* Larger touch target for mobile */
}

.morris-point.occupied-red,
.morris-point.occupied-white {
  border-color: #a61e1e;
  background:
    radial-gradient(circle at 66% 34%, #ff9f9f 0 24%, #d14040 48%, #a51919 80%);
  box-shadow:
    inset 0 -3px 5px rgba(82, 11, 11, 0.36),
    0 5px 12px rgba(93, 20, 15, 0.34);
}

.morris-point.occupied-black {
  border-color: #0a0a0a;
  background:
    radial-gradient(circle at 66% 34%, #7d858d 0 22%, #2f343b 48%, #1f252c 80%);
  box-shadow:
    inset 0 -3px 5px rgba(5, 7, 11, 0.55),
    0 5px 12px rgba(14, 16, 20, 0.42);
}

.morris-point.occupied-red::before,
.morris-point.occupied-black::before {
  content: '';
  position: absolute;
  inset: 21%;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.26);
}

.morris-point.occupied-red::after,
.morris-point.occupied-black::after {
  content: '';
  position: absolute;
  width: 44%;
  height: 30%;
  top: 16%;
  left: 19%;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
  filter: blur(0.3px);
}

.morris-point.selected {
  transform: scale(1.08);
  border-color: #f2cf75;
  box-shadow:
    0 0 0 3px rgba(242, 207, 117, 0.3),
    0 7px 18px rgba(66, 41, 20, 0.4);
}

/* 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-status {
    font-size: 0.92rem;
    padding: 0.5rem 0.75rem;
  }

  .morris-info {
    width: min(var(--morris-board-size, 420px), 98%);
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
  }

  .morris-player-card {
    min-height: 90px;
    padding: 0.48rem 0.5rem 0.54rem;
  }

  .morris-player-name {
    font-size: 0.82rem;
  }

  .morris-captured-label {
    font-size: 0.74rem;
    margin-top: 0.25rem;
  }

  .morris-player-count {
    font-size: 0.8rem;
    padding: 0.1rem 0.34rem;
  }

  .morris-captured-strip {
    margin-top: 0.24rem;
    gap: 0.12rem;
  }

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

@media (max-width: 360px) {
  #game-section {
    padding: 1rem;
  }

  .morris-container h1 {
    font-size: 1.35rem;
    margin: 0.2rem 0 0.45rem;
  }

  .morris-board {
    width: 90vw;
    height: 90vw;
  }

  .morris-info {
    gap: 0.3rem;
  }

  .morris-player-name {
    font-size: 0.76rem;
  }

  .morris-captured-label {
    font-size: 0.69rem;
  }

  .morris-point {
    width: 32px;
    height: 32px;
    margin: -16px 0 0 -16px;
  }

  #restart-btn {
    font-size: 0.9rem;
    padding: 0.5rem 0.8rem;
  }
}

/* ---------- Morris: CSS-driven Board Theme (visual layer only) ---------- */
#game-section {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  border: 1px solid rgba(90, 60, 34, 0.24);
  background:
    radial-gradient(120% 120% at 0% 0%, rgba(224, 181, 119, 0.18), transparent 52%),
    radial-gradient(100% 110% at 100% 100%, rgba(97, 64, 37, 0.16), transparent 56%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(248, 240, 229, 0.9));
  box-shadow: 0 20px 46px rgba(54, 33, 18, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.morris-board {
  position: relative;
  width: var(--morris-board-size, 440px) !important;
  height: var(--morris-board-size, 440px) !important;
  margin: 0 auto;
  border-radius: 24px;
  border: 11px solid #6f4321;
  background:
    radial-gradient(circle at 20% 18%, rgba(255, 230, 188, 0.34), transparent 46%),
    radial-gradient(circle at 82% 84%, rgba(52, 28, 13, 0.32), transparent 56%),
    repeating-linear-gradient(24deg, rgba(255, 246, 232, 0.08) 0 2px, transparent 2px 8px),
    linear-gradient(145deg, #c79158 0%, #a96d3d 45%, #8f592f 100%);
  box-shadow:
    0 22px 44px rgba(49, 28, 14, 0.35),
    inset 0 2px 1px rgba(255, 233, 201, 0.4),
    inset 0 -15px 28px rgba(66, 35, 15, 0.36);
}

.morris-board::before {
  content: '';
  position: absolute;
  inset: 9px;
  border-radius: 15px;
  border: 1px solid rgba(250, 220, 176, 0.36);
  box-shadow: inset 0 0 0 1px rgba(78, 45, 21, 0.3);
  pointer-events: none;
  z-index: 2;
}

.morris-board::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 24px;
  height: 24px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 2px solid rgba(243, 218, 179, 0.92);
  background: radial-gradient(circle at 32% 28%, #f5d8ac, #8d552c 74%);
  box-shadow: 0 0 0 3px rgba(61, 35, 16, 0.34);
  pointer-events: none;
}

.morris-board svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 1px 1px rgba(55, 30, 13, 0.35));
}

.morris-board svg rect,
.morris-board svg line {
  stroke: #f7e4c8 !important;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.morris-point {
  position: absolute;
  width: var(--morris-point-size, 26px) !important;
  height: var(--morris-point-size, 26px) !important;
  margin: calc(var(--morris-point-size, 26px) / -2) 0 0 calc(var(--morris-point-size, 26px) / -2) !important;
  border-width: max(1px, calc(var(--morris-point-size, 26px) * 0.075)) !important;
  border-radius: 50%;
  border-style: solid;
  border-color: rgba(246, 222, 184, 0.9);
  background:
    radial-gradient(circle at 30% 26%, #f6dfbc 0 20%, #bb8550 52%, #8d5a30 100%);
  box-shadow:
    inset 0 3px 5px rgba(255, 242, 221, 0.42),
    inset 0 -6px 8px rgba(85, 51, 25, 0.52),
    0 7px 12px rgba(57, 33, 15, 0.36);
  transition: transform 0.18s ease, box-shadow 0.22s ease, border-color 0.18s ease;
}

.morris-point:not(.occupied-red):not(.occupied-black):hover {
  transform: translateY(-1px) scale(1.05);
  border-color: #fff2de;
  box-shadow:
    inset 0 3px 5px rgba(255, 246, 233, 0.58),
    inset 0 -6px 8px rgba(95, 58, 28, 0.56),
    0 10px 16px rgba(50, 29, 13, 0.42);
}

.morris-point.occupied-red,
.morris-point.occupied-white {
  border-color: #ffe9e2;
  background: radial-gradient(circle at 30% 24%, #ffd8d0 0 12%, #b62f2f 36%, #7c1717 70%, #4b0c0c 100%);
  box-shadow:
    inset 0 3px 5px rgba(255, 232, 227, 0.62),
    inset 0 -9px 12px rgba(57, 9, 9, 0.72),
    0 0 0 1px rgba(50, 9, 9, 0.65),
    0 11px 16px rgba(57, 11, 11, 0.56);
}

.morris-point.occupied-black {
  border-color: #e5efff;
  background: radial-gradient(circle at 30% 24%, #c6d8f6 0 10%, #31558f 34%, #1a2f56 68%, #0b1730 100%);
  box-shadow:
    inset 0 3px 6px rgba(220, 234, 255, 0.56),
    inset 0 -9px 12px rgba(8, 17, 38, 0.76),
    0 0 0 1px rgba(8, 18, 39, 0.76),
    0 11px 16px rgba(7, 14, 32, 0.62);
}

.morris-point.selected {
  transform: scale(1.12);
  border-color: #fff2cf;
  box-shadow:
    0 0 0 3px rgba(255, 235, 171, 0.36),
    0 0 0 7px rgba(255, 218, 128, 0.24),
    0 14px 20px rgba(18, 35, 44, 0.52);
}

.morris-point.ai-glow {
  animation: morrisAiMovePulse 0.95s ease-in-out infinite alternate;
}

.morris-point.ai-capture-glow {
  animation: morrisAiCapturePulse 0.95s ease-in-out infinite alternate;
}

@keyframes morrisAiMovePulse {
  from {
    box-shadow: 0 0 0 2px rgba(249, 255, 177, 0.62), 0 0 16px rgba(249, 255, 125, 0.6);
  }
  to {
    box-shadow: 0 0 0 8px rgba(249, 255, 177, 0.22), 0 0 28px rgba(249, 255, 125, 0.75);
  }
}

@keyframes morrisAiCapturePulse {
  from {
    box-shadow: 0 0 0 2px rgba(255, 206, 206, 0.62), 0 0 16px rgba(255, 119, 119, 0.6);
  }
  to {
    box-shadow: 0 0 0 8px rgba(255, 206, 206, 0.22), 0 0 28px rgba(255, 99, 99, 0.75);
  }
}

@media (max-width: 768px) {
  .morris-board {
    border-width: 9px;
    border-radius: 18px;
  }

  .morris-board::before {
    inset: 7px;
  }

  .morris-board::after {
    width: 18px;
    height: 18px;
  }
}

/* Final mobile/tablet interaction and layout overrides. */
.morris-point {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
}

.morris-point::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: max(44px, calc(var(--morris-point-size, 26px) + 18px));
  height: max(44px, calc(var(--morris-point-size, 26px) + 18px));
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: transparent;
}

@media (hover: none) {
  .morris-point:not(.occupied-red):not(.occupied-black):hover {
    transform: none;
    border-color: rgba(246, 222, 184, 0.9);
    box-shadow:
      inset 0 3px 5px rgba(255, 242, 221, 0.42),
      inset 0 -6px 8px rgba(85, 51, 25, 0.52),
      0 7px 12px rgba(57, 33, 15, 0.36);
  }
}

@media (max-width: 540px) {
  #game-section {
    padding: 1rem;
  }

  .morris-container h1 {
    font-size: 1.4rem;
    margin: 0.2rem 0 0.5rem;
    text-align: center;
  }

  .morris-status,
  .morris-controls,
  .morris-info {
    width: min(var(--morris-board-size, 440px), 100%);
  }

  .morris-info {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .morris-player-card {
    min-height: 84px;
  }

  .morris-player-name {
    font-size: 0.8rem;
  }

  .morris-captured-label {
    font-size: 0.72rem;
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  #game-section {
    padding: 0.9rem;
  }

  .morris-container h1 {
    font-size: 1.25rem;
    margin: 0 0 0.35rem;
  }

  .morris-status {
    margin-top: 0.55rem;
    font-size: 0.9rem;
    padding: 0.45rem 0.6rem;
  }

  .morris-controls {
    margin-top: 0.55rem;
    gap: 0.5rem;
  }

  .morris-info {
    margin: 0.55rem auto 0.5rem;
  }
}

@media (max-width: 768px) {
  main {
    padding: 1.25rem 0.85rem 2rem;
  }

  #game-section,
  .info-section {
    border-radius: 14px;
    padding: 1.15rem;
    margin-bottom: 1.2rem;
  }

  .internal-nav {
    margin-bottom: 1.2rem;
  }

  .internal-nav h3 {
    font-size: 1.45rem;
    margin-bottom: 0.9rem;
  }

  .info-section {
    gap: 1rem;
  }

  .info-card h2 {
    font-size: 1.35rem;
    margin-bottom: 0.7rem;
  }

  .info-card h3 {
    font-size: 1.08rem;
  }

  .info-card p,
  .info-card li,
  .info-card dt,
  .info-card dd {
    font-size: 0.96rem;
    line-height: 1.52;
  }
}

@media (max-width: 560px) {
  .morris-status {
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.35;
    padding: 0.5rem 0.62rem;
  }

  .morris-controls {
    gap: 0.58rem;
  }

  .morris-controls .difficulty-controls {
    width: 100%;
    justify-content: center;
  }

  .morris-controls .diff-btn,
  #restart-btn {
    min-height: 42px;
    padding: 0.58rem 0.72rem;
  }

}

@media (max-width: 360px) {
  main {
    padding-left: 0.65rem;
    padding-right: 0.65rem;
  }

  #game-section,
  .info-section {
    padding: 0.9rem;
  }

  .morris-status {
    font-size: 0.84rem;
  }

  .morris-controls .diff-btn,
  #restart-btn {
    font-size: 0.84rem;
    min-height: 40px;
    padding: 0.5rem 0.6rem;
  }

  .info-card h2 {
    font-size: 1.2rem;
  }

  .info-card p,
  .info-card li,
  .info-card dt,
  .info-card dd {
    font-size: 0.9rem;
  }
}
