* {
  box-sizing: border-box;
}

:root {
  --toolbar-height: 0px;
  --pose-canvas-height: 100vh;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #f5f5f5;
  color: #222;
  overflow: hidden;
}

.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}


.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  padding: 1rem 1.5rem;
  background: #ffffff;
  border-bottom: 1px solid #dedede;
  position: sticky;
  top: 0;
  z-index: 10;
}

.toolbar-menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.7rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fafafa;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.toolbar-menu-toggle:hover,
.toolbar-menu-toggle:focus-visible,
.toolbar-menu-toggle[aria-expanded='true'] {
  background: #4066ff;
  color: #ffffff;
  border-color: #304ddb;
  outline: none;
}

.toolbar-group {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.75rem;
  flex: 1 1 280px;
  flex-wrap: wrap;
}

.toolbar-group[data-role='left'] {
  order: 1;
}

.toolbar-group[data-role='right'] {
  order: 3;
  justify-content: flex-end;
}

.toolbar .section {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toolbar .section.action-group {
  gap: 0.75rem;
}

.toolbar-menu {
  position: fixed;
  top: calc(var(--toolbar-height, 64px) + 0.75rem);
  left: var(--toolbar-menu-left, 1.5rem);
  min-width: 260px;
  padding: 1rem 1.25rem;
  background: #ffffff;
  border: 1px solid #d8d8d8;
  border-radius: 0.75rem;
  box-shadow: 0 14px 42px rgba(15, 23, 42, 0.18);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  z-index: 20;
}

.toolbar-menu[hidden] {
  display: none;
}

.menu-section {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.menu-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  color: #1f2933;
}

.menu-reset {
  padding: 0.55rem 0.75rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fafafa;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.menu-reset:hover,
.menu-reset:focus-visible {
  background: #ff5f5f;
  color: #ffffff;
  border-color: #e23a3a;
  outline: none;
}

.app-title {
  order: 2;
  flex: 0 0 auto;
  margin: 0 auto;
  text-align: center;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #1d1d1d;
}

.toolbar-icon {
  font-size: 1.2rem;
  line-height: 1;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.toolbar button {
  padding: 0.5rem 0.75rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fafafa;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.toolbar button:hover,
.toolbar button.active {
  background: #4066ff;
  color: #fff;
  border-color: #304ddb;
}

/* Canvas layout */
main {
  flex: 1;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
  overflow: hidden;
  height: var(--pose-canvas-height, auto);
  max-height: var(--pose-canvas-height, none);
}

#poseCanvas {
  width: 100%;
  height: 100%;
  background: #ffffff;
  border: none;
  border-radius: 0;
  box-shadow: none;
  cursor: crosshair;
  display: block;
  touch-action: none;
}

.stickman-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.stickman-selector button {
  min-width: 3rem;
}

.background-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.zoom-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.zoom-controls button {
  flex: 1 1 0;
}
