html, body {
  margin: 0;
  padding: 0;
  background: #f6f6f6;
}

body {
  display: grid;
  place-items: start center;
  gap: 12px;
  padding: 16px;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

canvas {
  display: block;
  width: var(--game-width, 400px);
  max-width: 95vw;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

.topbar {
  width: var(--game-width, 400px);
  max-width: 95vw;
  background: #ffffff;
  border: 1px solid #e5e5e5;
  border-radius: 10px;
  padding: 10px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
}

.row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
}

.label {
  font-size: 12px;
  color: #333;
  min-width: 42px;
}

.hint {
  font-size: 12px;
  color: #666;
}

.input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid #ddd;
  border-radius: 8px;
  outline: none;
}

.input:focus {
  border-color: #999;
}

.btn {
  padding: 8px 10px;
  border: 1px solid #ddd;
  background: #fafafa;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
}

.btn:hover {
  background: #f0f0f0;
}

.btn.active {
  background: #e8f0fe;
  border-color: #9bb7f0;
}

.link {
  font-size: 12px;
  color: #0b57d0;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 260px;
}

.link:hover {
  text-decoration: underline;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #333;
  user-select: none;
}

.toggle input {
  width: 14px;
  height: 14px;
}

.btn.small {
  padding: 6px 8px;
  font-size: 12px;
}

.row.compact {
  margin: 10px 0 0;
}

.input.small {
  max-width: 90px;
}

.range {
  flex: 1;
  min-width: 80px;
}

.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(2px);
  z-index: 20;
}

.backdrop.hidden {
  display: none;
}

.sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  width: 340px;
  max-width: 92vw;
  background: #ffffff;
  border: 1px solid #e5e5e5;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  z-index: 30;
  display: flex;
  flex-direction: column;
}

.sidebar.left {
  left: 0;
  transform: translateX(-102%);
}

.sidebar.right {
  right: 0;
  transform: translateX(102%);
}

.sidebar:not(.hidden) {
  transform: translateX(0);
}

.sidebarHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid #eee;
}

.sidebarTitle {
  font-weight: 650;
}

.sidebarBody {
  padding: 12px;
  overflow: auto;
}

.panel {
  border: 1px solid #eee;
  border-radius: 10px;
  padding: 10px;
  background: #fafafa;
  margin-bottom: 12px;
}

.panelTitle {
  font-weight: 650;
  margin-bottom: 8px;
}

.input.textarea {
  resize: vertical;
  min-height: 76px;
  font-family: inherit;
}

.coachOut {
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  background: #ffffff;
  color: #222;
  font-size: 12px;
  line-height: 1.35;
  white-space: pre-wrap;
  max-height: 220px;
  overflow: auto;
}

.coachOut.hidden {
  display: none;
}

.p {
  margin: 0 0 10px;
  font-size: 13px;
  color: #222;
}
