@font-face {
  font-family: Galmuri;
  src: url("./font.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: #0b1020;
  color: #e9edfa;
  font:
    14px Galmuri,
    monospace;
}
main {
  max-width: 1040px;
  margin: auto;
  padding: 20px;
}
header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
h1 {
  font-size: 23px;
  margin: 0;
  flex: 1;
}
button,
select,
a {
  font: inherit;
}
button,
select {
  border: 1px solid #343e5e;
  color: #e9edfa;
  background: #10162a;
  padding: 8px 12px;
  border-radius: 5px;
  cursor: pointer;
}
button:disabled {
  opacity: 0.35;
  cursor: default;
}
button:focus-visible,
a:focus-visible,
select:focus-visible,
canvas:focus-visible {
  outline: 2px solid #c6f432;
  outline-offset: 3px;
}
button:hover:not(:disabled) {
  border-color: #c6f432;
}
nav {
  display: flex;
  gap: 7px;
  overflow: auto;
  padding: 0 0 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid #252e47;
}
nav a {
  white-space: nowrap;
  color: #929db7;
  font-size: 12px;
  text-decoration: none;
  border: 1px solid #343e5e;
  border-radius: 5px;
  padding: 8px;
}
nav a[aria-current="page"] {
  border-color: #c6f432;
  color: #c6f432;
}
.settings {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.settings label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #929db7;
}
.settings button,
.settings select {
  font-size: 12px;
}
.settings #undo {
  margin-left: auto;
}
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 215px;
  gap: 24px;
  margin-top: 16px;
}
.status-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  font-size: 13px;
}
#status {
  color: #c6f432;
}
#count {
  color: #929db7;
  white-space: nowrap;
}
#stage {
  position: relative;
  min-width: 0;
}
#grid {
  display: grid;
  gap: 5px;
  aspect-ratio: 1;
  padding: 8px;
  border: 1px solid #343e5e;
  border-radius: 6px;
  background: #10162a;
  margin-top: 8px;
}
#grid button {
  padding: 0;
  min-width: 0;
  position: relative;
  background: #0b1020;
  border-color: #252e47;
  display: grid;
  place-items: center;
  border-radius: 4px;
  font-size: clamp(26px, 6vw, 66px);
  aspect-ratio: 1;
}
#grid button:disabled {
  opacity: 1;
}
#grid button.p1 {
  color: #c6f432;
}
#grid button.p2 {
  color: #e9edfa;
}
#grid .legal:after {
  content: "";
  width: 9px;
  height: 9px;
  background: #65d9ff;
  border-radius: 50%;
}
#grid .last {
  outline: 2px solid #ff9b57;
  outline-offset: -3px;
}
#grid .won {
  background: #c6f43222;
  border-color: #c6f432;
}
#grid.flip,
#grid.drop {
  background: #182c31;
}
#grid.flip button,
#grid.drop button {
  background: #10202a;
  border: 0;
  border-radius: 50%;
}
#grid .disc {
  border-radius: 50%;
  width: 78%;
  height: 78%;
  box-shadow: inset -3px -5px #0003;
}
#grid .p1 .disc {
  background: #c6f432;
}
#grid .p2 .disc {
  background: #e9edfa;
}
#grid.gomoku {
  gap: 0;
  background: #273443;
  padding: 12px;
}
#grid.gomoku button {
  border: 0;
  border-radius: 0;
  background:
    linear-gradient(
      90deg,
      transparent calc(50% - 0.5px),
      #6b7e91 calc(50% - 0.5px),
      #6b7e91 calc(50% + 0.5px),
      transparent calc(50% + 0.5px)
    ),
    linear-gradient(
      transparent calc(50% - 0.5px),
      #6b7e91 calc(50% - 0.5px),
      #6b7e91 calc(50% + 0.5px),
      transparent calc(50% + 0.5px)
    );
}
#grid.gomoku .disc {
  z-index: 1;
  width: 85%;
  height: 85%;
  box-shadow: none;
}
#grid.gomoku .legal:after {
  width: 4px;
  height: 4px;
}
#grid.gomoku .last {
  outline: 0;
}
#grid.gomoku .last:before {
  content: "";
  z-index: 3;
  width: 5px;
  height: 5px;
  background: #ff7a1a;
  border-radius: 50%;
  position: absolute;
}
#grid.drop {
  aspect-ratio: 7/6;
}
#canvas {
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid #343e5e;
  border-radius: 6px;
  display: block;
  touch-action: none;
}
#scene {
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid #343e5e;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
  touch-action: none;
}
#scene canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}
#message {
  font-size: 12px;
  line-height: 1.8;
  color: #a4b1c9;
  min-height: 23px;
}
#controls {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  margin-top: 12px;
  font-size: 12px;
}
#controls label {
  display: flex;
  align-items: center;
  gap: 6px;
}
#controls [role="group"] {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
input[type="range"] {
  accent-color: #c6f432;
  width: 120px;
}
aside {
  border-left: 1px solid #252e47;
  padding-left: 20px;
}
h2 {
  font-size: 14px;
  margin: 7px 0 12px;
}
aside p {
  font-size: 12px;
  line-height: 1.9;
  color: #adbad1;
}
aside h2:not(:first-child) {
  margin-top: 24px;
}
aside small {
  font-size: 10px;
  color: #929db7;
}
#record {
  color: #c6f432;
}
details {
  margin-top: 24px;
  border-top: 1px solid #252e47;
  padding-top: 14px;
}
summary {
  font-size: 12px;
  cursor: pointer;
  color: #929db7;
}
dialog {
  background: #10162a;
  color: #e9edfa;
  border: 1px solid #343e5e;
  border-radius: 8px;
  max-width: 340px;
  padding: 24px;
}
dialog::backdrop {
  background: #020612bd;
}
dialog p {
  font-size: 12px;
  color: #929db7;
}
dialog form > div {
  display: flex;
  gap: 8px;
  margin-top: 20px;
}
.primary {
  background: #c6f432;
  color: #0b1020;
  border-color: #c6f432;
}
[hidden] {
  display: none !important;
}
@media (max-width: 650px) {
  main {
    padding: 14px;
  }
  h1 {
    font-size: 20px;
  }
  .layout {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  aside {
    border-left: 0;
    border-top: 1px solid #252e47;
    padding: 14px 0 0;
  }
  .settings {
    gap: 7px;
  }
  .settings button,
  .settings select {
    padding: 7px 8px;
  }
  .settings #undo {
    margin-left: 0;
  }
  #grid {
    gap: 3px;
    padding: 5px;
  }
  .status-line {
    font-size: 12px;
  }
  #controls {
    gap: 7px;
  }
  input[type="range"] {
    width: 90px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto;
  }
}
