@import url("/fonts.css");
:root {
  color-scheme: light;
  --page: #fff;
  --surface: #fff;
  --text: #111;
  --border: #111;
  --hover: #f2f2f2;
  --muted: #777;
  --disabled-border: #aaa;
  --subtle-border: #ddd;
  --backdrop: #ffffffbb;
  --square: #fff;
  --square-dark: #c6c6c6;
  --last-move: #dedede;
  font-family: "Nanum Gothic", Arial, sans-serif;
  color: var(--text);
  background: var(--page);
  font-size: 16px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input {
  font: inherit;
  color: inherit;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 4px;
  min-height: 44px;
  padding: 10px 14px;
}
button {
  cursor: pointer;
}
button:hover:not(:disabled) {
  background: var(--hover);
}
button:disabled {
  color: var(--muted);
  border-color: var(--disabled-border);
  cursor: not-allowed;
}
a {
  color: inherit;
  text-underline-offset: 5px;
}
button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid var(--text);
  outline-offset: 3px;
}
[hidden] {
  display: none !important;
}
.topbar {
  max-width: 1120px;
  margin: auto;
  min-height: 80px;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid var(--border);
}
.brand {
  font-size: 24px;
  font-weight: 700;
  text-decoration: none;
}
nav {
  display: flex;
  gap: 24px;
}
dialog {
  background: var(--surface);
  color: var(--text);
  border: 2px solid var(--border);
  border-radius: 6px;
  padding: 28px;
  width: min(460px, calc(100% - 32px));
  max-height: 90dvh;
}
dialog::backdrop {
  background: var(--backdrop);
}
dialog h2 {
  font-size: 22px;
  margin-bottom: 18px;
}
dialog p {
  line-height: 1.7;
}
.dialog-buttons {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 24px;
}
.close {
  display: block;
  margin: -12px -12px 4px auto;
  border: 0;
  font-size: 24px;
}
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 2px solid var(--border);
  padding: 16px 20px;
  width: max-content;
  max-width: calc(100% - 32px);
  z-index: 100;
  line-height: 1.6;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #111317;
  --surface: #1b1e23;
  --text: #f0f1f3;
  --border: #9ba1ac;
  --hover: #30353e;
  --muted: #a4aab5;
  --disabled-border: #555d69;
  --subtle-border: #414752;
  --backdrop: #080a0ed9;
  --square: #393e47;
  --square-dark: #171b22;
  --last-move: #535f70;
}
.theme-toggle {
  width: 44px;
  flex: 0 0 44px;
  padding: 8px;
  display: grid;
  place-items: center;
}
.topbar nav {
  align-items: center;
}
/* Preserve piece colors; outline black pieces against dark surfaces. */
[data-theme="dark"] img[src^="/assets/b"] {
  filter: drop-shadow(1px 0 0 #c7ccd4) drop-shadow(-1px 0 0 #c7ccd4)
    drop-shadow(0 1px 0 #c7ccd4) drop-shadow(0 -1px 0 #c7ccd4);
}
