:root {
  color-scheme: dark;
  --ink: #f7f6ff;
  --muted: #c4cbe4;
  --accent: #f3c565;
  --surface: #182449;
  --line: #7186b5;
  --heading: Rockwell, "Roboto Slab", "Bookman Old Style", Georgia, serif;
  font: 16px/1.5 "Avenir Next", Avenir, "Segoe UI", sans-serif;
  color: var(--ink);
  background: #101631;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  min-height: 100dvh;
  margin: 0;
  background: radial-gradient(ellipse at 50% 35%, var(--table-light) 0, transparent 65%),
    linear-gradient(160deg, var(--table-edge), #101631 78%);
}
h1, h2, p { margin: 0; }
h1 { font: 700 clamp(1.18rem, 3.5vw, 1.5rem)/1.1 var(--heading); white-space: nowrap; }
h2 { font: 700 1.16rem/1.2 var(--heading); }
a { color: inherit; text-underline-offset: .22em; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
button, select {
  min-height: 2.6rem;
  padding: .3rem .75rem;
  border: 1px solid var(--line);
  border-radius: .4rem;
  color: inherit;
  background: var(--surface);
  font-family: inherit;
  font-size: .94rem;
  font-weight: 600;
}
button { cursor: pointer; touch-action: manipulation; }
button:disabled { opacity: .55; cursor: default; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

.bar {
  display: flex;
  align-items: center;
  gap: .55rem .8rem;
  flex-wrap: wrap;
  padding: .55rem clamp(.65rem, 2vw, 1.25rem);
  background: rgb(10 16 41 / .88);
  border-bottom: 1px solid rgb(211 219 255 / .17);
}
.bar form, .notices { display: flex; gap: .55rem; align-items: center; }
.notices { min-height: 1.5em; flex: 1; justify-content: center; text-align: center; }
#status { color: var(--muted); font-size: .95rem; font-weight: 600; }
#start, #confirm button[value="replace"] { color: #1b233b; background: var(--accent); border-color: var(--accent); }
main { display: grid; justify-items: center; padding: clamp(.75rem, 4vh, 2.5rem) .5rem 2rem; }
#welcome { max-width: 28rem; padding: 15vh 1rem 0; text-align: center; color: var(--muted); }
.table { width: min(100%, var(--table-width)); min-width: 0; }
.table-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  min-height: 2.6rem;
  gap: .4rem .75rem;
  margin-bottom: .5rem;
  color: var(--muted);
  font-size: .92rem;
  font-variant-numeric: tabular-nums;
}
.board {
  border: 1px solid rgb(196 211 255 / .32);
  background: rgb(8 16 39 / .77);
  border-radius: .8rem;
  padding: clamp(.3rem, 1.5vw, .9rem);
  box-shadow: 0 16px 46px rgb(3 7 23 / .36);
}
.hint { margin-top: .8rem; text-align: center; color: var(--muted); font-size: .89rem; }
dialog {
  width: min(26rem, calc(100% - 1rem));
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: .65rem;
  color: inherit;
  background: #141e3c;
}
dialog::backdrop { background: rgb(6 11 31 / .69); }
#panel {
  height: 100dvh;
  max-height: none;
  inset: 0 auto 0 0;
  margin: 0;
  border-width: 0 1px 0 0;
  border-radius: 0;
  overflow-y: auto;
}
#panel[open] { animation: slide-in 160ms ease-out; }
@keyframes slide-in { from { transform: translateX(-100%); } }
@media (prefers-reduced-motion: reduce) { #panel[open] { animation: none; } }
.dialog-head, .choices, footer, nav { display: flex; flex-wrap: wrap; gap: .65rem; align-items: center; }
.dialog-head, footer { justify-content: space-between; }
.choices { justify-content: end; margin-top: 1rem; }
dialog section, dialog p, dialog footer { margin-top: 1rem; }
dialog p { color: var(--muted); }
[aria-current="page"] { text-decoration: none; font-weight: 700; color: var(--accent); }
@media (max-width: 43rem) {
  .notices { flex-basis: 100%; order: 3; }
  .bar form { margin-left: auto; }
}
@media (max-width: 33rem) {
  .bar form { margin: 0; flex: 1 1 100%; }
  .bar select { flex: 1; min-width: 0; }
}
