* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f0f2f5;
  color: #333;
  height: 100vh;
  overflow: hidden;
}

[hidden] {
  display: none !important;
}

/* Join Screen */
#join-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  gap: 16px;
}

#join-screen h1 {
  font-size: 2.5rem;
  color: #22c55e;
}

#join-screen p {
  color: #666;
  margin-bottom: 8px;
}

#token-input {
  padding: 12px 20px;
  font-size: 1.2rem;
  border: 2px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
  color: #333;
  text-align: center;
  width: 280px;
  outline: none;
  transition: border-color 0.2s;
}

#token-input:focus {
  border-color: #22c55e;
}

#join-btn {
  padding: 12px 40px;
  font-size: 1.1rem;
  border: none;
  border-radius: 8px;
  background: #22c55e;
  color: white;
  cursor: pointer;
  transition: background 0.2s;
}

#join-btn:hover {
  background: #16a34a;
}

/* App Screen */
#app-screen {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

#toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
}

#session-label {
  font-weight: 600;
  color: #22c55e;
}

#user-count {
  color: #888;
  font-size: 0.9rem;
}

/* Tool Toolbar */
#tools {
  display: flex;
  gap: 10px;
  padding: 10px 24px;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
}

.tool-btn {
  width: 48px;
  height: 44px;
  border: 2px solid #d1d5db;
  border-radius: 8px;
  background: transparent;
  color: #555;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tool-btn svg {
  width: 36px;
  height: 36px;
}

.tool-btn:hover {
  background: #f3f4f6;
}

.tool-btn.active {
  border-color: #22c55e;
  background: rgba(34, 197, 94, 0.1);
  color: #22c55e;
}

.tool-btn-danger:hover {
  background: #fef2f2;
  border-color: #ef4444;
  color: #ef4444;
}

.trash-lid {
  transform-origin: 17px 9px;
  transition: transform 0.2s ease-out;
}

.tool-btn-danger.open .trash-lid {
  transform: rotate(35deg);
}

.tool-btn-danger.full {
  background: #fef2f2;
  border-color: #ef4444;
  color: #ef4444;
}

.tool-btn-danger.full .trash-fill {
  animation: trash-fill-in 0.25s ease-out forwards;
}

@keyframes trash-fill-in {
  0% { opacity: 0; transform: translateY(-3px); }
  100% { opacity: 1; transform: translateY(0); }
}

.tool-separator {
  width: 1px;
  background: #e5e7eb;
  margin: 0 10px;
}

/* Canvas */
#canvas {
  flex: 1;
  position: relative;
  overflow: hidden;
  cursor: default;
  background: #fafafa;
}

#canvas-world {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform-origin: 0 0;
  pointer-events: none;
}

#draw-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

/* Zoom Controls */
#zoom-controls {
  position: absolute;
  bottom: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 4px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 4px 8px;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  opacity: 0;
  transition: opacity 0.3s;
}

#zoom-controls:hover {
  opacity: 1;
}

#zoom-controls button {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: #555;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

#zoom-controls button:hover {
  background: #f3f4f6;
}

#zoom-controls button svg {
  width: 16px;
  height: 16px;
}

#zoom-level {
  font-size: 0.8rem;
  color: #666;
  min-width: 38px;
  text-align: center;
  user-select: none;
}

.square {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  position: absolute;
  cursor: grab;
  z-index: 1;
  transition: box-shadow 0.2s;
  pointer-events: auto;
}

.square:active {
  cursor: grabbing;
}

/* Text input overlay */
#text-input {
  position: absolute;
  z-index: 20;
  border: 2px solid #0ea5e9;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.9);
  color: #333;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  padding: 4px 6px;
  min-width: 80px;
  min-height: 28px;
  outline: none;
  resize: none;
  overflow: hidden;
}
