:root {
  --bg: #ffffff;
  --text: #111;
  --muted: #666;
  --card: #f6f7fb;
  --border: #d9dbe7;
  --blue: #2b6cff;
}

* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family:
    system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    Arial,
    sans-serif;
  background: var(--bg);
  color: var(--text);
}
.eqsy-wrap {
  max-width: 980px;
  margin: 0 auto;
  padding: 18px;
}
.eqsy-wrap {
  -webkit-user-select: none;
  user-select: none;
}
.eqsy-header {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 14px 10px;
  display: grid;
  gap: 12px;
}
.eqsy-leaderboards {
  margin-bottom: 12px;
  display: grid;
  gap: 10px;
}
.lb-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  padding: 10px 12px;
}
.lb-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.lb-title {
  font-weight: 800;
  font-size: 15px;
}
.lb-sub {
  color: var(--muted);
  font-size: 12px;
}
.lb-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 6px;
}
.lb-table th,
.lb-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #eef;
  font-size: 12px;
  text-align: left;
}
.lb-table th {
  background: #fafbff;
  font-weight: 700;
}
.lb-table tr.lb-highlight {
  background: #e6f6ef;
  font-weight: 700;
}
.lb-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.lb-modal.open {
  display: flex;
}
.lb-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}
.lb-modal-dialog {
  position: relative;
  background: #fff;
  border-radius: 16px;
  border: 1px solid var(--border);
  padding: 14px;
  width: min(720px, 92vw);
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.24);
}
.lb-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.lb-modal-title {
  font-size: 18px;
  font-weight: 800;
}
.lb-modal-close {
  font-size: 13px;
  padding: 8px 10px;
}
.lb-modal-pagebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-weight: 700;
}
.lb-modal-nav {
  display: flex;
  gap: 8px;
}
.lb-modal-nav button {
  padding: 8px 12px;
}
.lb-modal-table-wrap {
  overflow: auto;
  border: 1px solid #eef;
  border-radius: 12px;
}
.lb-modal .lb-table td,
.lb-modal .lb-table th {
  font-size: 13px;
}
.title h1 {
  margin: 0;
  font-size: 28px;
}
.sub {
  margin: 4px 0 0;
  color: var(--muted);
}
.controls .row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
}
label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
  font-size: 13px;
  color: #222;
}
select {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 15px;
  background: #fff;
}
button {
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  font-weight: 700;
}
button:hover {
  border-color: #bfc3d8;
}
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.info {
  color: #222;
  font-weight: 600;
}
.info .label {
  color: var(--muted);
  font-weight: 700;
  margin-right: 6px;
}

.eqsy-main {
  margin-top: 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
}
#board {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  background: #fff;
  touch-action: manipulation;
}
.legend {
  margin-top: 12px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
  color: var(--muted);
  font-weight: 600;
}
.chip {
  width: 18px;
  height: 10px;
  border-radius: 6px;
  display: inline-block;
  margin-right: 8px;
  border: 2px solid #999;
}
.chip.line {
  border-color: #222;
}
.chip.x {
  border-color: #d22;
}
.hint {
  flex: 1;
  min-width: 260px;
}
.eqsy-footer {
  margin-top: 14px;
  color: var(--muted);
  display: flex;
  gap: 10px;
  align-items: center;
}
.eqsy-footer a {
  color: var(--blue);
  text-decoration: none;
  font-weight: 700;
}
.sep {
  opacity: 0.5;
}
