* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #1f2430;
  color: #f5f5f5;
  overflow: hidden;
}

.toolbar {
  height: 56px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  background: #11151f;
  border-bottom: 1px solid #303849;
}

.brand {
  font-weight: bold;
  font-size: 18px;
  margin-right: 12px;
}

button {
  border: 0;
  border-radius: 8px;
  padding: 9px 13px;
  background: #3d7cff;
  color: white;
  cursor: pointer;
  font-weight: bold;
  white-space: nowrap;
}

button:hover { filter: brightness(1.1); }

.secondary-button {
  background: #2c3447;
}

.help-menu {
  position: relative;
  margin-left: auto;
}

.help-panel {
  position: absolute;
  top: 44px;
  right: 0;
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100vh - 86px);
  overflow: auto;
  z-index: 1000000;
  padding: 18px 20px;
  border: 1px solid #3b465d;
  border-radius: 12px;
  background: #171d29;
  box-shadow: 0 18px 48px rgba(0,0,0,.45);
  color: #eef2ff;
}

.help-panel h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

.help-panel h3 {
  margin: 8px 0 4px 0;
  font-size: 14px;
  color: #9fc2ff;
}

.help-panel p {
  margin: 0;
  color: #d7dcea;
  font-size: 13px;
  line-height: 1.45;
}

.help-panel strong {
  color: #ffffff;
}

.help-panel ul {
    margin: 0 0 8px 15px;
    padding: 0;
}

.help-panel li {
    font-size: 13px;
}

.zoom-label {
  min-width: 48px;
  text-align: center;
  color: #d7dcea;
  font-weight: bold;
}


.viewport {
  position: relative;
  width: 100vw;
  height: calc(100vh - 56px);
  overflow: auto;
  background: #1f2430;
  outline: none;
  cursor: default;
}

.board {
  position: relative;
  width: 20000px;
  height: 14000px;
  transform-origin: 0 0;
  background-color: #252b38;
  background-image:
    linear-gradient(rgba(255,255,255,.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.055) 1px, transparent 1px);
  background-size: 32px 32px;
  background-position: 0 0;
}

.empty-state {
  position: absolute;
  top: 260px;
  left: 50%;
  transform: translateX(-50%);
  color: #d7dcea;
  text-align: center;
  pointer-events: none;
  opacity: .75;
}

.board-item {
  position: absolute;
  min-width: 60px;
  min-height: 40px;
  border: 2px solid transparent;
  user-select: none;
  touch-action: none;
  overflow: visible;
}

.board-item.selected {
  border-color: #5e9cff;
  box-shadow: 0 0 0 2px rgba(94,156,255,.25);
}

.board-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.text-item {
  min-width: 160px;
  min-height: 70px;
  padding: 12px;
  background: #fff8b7;
  color: #222;
  border-radius: 8px;
  font-size: 18px;
  line-height: 1.3;
  box-shadow: 0 8px 20px rgba(0,0,0,.25);
}

.text-content {
  width: 100%;
  height: 100%;
  white-space: pre-wrap;
  overflow: hidden;
  user-select: text;
}

.text-content {
  cursor: text;
}

.text-content:focus {
  outline: 1px dashed rgba(0,0,0,.25);
  outline-offset: 2px;
}

.resize-handle {
  position: absolute;
  width: 14px;
  height: 14px;
  right: -8px;
  bottom: -8px;
  border-radius: 50%;
  background: #5e9cff;
  border: 2px solid white;
  cursor: nwse-resize;
  display: none;
}

.board-item.selected .resize-handle { display: block; }

.delete-btn {
  position: absolute;
  top: -16px;
  right: -16px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #d84949;
  color: white;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  z-index: 3;
}

.board-item.selected .delete-btn { display: flex; }


.selection-box {
  position: absolute;
  border: 1px dashed #9fc2ff;
  background: rgba(94,156,255,.14);
  pointer-events: none;
  z-index: 999999;
}
