:root {
  color-scheme: dark;
  --canvas: #101f17;
  --panel: #17271e;
  --border: #344538;
  --ink: #f2f1e2;
  --muted: #a9b7a8;
  --accent: #d0e596;
  --accent-hover: #e0efa9;
  --dark-ink: #1d2b17;
  --accent-dark: #273b29;
  --light-square: #e4e8cf;
  --dark-square: #6d8e77;
  --danger: #f4a592;
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: Georgia, "Times New Roman", serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

*, *::before, *::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-height: 100vh;
  margin: 0;
  background-color: var(--canvas);
  background-image:
    radial-gradient(ellipse 68% 46% at 37% 16%, #263f2d70, transparent 87%),
    linear-gradient(#9eb39f08 1px, transparent 1px),
    linear-gradient(90deg, #9eb39f08 1px, transparent 1px);
  background-size: auto, 46px 46px, 46px 46px;
  color: var(--ink);
  font: 1rem/1.45 var(--font);
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
  cursor: pointer;
}

button:disabled {
  cursor: default;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

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

p, h1, h2 {
  margin: 0;
}

.icon {
  display: block;
  flex: none;
  width: 1.125rem;
  height: 1.125rem;
}

.top-bar {
  border-bottom: 1px solid #a5b59c24;
  background: #0c1a14c9;
}

.top-bar-inner,
.room {
  width: min(100% - 4.5rem, 68.5rem);
  margin-inline: auto;
}

.top-bar-inner {
  min-height: 4.35rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.wordmark {
  display: inline-flex;
  gap: .68rem;
  align-items: center;
  white-space: nowrap;
  font-size: .87rem;
  font-weight: 750;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.brand-icon {
  display: grid;
  width: 2.25rem;
  height: 2.25rem;
  place-items: center;
  border: 1px solid #657750a8;
  border-radius: .52rem;
  color: var(--accent);
  background: #283b26;
}

.brand-icon svg {
  width: 1.48rem;
  height: 1.48rem;
}

.button {
  display: inline-flex;
  min-height: 2.65rem;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  border: 1px solid transparent;
  border-radius: .55rem;
  padding: .55rem .9rem;
  font-size: .875rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  transition: background-color 140ms ease, color 140ms ease, border-color 140ms ease;
}

.button-primary {
  background: var(--accent);
  color: var(--dark-ink);
}

.button-primary:hover {
  background: var(--accent-hover);
}

.button-secondary {
  border-color: #455449;
  background: #202f25;
}

.button-secondary:hover {
  border-color: #6b7f6d;
  background: #293c2f;
}

.new-game-button {
  padding-inline: .79rem .92rem;
}

.room {
  padding-block: 2.45rem 2.4rem;
}

.room-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.35rem;
  margin-bottom: 1.6rem;
}

.room-intro h1 {
  color: var(--ink);
  font: 400 clamp(2.75rem, 6.25vw, 4.5rem)/.99 var(--serif);
  letter-spacing: -.063em;
}

.room-intro p {
  margin-top: .7rem;
  color: var(--muted);
  font-size: 1rem;
}

.clock-controls {
  display: flex;
  align-items: stretch;
  gap: .45rem;
  max-width: min(49%, 27rem);
}

.timer-switch {
  flex: none;
  min-height: 2.5rem;
  padding-inline: .62rem;
  white-space: nowrap;
}

.timer-switch[aria-checked="true"] strong {
  color: var(--accent);
}

.timer-switch[aria-checked="false"] strong {
  color: var(--muted);
}

.timer-switch:disabled {
  opacity: .65;
}

.clock-settings {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: .68rem;
  min-height: 3.3rem;
  min-width: 0;
  border: 1px solid #425343;
  border-radius: .64rem;
  padding: .42rem .66rem;
  background: #182a20;
  text-align: left;
  transition: background-color 140ms ease, border-color 140ms ease;
}

.clock-settings:hover {
  border-color: #728570;
  background: #22372a;
}

.clock-settings-icon {
  width: 1.92rem;
  height: 1.92rem;
  padding: .28rem;
  color: var(--accent);
  border-radius: .38rem;
  background: #2b3e2c;
}

.clock-settings-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: .1rem;
  line-height: 1.23;
}

.eyebrow {
  color: var(--muted);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .075em;
  text-transform: uppercase;
}

.clock-settings strong {
  font-size: .9rem;
  overflow-wrap: anywhere;
}

.settings-chevron {
  width: .88rem;
  height: .88rem;
  color: var(--muted);
  margin-inline-start: .18rem;
}

.game-layout {
  display: grid;
  align-items: start;
  grid-template-columns: minmax(0, 39rem) minmax(18rem, 1fr);
  gap: clamp(1.4rem, 3.5vw, 2.25rem);
}

.board-pane,
.game-console {
  min-width: 0;
}

.board-frame {
  display: grid;
  grid-template-columns: 2.36rem minmax(0, 1fr);
  grid-template-rows: 2rem auto;
  border: 1px solid #465848;
  border-radius: .75rem;
  padding: 0 .7rem .7rem 0;
  background: linear-gradient(141deg, #25382a, #17281e 65%);
  box-shadow: 0 16px 40px #070f0a4a, inset 0 0 0 1px #c4d7b80a;
}

.file-labels,
.rank-labels {
  display: grid;
  color: #f1f3de;
  font: 700 1rem/1 var(--mono);
  text-transform: uppercase;
}

.file-labels span,
.rank-labels span {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
}

.file-labels {
  grid-column: 2;
  grid-row: 1;
  grid-template-columns: repeat(8, minmax(0, 1fr));
}

.rank-labels {
  grid-column: 1;
  grid-row: 2;
  grid-template-rows: repeat(8, minmax(0, 1fr));
}

.board {
  display: grid;
  grid-column: 2;
  grid-row: 2;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  grid-template-rows: repeat(8, minmax(0, 1fr));
  min-width: 0;
  width: 100%;
  aspect-ratio: 1;
  background: var(--dark-square);
  outline: 1px solid #0e1b13;
  border-radius: .28rem;
  overflow: hidden;
}

.square {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
  padding: 0;
  user-select: none;
  touch-action: manipulation;
}

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

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

.square.movable {
  cursor: grab;
}

.square.movable:active {
  cursor: grabbing;
}

#board .square.movable {
  touch-action: none;
}

.square.legal,
.square.selected {
  cursor: pointer;
}

.square.last-move {
  box-shadow: inset 0 0 0 6rem #d9df5c61;
}

.square.selected {
  background: #c4d979;
  box-shadow: inset 0 0 0 2px #444b24af;
}

.square.in-check {
  background: #d68266;
  box-shadow: inset 0 0 0 2px #8f3728a0;
}

.square.legal::after {
  position: absolute;
  z-index: 2;
  width: 26%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #14271b57;
  content: "";
  pointer-events: none;
}

.square.capture::after {
  width: 89%;
  background: transparent;
  border: clamp(2px, .48vw, 5px) solid #25362572;
}

.square:focus-visible {
  z-index: 3;
  outline: 2px solid #152c25;
  outline-offset: -4px;
  box-shadow: inset 0 0 0 5px #eff9ab;
}

.piece {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 92%;
  height: 92%;
  pointer-events: none;
}

.piece > svg {
  display: block;
  width: 100%;
  height: 100%;
}

.piece-drag-ghost {
  position: fixed;
  z-index: 8;
  height: auto;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 3px 3px #101c14a8);
}

.board-drag-origin > .piece {
  visibility: hidden;
}

.square.board-drop-target {
  outline: 2px solid #edf4ae;
  outline-offset: -3px;
  box-shadow: inset 0 0 0 4px #31432b;
}

.board-help {
  display: flex;
  align-items: center;
  gap: .47rem;
  min-height: 1.42rem;
  margin: .68rem 0 0 .12rem;
  color: var(--muted);
  font-size: .83rem;
}

.board-help .icon {
  width: .94rem;
  height: .94rem;
  color: #94ab86;
}

.game-console {
  display: flex;
  flex-direction: column;
  gap: .68rem;
}

.game-status {
  min-height: 4.05rem;
  display: flex;
  align-items: flex-start;
  gap: .66rem;
  padding: .45rem .12rem .38rem;
}

.status-marker {
  width: .58rem;
  height: .58rem;
  flex: none;
  margin-top: .39rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 .24rem #cade8e1c;
  transition: background-color 140ms ease;
}

.game-layout[data-game-state="check"] .status-marker {
  background: #e8a779;
}

.game-layout[data-game-state="over"] .status-marker {
  background: #a0ada0;
  box-shadow: none;
}

.game-status h2 {
  font-size: 1.17rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -.024em;
}

.game-status p {
  margin-top: .22rem;
  color: var(--muted);
  font-size: .875rem;
}

.clock-stack {
  display: grid;
  gap: .52rem;
}

.player-clock {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: .68rem;
  min-width: 0;
  min-height: 4.55rem;
  border: 1px solid var(--border);
  border-radius: .65rem;
  padding: .62rem .86rem;
  background: var(--panel);
  transition: background-color 140ms ease, border-color 140ms ease;
}

#game-layout[data-clock-enabled="false"] .time-display {
  display: none;
}

#game-layout[data-clock-enabled="false"] .play-controls {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.player-clock.active {
  border-color: #758d58;
  background: linear-gradient(100deg, #34462d, #283b29 65%);
}

.player-clock.active::before {
  position: absolute;
  inset: auto auto auto -1px;
  width: 3px;
  height: 1.53rem;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
  content: "";
}

.player-piece {
  display: grid;
  width: 2.37rem;
  height: 2.37rem;
  place-items: center;
  border-radius: .5rem;
}

.player-piece svg {
  width: 1.48rem;
  height: 1.48rem;
}

.white-piece {
  color: #f2ecda;
  background: #ffffff15;
}

.black-piece {
  color: #19251c;
  background: #9eb09e;
}

.player-meta {
  min-width: 0;
}

.player-name {
  font-size: .96rem;
  font-weight: 700;
}

.captures {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin-inline-start: -.15rem;
}

.captures:not(:empty) {
  margin-top: .17rem;
}

.captures > span,
.captures svg {
  width: 1.14rem;
  height: 1.14rem;
}

.time-display {
  position: relative;
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: flex-end;
}

.clock-digits {
  color: #f1f2df;
  font: 700 clamp(1.75rem, 2.5vw, 2.15rem)/1 var(--mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.06em;
  white-space: nowrap;
}

.active .clock-digits {
  color: var(--accent);
}

.low-time .clock-digits,
.flagged .clock-digits {
  color: var(--danger);
}

.player-clock.flagged {
  border-color: #9a5c4c;
}

.clock-delay {
  margin-top: .2rem;
  color: var(--accent);
  font: 600 .75rem/1.1 var(--mono);
}

.move-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: clamp(12.2rem, 19vw, 17rem);
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: .65rem;
  background: #142319;
}

.move-panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .35rem;
  padding: .88rem .93rem .78rem;
  border-bottom: 1px solid #334336;
}

.move-panel-title h2 {
  font-size: 1rem;
  font-weight: 700;
}

.move-panel-title p {
  margin-top: .17rem;
  font-size: .82rem;
  color: var(--muted);
}

.move-count {
  flex: none;
  color: #a8b9a1;
  font: 600 .75rem/1.25 var(--mono);
}

.moves-scroll {
  min-height: 0;
  overflow: auto;
  scrollbar-color: #57705a #142319;
  scrollbar-width: thin;
}

.move-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  text-align: left;
}

.move-number-col {
  width: 2.8rem;
}

.move-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: .51rem .38rem;
  border-bottom: 1px solid #334336;
  background: #1a2a20;
  color: #b6c2b2;
  font-size: .8rem;
  font-weight: 650;
}

.move-table th:first-child,
.move-table td:first-child {
  padding-inline-start: .94rem;
}

.move-table td,
.move-table tbody th {
  height: 2rem;
  padding: .28rem .38rem;
  border-bottom: 1px solid #2a3c2e;
  color: #eeeede;
  font: 650 .9rem/1.25 var(--mono);
  overflow-wrap: anywhere;
}

.move-table tbody th {
  color: var(--muted);
  font-weight: 500;
}

.move-table tbody tr:last-child > * {
  background-color: #1d3023;
}

.move-table td.latest-move {
  color: var(--accent);
}

.moves-empty {
  min-height: 6.25rem;
  height: calc(100% - 2.25rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  color: var(--muted);
  font-size: .88rem;
}

.moves-empty svg {
  width: 1.85rem;
  height: 1.85rem;
  color: #829881;
}

.play-controls {
  display: grid;
  grid-template-columns: 1.12fr 1.12fr .76fr;
  gap: .4rem;
}

.control-button {
  border-color: #415244;
  background: #1d2e23;
  padding-inline: .35rem;
  white-space: nowrap;
}

.control-button .icon {
  width: .98rem;
  height: .98rem;
  color: #bacab3;
}

.control-button:hover:not(:disabled) {
  border-color: #6b8069;
  background: #293c2f;
}

.control-button:disabled {
  border-color: #344438;
  color: #849788;
  opacity: .65;
}

.clock-pause-icon,
.clock-action[data-running="true"] .clock-play-icon {
  display: none;
}

.clock-action[data-running="true"] .clock-pause-icon {
  display: block;
}

.game-actions {
  min-height: 2.05rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: .58rem;
}

.text-button {
  display: inline-flex;
  align-items: center;
  border: 0;
  border-radius: .3rem;
  padding: .27rem .33rem;
  background: transparent;
  color: #bdc8b9;
  font-size: .83rem;
  font-weight: 650;
}

.text-button:hover:not(:disabled) {
  color: var(--ink);
  background-color: #2d4031;
}

.text-button:disabled {
  color: #839285;
}

#claim-draw {
  color: var(--accent);
}

#claim-draw[aria-pressed="true"] {
  background: #3f5434;
}

#resign:hover:not(:disabled) {
  color: var(--danger);
}

.dialog {
  width: min(34rem, 100% - 2.2rem);
  max-height: calc(100dvh - 2.2rem);
  overflow: auto;
  border: 1px solid #4b6150;
  border-radius: .9rem;
  padding: clamp(.93rem, 3.8vw, 1.6rem);
  background: #182a20;
  color: var(--ink);
  box-shadow: 0 20px 80px #080e09a0;
  scrollbar-color: #57705a #182a20;
  scrollbar-width: thin;
}

.dialog::backdrop {
  background: #07100cbb;
  backdrop-filter: blur(3px);
}

.dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .65rem;
  margin-bottom: 1.03rem;
}

.dialog-heading h2 {
  color: var(--ink);
  font: 400 clamp(1.8rem, 5vw, 2.45rem)/1.03 var(--serif);
  letter-spacing: -.038em;
}

.dialog-heading p {
  margin-top: .45rem;
  color: var(--muted);
  font-size: .94rem;
}

.icon-button {
  display: grid;
  width: 2.45rem;
  height: 2.45rem;
  flex: none;
  place-items: center;
  border: 1px solid #435748;
  border-radius: .47rem;
  background: #233729;
}

.icon-button:hover {
  background: #2d4634;
}

.preset-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .47rem;
}

.preset-option {
  display: flex;
  min-height: 3.54rem;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: .15rem;
  border: 1px solid #415646;
  border-radius: .52rem;
  padding: .52rem .61rem;
  background: #1d3123;
  text-align: left;
  line-height: 1.31;
  transition: border-color 140ms ease, background-color 140ms ease;
}

.preset-option:hover {
  border-color: #6c856a;
}

.preset-option[aria-pressed="true"] {
  border-color: #99ad6d;
  background: #34492e;
}

.preset-name {
  color: #f3f3e3;
  font-size: .9rem;
  font-weight: 750;
}

.preset-detail {
  color: #bac9b4;
  font-size: .79rem;
}

.custom-settings {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-width: 0;
  gap: .55rem;
  margin: .95rem 0 0;
  border: 1px solid #465b48;
  border-radius: .57rem;
  padding: .65rem;
}

.custom-settings legend {
  padding-inline: .25rem;
  font-size: .9rem;
  font-weight: 680;
}

.field {
  display: grid;
  min-width: 0;
  gap: .15rem;
  color: #c4d1c1;
  font-size: .83rem;
  font-weight: 650;
}

.field-mode {
  grid-column: 1 / -1;
}

.field input,
.field select {
  min-width: 0;
  min-height: 2.5rem;
  width: 100%;
  border: 1px solid #4e6352;
  border-radius: .43rem;
  padding: .4rem .54rem;
  background: #132219;
  color: var(--ink);
  font-size: 1rem;
}

.field select {
  appearance: none;
  padding-right: 1.75rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4' fill='none' stroke='%23b3c2ae' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: right .6rem center;
  background-repeat: no-repeat;
  background-size: 1rem;
}

.form-error {
  margin-top: .65rem;
  color: var(--danger);
  font-size: .87rem;
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: .47rem;
  margin-top: 1.07rem;
}

.promotion-dialog,
.action-dialog {
  width: min(27rem, 100% - 2.2rem);
}

.promotion-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .47rem;
}

.promotion-option {
  display: grid;
  place-items: center;
  min-width: 0;
  border: 1px solid #527056;
  border-radius: .53rem;
  padding: .25rem;
  background: #304e37;
  color: var(--ink);
  font-size: .76rem;
  font-weight: 650;
}

.promotion-option:hover {
  background: #435d42;
  border-color: #b4cb7d;
}

.promotion-option svg {
  display: block;
  width: min(100%, 3.9rem);
  height: auto;
}

@media (max-width: 800px) {
  .top-bar-inner, .room {
    width: min(100% - 2rem, 39rem);
  }

  .top-bar-inner {
    min-height: 3.72rem;
  }

  .room {
    padding-block: 1.32rem 1.9rem;
  }

  .room-intro {
    gap: .5rem;
    margin-bottom: .91rem;
  }

  .room-intro h1 {
    font-size: clamp(2.1rem, 8vw, 3.6rem);
  }

  .room-intro p {
    margin-top: .39rem;
    font-size: .9rem;
  }

  .clock-settings {
    gap: .4rem;
    min-height: 2.82rem;
    padding: .32rem .44rem;
  }

  .clock-settings strong {
    font-size: .81rem;
  }

  .clock-settings-icon {
    width: 1.53rem;
    height: 1.53rem;
    padding: .16rem;
  }

  .clock-settings .eyebrow {
    font-size: .66rem;
  }

  .settings-chevron {
    width: .78rem;
    height: .78rem;
    margin: 0;
  }

  .game-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: .52rem;
  }

  .game-console {
    display: contents;
  }

  .game-status {
    order: -3;
    min-height: 2.65rem;
    padding-block: 0 .1rem;
  }

  .game-status h2 {
    font-size: 1.03rem;
  }

  .game-status p {
    margin-top: .09rem;
    font-size: .8rem;
  }

  .status-marker {
    margin-top: .32rem;
  }

  .clock-stack {
    order: -2;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .42rem;
  }

  .game-layout[data-orientation="b"] #black-card {
    order: -1;
  }

  .player-clock {
    min-height: 3.05rem;
    gap: .32rem;
    padding: .35rem .46rem;
  }

  .player-piece {
    width: 1.55rem;
    height: 1.55rem;
    border-radius: .32rem;
  }

  .player-piece svg {
    width: 1.23rem;
    height: 1.23rem;
  }

  .player-name {
    font-size: .82rem;
  }

  .captures > span,
  .captures svg {
    width: .83rem;
    height: .83rem;
  }

  .clock-digits {
    font-size: clamp(1.2rem, 3.9vw, 1.85rem);
  }

  .clock-delay {
    font-size: .69rem;
  }

  .board-pane {
    order: -1;
  }

  .board-frame {
    grid-template-columns: 1.62rem minmax(0, 1fr);
    grid-template-rows: 1.48rem auto;
    padding: 0 .37rem .37rem 0;
  }

  .rank-labels,
  .file-labels {
    font-size: .86rem;
  }

  .board-help {
    min-height: 1.25rem;
    margin-top: .37rem;
  }

  .play-controls {
    order: 0;
  }

  .move-panel {
    order: 1;
    min-height: 10.5rem;
    height: 11rem;
  }

  .game-actions {
    order: 2;
  }
}

@media (max-width: 560px) {
  .clock-controls {
    flex-direction: column;
    width: max-content;
    max-width: 39%;
    gap: .3rem;
  }

  .timer-switch {
    min-height: 2.1rem;
    padding-block: .24rem;
  }
}

@media (max-width: 370px) {
  .top-bar-inner, .room {
    width: calc(100% - 1.3rem);
  }

  .clock-settings-icon,
  .settings-chevron {
    display: none;
  }

  .clock-settings {
    grid-template-columns: 1fr;
  }

  .clock-stack .player-piece {
    display: none;
  }

  .player-clock {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .control-button {
    gap: .19rem;
    font-size: .8rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: .01ms !important;
  }
}

.top-bar-actions,
.board-tools {
  display: flex;
  align-items: center;
  gap: .44rem;
}

.appearance-button {
  padding-inline: .7rem;
}

.board-tools {
  flex-wrap: wrap;
}

.board-tools .button {
  flex: 1 1 auto;
  min-height: 2.35rem;
  padding: .4rem .54rem;
  text-align: left;
}

.notation-content {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  min-height: 0;
}

.move-panel-actions .notation-button {
  border-color: #455449;
  background-color: #202f25;
}

.move-panel-actions .notation-button:hover {
  border-color: #6b7f6d;
  background-color: #293c2f;
}

.move-panel-actions .icon {
  width: .95rem;
  height: .95rem;
}

.opponent-settings {
  display: grid;
  gap: .56rem;
  margin-bottom: 1rem;
  padding: .68rem .75rem;
  border: 1px solid var(--border);
  border-radius: .55rem;
  background: #14261b;
}

.opponent-fields,
.clock-field-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .5rem;
}

.clock-form-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .57rem;
  color: var(--ink);
  font-size: .92rem;
  font-weight: 700;
}

.clock-form-tabs {
  display: flex;
  gap: .18rem;
  padding: .18rem;
  border: 1px solid #435748;
  border-radius: .51rem;
  background: #132219;
}

.clock-form-tabs .button {
  min-height: 2rem;
  padding: .35rem .57rem;
  border-radius: .35rem;
  background-color: transparent;
  color: var(--muted);
}

.clock-form-tabs [aria-pressed="true"] {
  background: #354c2e;
  color: var(--accent);
}

.custom-settings {
  margin-top: 0;
  padding: .7rem;
}

.clock-field-group,
.clock-form-check,
.custom-rule-detail,
.custom-settings .field-adjustment {
  grid-column: 1 / -1;
}

.clock-field-title {
  grid-column: 1 / -1;
  color: var(--ink);
  font-size: .83rem;
  font-weight: 650;
  line-height: 1.3;
}

.clock-form-check {
  display: flex;
  align-items: center;
  gap: .48rem;
  min-height: 2.1rem;
  font-size: .86rem;
}

.clock-form-check input {
  flex: none;
  width: 1rem;
  height: 1rem;
  margin: 0;
  accent-color: var(--accent);
}

.custom-rule-detail {
  margin: 0 0 .32rem;
  color: var(--muted);
  font-size: .85rem;
}

@media (max-width: 800px) {
  .board-tools { order: 1; }
  .move-panel { order: 2; }
  .game-actions { order: 3; }
}

@media (max-width: 530px) {
  .board-tools {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .board-tools .button {
    font-size: .79rem;
    padding-inline: .36rem;
  }
}

@media (max-width: 465px) {
  .board-tools .button .icon {
    display: none;
  }

  .top-bar-inner {
    gap: .25rem;
  }

  .appearance-button {
    min-width: 2.65rem;
    padding: .4rem;
  }

  .appearance-button span {
    display: none;
  }

  .new-game-button {
    padding-inline: .45rem;
  }
}

@media (max-width: 350px) {
  .wordmark {
    gap: .35rem;
    font-size: .75rem;
  }

  .top-bar-actions {
    gap: .24rem;
  }

  .move-panel-actions .notation-button .icon {
    display: none;
  }
}

.online-link {
  flex: none;
  text-decoration: none;
}

@media (max-width: 465px) {
  .online-link {
    padding-inline: .5rem;
  }

  .online-link .icon {
    display: none;
  }
}
