:root {
  --ink: #17231d;
  --muted: #6f7b74;
  --paper: #f4f1e9;
  --card: #fffdf8;
  --accent: #d8643f;
  --green: #254b3c;
  --light-square: #e8dec8;
  --dark-square: #718878;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 12%, rgba(216, 100, 63, 0.12), transparent 25rem),
    var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.site-header,
main,
footer {
  width: min(1180px, calc(100% - 48px));
  margin-inline: auto;
}

.site-header {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(23, 35, 29, 0.12);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  font-weight: 750;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--green);
  border-radius: 11px;
  font-size: 24px;
}

.status {
  color: var(--muted);
  font-size: 13px;
}

.status i {
  width: 7px;
  height: 7px;
  display: inline-block;
  margin-right: 7px;
  background: #55a06d;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(85, 160, 109, 0.12);
}

main {
  padding: 76px 0 90px;
}

.intro {
  max-width: 720px;
  margin-bottom: 56px;
}

.eyebrow,
.round {
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

h1 {
  margin: 13px 0 20px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(48px, 7vw, 86px);
  font-weight: 500;
  line-height: 0.94;
  letter-spacing: -0.055em;
}

.subtitle {
  max-width: 590px;
  margin: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.65;
}

.replayer {
  display: grid;
  grid-template-columns: minmax(400px, 590px) minmax(290px, 1fr);
  gap: 52px;
  align-items: center;
}

.player {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 12px;
  align-items: center;
  margin: 12px 0;
}

.player b,
.player small {
  display: block;
}

.player b {
  font-size: 14px;
}

.player small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.player time {
  padding: 8px 10px;
  color: white;
  background: var(--green);
  border-radius: 7px;
  font: 700 13px ui-monospace, SFMono-Regular, Menlo, monospace;
}

.avatar {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(23, 35, 29, 0.12);
  border-radius: 50%;
  font: 700 13px Georgia, serif;
}

.dark-avatar {
  color: white;
  background: var(--ink);
}

.light-avatar {
  background: var(--card);
}

.board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  width: 100%;
  overflow: hidden;
  border-radius: 5px;
  box-shadow: 0 18px 50px rgba(34, 48, 40, 0.18);
}

.square {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  font-size: clamp(28px, 5.1vw, 54px);
  line-height: 1;
  user-select: none;
}

.square.light {
  background: var(--light-square);
}

.square.dark {
  background: var(--dark-square);
}

.square::after {
  position: absolute;
  right: 5px;
  bottom: 3px;
  color: rgba(23, 35, 29, 0.48);
  font-size: 8px;
  font-weight: 700;
}

.panel {
  min-height: 470px;
  padding: 28px;
  background: rgba(255, 253, 248, 0.8);
  border: 1px solid rgba(23, 35, 29, 0.1);
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(34, 48, 40, 0.08);
  backdrop-filter: blur(10px);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding-bottom: 22px;
  border-bottom: 1px solid rgba(23, 35, 29, 0.1);
}

.panel h2 {
  margin: 5px 0 0;
  font-family: Georgia, serif;
  font-size: 25px;
  font-weight: 500;
}

.icon-button,
.controls button {
  border: 0;
  cursor: pointer;
}

.icon-button {
  width: 38px;
  height: 38px;
  color: var(--green);
  background: #e8eee9;
  border-radius: 10px;
  font-size: 19px;
  transition: transform 180ms ease;
}

.icon-button:hover {
  transform: rotate(25deg);
}

.moves {
  height: 226px;
  overflow-y: auto;
  padding: 20px 4px;
}

.move-row {
  display: grid;
  grid-template-columns: 30px 1fr 1fr;
  gap: 8px;
  min-height: 35px;
  align-items: center;
  color: var(--muted);
  font-size: 14px;
}

.move-row span:not(:first-child) {
  padding: 7px 9px;
  border-radius: 6px;
}

.move-row .active {
  color: white;
  background: var(--accent);
  font-weight: 700;
}

.controls {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.controls button {
  height: 42px;
  color: var(--green);
  background: #e8eee9;
  border-radius: 9px;
  font-size: 17px;
  transition: transform 120ms ease, background 120ms ease;
}

.controls button:hover {
  background: #dce6df;
  transform: translateY(-1px);
}

.controls .play {
  color: white;
  background: var(--green);
}

.controls .play:hover {
  background: #193b2e;
}

.progress {
  height: 3px;
  margin-top: 20px;
  overflow: hidden;
  background: #dce2dd;
  border-radius: 10px;
}

.progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 180ms ease;
}

.move-count {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}

footer {
  display: flex;
  justify-content: space-between;
  padding: 26px 0 34px;
  color: var(--muted);
  border-top: 1px solid rgba(23, 35, 29, 0.12);
  font-size: 12px;
}

@media (max-width: 860px) {
  .replayer {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .board-wrap {
    width: min(100%, 590px);
    margin-inline: auto;
  }

  .panel {
    min-height: auto;
  }
}

@media (max-width: 520px) {
  .site-header,
  main,
  footer {
    width: min(100% - 28px, 1180px);
  }

  .site-header {
    min-height: 72px;
  }

  main {
    padding: 50px 0 60px;
  }

  .intro {
    margin-bottom: 38px;
  }

  h1 {
    font-size: 47px;
  }

  .subtitle {
    font-size: 16px;
  }

  .panel {
    padding: 20px;
  }

  .moves {
    height: 200px;
  }

  footer {
    flex-direction: column;
    gap: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
