#burger {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 300;
  transform: scale(var(--scale, 1));
  transform-origin: top right;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
#burger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: background 0.2s, transform 0.25s ease, opacity 0.25s ease;
}
#burger:not(.open):hover span { background: var(--accent); }

#burger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
#burger.open span:nth-child(2) { opacity: 0; }
#burger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

#overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 200;
}
#overlay.open { display: block; }

#menu {
  position: fixed;
  top: 0;
  right: 0;
  width: calc(220px * var(--scale, 1));
  height: 100vh;
  background: var(--bg2);
  border-left: 1px solid var(--border);
  padding: calc(64px * var(--scale, 1)) calc(16px * var(--scale, 1)) calc(24px * var(--scale, 1));
  z-index: 201;
  display: flex;
  flex-direction: column;
  gap: calc(10px * var(--scale, 1));
  font-size: calc(0.9rem * var(--scale, 1));
  box-shadow: -4px 0 24px rgba(0,0,0,0.3);
  transform: translateX(100%);
  transition: transform 0.25s ease;
}
#menu.open { transform: translateX(0); }

#menu button {
  padding: calc(8px * var(--scale, 1)) calc(16px * var(--scale, 1));
  border-radius: calc(6px * var(--scale, 1));
  font-size: calc(0.9rem * var(--scale, 1));
}
#menu select {
  padding: calc(8px * var(--scale, 1)) calc(12px * var(--scale, 1));
  border-radius: calc(6px * var(--scale, 1));
  font-size: calc(0.9rem * var(--scale, 1));
}
#menu label {
  font-size: calc(0.8rem * var(--scale, 1));
  color: var(--text-dim);
  margin-bottom: 2px;
}
#menu hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2px 0;
}


#orientation-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
#orientation-toggle button {
  flex: 1;
  padding: calc(7px * var(--scale, 1)) 0;
  border-radius: 0;
  border: none;
  border-right: 1px solid var(--border);
  background: var(--bg2);
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
}
#orientation-toggle button:last-child { border-right: none; }
#orientation-toggle button svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
#orientation-toggle button.active { background: var(--accent); color: #fff; }
#orientation-toggle button:not(.active):hover { background: var(--bg3); color: var(--text); }

#btn-new   { background: var(--accent); color: #fff; }
#btn-check { background: var(--bg3); color: var(--text); border: 1px solid var(--accent); }
#btn-solve { background: var(--bg2); color: var(--text); border: 1px solid var(--text-dim); }

#difficulty {
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
  width: 100%;
}

#theme-toggle {
  position: fixed;
  top: 18px;
  left: 14px;
  z-index: 300;
  transform: scale(var(--scale, 1));
  transform-origin: top left;
  cursor: pointer;
  user-select: none;
  width: 44px;
  height: 24px;
  background: #3a3a3a;
  border-radius: 12px;
  transition: background 0.3s;
}
[data-theme="light"] #theme-toggle { background: #b8cef5; }

#theme-toggle .toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #2a2a2a;
  transition: transform 0.25s, background 0.25s;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  line-height: 1;
  filter: grayscale(1);
}
[data-theme="light"] #theme-toggle .toggle-thumb {
  transform: translateX(20px);
  background: #fff;
}
#theme-toggle .toggle-thumb svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
