* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #F5F0E8;
  font-family: -apple-system, 'Helvetica Neue', Arial, sans-serif;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#canvas {
  display: block;
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  touch-action: none;
  cursor: crosshair;
}

#toolbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  background: rgba(245, 240, 232, 0.92);
  border-bottom: 1px solid rgba(42, 42, 42, 0.12);
  z-index: 100;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

#toolbar.hidden {
  opacity: 0;
  transform: translateY(-100%);
  pointer-events: none;
}

#toolbar-label {
  font-family: 'Caveat', cursive;
  font-size: 22px;
  font-weight: 700;
  color: #2A2A2A;
  margin-left: auto;
  opacity: 0.5;
  letter-spacing: 0.5px;
}

.toolbar-btn {
  width: 48px;
  height: 48px;
  border: 2px solid rgba(42, 42, 42, 0.2);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.6);
  color: #2A2A2A;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.toolbar-btn:active {
  background: rgba(42, 42, 42, 0.15);
  transform: scale(0.93);
}

.toolbar-btn.active {
  background: #2A2A2A;
  color: #F5F0E8;
  border-color: #2A2A2A;
}

#status-bar {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 18px;
  background: rgba(245, 240, 232, 0.88);
  border: 1px solid rgba(42, 42, 42, 0.1);
  border-radius: 20px;
  z-index: 100;
  font-family: 'Caveat', cursive;
  font-size: 18px;
  color: #555;
  opacity: 0.7;
  max-width: 90%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

#status-bar:empty, #status-bar:has(#parsed-eq:empty) {
  opacity: 0;
}

#footer-wrap {
  position: fixed;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
}

#remix-link {
  font-family: 'Caveat', cursive;
  font-size: 14px;
  color: #2A2A2A;
  opacity: 0.25;
  text-decoration: none;
  transition: opacity 0.2s;
}

#remix-link:hover {
  opacity: 0.5;
}

@keyframes fadeInAnswer {
  from { opacity: 0; transform: translateX(-4px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes shakeAnswer {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-3px); }
  40% { transform: translateX(3px); }
  60% { transform: translateX(-2px); }
  80% { transform: translateX(2px); }
}