body.wb-body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
  user-select: none;
  -webkit-user-select: none;
}

.wb-body .wb-text-input {
  user-select: text;
  -webkit-user-select: text;
}

.wb-layout {
  display: flex;
  height: 100vh;
}

.wb-sidebar {
  width: 220px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px 14px;
  overflow-y: auto;
  background: var(--panel-strong);
  border-right: 1px solid var(--border);
}

.wb-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wb-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.wb-tool-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.wb-size-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.wb-color-group {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.wb-body .wb-tool,
.wb-body .wb-size,
.wb-body .wb-font,
.wb-body .wb-action {
  padding: 10px 12px;
  color: var(--text);
  font-weight: 700;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.68);
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

.wb-body .wb-tool:hover,
.wb-body .wb-size:hover,
.wb-body .wb-font:hover,
.wb-body .wb-action:hover {
  transform: translateY(-1px);
  border-color: rgba(148, 163, 184, 0.38);
}

.wb-body .wb-tool.active,
.wb-body .wb-size.active,
.wb-body .wb-font.active {
  color: #020617;
  background: var(--cyan);
  border-color: var(--cyan);
}

.wb-body .wb-color {
  width: 100%;
  aspect-ratio: 1 / 1;
  padding: 0;
  border-radius: 999px;
  background: var(--swatch);
  border: 2px solid rgba(148, 163, 184, 0.25);
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}
.wb-body .wb-color:hover { transform: translateY(-1px); }
.wb-body .wb-color.active {
  border-color: #ffffff;
  box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.55);
}

.wb-actions {
  gap: 8px;
}

.wb-body .wb-action[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.wb-body .wb-action.wb-primary {
  color: #ffffff;
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  border-color: transparent;
}

.wb-body .wb-action.wb-danger {
  color: #fecdd3;
  background: rgba(127, 29, 29, 0.35);
  border-color: rgba(251, 113, 133, 0.35);
}

.wb-zoom-readout {
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
  padding: 6px 0;
}

.wb-footer {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.wb-body .wb-shortcuts-btn {
  width: 100%;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.8rem;
}
.wb-body .wb-shortcuts-btn:hover {
  color: var(--text);
}

.wb-shortcuts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wb-shortcuts li {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.3;
}

.wb-shortcuts kbd {
  display: inline-block;
  flex-shrink: 0;
  min-width: 68px;
  padding: 4px 8px;
  color: var(--text);
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.75rem;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}

.wb-dialog {
  width: min(360px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  margin: auto;
  padding: 0;
  color: var(--text);
  background: var(--panel-strong);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}

.wb-dialog::backdrop {
  background: rgba(2, 6, 23, 0.65);
  backdrop-filter: blur(2px);
}

.wb-dialog-inner {
  position: relative;
  padding: 20px 22px 22px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}

.wb-dialog h2 {
  margin: 0 0 14px;
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.wb-body .wb-dialog-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  padding: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: rgba(15, 23, 42, 0.68);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
}
.wb-body .wb-dialog-close:hover {
  color: var(--text);
  transform: none;
}

.wb-hidden { display: none !important; }

.wb-canvas-wrap {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #0b1220;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.06) 1px, transparent 1px);
  background-size: 24px 24px;
}

#wbCanvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  outline: none;
  cursor: crosshair;
}

.wb-body .wb-text-input {
  position: absolute;
  display: none;
  width: auto;
  min-width: 120px;
  padding: 2px 4px;
  border: 1px dashed var(--cyan);
  border-radius: 4px;
  background: rgba(2, 6, 23, 0.55);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-weight: 700;
  outline: none;
  z-index: 10;
  box-shadow: none;
}

.wb-body .wb-text-input.active {
  display: inline-block;
}
