* {
  box-sizing: border-box;
}

body {
  font-family: Arial, sans-serif;
  text-align: center;
  background: #f3f4f6;
  margin: 0;
  color: #222;
}

a {
  color: #2457c5;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.site-header {
  background: #111827;
  color: white;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0,0,0,0.25);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.logo {
  font-weight: bold;
  font-size: 22px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-mark {
  background: #facc15;
  color: #111827;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: Arial, sans-serif;
  font-weight: 700;
  font-size: 13px;
}

.main-nav a {
  color: white;
  margin-left: 18px;
  font-weight: bold;
}

.main-nav a:hover {
  color: #dbeafe;
}

.hero-section {
  background: linear-gradient(135deg, #111827, #374151);
  color: white;
  padding: 55px 20px;
}

.hero-content {
  max-width: 800px;
  margin: 0 auto;
}

.hero-section h1 {
  font-size: 48px;
  margin: 0 0 10px;
}

.subtitle {
  font-size: 18px;
  line-height: 1.5;
  color: #e5e7eb;
  margin: 0 auto 25px;
  max-width: 780px;
}

.play-button {
  display: inline-block;
  background: #facc15;
  color: #111827;
  padding: 12px 22px;
  border-radius: 8px;
  font-weight: bold;
}

.play-button:hover {
  background: #fde047;
  text-decoration: none;
}

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 16px 30px;
}

.ad-placeholder {
  max-width: 970px;
  min-height: 90px;
  margin: 20px auto;
  border: 2px dashed #bbb;
  background: #fafafa;
  color: #777;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.game-section {
  scroll-margin-top: 90px;
}

.top-panel {
  background: white;
  max-width: 1000px;
  margin: 20px auto 15px;
  padding: 15px;
  border-radius: 14px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.12);
}

.control-group {
  margin: 10px 0;
}

.control-group label {
  margin: 0 8px;
  display: inline-block;
}

button,
select,
input {
  padding: 8px;
  margin: 4px;
  font-size: 14px;
}

button {
  cursor: pointer;
  border: none;
  border-radius: 7px;
  background: #111827;
  color: white;
}

button:hover {
  background: #374151;
}

.rating-box {
  margin-top: 10px;
  font-weight: bold;
}

.rating-box span {
  margin: 0 15px;
}

.clock-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 25px;
  flex-wrap: wrap;
  margin-top: 15px;
}

.clock {
  background: #111827;
  color: white;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 18px;
  font-weight: bold;
}

#turn {
  font-size: 22px;
  font-weight: bold;
}

#message {
  min-height: 24px;
  margin: 10px;
  font-weight: bold;
  color: #b00020;
}

.game-layout {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
}

#board {
  width: 480px;
  height: 480px;
  display: grid;
  grid-template-columns: repeat(8, 60px);
  grid-template-rows: repeat(8, 60px);
  border: 4px solid #111827;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

.square {
  width: 60px;
  height: 60px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 42px;
  cursor: pointer;
  position: relative;
  user-select: none;
  font-family: "Times New Roman", "DejaVu Serif", serif;
  font-variant-emoji: text;
}

.selected {
  outline: 4px solid yellow;
  outline-offset: -4px;
}

.legal::after {
  content: "";
  width: 18px;
  height: 18px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 50%;
  position: absolute;
}

.capture {
  box-shadow: inset 0 0 0 5px rgba(255, 0, 0, 0.45);
}

.in-check {
  background: #ff7777 !important;
}

.side-panel {
  width: 160px;
  min-height: 160px;
  background: white;
  border-radius: 12px;
  padding: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.side-panel h3 {
  margin-top: 0;
}

.captured {
  font-size: 28px;
  min-height: 40px;
}

.info-layout {
  max-width: 1000px;
  margin: 20px auto;
  display: flex;
  gap: 20px;
  justify-content: center;
  align-items: stretch;
  flex-wrap: wrap;
}

.rules-box,
.tips-box,
.content-section,
.history-box {
  background: white;
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.12);
}

.rules-box,
.tips-box {
  width: 470px;
  text-align: left;
}

.rules-box h3,
.tips-box h3,
.history-box h3 {
  text-align: center;
  margin-top: 0;
}

.rules-box ul {
  padding-left: 20px;
  line-height: 1.5;
}

.tips-box button {
  display: block;
  margin: 15px auto 0;
}

.content-section {
  max-width: 900px;
  margin: 20px auto;
  text-align: left;
  line-height: 1.6;
}

.content-section h2 {
  text-align: center;
}

.history-box {
  max-width: 600px;
  margin: 20px auto;
  text-align: left;
}

#moveHistory {
  max-height: 180px;
  overflow-y: auto;
}

.site-footer {
  background: #111827;
  color: white;
  padding: 25px 16px;
  margin-top: 30px;
}

.site-footer a {
  color: #dbeafe;
}

@media (max-width: 760px) {
  .hero-section h1 {
    font-size: 36px;
  }

  .main-nav a {
    margin: 0 8px;
  }

  #board {
    width: 320px;
    height: 320px;
    grid-template-columns: repeat(8, 40px);
    grid-template-rows: repeat(8, 40px);
  }

  .square {
  width: 40px;
  height: 40px;
  font-size: 30px;
  font-family: "Times New Roman", "DejaVu Serif", serif;
  font-variant-emoji: text;
}

  .side-panel {
    width: 140px;
  }

  .rules-box,
  .tips-box {
    width: 100%;
  }

  .ad-placeholder {
    min-height: 70px;
  }
}
.game-only-page {
  background: #f3f4f6;
}

.game-only-main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 16px 30px;
}

.game-only-hero {
  max-width: 900px;
  margin: 0 auto 20px;
  padding: 24px 18px;
  background: #111827;
  color: white;
  border-radius: 14px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.18);
}

.game-only-hero h1 {
  margin: 0 0 10px;
  font-size: 38px;
}

.game-only-hero p {
  margin: 0 auto;
  max-width: 760px;
  color: #e5e7eb;
  line-height: 1.5;
}


.hero-content {
  max-width: 950px;
}

.play-button {
  margin-top: 4px;
}

.hero-cover {
  display: block !important;
  width: 100% !important;
  max-width: 620px !important;
  height: auto !important;
  margin: 24px auto 18px auto !important;
  border-radius: 16px !important;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35) !important;
}

.hero-content {
  max-width: 950px !important;
  margin: 0 auto !important;
}

/* Mobile polish for Chess Revamped */

@media (max-width: 760px) {
  body {
    padding: 0;
    overflow-x: hidden;
  }

  main {
    padding: 0 10px 24px;
  }

  .site-header {
    position: static;
  }

  .header-inner {
    justify-content: center;
    text-align: center;
    padding: 12px 10px;
  }

  .logo {
    justify-content: center;
    width: 100%;
  }

  .main-nav {
    width: 100%;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
  }

  .main-nav a {
    margin: 0;
    font-size: 13px;
  }

  .hero-section {
    padding: 32px 12px;
  }

  .hero-section h1 {
    font-size: 34px;
    line-height: 1.1;
  }

  .subtitle {
    font-size: 15px;
  }

  .hero-cover {
    max-width: 340px !important;
    width: 100% !important;
    margin: 18px auto 16px !important;
  }

  .top-panel {
    padding: 12px;
    margin: 14px auto;
  }

  .control-group {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    margin: 8px 0;
  }

  .control-group label {
    margin: 0;
    text-align: left;
    font-weight: bold;
  }

  .control-group select,
  .control-group button {
    width: 100%;
    min-height: 42px;
    font-size: 15px;
  }

  .rating-box {
    display: flex;
    flex-direction: column;
    gap: 5px;
  }

  .rating-box span {
    margin: 0;
  }

  .clock-row {
    gap: 8px;
    margin-top: 12px;
  }

  .clock {
    padding: 8px 10px;
    font-size: 15px;
  }

  #turn {
    width: 100%;
    font-size: 18px;
    order: -1;
  }

  #message {
    padding: 0 10px;
    font-size: 14px;
  }

  .game-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
  }

  #board {
    order: 1;
    width: min(92vw, 360px);
    height: min(92vw, 360px);
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
  }

  .square {
    width: auto;
    height: auto;
    font-size: clamp(26px, 8vw, 36px);
  }

  .side-panel {
    order: 2;
    width: min(92vw, 360px);
    min-height: auto;
  }

  .side-panel h3 {
    margin-bottom: 6px;
  }

  .captured {
    font-size: 24px;
    min-height: 28px;
  }

  .info-layout {
    margin: 14px auto;
    gap: 14px;
  }

  .rules-box,
  .tips-box,
  .content-section,
  .history-box {
    padding: 14px;
    border-radius: 12px;
  }

  .rules-box,
  .tips-box {
    width: 100%;
  }

  .content-section {
    font-size: 15px;
  }

  .content-section h1 {
    font-size: 28px;
  }

  .content-section h2 {
    font-size: 22px;
  }

  .ad-placeholder {
    width: 100%;
    min-height: 60px;
    margin: 14px auto;
  }

  .site-footer {
    font-size: 14px;
  }

  .game-only-main {
    padding: 12px 10px 24px;
  }

  .game-only-hero {
    padding: 18px 12px;
  }

  .game-only-hero h1 {
    font-size: 32px;
  }
}

/* Hard mobile cover fix */
.hero-section {
  overflow: hidden;
}

.hero-content {
  width: 100%;
  max-width: 950px;
  margin: 0 auto;
  overflow: hidden;
}

.hero-cover {
  display: block !important;
  width: min(92vw, 620px) !important;
  max-width: 100% !important;
  height: auto !important;
  margin: 24px auto 18px auto !important;
  border-radius: 16px !important;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35) !important;
}

@media (max-width: 760px) {
  .hero-section {
    padding-left: 10px !important;
    padding-right: 10px !important;
    overflow: hidden !important;
  }

  .hero-content {
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden !important;
  }

  .hero-cover {
    width: 100% !important;
    max-width: 280px !important;
    height: auto !important;
    margin: 16px auto 14px auto !important;
    border-radius: 12px !important;
  }
}